-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
105 lines (77 loc) · 3.33 KB
/
Makefile
File metadata and controls
105 lines (77 loc) · 3.33 KB
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
.PHONY: gcc-ccc clang-ccc default build gcc-release gcc-debug clang-release clang-debug sanitize-debug sanitize-release clean tests samples all-gcc-debug all-gcc-release all-sanitize-debug all-sanitize-release all-clang-debug all-clang-release test utility tidy format coverage-developer coverage-publish
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-release -DCMAKE_INSTALL_PREFIX=$(PREFIX)
cmake --build $(BUILD_DIR) $(JOBS) --target install $(JOBS)
clang-ccc:
cmake --preset=clang-release -DCMAKE_INSTALL_PREFIX=$(PREFIX)
cmake --build $(BUILD_DIR) $(JOBS) --target install $(JOBS)
install:
cmake --build $(BUILD_DIR) $(JOBS) --target install
gcc-release:
cmake --preset=gcc-release -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) build
gcc-debug:
cmake --preset=gcc-debug -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) build
clang-release:
cmake --preset=clang-release -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) build
clang-debug:
cmake --preset=clang-debug -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) build
sanitize-release:
cmake --preset=gcc-sanitize-release -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) build
sanitize-debug:
cmake --preset=gcc-sanitize-debug -DCMAKE_INSTALL_PREFIX=$(PREFIX)
$(MAKE) build
format:
cmake --build $(BUILD_DIR) $(JOBS) --target format
tidy:
cmake --build $(BUILD_DIR) $(JOBS) --target tidy
tests:
cmake --build $(BUILD_DIR) $(JOBS) --target tests
samples:
cmake --build $(BUILD_DIR) $(JOBS) --target samples
utility:
cmake --build $(BUILD_DIR) $(JOBS) --target utility
coverage-developer:
cmake --build $(BUILD_DIR) --target coverage-developer
coverage-publish:
cmake --build $(BUILD_DIR) --target coverage-publish
all-gcc-debug:
cmake --preset=gcc-debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) && cmake --build build $(JOBS) --target ccc tests samples
all-gcc-release:
cmake --preset=gcc-release -DCMAKE_INSTALL_PREFIX=$(PREFIX) && cmake --build build $(JOBS) --target ccc tests samples
all-sanitize-debug:
cmake --preset=gcc-sanitize-debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) && cmake --build build $(JOBS) --target ccc tests samples
all-sanitize-release:
cmake --preset=gcc-sanitize-release -DCMAKE_INSTALL_PREFIX=$(PREFIX) && cmake --build build $(JOBS) --target ccc tests samples
all-clang-debug:
cmake --preset=clang-debug -DCMAKE_INSTALL_PREFIX=$(PREFIX) && cmake --build build $(JOBS) --target ccc tests samples
all-clang-release:
cmake --preset=clang-release -DCMAKE_INSTALL_PREFIX=$(PREFIX) && cmake --build build $(JOBS) --target ccc tests samples
test: tests
@if [ -x "$(BUILD_DIR)debug/bin/run_tests" ]; then \
$(BUILD_DIR)debug/bin/run_tests $(BUILD_DIR)debug/bin/tests/; \
elif [ -x "$(BUILD_DIR)bin/run_tests" ]; then \
$(BUILD_DIR)bin/run_tests $(BUILD_DIR)bin/tests/; \
else \
echo "No test runner found"; \
exit 1; \
fi
@echo "RAN TESTS"
clean:
rm -rf build/ install/