-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (56 loc) · 1.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
CC = gcc
CFLAGS = -Wall -Wextra -Werror -g -I /usr/X11/include
NAME = miniRT
LIBFT = ./libft/libft.a
MINILIBX = ./minilibx-linux
SRCS = main.c \
init.c \
vector_utils.c \
camera_ray.c \
equation.c \
is_hittable.c \
luminance.c \
draw.c \
ray_trace.c \
color_utils.c \
utils.c \
get_nearest.c \
get_shadow_ray.c \
set_scene.c \
set_shapes.c \
vec_operator.c \
dot_cross_vec.c \
atod.c \
set_utils1.c \
set_utils2.c \
valid_utils.c \
window_utils.c \
error.c \
mlx_error.c
OBJS = $(SRCS:.c=.o)
INCLUDE = -I includes -I ./libft/includes
ifeq ($(shell uname), Linux)
LDFLAGS := -Wl,-start-group -I/usr/X11/include -L/usr/X11/include/../lib -lXext -lX11 -I minilibx-linux -L minilibx-linux -lmlx_Linux
MINILIBX = ./minilibx-linux/libmlx_Linux.a -Wl,-end-group
else
LDFLAGS := -I/usr/X11/include -L/usr/X11/include/../lib -lXext -lX11 -I minilibx-linux -L minilibx-linux -lmlx_Darwin
MINILIBX = ./minilibx-linux/libmlx_Darwin.a
endif
all: $(NAME)
%.o: %.c
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ -I minilibx-linux
$(NAME): $(OBJS) $(LIBFT) $(MINILIBX)
$(CC) $(LDFLAGS) $(INCLUDE) -o $(NAME) $(OBJS) $(LIBFT) $(MINILIBX) -lm
$(LIBFT):
$(MAKE) -C ./libft
$(MINILIBX):
$(MAKE) -C ./minilibx-linux
clean:
$(MAKE) clean -C ./libft
$(MAKE) clean -C ./minilibx-linux
$(RM) $(OBJS)
fclean: clean
$(MAKE) fclean -C ./libft
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re