-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
108 lines (95 loc) · 2.32 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
SRCDIR = src/
OBJDIR = bin/
INCDIR = include/
FTPATH = libft/
MLXPATH = minilibx-linux/
FTINC = $(FTPATH)include/
LIBFT = $(FTPATH)libft.a
MLX = $(MLXPATH)libmlx.a
######################################################################
SRCS = maths/ft_atof.c \
maths/ft_atof_utils.c\
maths/math_utils.c\
maths/matrix.c\
maths/matrix2.c\
maths/matrix3.c\
maths/matrix4.c\
maths/matrix_test.c\
maths/transformations.c\
maths/transformations2.c\
maths/vector.c\
maths/vector2.c\
maths/vector3.c\
mlx_utils/hook.c\
mlx_utils/image.c\
parser/data_parser.c\
parser/data_parser2.c\
parser/obj_filler.c\
parser/obj_filler2.c\
parser/parsing.c\
parser/parsing_utils.c\
primitives/cone.c\
primitives/cylinder.c\
primitives/sphere.c\
primitives/plane.c\
primitives/get_normal.c\
rendering/bump_map.c\
rendering/colors.c\
rendering/colors2.c\
rendering/init.c\
rendering/intersect_utils.c\
rendering/is_shadowed.c\
rendering/lighting.c\
rendering/lighting2.c\
rendering/ray.c\
rendering/text_mapping.c\
scene/camera.c\
scene/obj.c\
utils/exit_rt.c\
utils/print.c\
utils/test.c\
main.c
OBJS = $(addprefix $(OBJDIR),$(SRCS:.c=.o))
DEPENDS = $(OBJS:.o=.d)
######################################################################
CC = gcc -O3
CFLAGS = -Wall -Wextra -Werror -MMD -MP
LINK = -lmlx -lft -lm -lXext -lX11
INCPATH = -I$(INCDIR) -I$(FTINC) -I$(MLXPATH)
LIBPATH = -L$(FTPATH) -L$(MLXPATH)
NAME = miniRT
VAL = valgrind --leak-check=full ./$(NAME) input.rt
RUN = ./$(NAME) input/*.rt
######################################################################
all: $(NAME)
bonus: $(NAME)
$(NAME): $(OBJDIR) $(MLX) $(LIBFT) $(OBJS)
$(CC) $(OBJS) $(LIBPATH) $(LINK) -o $(NAME)
-include $(DEPENDS)
$(OBJDIR)%.o: $(SRCDIR)%.c
$(CC) -c $(CFLAGS) $(INCPATH) $< -o $@
$(LIBFT):
make -C $(FTPATH)
$(MLX):
make -C $(MLXPATH)
$(OBJDIR):
@mkdir -p $(OBJDIR)
@mkdir -p $(OBJDIR)/maths
@mkdir -p $(OBJDIR)/mlx_utils
@mkdir -p $(OBJDIR)/parser
@mkdir -p $(OBJDIR)/primitives
@mkdir -p $(OBJDIR)/rendering
@mkdir -p $(OBJDIR)/scene
@mkdir -p $(OBJDIR)/utils
run:
$(RUN)
val:
$(VAL)
clean:
rm -rf $(OBJDIR)
fclean: clean
make fclean -C $(FTPATH)
make clean -C $(MLXPATH)
rm -f $(NAME)
re: fclean $(NAME) run
.PHONY: all libft clean fclean re