-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
96 lines (75 loc) · 2.03 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
NAME = webserv
CXX = clang++
CXXFLAGS = -Wall -Werror -Wextra -Wshadow -MMD -MP -std=c++98 -I$(includes) -O2 #-g -fsanitize=address -fsanitize=undefined -ftrivial-auto-var-init=pattern -Wtautological-compare -Wsign-compare -gfull -fstandalone-debug -gdwarf-5 -gz
includes = srcs
srcsdir = srcs
objsdir = objs
srcs = $(shell find $(srcsdir) -name "*.cpp" -type f)
objs = $(srcs:$(srcsdir)%.cpp=$(objsdir)%.o)
deps = $(srcs:$(srcsdir)%.cpp=$(objsdir)%.d)
# == path of googletest dir ==
gtestdir := googletest
# == path of integrationtest dir ==
itestdir := integrationtest
.PHONY: all
all: $(NAME)
$(NAME): $(objs)
$(CXX) $(CXXFLAGS) $^ -o $(NAME)
$(objsdir)/%.o: $(srcsdir)/%.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c $< -o $@
.PHONY: test
test:
$(MAKE) -C $(gtestdir) run
.PHONY: cav
cav: $(objs)
$(MAKE) -C $(gtestdir) cav
.PHONY: itest
itest: $(NAME)
$(MAKE) -C $(itestdir) run
.PHONY: itest_all
itest_all: $(NAME)
$(MAKE) -C $(itestdir) run_all
.PHONY: gotest
gotest:
$(MAKE) -C $(itestdir) gotest
.PHONY: wtest
wtest: test itest
.PHONY: clean
clean:
$(RM) $(objs) $(deps)
$(RM) -r $(objsdir)
$(MAKE) -C $(gtestdir) clean
.PHONY: fclean
fclean: clean
$(RM) $(NAME)
$(MAKE) -C $(gtestdir) fclean
.PHONY: re
re: fclean all
.PHONY: prepush
prepush:
zsh .github/pre-push
# 改修予定
gbench = ./test/benchmark
benchdir = ./gbench
benchflg = clang++ -std=c++11 -O2
benchflg2 = $(benchdir)/gbench.cpp \
-isystem $(gbench)/include \
-L$(gbench)/build/src -lbenchmark -lpthread \
-I$(gtestdir) -I/usr/local/opt/llvm/include -I$(includes) -I$(benchdir) -o benchmark
.PHONY: bench
bench:
$(benchflg) \
$(benchflg2) \
./benchmark \
--benchmark_out_format=csv \
--benchmark_out=benchmark.csv # --benchmark_filter=BM_VectorInsert_input_iterator
cov: CXXFLAGS += -fprofile-arcs -ftest-coverage
cov: re
./$(NAME) conf/test.conf
lcov -c -b . -d . -o cov_test.info $(lcov_op)
genhtml cov_test.info -o cov_test
# $(RM) $(NAME) cov_test.info
# $(RM) $(TOBJS) $(TOBJDIR)/*.gcda $(TOBJDIR)/*.gcno
open cov_test/index-sort-f.html
-include $(deps)