-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (44 loc) · 1.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
NAME := ft_containers
CXX := c++
CXXFLAGS = -Wall -Werror -Wextra -Wpedantic
CXXFLAGS += -I/Users/mjoosten/.brew/opt/llvm/include
LDFLAGS = -L/Users/mjoosten/.brew/opt/llvm/lib
ifdef DEBUG
CXXFLAGS += -g -fsanitize=address
LDFLAGS += -g -fsanitize=address
endif
ifdef STD
CXXFLAGS += -D STD
endif
INC = -I include
SRCDIR = src
SRC = subject.cpp
OBJDIR = obj
OBJ = $(addprefix $(OBJDIR)/,$(SRC:.cpp=.o))
DEP = $(OBJ:.o=.d)
all: $(NAME)
$(NAME): $(OBJ)
$(CXX) $(LDFLAGS) $< -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | $(OBJDIR)
$(CXX) $(CXXFLAGS) -std=c++98 -MMD -c $< $(INC) -o $@
$(OBJDIR):
mkdir -p $@
clean:
$(RM) -r $(OBJDIR)
fclean: clean
$(RM) $(NAME)
re: fclean
make all
run: all
./$(NAME)
CASE := map
test:
$(CXX) $(CXXFLAGS) tests/$(CASE).cpp $(INC) -o catch2 && ./catch2
LIST = vector stack map set
testall:
@for case in $(LIST) ; do make test CASE=$$case; done
bm:
$(CXX) $(CXXFLAGS) benchmark/*.cpp $(INC) -D STD -o benchmark/std && ./benchmark/std > std.log
$(CXX) $(CXXFLAGS) benchmark/*.cpp $(INC) -o benchmark/ft && ./benchmark/ft > ft.log
.PHONY = clean fclean re run test testall bm
-include $(DEP)