-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
87 lines (67 loc) · 3.05 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jrasser <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/08/01 15:24:21 by jrasser #+# #+# #
# Updated: 2022/11/05 02:10:42 by jrasser ### ########.fr #
# #
# **************************************************************************** #
BLU = \033[0;34m
GRN = \033[0;32m
RED = \033[0;31m
ERASE = \033[2K\r
END = \033[0m
CHECK = ✓
SRCS = $(wildcard *.cpp) $(wildcard srcs/**.cpp)
SRCS_FT = $(wildcard srcs/rendu/**.cpp)
NAME = tester
TESTER_FT = tester_ft
TESTER_STD = tester_std
OBJS_DIR = objs/
OBJS = $(addprefix $(OBJS_DIR), $(notdir $(SRCS:.cpp=.o)))
OBJS_BIN = $(addprefix $(OBJS_DIR), $(notdir $(SRCS_FT:.cpp=.o)))
RM = @rm -rf
CC = g++
CFLAGS = -Wall -Wextra -std=c++98
CPPFLAGS = -I. -I./class -I./includes
DEBEUG = -g
objs/%.o: *%.cpp
@mkdir -p $(OBJS_DIR)
@${CC} $(CPPFLAGS) -o $@ -c $< ${CFLAGS} ${DEBEUG}
@printf "$(ERASE) ${BLU}$ [BUILD]${RST} '$<' $(END)"
objs/%.o: srcs/**%.cpp
@mkdir -p $(OBJS_DIR)
@${CC} $(CPPFLAGS) -o $@ -c $< ${CFLAGS} ${DEBEUG}
@printf "$(ERASE) ${BLU}$ [BUILD]${RST} '$<' $(END)"
objs/%.o: srcs/rendu/**%.cpp
@mkdir -p $(OBJS_DIR)
@${CC} $(CPPFLAGS) -o $@ -c $< ${CFLAGS} ${DEBEUG}
@printf "$(ERASE) ${BLU}$ [BUILD]${RST} '$<' $(END)"
${NAME} : ${OBJS}
@${CC} ${OBJS} -o $(NAME) ${CFLAGS} ${DEBEUG}
@echo "$(ERASE)$(GRN) [Successfully compiled]$(END) $(CHECK)"
@echo " Executable ./$(NAME) \n"
all : ${NAME} bin_ft bin_std
bin : bin_std bin_ft
bin_std :
@${CC} -DSTL_TYPE=std $(wildcard srcs/rendu/**.cpp) -o $(TESTER_STD) ${CFLAGS} ${DEBEUG}
@echo "$(ERASE)$(GRN) [Tester STD compiled]$(END) $(CHECK)"
@echo " Executable ./$(TESTER_STD) \n"
bin_ft :
@${CC} -DSTL_TYPE=ft $(wildcard srcs/rendu/**.cpp) -o $(TESTER_FT) ${CFLAGS} ${DEBEUG}
@echo "$(ERASE)$(GRN) [Tester FT compiled]$(END) $(CHECK)"
@echo " Executable ./$(TESTER_FT) \n"
clean :
${RM} $(OBJS) ${OBJS_BIN}
@echo "$(GRN) [Clean]$(END) $(CHECK)"
fclean : clean
${RM} ${NAME} ${TESTER_FT} ${TESTER_STD}
@echo "$(GRN) [Fclean]$(END) $(CHECK)"
re : fclean all
.PHONY: all clean fclean re
# make fclean && make bin && ./tester_ft > testerft.txt && ./tester_std > testerstd.txt && diff testerft.txt testerstd.txt
# make fclean && make bin && ./tester_ft > testerft.txt && ./tester_std > testerstd.txt && diff testerstd.txt testerft.txt > diff.txt
# ./tester_ft > testerft.txt && ./tester_std > testerstd.txt && diff testerstd.txt testerft.txt > diff.txt