-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
156 lines (132 loc) · 4.82 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
NAME = miniRT
SRCS_PATH = ./mandatory/srcs
OBJS_PATH = ./objs
INCLUDE_PATH = ./mandatory/includes/
NAME_BONUS = miniRT_bonus
BONUS_SRCS_PATH = ./bonus/srcs
BONUS_OBJS_PATH = ./bonus_objs
BONUS_INCLUDE_PATH = ./bonus/includes/
LIBFT_PATH = ./libft
FILES = main \
render \
lighting_and_shadow/shade_hit \
lighting_and_shadow/lighting \
lighting_and_shadow/is_shadowed \
ray/reflect \
ray/normal_at \
ray/ray_for_pixel \
structures/hittable_lst \
structures/hittable_getters \
structures/clean_hittable \
structures/intersection_lst \
structures/create_structure \
linear_algebra/vectors/basic_operations \
linear_algebra/vectors/scalar_operations \
linear_algebra/vectors/extra_operations \
linear_algebra/matrices/matrix_create \
linear_algebra/matrices/matrix_operators \
linear_algebra/matrices/matrix_rotates \
linear_algebra/matrices/matrix_utils \
linear_algebra/matrices/matrix_transform \
linear_algebra/matrices/view_transformation \
linear_algebra/conversions \
linear_algebra/transforms \
intersections/intersection \
intersections/intersect_sphere \
intersections/intersect_plane \
intersections/intersect_cylinder \
mlx/mlx_hooks \
mlx/mlx_create_img \
mlx/mlx_img_pix_put \
mlx/mlx_close_window \
mlx/mlx_create_window \
file_parsing/parse \
file_parsing/map_parse \
file_parsing/parse_aux_functions/expected_number_of_identifiers \
file_parsing/parse_aux_functions/trim_lines \
file_parsing/parse_aux_functions/is_valid_identifier \
file_parsing/parse_aux_functions/is_valid_ambient_lighting \
file_parsing/parse_aux_functions/is_valid_camera \
file_parsing/parse_aux_functions/is_valid_light \
file_parsing/parse_aux_functions/is_valid_sphere \
file_parsing/parse_aux_functions/is_valid_plane \
file_parsing/parse_aux_functions/is_valid_cylinder \
file_parsing/parse_aux_functions/is_number \
file_parsing/parse_aux_functions/is_valid_rgb_set \
file_parsing/parse_aux_functions/set_contain_only_numbers \
file_parsing/parse_aux_functions/is_valid_lighting_ratio \
file_parsing/parse_aux_functions/is_valid_coordinates \
file_parsing/parse_aux_functions/expected_number_of_fields \
file_parsing/parse_aux_functions/is_valid_3d_normalized_vec \
file_parsing/parse_aux_functions/count_dots \
file_parsing/parse_aux_functions/only_two_commas \
world/init_world \
world/objects \
world/material \
world/camera \
aux_functions/color \
aux_functions/reset_fd \
aux_functions/get_file_content \
aux_functions/get_splitted_identifier \
aux_functions/assign_value \
aux_functions/sort_lst \
aux_functions/double_equals \
aux_functions/check_equal_vec3 \
aux_functions/get_orientation
FILES_BONUS = ${FILES:%=%_bonus} \
intersections/intersect_cone_bonus \
intersections/hit_objects_bonus \
ray/specific_normals_bonus \
world/pattern_bonus \
world/texture_bonus \
world/texture_map_bonus \
world/init_objects_bonus \
structures/get_transforms_bonus \
lighting_and_shadow/compute_lighting_bonus \
file_parsing/parse_aux_functions/is_valid_texture_bonus \
file_parsing/parse_aux_functions/is_valid_pattern_bonus \
file_parsing/parse_aux_functions/is_valid_material_type_bonus \
file_parsing/parse_aux_functions/is_valid_cone_bonus \
SRCS = ${FILES:%=$(SRCS_PATH)/%.c}
OBJS = ${FILES:%=$(OBJS_PATH)/%.o}
SRCS_BONUS = ${FILES_BONUS:%=$(BONUS_SRCS_PATH)/%.c}
OBJS_BONUS = ${FILES_BONUS:%=$(BONUS_OBJS_PATH)/%.o}
CC = cc
CFLAGS = -Wall -Wextra -Werror -O3
LIBXFLAGS = -lmlx -lXext -lX11 -lm -lz
LIBFTFLAGS = -L $(LIBFT_PATH) -lft
all: libft $(NAME)
libft:
@make -C $(LIBFT_PATH) --no-print-directory
$(LIBFT_PATH)/libft.a:
make -C $(LIBFT_PATH) --no-print-directory
$(NAME): $(OBJS) $(LIBFT_PATH)/libft.a
$(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(LIBFTFLAGS) $(LIBXFLAGS)
$(OBJS_PATH)/%.o: $(SRCS_PATH)/%.c | $(OBJS_PATH)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -I $(OBJS_PATH) -c $< -o $@
$(OBJS_PATH):
mkdir -p $(OBJS_PATH)
bonus: libft $(NAME_BONUS)
$(NAME_BONUS): $(OBJS_BONUS) $(LIBFT_PATH)/libft.a
$(CC) $(CFLAGS) -o $(NAME_BONUS) $(OBJS_BONUS) $(LIBFTFLAGS) $(LIBXFLAGS)
$(BONUS_OBJS_PATH)/%.o: $(BONUS_SRCS_PATH)/%.c | $(BONUS_OBJS_PATH)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -I $(BONUS_INCLUDE_PATH) -c $< -o $@
$(BONUS_OBJS_PATH):
mkdir -p $(BONUS_OBJS_PATH)
clean:
rm -rf $(OBJS_PATH)
make -C $(LIBFT_PATH) clean --no-print-directory
clean_bonus:
rm -rf $(BONUS_OBJS_PATH)
make -C $(LIBFT_PATH) clean --no-print-directory
fclean: clean
rm -f $(NAME)
make -C $(LIBFT_PATH) fclean --no-print-directory
fclean_bonus: clean_bonus
rm -f $(NAME_BONUS)
make -C $(LIBFT_PATH) fclean --no-print-directory
re: fclean all
rebonus: fclean_bonus bonus
.PHONY: all clean fclean re