-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
98 lines (71 loc) · 2.29 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
.PHONY: gcc-ccc clang-ccc default build gcc-rel gcc-deb clang-rel clang-deb dsan rsan clean tests samples all-gcc-deb all-gcc-rel all-dsan all-rsan all-clang-deb all-clang-rel dtest rtest util tidy format fanalyze
MAKE := $(MAKE)
MAKEFLAGS += --no-print-directory
# Adjust parallel build jobs based on your available cores.
JOBS ?= $(shell (command -v nproc > /dev/null 2>&1 && echo "-j$$(nproc)") || echo "")
BUILD_DIR := build/
PREFIX := install/
ifeq ($(words $(MAKECMDGOALS)),2)
PREFIX := $(word 2, $(MAKECMDGOALS))
endif
default: build
build:
cmake --build $(BUILD_DIR) $(JOBS)
gcc-ccc:
cmake --preset=gcc-rel -DCMAKE_INSTALL_PREFIX=$(PREFIX)
cmake --build $(BUILD_DIR) --target install $(JOBS)
clang-ccc:
cmake --preset=clang-rel -DCMAKE_INSTALL_PREFIX=$(PREFIX)
cmake --build $(BUILD_DIR) --target install $(JOBS)
install:
cmake --build $(BUILD_DIR) --target install $(JOBS)
gcc-rel:
cmake --preset=gcc-rel
$(MAKE) build
gcc-deb:
cmake --preset=gcc-deb
$(MAKE) build
clang-rel:
cmake --preset=clang-rel
$(MAKE) build
clang-deb:
cmake --preset=clang-deb
$(MAKE) build
rsan:
cmake --preset=rsan
$(MAKE) build
dsan:
cmake --preset=dsan
$(MAKE) build
format:
cmake --build $(BUILD_DIR) --target format
tidy:
cmake --build $(BUILD_DIR) --target tidy $(JOBS)
tests:
cmake --build $(BUILD_DIR) --target tests $(JOBS)
samples:
cmake --build $(BUILD_DIR) --target samples $(JOBS)
util:
cmake --build $(BUILD_DIR) --target util $(JOBS)
all-gcc-deb:
cmake --preset=gcc-deb && cmake --build build $(JOBS) --target ccc tests samples
all-gcc-rel:
cmake --preset=gcc-rel && cmake --build build $(JOBS) --target ccc tests samples
all-dsan:
cmake --preset=dsan && cmake --build build $(JOBS) --target ccc tests samples
all-rsan:
cmake --preset=rsan && cmake --build build $(JOBS) --target ccc tests samples
all-clang-deb:
cmake --preset=clang-deb && cmake --build build $(JOBS) --target ccc tests samples
all-clang-rel:
cmake --preset=clang-rel && cmake --build build $(JOBS) --target ccc tests samples
dtest: tests
cmake --build build $(JOBS) --target tests
$(BUILD_DIR)debug/bin/run_tests $(BUILD_DIR)debug/bin/tests/
@echo "RAN TESTS"
rtest: tests
cmake --build build $(JOBS) --target tests
$(BUILD_DIR)bin/run_tests $(BUILD_DIR)bin/tests/
@echo "RAN TESTS"
clean:
rm -rf build/ install/