-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
72 lines (50 loc) · 1.72 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
W = -Wall
OPT = -O2 -g
STD = -std=c++17
CXXFLAGS = $(STD) $(OPT) $(W) -fPIC $(XCXXFLAGS)
INCS = -Iinclude -Iexternal -Iexternal/hoytech-cpp -Iexternal/docopt.cpp
LDLIBS = -llmdb -lb2 -pthread
LDFLAGS = -flto $(XLDFLAGS)
CHECK_SRCS = check.cpp
SYNCBENCH_SRCS = syncBench.cpp
TOOL_SRCS = quadb.cpp
CHECK_OBJS := $(CHECK_SRCS:.cpp=.o)
TOOL_OBJS := $(TOOL_SRCS:.cpp=.o)
SYNCBENCH_OBJS := $(SYNCBENCH_SRCS:.cpp=.o)
DEPS := $(CHECK_SRCS:.cpp=.d) $(TOOL_SRCS:.cpp=.d) $(SYNCBENCH_SRCS:.cpp=.d)
.PHONY: phony
all: phony verify-submodules quadb check
check: $(CHECK_OBJS) $(DEPS)
$(CXX) $(CHECK_OBJS) $(LDFLAGS) $(LDLIBS) -o $@
syncBench: $(SYNCBENCH_OBJS) $(DEPS)
$(CXX) $(SYNCBENCH_OBJS) $(LDFLAGS) $(LDLIBS) -o $@
quadb: $(TOOL_OBJS) $(DEPS)
$(CXX) $(TOOL_OBJS) $(LDFLAGS) $(LDLIBS) -o $@
%.o: %.cpp %.d
$(CXX) $(CXXFLAGS) $(INCS) -MMD -MP -MT $@ -MF $*.d -c $< -o $@
quadb.o: XCXXFLAGS += -DDOCOPT_HEADER_ONLY -DQUADRABLE_VERSION='"'`git describe --tags`'"'
-include *.d
%.d: ;
verify-submodules: phony | external/hoytech-cpp/README.md
external/hoytech-cpp/README.md:
@echo
@echo "*** SUBMODULES NOT CHECKED OUT ***"
@echo "Run this command:"
@echo " git submodule update --init"
@echo
@false
clean: phony
rm -rf quadb check *.o *.d testdb/ *.gcda *.gcno coverage.lcov coverage-report/
run-check: phony check
mkdir -p testdb/
rm -f testdb/*.mdb
./check
test: XCXXFLAGS += -fsanitize=address
test: XLDFLAGS += -fsanitize=address
test: phony clean run-check
coverage: XCXXFLAGS += --coverage
coverage: XLDFLAGS += --coverage
coverage: phony clean run-check
lcov --directory . --capture --output-file coverage.lcov
mkdir -p coverage-report
genhtml coverage.lcov --output-directory coverage-report