Debian Codegraph @

Makefile

raw
1 default: help
2
3 # The general philosophy and functionality of this makefile is shamelessly stolen from compiler explorer
4
5 help: # with thanks to Ben Rady
6 @grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
7
8 .PHONY: build
9 build: debug ## build in debug mode
10
11 build/configured-debug:
12 cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCPPTRACE_BUILD_TESTING=On -DCPPTRACE_BUILD_TOOLS=On
13 rm -f build/configured-release
14 touch build/configured-debug
15
16 build/configured-release:
17 cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCPPTRACE_BUILD_TESTING=On -DCPPTRACE_BUILD_TOOLS=On
18 rm -f build/configured-debug
19 touch build/configured-release
20
21 .PHONY: configure-debug
22 configure-debug: build/configured-debug
23
24 .PHONY: configure-release
25 configure-release: build/configured-release
26
27 .PHONY: debug
28 debug: configure-debug ## build in debug mode
29 cmake --build build
30
31 .PHONY: release
32 release: configure-release ## build in release mode (with debug info)
33 cmake --build build
34
35 .PHONY: debug-msvc
36 debug-msvc: ## build in debug mode
37 cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCPPTRACE_BUILD_TESTING=On -DCPPTRACE_BUILD_TOOLS=On
38 cmake --build build --config Debug
39
40 .PHONY: release-msvc
41 release-msvc: ## build in release mode (with debug info)
42 cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCPPTRACE_BUILD_TESTING=On -DCPPTRACE_BUILD_TOOLS=On
43 cmake --build build --config RelWithDebInfo
44
45 .PHONY: clean
46 clean: ## clean
47 rm -rf build
48
49 .PHONY: test
50 test: debug ## test
51 cd build && ninja test
52
53 .PHONY: test-release
54 test-release: release ## test-release
55 cd build && ninja test
56
57 # .PHONY: test-msvc
58 # test-msvc: debug-msvc ## test
59 # cmake --build build --target RUN_TESTS --config Debug
60
61 # .PHONY: test-msvc-release
62 # test-msvc-release: release-msvc ## test-release
63 # cmake --build build --target RUN_TESTS --config Release