-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
78 lines (63 loc) · 2.08 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
CUR_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
include $(CUR_DIR)/Makefile.inc
PHONY := all
all: lib benchmark
PHONY += clean
clean:
(cd $(PROJ_DIR)/lib && 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)/*-mvrlu
rm -f $(BIN_DIR)/*-mvrlu-ordo
rm -f $(BIN_DIR)/*-mvrlu-gclk
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]
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
lib: git-hooks
(cd $(PROJ_DIR)/lib && \
CONF=ordo make -j$(NJOB) && \
CONF=gclk make -j$(NJOB))
PHONY += lib-clean
lib-clean: git-hooks
(cd $(PROJ_DIR)/lib && \
CONF=ordo make -j$(NJOB) clean && \
CONF=gclk make -j$(NJOB) clean)
PHONY += ordo
ordo:
make -C tools/ordo/
(cd tools/ordo && sudo ./gen_table.py)
PHONY += help
help: git-hooks
@echo '## Generic targets:'
@echo ' all - Configure and build all source code including mv-rlu.'
@echo ' clean - Remove most generated files.'
@echo ' distclean - Remove all generated 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 mv-rlu library'
@echo ' lib-clean - Clean mv-rlu library'
@echo ' ordo - Get ordo value of the server'
@echo ''
@echo '## Benchmark targets:'
@echo ' benchmark - Build all benchmarks'
@echo ' benchmark-clean - Clean all benchmarks'
.PHONY: $(PHONY)