-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·397 lines (323 loc) · 12.2 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
EOC = \033[0m
BOLD = \033[1m
GREEN = \033[32m
YELLOW = \033[33m
NAME := ft_container
INCLUDES += ./includes/
SRCS_DIR = ./srcs
CC = clang++
OBJ_DIR = ./objs_$(NAME)/
PCH_DIR = ./pchs_$(NAME)/
CFLAGS += -Wall
CFLAGS += -Wextra
# CFLAGS += -g3
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CFLAGS += -fPIC
endif
ifeq ($(UNAME_S),Darwin)
CFLAGS += -Wno-self-assign-overloaded
CFLAGS += -Wno-deprecated-copy
endif
ifeq ($(noassert), 1)
CFLAGS += -DNDEBUG=1
endif
ifeq ($(valgrind_mode), 1)
CFLAGS += -D VALGRIND_MODE=1
else
CFLAGS += -D VALGRIND_MODE=0
endif
ifeq ($(print_all), 1)
OTHER_FLAGS += -D NOPRINT=1
else
OTHER_FLAGS += -D NOPRINT=0
endif
ifeq ($(unused), 1)
CFLAGS += -Wno-unused
endif
ifeq ($(help), 1)
CFLAGS += -Wconversion
else ifeq ($(help), 2)
CFLAGS += -Wsuggest-attribute=pure
else ifeq ($(help), 3)
CFLAGS += -Wsuggest-attribute=const
else ifeq ($(help), 4)
CFLAGS += -Wsuggest-attribute=noreturn
else ifeq ($(help), 5)
CFLAGS += -fsanitize-undefined-trap-on-error
else ifneq ($(no_error), 1)
CFLAGS += -Werror
endif
ifeq ($(debug), 1)
CFLAGS += -g3
else ifeq ($(debug), 2)
CFLAGS += -fsanitize=address,undefined
CFLAGS += -g3
else ifeq ($(debug), 3)
CFLAGS += -fsanitize=address,undefined
CFLAGS += -g3
CFLAGS += -Wpadded
else ifeq ($(debug), 4)
CFLAGS += -fsanitize=address,undefined
CFLAGS += -g3
CFLAGS += -Wpadded
ifneq ($(CC), gcc)
CFLAGS += -Weverything
endif
endif
ifeq ($(opti), 1)
CFLAGS += -O3
endif
ifeq ($(debug_mode), 1)
CFLAGS += -D DEBUG_MODE=1
else ifeq ($(debug_mode), 2)
CFLAGS += -D DEBUG_MODE=2
else ifeq ($(debug_mode), 3)
CFLAGS += -D DEBUG_MODE=3
else ifeq ($(debug_mode), 4)
CFLAGS += -D DEBUG_MODE=4
endif
PROJECT_HEADER += ./your_headers.hpp
HEADER += ./bvaletteTester.hpp
HEADER += ./bvaletteTester_defines.hpp
HEADER += ./bvaletteTester_list.hpp
HEADER += ./bvaletteTester_vector.hpp
HEADER += ./bvaletteTester_deque.hpp
HEADER += ./bvaletteTester_map.hpp
HEADER += ./bvaletteTester_set.hpp
HEADER += ./exampleClass.hpp
HEADER += ./compClass.hpp
################################################################################
#-------- MAIN #################################################################
################################################################################
SRCS += ./main_utils.cpp
################################################################################
#-------- LIST #################################################################
################################################################################
SRCS_LIST += ./main_tester_list.cpp
SRCS_LIST += ./test_list_instantiation.cpp
SRCS_LIST += ./test_list_push_back_push_front_pop_back_pop_front.cpp
SRCS_LIST += ./test_list_clear.cpp
SRCS_LIST += ./test_list_capacities.cpp
SRCS_LIST += ./test_list_insert_erase.cpp
SRCS_LIST += ./test_list_operatorEqual.cpp
SRCS_LIST += ./test_list_resize.cpp
SRCS_LIST += ./test_list_assign.cpp
SRCS_LIST += ./test_list_member_swap.cpp
SRCS_LIST += ./test_list_nonmember_swap.cpp
SRCS_LIST += ./test_list_relational_operators.cpp
SRCS_LIST += ./test_list_splice.cpp
SRCS_LIST += ./test_list_remove_if.cpp
SRCS_LIST += ./test_list_remove.cpp
SRCS_LIST += ./test_list_unique.cpp
SRCS_LIST += ./test_list_merge.cpp
SRCS_LIST += ./test_list_sort.cpp
SRCS_LIST += ./test_list_iterator.cpp
SRCS_LIST += ./test_list_reverseIterator.cpp
SRCS_LIST += ./test_list_reverse.cpp
SRCS_LIST += ./test_list_element_access.cpp
################################################################################
#-------- VECTOR ###############################################################
################################################################################
SRCS_VECTOR += ./main_tester_vector.cpp
SRCS_VECTOR += ./test_vector_instantiation.cpp
SRCS_VECTOR += ./test_vector_push_back_pop_back.cpp
SRCS_VECTOR += ./test_vector_clear.cpp
SRCS_VECTOR += ./test_vector_capacities.cpp
SRCS_VECTOR += ./test_vector_insert_erase.cpp
SRCS_VECTOR += ./test_vector_operatorEqual.cpp
SRCS_VECTOR += ./test_vector_resize.cpp
SRCS_VECTOR += ./test_vector_assign.cpp
SRCS_VECTOR += ./test_vector_at_operatorBrackets.cpp
SRCS_VECTOR += ./test_vector_member_swap.cpp
SRCS_VECTOR += ./test_vector_nonmember_swap.cpp
SRCS_VECTOR += ./test_vector_relational_operators.cpp
SRCS_VECTOR += ./test_vector_iterator.cpp
SRCS_VECTOR += ./test_vector_reverseIterator.cpp
SRCS_VECTOR += ./test_vector_element_access.cpp
################################################################################
#-------- STACK ###############################################################
################################################################################
SRCS_STACK += ./main_tester_stack.cpp
SRCS_STACK += ./test_stack_general.cpp
# ################################################################################
# #-------- QUEUE ###############################################################
# ################################################################################
SRCS_QUEUE += ./main_tester_queue.cpp
SRCS_QUEUE += ./test_queue_general.cpp
################################################################################
#-------- DEQUE ###############################################################
################################################################################
SRCS_DEQUE += ./main_tester_deque.cpp
SRCS_DEQUE += ./test_deque_instantiation.cpp
SRCS_DEQUE += ./test_deque_push_pop.cpp
SRCS_DEQUE += ./test_deque_clear.cpp
SRCS_DEQUE += ./test_deque_capacities.cpp
SRCS_DEQUE += ./test_deque_insert_erase.cpp
SRCS_DEQUE += ./test_deque_operatorEqual.cpp
SRCS_DEQUE += ./test_deque_resize.cpp
SRCS_DEQUE += ./test_deque_assign.cpp
SRCS_DEQUE += ./test_deque_at_operatorBrackets.cpp
SRCS_DEQUE += ./test_deque_member_swap.cpp
SRCS_DEQUE += ./test_deque_nonmember_swap.cpp
SRCS_DEQUE += ./test_deque_relational_operators.cpp
SRCS_DEQUE += ./test_deque_iterator.cpp
SRCS_DEQUE += ./test_deque_reverseIterator.cpp
SRCS_DEQUE += ./test_deque_element_access.cpp
################################################################################
#-------- MAP ###############################################################
################################################################################
SRCS_MAP += ./main_tester_map.cpp
SRCS_MAP += ./test_map_instantiation.cpp
SRCS_MAP += ./test_map_insert_erase.cpp
SRCS_MAP += ./test_map_capacities.cpp
SRCS_MAP += ./test_map_iterator.cpp
SRCS_MAP += ./test_map_at_operatorBrackets.cpp
SRCS_MAP += ./test_map_swap.cpp
SRCS_MAP += ./test_map_clear.cpp
SRCS_MAP += ./test_key_compare_value_compare.cpp
SRCS_MAP += ./test_map_operatorEqual.cpp
SRCS_MAP += ./test_map_find.cpp
SRCS_MAP += ./test_map_count.cpp
SRCS_MAP += ./test_map_lower_bound.cpp
SRCS_MAP += ./test_map_upper_bound.cpp
SRCS_MAP += ./test_map_equal_range.cpp
SRCS_MAP += ./test_map_reverseIterator.cpp
################################################################################
#-------- SET ###############################################################
################################################################################
SRCS_SET += ./main_tester_set.cpp
SRCS_SET += ./test_set_instantiation.cpp
SRCS_SET += ./test_set_insert_erase.cpp
SRCS_SET += ./test_set_capacities.cpp
SRCS_SET += ./test_set_iterator.cpp
SRCS_SET += ./test_set_swap.cpp
SRCS_SET += ./test_set_clear.cpp
SRCS_SET += ./test_set_key_compare_value_compare.cpp
SRCS_SET += ./test_set_operatorEqual.cpp
SRCS_SET += ./test_set_find.cpp
SRCS_SET += ./test_set_count.cpp
SRCS_SET += ./test_set_lower_bound.cpp
SRCS_SET += ./test_set_upper_bound.cpp
SRCS_SET += ./test_set_equal_range.cpp
SRCS_SET += ./test_set_reverseIterator.cpp
vpath %.cpp ./srcs
vpath %.cpp ./srcs/list_tests
vpath %.cpp ./srcs/vector_tests
vpath %.cpp ./srcs/deque_tests
vpath %.cpp ./srcs/stack_tests
vpath %.cpp ./srcs/queue_tests
vpath %.cpp ./srcs/map_tests
vpath %.cpp ./srcs/set_tests
vpath %.hpp ./includes
vpath %.hpp ./includes/tester
vpath %.hpp ./includes/your_headers
OBJS_VECTOR = $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS_VECTOR))
OBJS_STACK= $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS_STACK))
OBJS_QUEUE = $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS_QUEUE))
OBJS_DEQUE = $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS_DEQUE))
OBJS_MAP = $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS_MAP))
OBJS_SET = $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS_SET))
OBJS_LIST = $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS_LIST))
OBJS = $(patsubst %.cpp, $(OBJ_DIR)%.o, $(SRCS))
PCHS = $(patsubst %.hpp, $(PCH_DIR)%.pch, $(PROJECT_HEADER))
all:
$(MAKE) $(NAME)
@echo
@echo
$(NAME): $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_DEQUE) $(OBJS_LIST) $(OBJS_MAP) $(OBJS_SET) $(OBJS_STACK) $(OBJS_VECTOR)
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
compile_deque: $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_DEQUE)
@echo
@echo "🎉 \033[32m Ready to $@ ...\033[0m "
compile_list: $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_LIST)
@echo
@echo "🎉 \033[32m Ready to $@ ...\033[0m "
compile_map: $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_MAP)
@echo
@echo "🎉 \033[32m Ready to $@ ...\033[0m "
compile_vector: $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_VECTOR)
@echo
@echo "🎉 \033[32m Ready to $@ ...\033[0m "
compile_stack: $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_STACK)
@echo
@echo "🎉 \033[32m Ready to $@ ...\033[0m "
compile_set: $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_SET)
@echo
@echo "🎉 \033[32m Ready to $@ ...\033[0m "
compile_queue: $(PCH_DIR) $(PCHS) $(OBJ_DIR) $(OBJS) $(OBJS_QUEUE)
@echo
@echo "🎉 \033[32m Ready to $@ ...\033[0m "
deque: compile_deque
$(CC) -std=c++11 $(CFLAGS) $(OBJS) $(OBJS_DEQUE) -I $(INCLUDES) -o $@
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
@./$@ | cat -n
list: compile_list
$(CC) -std=c++11 $(CFLAGS) $(OBJS) $(OBJS_LIST) -I $(INCLUDES) -o $@
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
@./$@ | cat -n
map: compile_map
$(CC) -std=c++11 $(CFLAGS) $(OBJS) $(OBJS_MAP) -I $(INCLUDES) -o $@
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
@./$@ | cat -n
vector: compile_vector
$(CC) -std=c++11 $(CFLAGS) $(OBJS) $(OBJS_VECTOR) -I $(INCLUDES) -o $@
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
@./$@ | cat -n
stack: compile_stack
$(CC) -std=c++11 $(CFLAGS) $(OBJS) $(OBJS_STACK) -I $(INCLUDES) -o $@
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
@./$@ | cat -n
set: compile_set
$(CC) -std=c++11 $(CFLAGS) $(OBJS) $(OBJS_SET) -I $(INCLUDES) -o $@
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
@./$@ | cat -n
queue: compile_queue
$(CC) -std=c++11 $(CFLAGS) $(OBJS) $(OBJS_QUEUE) -I $(INCLUDES) -o $@
@echo
@echo "🎉 \033[32m Ready to test $@ !\033[0m ✅"
@./$@ | cat -n
$(OBJS_DEQUE): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(OBJS_LIST): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(OBJS_MAP): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(OBJS_QUEUE): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(OBJS_SET): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(OBJS_STACK): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(OBJS_VECTOR): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(OBJS): $(OBJ_DIR)%.o: %.cpp $(PROJECT_HEADER) $(HEADER)
$(CC) -std=c++11 $(CFLAGS) $(OTHER_FLAGS) -c $< -I $(INCLUDES) -o $@
$(PCHS): $(PCH_DIR)%.pch: %.hpp $(PROJECT_HEADER)
$(CC) -std=c++98 $(CFLAGS) $< -o $@
@echo "🎉 \033[32m Your project's headers are cpp98 compliant $@ !\033[0m ✅"
$(OBJ_DIR):
@mkdir -p $@
$(PCH_DIR):
@mkdir -p $@
cpp98 : $(PCH_DIR) $(PCHS)
pch:
$(MAKE) $(PCH_DIR)
$(MAKE) $(PCHS)
FORCE :
clean :
$(RM) -R $(OBJ_DIR) $(PCH_DIR)
fclean : clean
$(RM) $(NAME) list map queue stack deque set vector
re : fclean
@$(MAKE)
f : cpp98 all list map vector stack queue deque set
.PHONY: all clean fclean mclean re list map queue stack deque set vector FORCE cmp
#.SILENT: