-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (93 loc) · 3.26 KB
/
Makefile
File metadata and controls
113 lines (93 loc) · 3.26 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
106
107
108
109
110
111
112
113
# you can set this to 1 to see all commands that are being run
export VERBOSE := 0
ifeq ($(VERBOSE),1)
export Q :=
export VERBOSE := 1
else
export Q := @
export VERBOSE := 0
endif
BUILDRESULTS?=buildresults
CONFIGURED_BUILD_DEP = $(BUILDRESULTS)/build.ninja
MESON ?= meson
all: default
.PHONY: default
default: | $(CONFIGURED_BUILD_DEP)
$(Q)ninja -C $(BUILDRESULTS)
.PHONY: test
test: | $(CONFIGURED_BUILD_DEP)
$(Q)ninja -C $(BUILDRESULTS) clear-test-results
$(Q)ninja -C $(BUILDRESULTS) test
.PHONY: docs
docs: | $(CONFIGURED_BUILD_DEP)
$(Q)ninja -C $(BUILDRESULTS) docs
# Manually Reconfigure a target, esp. with new options
.PHONY: reconfig
reconfig:
$(Q) $(MESON) $(BUILDRESULTS) --reconfigure $(INTERNAL_OPTIONS) $(OPTIONS)
# Runs whenever the build has not been configured successfully
$(CONFIGURED_BUILD_DEP):
$(Q) $(MESON) setup $(BUILDRESULTS) $(INTERNAL_OPTIONS) $(OPTIONS)
.PHONY: cppcheck
cppcheck: | $(CONFIGURED_BUILD_DEP)
$(Q) ninja -C $(BUILDRESULTS) cppcheck
.PHONY: cppcheck-xml
cppcheck-xml: | $(CONFIGURED_BUILD_DEP)
$(Q) ninja -C $(BUILDRESULTS) cppcheck-xml
.PHONY: scan-build
scan-build: $(CONFIGURED_BUILD_DEP)
$(Q) ninja -C $(BUILDRESULTS) scan-build
.PHONY: tidy
tidy: $(CONFIGURED_BUILD_DEP)
$(Q) ninja -C $(BUILDRESULTS) clang-tidy
.PHONY: format
format: $(CONFIGURED_BUILD_DEP)
$(Q)ninja -C $(BUILDRESULTS) format
.PHONY : format-patch
format-patch: $(CONFIGURED_BUILD_DEP)
$(Q)ninja -C $(BUILDRESULTS) format-patch
.PHONY: list-targets
list-targets: groundwork
$(Q) cd $(BUILDRESULTS); ninja -t targets
.PHONY: list-targets-all
list-targets-all: groundwork
$(Q) cd $(BUILDRESULTS); ninja -t targets all
.PHONY: analyze
analyze: groundwork
$(Q) cd $(BUILDRESULTS); ninja scan-build
.PHONY: clean
clean:
$(Q) if [ -d "$(BUILDRESULTS)" ]; then ninja -C buildresults clean; fi
.PHONY: distclean
distclean:
$(Q) rm -rf $(BUILDRESULTS)
.PHONY: ccc
ccc: groundwork
$(Q)cd $(BUILDRESULTS); ninja complexity
### Help Output ###
.PHONY : help
help :
@echo "usage: make [OPTIONS] <target>"
@echo " Options:"
@echo " > VERBOSE Show verbose output for Make rules. Default 0. Enable with 1."
@echo " > BUILDRESULTS Directory for build results. Default buildresults."
@echo " > OPTIONS Configuration options to pass to a build. Default empty."
@echo "Targets:"
@echo " default: Builds all default targets ninja knows about"
@echo " test: Build and run unit test programs"
@echo " docs: Generate documentation"
@echo " clean: Cleans build artifacts, keeping build files in place"
@echo " distclean: Removes the configured build output directory"
@echo " reconfig: Reconfigure an existing build output folder with new settings"
@echo " list-targets: List all build targets"
@echo " list-targets-all: List all build targets (detailed)"
@echo " Code Formatting:"
@echo " format: Runs clang-format on codebase"
@echo " format-patch: Generates a patch file with formatting changes"
@echo " Static Analysis:"
@echo " cppcheck: Runs cppcheck"
@echo " cppcheck-xml: Runs cppcheck and generates an XML report (for build servers)"
@echo " scan-build: Runs clang static analysis"
@echo " analyze: Runs clang static analysis (alias for scan-build)"
@echo " tidy: Runs clang-tidy linter"
@echo " ccc: Runs complexity analysis"