File: Makefile.meson

package info (click to toggle)
trace-cmd 3.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,056 kB
  • sloc: ansic: 33,750; makefile: 966; sh: 762; python: 604
file content (40 lines) | stat: -rw-r--r-- 970 bytes parent folder | download | duplicates (5)
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
# SPDX-License-Identifier: GPL-2.0

undefine CFLAGS

# Makefiles suck: This macro sets a default value of $(2) for the
# variable named by $(1), unless the variable has been set by
# environment or command line. This is necessary for CC and AR
# because make sets default values, so the simpler ?= approach
# won't work as expected.
define allow-override
  $(if $(or $(findstring environment,$(origin $(1))),\
            $(findstring command line,$(origin $(1)))),,\
    $(eval $(1) = $(2)))
endef

$(call allow-override,MESON,meson)
$(call allow-override,MESON_BUILD_DIR,build)


all: compile

PHONY += compile
compile: $(MESON_BUILD_DIR) force
	$(MESON) compile -C $(MESON_BUILD_DIR)

$(MESON_BUILD_DIR):
	$(MESON) setup --prefix=$(prefix) $(MESON_BUILD_DIR)

install: compile
	$(MESON) install -C $(MESON_BUILD_DIR)

docs: $(MESON_BUILD_DIR)
	$(MESON) compile -C build docs

PHONY += clean_meson
clean_meson:
	$(Q)$(RM) -rf $(MESON_BUILD_DIR)

PHONY += force
force: