summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-09-10 00:49:02 +1000
committerDamien George <damien.p.george@gmail.com>2019-10-15 21:34:23 +1100
commite81f538e2509938b25eb48ed2670142eed1f2573 (patch)
treec665808d534a3be2741b93f682afcf3db6fedc80 /py
parent8e8cfa6f53b95fb9a7f7a430fb7bda77be56a6bd (diff)
tools: Add mechanism to provide a manifest of frozen files.
This introduces a new build variable FROZEN_MANIFEST which can be set to a manifest listing (written in Python) that describes the set of files to be frozen in to the firmware.
Diffstat (limited to 'py')
-rw-r--r--py/mkenv.mk1
-rw-r--r--py/mkrules.mk6
-rw-r--r--py/py.mk5
3 files changed, 12 insertions, 0 deletions
diff --git a/py/mkenv.mk b/py/mkenv.mk
index 0a59c2ac7..70d937c45 100644
--- a/py/mkenv.mk
+++ b/py/mkenv.mk
@@ -61,6 +61,7 @@ CXX += -m32
LD += -m32
endif
+MAKE_MANIFEST = $(PYTHON) $(TOP)/tools/makemanifest.py
MAKE_FROZEN = $(PYTHON) $(TOP)/tools/make-frozen.py
MPY_CROSS = $(TOP)/mpy-cross/mpy-cross
MPY_TOOL = $(PYTHON) $(TOP)/tools/mpy-tool.py
diff --git a/py/mkrules.mk b/py/mkrules.mk
index a75c64db9..2a7e1980c 100644
--- a/py/mkrules.mk
+++ b/py/mkrules.mk
@@ -97,6 +97,12 @@ $(OBJ_DIRS):
$(HEADER_BUILD):
$(MKDIR) -p $@
+ifneq ($(FROZEN_MANIFEST),)
+# to build frozen_content.c from a manifest
+$(BUILD)/frozen_content.c: FORCE $(BUILD)/genhdr/qstrdefs.generated.h
+ $(Q)$(MAKE_MANIFEST) -o $@ $(TOP) $(BUILD) "$(MPY_CROSS_FLAGS)" $(FROZEN_MANIFEST)
+endif
+
ifneq ($(FROZEN_DIR),)
$(BUILD)/frozen.c: $(wildcard $(FROZEN_DIR)/*) $(HEADER_BUILD) $(FROZEN_EXTRA_DEPS)
$(ECHO) "GEN $@"
diff --git a/py/py.mk b/py/py.mk
index 5669e33fc..514a0e405 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -202,6 +202,11 @@ PY_EXTMOD_O = $(addprefix $(BUILD)/, $(PY_EXTMOD_O_BASENAME))
# this is a convenience variable for ports that want core, extmod and frozen code
PY_O = $(PY_CORE_O) $(PY_EXTMOD_O)
+# object file for frozen code specified via a manifest
+ifneq ($(FROZEN_MANIFEST),)
+PY_O += $(BUILD)/$(BUILD)/frozen_content.o
+endif
+
# object file for frozen files
ifneq ($(FROZEN_DIR),)
PY_O += $(BUILD)/$(BUILD)/frozen.o