-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
89 lines (67 loc) · 2.18 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
###############################################################################
# This makefile is provided as a simple convenience
## Optional features; set to 'true' to enable or 'false' to disable
# Debug build; adds warnings and debugging symbols
DEBUG := false
# Include coverage instrumentation in build
COVERAGE := false
# Enable address and undefined behavior sanitation
SANITIZE := false
# Enable hardening flags
HARDEN := false
# Generate statically linked binary
# It is recommended to use the included Containerfile to build the static binary
STATIC := false
###############################################################################
ifeq ($(strip ${DEBUG}), true)
BUILD_OPTS := debugoptimized
else
ifeq ($(strip ${DEBUG}), false)
BUILD_OPTS := release
else
$(error "DEBUG must be 'true' or 'false', not '${DEBUG}'")
endif
endif
ifeq ($(strip ${SANITIZE}), true)
SANITIZE_OPTS := address,undefined
else
ifeq ($(strip ${SANITIZE}), false)
SANITIZE_OPTS := none
else
$(error "SANITIZE must be 'true' or 'false', not '${SANITIZE}'")
endif
endif
###############################################################################
.PHONY := clean executable install regression setup static static-container test
# Meson commands cannot be run in parallel
.NOTPARALLEL:
# Default meson build directory
BUILDDIR := build
# Location of ninja build-file; used to detected existing setup
NINJAFILE := ${BUILDDIR}/build.ninja
executable: ${NINJAFILE}
meson compile -C "${BUILDDIR}" adapterremoval3
clean:
rm -rvf "${BUILDDIR}"
coverage: ${NINJAFILE}
ninja -C "${BUILDDIR}" coverage-text
cat build/meson-logs/coverage.txt
install: ${NINJAFILE}
meson install -C "${BUILDDIR}"
regression: ${NINJAFILE}
meson test -C "${BUILDDIR}" --print-errorlogs --suite regression
setup:
meson setup "${BUILDDIR}" --reconfigure \
--buildtype=${BUILD_OPTS} \
-Db_coverage=${COVERAGE} \
-Db_sanitize=${SANITIZE_OPTS} \
-Dharden=${HARDEN} \
-Dstatic=${STATIC}
static: ${NINJAFILE}
meson compile -C "${BUILDDIR}" static
static-container: ${NINJAFILE}
meson compile -C "${BUILDDIR}" static-container
test: ${NINJAFILE}
meson test -C "${BUILDDIR}" --print-errorlogs --suite unit
${NINJAFILE}:
$(MAKE) setup