-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathMakefile
More file actions
88 lines (68 loc) · 1.84 KB
/
Makefile
File metadata and controls
88 lines (68 loc) · 1.84 KB
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
MODE ?= UNDEFINED
PROJECT := MatrixOS
# Remember last used DEVICE and MODE
LAST_CONFIG_FILE := .last_config
# Load last config if it exists
ifneq ($(wildcard $(LAST_CONFIG_FILE)),)
include $(LAST_CONFIG_FILE)
endif
# Use provided DEVICE or fall back to last used
ifeq ($(DEVICE),)
ifdef LAST_DEVICE
DEVICE := $(strip $(LAST_DEVICE))
$(info Using last DEVICE: $(DEVICE))
else
$(error You must provide a DEVICE parameter with 'DEVICE=' on first run)
endif
endif
# Use provided MODE or fall back to last used
ifeq ($(MODE),UNDEFINED)
ifdef LAST_MODE
MODE := $(strip $(LAST_MODE))
$(info Using last MODE: $(MODE))
endif
endif
# Device without family
ifneq ($(wildcard ./Devices/$(DEVICE)/family.mk),)
FAMILY_PATH := Devices/$(DEVICE)
FAMILY := $(DEVICE)
endif
# Device within family
ifeq ($(FAMILY_PATH),)
DEVICE_PATH := $(subst ,,$(wildcard Devices/*/Variants/$(DEVICE)))
FAMILY := $(word 2, $(subst /, ,$(DEVICE_PATH)))
FAMILY_PATH = Devices/$(FAMILY)
endif
ifeq ($(FAMILY_PATH),)
$(error Unable to find the device $(DEVICE))
endif
BUILD := build/$(DEVICE)
include $(FAMILY_PATH)/family.mk
.PHONY: all build build-dev build-release build-beta build-rc build-nightly clean fullclean
all: save-config build
# Save config before building
save-config:
@echo LAST_DEVICE := $(DEVICE) > $(LAST_CONFIG_FILE)
@echo LAST_MODE := $(MODE) >> $(LAST_CONFIG_FILE)
build-dev:
$(MAKE) MODE=DEVELOPMENT save-config build
build-release:
$(MAKE) MODE=RELEASE save-config build
build-beta:
$(MAKE) MODE=BETA save-config build
build-rc:
$(MAKE) MODE=RELEASECANDIDATE save-config build
build-nightly:
$(MAKE) MODE=NIGHTLY save-config build
clean:
ifeq ($(OS),Windows_NT)
if exist "$(BUILD)" rmdir /s /q "$(BUILD)"
else
rm -rf $(BUILD)
endif
fullclean:
ifeq ($(OS),Windows_NT)
if exist "build" rmdir /s /q "build"
else
rm -rf build
endif