-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
138 lines (114 loc) · 4.01 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
CUR_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
include $(CUR_DIR)/Makefile.inc
PHONY := all
all: lib-nv-jemalloc lib benchmark
PHONY += clean
clean:
(cd $(PROJ_DIR)/lib && make -s clean)
(cd $(PROJ_DIR)/lib++ && make -s clean)
(cd $(PROJ_DIR)/lib-makalu && make -s clean)
(cd $(PROJ_DIR)/lib-nv-jemalloc && make -s clean)
(cd $(PROJ_DIR)/benchmark && make -s clean)
PHONY += distclean
distclean: clean
@echo -e "\033[0;32m# Clean everything completely...\033[0m"
(cd $(PROJ_DIR)/benchmark && make distclean)
rm -f $(BIN_DIR)/*-rlu
rm -f $(BIN_DIR)/*-timestone*
rm -f $(BIN_DIR)/*-mvrlu
rm -f $(BIN_DIR)/*-mvrlu-*
rm -f $(BIN_DIR)/*-vanilla
PHONY += format
format: git-hooks
@echo -e "\033[0;32m# Running clang-format...\033[0m"
@clang-format -i $(INC_DIR)/*.[ch] $(LIB_DIR)/*.[ch]
@clang-format -style=Google -i $(INC_DIR)/*.hpp
git-hooks: $(GIT_DIR)/hooks/pre-commit
$(GIT_DIR)/hooks/pre-commit:
@echo -e "\033[0;32m# Installing git pre-commit hook for formatting\033[0m"
@ln -s $(TOOLS_DIR)/pre-commit $(GIT_DIR)/hooks/pre-commit
PHONY += benchmark
benchmark: lib
(cd $(PROJ_DIR)/benchmark && make)
PHONY += benchmark-clean
benchmark-clean:
(cd $(PROJ_DIR)/benchmark && make clean)
PHONY += lib-nv-jemalloc
lib-nv-jemalloc: git-hooks
make -C $(PROJ_DIR)/lib-nv-jemalloc -j$(NJOB)
PHONY += lib-nv-jemalloc-clean
lib-nv-jemalloc-clean: git-hooks
make -C $(PROJ_DIR)/lib-nv-jemalloc clean
PHONY += lib-makalu
lib-makalu: git-hooks
make -C $(PROJ_DIR)/lib-makalu -j$(NJOB)
PHONY += lib-makalu-clean
lib-makalu-clean: git-hooks
make -C $(PROJ_DIR)/lib-makalu clean
PHONY += lib
lib: git-hooks lib-nv-jemalloc
(cd $(PROJ_DIR)/lib && \
CONF= make -j$(NJOB) && \
CONF=gtest make -j$(NJOB))
PHONY += lib-clean
lib-clean: git-hooks
(cd $(PROJ_DIR)/lib && \
CONF= make -j$(NJOB) clean && \
CONF=gtest make -j$(NJOB) clean)
PHONY += lib++
lib++: git-hooks
(cd $(PROJ_DIR)/lib++ && \
CONF= make -j$(NJOB) && \
CONF=gtest make -j$(NJOB))
PHONY += lib++-clean
lib++-clean: git-hooks
(cd $(PROJ_DIR)/lib++ && \
CONF= make -j$(NJOB) clean && \
CONF=gtest make -j$(NJOB) clean)
PHONY += unittest
unittest: lib lib++
make -C $(PROJ_DIR)/unittest -j$(NJOB)
PHONY += unittest-clean
unittest-clean:
make -C $(PROJ_DIR)/unittest -j$(NJOB) clean
PHONY += ordo
ordo: git-hooks
make -C $(TOOLS_DIR)/ordo/
(cd $(TOOLS_DIR)/ordo && sudo ./gen_table.py)
PHONY += ordo-clean
ordo-clean:
make -C $(TOOLS_DIR)/ordo/ clean
PHONY += help
help: git-hooks
@echo '## Generic targets:'
@echo ' all - Configure and build all source code'
@echo ' clean - Remove most generated files.'
@echo ' distclean - Remove all generated files and config files'
@echo ' format - Apply clang-format. Follow LLVM style for C++ code'
@echo ' and Linux kernel style for C code'
@echo ''
@echo '## Library targets:'
@echo ' lib - Build TimeStone C library'
@echo ' lib-clean - Clean TimeStone C library'
@echo ' lib++ - Build TimeStone C++ library'
@echo ' lib++-clean - Clean TimeStone C++ library'
@echo ' lib-nv-jemalloc - Build NV Jemalloc allocator'
@echo ' lib-nv-jemalloc-clean - Clean NV Jemalloc allocator'
@echo ' lib-makalu - Build Makalu NVM allocator'
@echo ' lib-makalu-clean - Clean Makalu NVM allocator'
@echo ' ordo - Get ordo value of the server'
@echo ''
@echo '## Unittest targets:'
@echo ' unittest - Build unittest'
@echo ' Install google test lib: `sudo dnf install gtest-devel`'
@echo ' unittest-clean - Clean unittest'
@echo ''
@echo '## Benchmark targets:'
@echo ' benchmark - Build all benchmarks'
@echo ' benchmark-clean - Clean all benchmarks'
@echo ''
@echo '## ORDO targets:'
@echo ' ordo - Build and measure ORDO boundary'
@echo ' ordo-clean - Clean ORDO binaries'
@echo ''
.PHONY: $(PHONY)