forked from Pinkyboi/RT
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
executable file
·179 lines (147 loc) · 5.12 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: azarzor <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/11/17 15:42:28 by abiri #+# #+# #
# Updated: 2020/03/04 12:23:10 by abiri ### ########.fr #
# #
# **************************************************************************** #
_lCYAN = \x1b[96m
_lYELLOW = \x1b[93m
_lGREEN = \x1b[92m
_lBLUE = \x1b[94m
_RED = \x1b[31m
_BOLD = \x1b[1m
_END = \x1b[0m
CC = gcc
NAME = rt
SLAVE_NAME = slave_rt
FILENAMES = basics_constructors.c\
basics_intersection.c\
basics_normals.c\
cam_utils.c\
colors.c\
colors_calcul.c\
colors_operations.c\
colors_utils.c\
cut_helper.c\
destroy.c\
dump_bitmap.c\
filter.c\
ft_atof.c\
intersection_utils.c\
key_managing.c\
limited_constructors.c\
loading_functions.c\
ray_marching.c\
noise.c\
parser_main.c\
parser_tools.c\
parser_types.c\
procedural_textures.c\
quadrics_constructors.c\
quadrics_intersection.c\
quadrics_normals.c\
reflection.c\
refraction.c\
shapes_cut.c\
shapes_limit.c\
string_parsers.c\
uv_mapping_utils.c\
world_constructors.c\
fractals.c\
user_interface.c\
box_constructor.c\
pill_constructor.c\
parallelepiped_constructor.c\
image_filtering.c\
textures_constructors.c\
stereoscopie.c\
shadows.c\
material.c\
texture_maps.c\
hit_texture_color.c\
color_intersection.c\
mlx_managing.c\
bottom_buttons.c\
draw_buttons.c\
holo_cube.c\
complex_constructors.c\
xml_parser_tools.c \
quartic_solver.c \
cubic_solver.c\
torus.c\
cube.c\
depth_of_field.c
HEADER_FILE = objects.h\
parser.h\
rtv1.h
SRC_DIR = ./src
OBJ_DIR = ./obj
INC_DIR = ./inc
MAIN_RENDER_SRC = headless_rendering.c\
main.c
SLAVE_RENDER_SRC = slave_rendering.c\
slave_main.c
OBJ = $(addprefix $(OBJ_DIR)/, $(FILENAMES:.c=.o))
MAIN_OBJ = $(addprefix $(OBJ_DIR)/, $(MAIN_RENDER_SRC:.c=.o))
SLAVE_OBJ = $(addprefix $(OBJ_DIR)/, $(SLAVE_RENDER_SRC:.c=.o))
HEADER_FILES = $(addprefix $(INC_DIR)/, $(HEADER_FILE))
FLAGS = -g -Wall -Werror -Wextra
FTMATHS = ./libs/ft_maths
LIBFTMATHS = $(FTMATHS)/libftmaths.a
LIBFTDIR = ./libs/libft
LIBFT = $(LIBFTDIR)/libft.a
LIBTTSLISTDIR = ./libs/ttslist
LIBTTSLIST = $(LIBTTSLISTDIR)/libttslist.a
INCLUDES = -I ./inc -I $(LIBFTDIR) -I ./libs/ft_maths/inc -I $(LIBTTSLISTDIR)/includes -I ./libs/MinilibX/elcapitan
# detecting the os and linking with the good minilibx
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Linux)
LIBRARIES = -L $(LIBFTDIR) -lft -L ./minilibx -lmlx -lX11 -lXext -L $(FTMATHS) -lftmaths -lm -L $(LIBTTSLISTDIR) -lttslist -pthread
else
LIBRARIES = -L $(LIBFTDIR) -lft -L ./libs/MinilibX -lmlx -framework OpenGL -framework AppKit -L $(FTMATHS) -lftmaths -L $(LIBTTSLISTDIR) -lttslist
endif
DELAY = 0
all : $(NAME)
$(NAME): $(MAIN_OBJ) $(OBJ) $(LIBFT) $(LIBFTMATHS) $(LIBTTSLIST)
@echo "$(CC) $(_lYELLOW)$(FLAGS)$(_END) $(_lCYAN)$(OBJ)$(_END)\n$(_lGREEN)$(LIBRARIES)$(_END) -I$(_RED)$(INC_DIR)$(_END)$(_RED)$(INCLUDES)$(_END) -o $(_lBLUE)$(NAME)$(_lEND)$(_RED)\n"
@$(CC) $(FLAGS) $(MAIN_OBJ) $(OBJ) $(LIBRARIES) $(INCLUDES) -o $(NAME)
$(SLAVE_NAME): $(SLAVE_OBJ) $(OBJ) $(LIBFT) $(LIBFTMATHS) $(LIBTTSLIST)
@echo "$(CC) $(_lYELLOW)$(FLAGS)$(_END) $(_lCYAN)$(OBJ)$(_END)\n$(_lGREEN)$(LIBRARIES)$(_END) -I$(_RED)$(INC_DIR)$(_END)$(_RED)$(INCLUDES)$(_END) -o $(_lBLUE)$(NAME)$(_lEND)$(_RED)\n"
@$(CC) $(FLAGS) $(SLAVE_OBJ) $(OBJ) $(LIBRARIES) $(INCLUDES) -o $(SLAVE_NAME)
$(OBJ): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c $(HEADER_FILES) | $(OBJ_DIR)
$(CC) $(FLAGS) -c $< -o $@ -I $(INC_DIR) $(INCLUDES)
$(SLAVE_OBJ): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c $(HEADER_FILES) | $(OBJ_DIR)
$(CC) $(FLAGS) -c $< -o $@ -I $(INC_DIR) $(INCLUDES)
$(MAIN_OBJ): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c $(HEADER_FILES) | $(OBJ_DIR)
$(CC) $(FLAGS) -c $< -o $@ -I $(INC_DIR) $(INCLUDES)
$(OBJ_DIR):
@mkdir $(OBJ_DIR)
$(LIBFTMATHS):
@make -C $(FTMATHS)
$(LIBFT):
@make -C $(LIBFTDIR)
$(LIBTTSLIST):
@make -C $(LIBTTSLISTDIR)
clean:
@echo "\n$(_lCYAN)Makefile :$(_END) will delete $(_RED)$(OBJ) $(VIS_OBJ)$(_END)"
@echo "starting in $(DELAY) sec, $(_RED)press Ctrl-c to abort$(_END)"
@sleep $(DELAY)
@make -C $(LIBFTDIR) clean
@make -C $(FTMATHS) clean
@make -C $(LIBTTSLISTDIR) clean
@rm -rf $(OBJ_DIR)
fclean: clean
@echo "\n$(_lCYAN)Makefile :$(_END) will delete $(_RED)$(NAME)$(_END)"
@echo "starting in $(DELAY) sec, $(_RED)press Ctrl-c to abort$(_END)"
@sleep $(DELAY)
@make -C $(LIBFTDIR) fclean
@make -C $(FTMATHS) fclean
@make -C $(LIBTTSLISTDIR) fclean
@rm -f $(NAME)
@rm -f $(SLAVE_NAME)
re: fclean all