-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
109 lines (84 loc) · 2.43 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
#---------------------------------------------------------------------
# vim:set noexpandtab:
#---------------------------------------------------------------------
# Copyright (c) 2023 James O. D. Hunt <jamesodhunt@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#---------------------------------------------------------------------
# Override make's default value of "as" (as(1) / gas) which isn't
# helpful as it uses different syntax (AT&T format!)
AS = nasm
BUILD_DIR = builddir
# meson program arguments
MESON_ARGS =
# configure arguments
MESON_CONFIGURE_OPTIONS =
# Handle the build type
#
# (only passed to the configure meson sub-command).
ifneq (,$(RELEASE))
MESON_CONFIGURE_OPTIONS += --buildtype release
else
MESON_CONFIGURE_OPTIONS += --buildtype debug
endif
# options from "meson_options.txt"
MESON_OPTIONS =
ifneq (,$(MESON_DEBUG))
# Show assembler CLI.
MESON_ARGS += -v
endif
ifneq (1,$(V))
MESON_ARGS += -v
endif
ifneq (,$(AS))
MESON_OPTIONS += -Dassembler=$(AS)
endif
ifneq (,$(EXTRA_C_SOURCES))
MESON_OPTIONS += -Dextra_c_sources="$(EXTRA_C_SOURCES)"
endif
ifneq (,$(DISABLE_TESTS))
MESON_OPTIONS += -Dtests=false
endif
ifeq (bats-test,$(MAKECMDGOALS))
ifeq (,$(BATS_TEST))
$(error "ERROR: Set BATS_TEST to test basename (example: 'BATS_TEST="true"')")
else
BATS_TEST_NAME="bats test $(BATS_TEST).bats"
endif
endif
#---------------------------------------------------------------------
default: configure build
CORE_DEPS = clean configure build test
MOST_DEPS = $(CORE_DEPS) check
ALL_DEPS = $(MOST_DEPS) dist
core : $(CORE_DEPS)
most : $(MOST_DEPS)
all : $(ALL_DEPS)
.PHONY: configure build test clean
configure:
@echo "INFO: configuring"
meson setup $(BUILD_DIR) $(MESON_OPTIONS) $(MESON_CONFIGURE_OPTIONS)
build: configure
@echo "INFO: building"
meson compile -C $(BUILD_DIR) $(MESON_ARGS)
check: configure
@echo "INFO: checking"
ninja -C $(BUILD_DIR) check
# Run all tests
test: build
@echo "INFO: testing"
meson test -C $(BUILD_DIR) $(MESON_ARGS)
# Just run the utilities tests
utils-test: build
@echo "INFO: testing (utils)"
meson test -C $(BUILD_DIR) $(MESON_ARGS) 'utils test'
# Just run a *single* bats test
bats-test: build
@echo "INFO: testing (bats test with name '$(BATS_TEST_NAME)')"
meson test -C $(BUILD_DIR) $(MESON_ARGS) $(BATS_TEST_NAME)
dist: build
@echo "INFO: dist"
meson dist -C $(BUILD_DIR)
clean:
@echo "INFO: cleaning"
rm -rf $(BUILD_DIR)