forked from jarcode-foss/glava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (41 loc) · 1.63 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
.PHONY: all install clean ninja
# In case these were specified explicitly as options instead of environment variables, export them to child processes
export DESTDIR
export CFLAGS
BUILD_DIR = build
MESON_CONF = $(BUILD_DIR) -Ddisable_obs=true -Ddisable_config=true --prefix /usr
# Support assigning standalone/debug builds as the old Makefile did, otherwise complain
ifeq ($(BUILD),debug)
MESON_CONF += --buildtype=debug
else
ifdef BUILD
$(warning WARNING: ignoring build option '$(BUILD)' in compatibility Makefile)
endif
endif
ifeq ($(INSTALL),standalone)
MESON_CONF += -Dstandalone=true
else
ifdef INSTALL
$(warning WARNING: ignoring install option '$(INSTALL)' in compatibility Makefile)
endif
endif
# Store relevant variables that may change depending on the environment or user input
STATE = $(BUILD),$(INSTALL),$(PYTHON),$(CC),$(CFLAGS),$(DESTDIR)
# Only update the file if the contents changed, `make` just looks at the timestamp
$(shell if [[ ! -e build_state ]]; then touch build_state; fi)
$(shell if [ '$(STATE)' != "`cat build_state`" ]; then echo '$(STATE)' > build_state; fi)
all: ninja
# Rebuild if the makefile state changes to maintain old behaviour and smooth rebuilds with altered parameters
build: build_state
$(warning !!PACKAGE MAINTAINER NOTICE!!)
$(warning Configuring build for compatibility with old makefile. Some new features may be missing.)
$(warning If you are a package maintainer consider using meson directly!)
@rm -rf $(BUILD_DIR)
meson $(BUILD_DIR)
meson configure $(MESON_CONF)
ninja: build
ninja -C $(BUILD_DIR)
install:
ninja -C build install
clean:
rm -rf $(BUILD_DIR)