forked from embeddedartistry/libmemory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
121 lines (100 loc) · 3.45 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# 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
all: libmemory
.PHONY: groundwork
groundwork:
$(Q)if [ -d "$(BUILDRESULTS)" ]; then mkdir -p $(BUILDRESULTS); fi
$(Q)if [ ! -e "$(BUILDRESULTS)/build.ninja" ]; then meson --buildtype plain $(BUILDRESULTS); fi
.PHONY: libmemory
libmemory: groundwork
$(Q)cd $(BUILDRESULTS); ninja
.PHONY: docs
docs: groundwork
$(Q)cd $(BUILDRESULTS); ninja docs
.PHONY: format
format:
$(Q)tools/clang-format-libmemory.sh
.PHONY : format-diff
format-diff :
$(Q)tools/format/clang-format-git-diff.sh
.PHONY : format-check
format-check :
$(Q)tools/clang-format-libmemory-patch.sh
.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)echo Cleaning build artifacts
$(Q)if [ -d "$(BUILDRESULTS)" ]; then cd $(BUILDRESULTS); ninja -t clean; fi
$(Q)if [ -d "buildresults-coverage" ]; then cd buildresults-coverage; ninja -t clean; fi
.PHONY: purify
purify:
$(Q)echo Removing Build Output
$(Q)rm -rf $(BUILDRESULTS)/
$(Q)rm -rf buildresults-coverage
.PHONY: ccc
ccc: groundwork
$(Q)cd $(BUILDRESULTS); ninja complexity
.PHONY: cppcheck
cppcheck: groundwork
$(Q)cd $(BUILDRESULTS); ninja cppcheck
.PHONY: cppcheck-xml
cppcheck-xml: groundwork
$(Q)cd $(BUILDRESULTS); ninja cppcheck-xml
.PHONY: test
test: groundwork
ifneq ("$(wildcard $(BUILDRESULTS)/test/)","")
$(Q)rm -f $(BUILDRESULTS)/test/*.xml
endif
$(Q) cd $(BUILDRESULTS); meson test
.PHONY: coverage
coverage:
$(Q)if [ -d "buildresults-coverage" ]; then mkdir -p buildresults-coverage; fi
$(Q)if [ ! -e "buildresults-coverage/build.ninja" ]; then meson --buildtype plain buildresults-coverage -Db_coverage=true; fi
$(Q)cd buildresults-coverage; ninja; ninja test; ninja coverage-html; ninja coverage-xml
.PHONY: tidy
tidy: groundwork
$(Q) cd $(BUILDRESULTS); ninja tidy
### Help Rule ###
.PHONY : help
help :
@echo "usage: make [OPTIONS] <target>"
@echo " Options:"
@echo " > VERBOSE Boolean. Default Off."
@echo " > BUILDRESULTS Directory for build results. Default buildresults."
@echo "Targets:"
@echo " To list targets that ninja can compile:"
@echo " list-targets: list build targets for project"
@echo " list-targets-all: list all targets ninja knows about"
@echo " groundwork: runs meson and repares the BUILDRESULTS directory"
@echo " buildall: builds all targets that ninja knows about"
@echo " clean: cleans build artifacts"
@echo " purify: removes the BUILDRESULTS directory"
@echo " docs: Builds documentation"
@echo " test: Run unit tests"
@echo " Code Formating:"
@echo " format: runs clang-format on codebase"
@echo " format-diff: generates a diff file with formatting changes"
@echo " format-check: checks whether formatting needs to be applied"
@echo " Static Analysis:"
@echo " analyze: runs clang static analysis"
@echo " ccc: runs complexity analysis with lizard"
@echo " cppcheck: runs cppcheck"
@echo " cppcheck-xml: runs cppcheck and generates an XML report (for build servers)"
@echo " coverage: runs code coverage analysis and generates an HTML report and XML report"
@echo " tidy: runs clang-tidy linter"