forked from reticulatedpines/magiclantern_simplified
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile.top
84 lines (71 loc) · 2.39 KB
/
Makefile.top
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
RM=rm
MV=mv
MKDIR=mkdir
CP=cp
export BIN_FILES=magiclantern magiclantern.bin autoexec.bin autoexec
# redefine to 'date' if you want see you zone time in version timestamp
DATE=date -u
BINARIES_PATH=binaries
LUA_PATH=$(TOP_DIR)/lua
PWD_DIR=$(shell pwd)
SRC_DIR=$(TOP_DIR)/src
PLATFORM_PATH=$(TOP_DIR)/platform
BUILDER_DIR=$(TOP_DIR)/../dumper
DOC_DIR=$(TOP_DIR)/doc
FONT_DIR=$(TOP_DIR)/data/fonts
CROP_DIR=$(TOP_DIR)/data/cropmks
VRAM_DIR=$(TOP_DIR)/data/vram
SCRIPT_DIR=$(TOP_DIR)/scripts
MODULES_DIR=$(TOP_DIR)/modules
INSTALLER_DIR=$(TOP_DIR)/installer
BIN_FILES=magiclantern magiclantern.bin autoexec.bin autoexec
CF_CARD_ML_DIR = $(CF_CARD)/ML
BUILD_TOOLS_DIR=$(TOP_DIR)/build_tools
XOR_CHK=$(BUILD_TOOLS_DIR)/xor_chk
INSTALL_DIR ?= $(CF_CARD)
INSTALL_ML_DIR = $(INSTALL_DIR)/ML
INSTALL_FONTS_DIR= $(INSTALL_ML_DIR)/fonts
INSTALL_MODULES_DIR = $(INSTALL_ML_DIR)/modules
INSTALL_SETTINGS_DIR= $(INSTALL_ML_DIR)/settings
INSTALL_DATA_DIR= $(INSTALL_ML_DIR)/data
INSTALL_CROPMARKS_DIR= $(INSTALL_ML_DIR)/cropmks
INSTALL_SCRIPTS_DIR= $(INSTALL_ML_DIR)/scripts
INSTALL_DOC_DIR = $(INSTALL_ML_DIR)/doc
INSTALL_LOGS_DIR = $(INSTALL_ML_DIR)/logs
INSTALL_PREPARE ?= $(MOUNT_CARD)
INSTALL_FINISH ?= $(UMOUNT) $(CF_CARD)
# this one is called from both platform and modules
# copies all scripts, preserving directory structure
# (simpler way to do this?)
# GNU Make 4.3 changes how \#\# works, use a portable version:
# https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html
H := \#
INSTALL_ALL_SCRIPTS = \
$(call build,SCRIPTS,\
for f in $(shell find $(SCRIPT_DIR) -type f -name *.lua); do \
dst=$(INSTALL_SCRIPTS_DIR)/$${f$H$H$(SCRIPT_DIR)/}; \
dstdir=`dirname $$dst`; \
$(MKDIR) -p $$dstdir; \
$(CP) $$f $$dst; \
done)
make_loop = +$(foreach entry, $(1), $(MAKE) -C $(entry) $(2);)
# $1 = root_dir
# $2 = dir-target
define call_make_rule
+$(MAKE) -C $(1)/$(word 1, $(subst _rule_, ,$@)) $(word 2, $(subst _rule_, ,$@))
endef
define call_make_rule_ex
+$(MAKE) -C $(2)/$(call $(1), $(word 1, $(subst _rule_, ,$@))) $(word 2, $(subst _rule_, ,$@))
endef
# $1 - targets
# $2 - rule name
# Returns list of targets (combination of target name and rule name)
define targets_rules
$(foreach model, $1, $(model)_rule_$(strip $(2)))
endef
# evaluate once and only when used
# https://stackoverflow.com/a/28542922
# example: FOO = $(call eval_once,FOO,$(shell command))
define eval_once
$(eval $1 := $2)$(value $1)
endef