-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
127 lines (105 loc) · 7.55 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: gabdoush <gabdoush@student.42abudhabi.a +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/01/04 03:46:21 by gabdoush #+# #+# #
# Updated: 2023/01/11 10:59:05 by gabdoush ### ########.fr #
# #
# **************************************************************************** #
#-------------------- Define Color-------------------#
ifneq (,$(findstring xterm,${TERM}))
R := $(shell tput -Txterm setaf 1)
G := $(shell tput -Txterm setaf 2)
Y := $(shell tput -Txterm setaf 3)
LP := $(shell tput -Txterm setaf 4)
P := $(shell tput -Txterm setaf 5)
B := $(shell tput -Txterm setaf 6)
W := $(shell tput -Txterm setaf 7)
RS := $(shell tput -Txterm sgr0)
else
R := ""
G := ""
Y := ""
LP := ""
P := ""
B := ""
W := ""
RS := ""
endif
#----------------------------------------------------#
NAME = ft_containers
MY_VEC = ./tests/vector_tests/vector_test.cpp
ORG_VEC = ./tests/vector_tests/Original.cpp
MY_MAP = ./tests/map_tests/map_test.cpp
#ORG_MAP = ./tests/map_tests/Original.cpp
FLAGS = -Wall -Wextra -Werror -std=c++98
################################## [sanitizer] ##################################
# -fsanitize=address for address sanitizer
# -fsanitize=leak for leak sanitizer
# -fsanitize=undefined for undefined behavior sanitizer
# -fsanitize=thread for thread sanitizer
SFLAGS = -fsanitize=address -fsanitize=undefined -fsanitize=leak -fsanitize=thread
####################################################################################
CC = c++ -g3
#------------------------------------------------------------------------------------------------------
all: $(NAME) $(OBJ) clean
$(NAME): $(OBJ)
# Compile MY_VEC and ORG_VEC files
@$(CC) $(FLAGS) $(MY_VEC) -o MY_VEC
@$(CC) $(ORG_VEC) -o ORG_VEC
# Compile MY_MAP files
$(CC) $(FLAGS) $(MY_MAP) -o MY_MAP
#$(CC) $(FLAGS) $(ORG_MAP) -o ORG_MAP
# Move MY_VEC and ORG_VEC to tests folder
@mv MY_VEC ORG_VEC ./tests/vector_tests
# Move MY_MAP to tests folder
@mv MY_MAP ./tests/map_tests
@#mv ORG_MAP ./tests/map_tests
@echo "\033c"
@echo "$(R)≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ $(RS)"
@echo "$(R)║$(LP)░░░░████████░░████████░░░█████░░░███░█████████░█████████░░█████░░░███░░████████░████████░░░░░████████░░░$(R)║$(RS)"
@echo "$(R)║$(LP)░░░███░░░░░░░███░░░░███░███░███░░███░░░░███░░░░░░░███░░░░███░███░░███░███░░░░░░░███░░░░██░░░███░░░░░░░░░$(R)║$(RS)"
@echo "$(R)║$(LP)░░░███░░░░░░░███░░░░███░███░░███░███░░░░███░░░░░░░███░░░░███░░███░███░█████████░████████░░░░█████████░░░$(R)║$(RS)"
@echo "$(R)║$(LP)░░░███░░░░░░░███░░░░███░███░░░██████░░░░███░░░░░░░███░░░░███░░░██████░███░░░░░░░███░░░░██░░░░░░░░░███░░░$(R)║$(RS)"
@echo "$(R)║$(LP)░░░░████████░░████████░░███░░░░████░░░░░███░░░░█████████░███░░░░████░░░████████░███░░░░░██░░████████░░░░$(R)║$(RS)"
@echo "$(R)≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡ $(RS)"
@echo "$ $(LP) Created_By\n $(RS)"
@echo " $(Y) █▀▀ █▀█ █▄▄ $(RS)"
@echo " $(Y) █▄█ █▀█ █▄█ $(RS)"
@echo "$ $(LP) _____________________________$(RS)"
@echo "\n"
test:
# Compare MY_VEC and ORG_VEC outputs
@python3 Test_res_cmp.py
#------------------------------------------------------------------------------------------------------
leaks:
@echo
make re && make clean \
&& valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --error-limit=no ./$(NAME)
@echo "$(Y)——————————————————————————————————————————————————————————————————————————————————$(RS)"
#------------------------------------------------------------------------------------------------------
clean:
@rm -rf $(OBJ)
@echo "$(G)【OK】 $(RS) $(R)❮ft_containers❯ objects have been cleaned$(RS)"
@echo "$(Y)——————————————————————————————————————————————————————————————————————————————————$(RS)"
#------------------------------------------------------------------------------------------------------
fclean: clean
@rm -rf ./tests/vector_tests/MY_VEC
@rm -rf ./tests/vector_tests/ORG_VEC
@rm -rf ./MY_VEC.dSYM
@rm -rf ./ORG_VEC.dSYM
@rm -rf ./tests/map_tests/MY_MAP
@#rm -rf ./tests/map_tests/ORG_MAP
@rm -rf ./MY_MAP.dSYM
@#rm -rf ./ORG_MAP.dSYM
@echo "\033c"
@echo "$(G)【OK】 $(RS) $(R)❮ft_containers executable❯ DELETED$(RS)"
@echo "$(Y)——————————————————————————————————————————————————————————————————————————————————$(RS)"
#------------------------------------------------------------------------------------------------------
re: fclean all
#------------------------------------------------------------------------------------------------------
.PHONY: all clean fclean re
#------------------------------------------------------------------------------------------------------