-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGNUmakefile
68 lines (48 loc) · 1.8 KB
/
GNUmakefile
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
# export CXX=g++-12
# export CC=gcc-12
# export CXX=clang++
# export CC=clang
export CPM_USE_LOCAL_PACKAGES?=NO
export CPM_SOURCE_CACHE?${HOME}/.cache/CPM
####################################
# see https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html
export CTEST_OUTPUT_ON_FAILURE=YES
STAGE_DIR:=$(shell realpath $(CURDIR)/stagedir)
BUILD_DIR:=$(shell realpath $(CURDIR)/build)
####################################
.PHONY: setup all test gcov install lib_install test_install standalone documentation clean distclean check format
all: install
cd all && cmake --preset default --debug-find-pkg=greeter
cd all && cmake --workflow --preset default
test: setup
cmake --build $(BUILD_DIR)/all --target all
cmake --build $(BUILD_DIR)/all --target $@
check: setup
run-clang-tidy -extra-arg=-Wno-unknown-warning-option -p $(BUILD_DIR)/all source */source
setup:
cd all && cmake --preset default --log-level=TRACE --trace-expand --trace-source=CPM.cmake
#XXX perl -i.bak -p -e 's#-W[-\w]+(=\d)?\b##g;' \
#XXX -e 's#-I(${CPM_SOURCE_CACHE})#-isystem $$1#g;' $(BUILD_DIR)/all/compile_commands.json
################################
# Begin Release workflows
install: standalone
lib_install:
cmake --workflow --preset default --fresh
test_install: lib_install
cd test && cmake --workflow --preset default --fresh
standalone: test_install
cd standalone && cmake --workflow --preset default --fresh
# End Release workflows
################################
documentation:
cmake -S documentation -B build/doc
cmake --build build/doc --target GenerateDocs
gcov: test
gcovr $(BUILD_DIR)/all
clean:
-cmake --build $(BUILD_DIR)/all --target $@
distclean: #XXX clean
-cmake -E rm -rf $(BUILD_DIR) $(STAGE_DIR) ctags tags
format: setup
cmake --build $(BUILD_DIR)/all --target $@
################################