-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
102 lines (79 loc) · 1.81 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
NAME = unit_test
HDRS = ..
VECTORS_SRCS = $(addprefix srcs/vector/, \
constructor.cpp \
assign.cpp \
iterator.cpp \
capacity.cpp \
element_access.cpp \
modifier.cpp \
non_members_and_miscs.cpp \
benchmark.cpp)
MAP_SRCS = $(addprefix srcs/map/, \
constructor.cpp \
assign.cpp \
iterator.cpp \
capacity.cpp \
element_access.cpp \
modifier.cpp \
observer.cpp \
operation.cpp \
non_members_and_miscs.cpp \
benchmark.cpp)
SET_SRCS = $(addprefix srcs/set/, \
constructor.cpp \
assign.cpp \
iterator.cpp \
capacity.cpp \
modifier.cpp \
observer.cpp \
operation.cpp \
non_members_and_miscs.cpp \
benchmark.cpp)
STACK_SRCS = $(addprefix srcs/stack/, \
general.cpp)
SRCS_BASE = $(addprefix srcs/, main.cpp common.cpp)
SRCS += $(SRCS_BASE)
ifneq ("$(wildcard $(HDRS)/vector.hpp)","")
SRCS += $(VECTORS_SRCS)
$(info vector detected)
endif
ifneq ("$(wildcard $(HDRS)/map.hpp)","")
SRCS += $(MAP_SRCS)
$(info map detected)
endif
ifneq ("$(wildcard $(HDRS)/stack.hpp)","")
SRCS += $(STACK_SRCS)
$(info stack detected)
endif
ifneq ("$(wildcard $(HDRS)/set.hpp)","")
SRCS += $(SET_SRCS)
$(info set detected)
endif
ifneq ("$(wildcard $(HDRS)/vector.hpp)","")
ifneq ("$(wildcard $(HDRS)/map.hpp)","")
ifneq ("$(wildcard $(HDRS)/stack.hpp)","")
SRCS += srcs/42_main.cpp
endif
endif
endif
ifeq ("$(SRCS)", "$(SRCS_BASE)")
$(error None of the containers headers were turned in, please check the HDRS variable path at the top of the makefile)
endif
$(info )
OBJS = ${SRCS:.cpp=.o}
DEPS = ${SRCS:.cpp=.d}
FLAGS = -MMD -MP -Wall -Wextra -Werror -std=c++98
CC = c++
all: ${NAME} Makefile
${NAME}: ${OBJS} | $(HDRS)
$(CC) $(FLAGS) $(OBJS) -o $@
%.o: %.cpp
${CC} ${FLAGS} -I$(HDRS) -c $< -o ${<:.cpp=.o}
clean:
${RM} ${OBJS} ${DEPS}
fclean: clean
${RM} ${NAME}
re: fclean all
-include $(DEPS)
.PHONY: all clean fclean re