summaryrefslogtreecommitdiff
path: root/py/py.mk
diff options
context:
space:
mode:
authorDavid Lechner <david@pybricks.com>2022-07-01 12:29:08 -0500
committerDamien George <damien@micropython.org>2022-07-18 13:48:23 +1000
commitfc3d7ae11be11a7f05709ebfd439061fce9ee555 (patch)
tree8c0ec32de2abad065c7adc8b6d18d1d7d3dffc18 /py/py.mk
parenta8d78cc39839aaf4a77bef05377c457c7ba75ead (diff)
py/make_root_pointers: Add MP_REGISTER_ROOT_POINTER parser/generator.
This adds new compile-time infrastructure to parse source code files for `MP_REGISTER_ROOT_POINTER()` and generates a new `root_pointers.h` header file containing the collected declarations. This works the same as the existing `MP_REGISTER_MODULE()` feature. Signed-off-by: David Lechner <david@pybricks.com>
Diffstat (limited to 'py/py.mk')
-rw-r--r--py/py.mk5
1 files changed, 5 insertions, 0 deletions
diff --git a/py/py.mk b/py/py.mk
index dacfa1bd0..8aac460b4 100644
--- a/py/py.mk
+++ b/py/py.mk
@@ -218,6 +218,11 @@ $(HEADER_BUILD)/moduledefs.h: $(HEADER_BUILD)/moduledefs.collected
@$(ECHO) "GEN $@"
$(Q)$(PYTHON) $(PY_SRC)/makemoduledefs.py $< > $@
+# build a list of registered root pointers for py/mpstate.h.
+$(HEADER_BUILD)/root_pointers.h: $(HEADER_BUILD)/root_pointers.collected $(PY_SRC)/make_root_pointers.py
+ @$(ECHO) "GEN $@"
+ $(Q)$(PYTHON) $(PY_SRC)/make_root_pointers.py $< > $@
+
# Standard C functions like memset need to be compiled with special flags so
# the compiler does not optimise these functions in terms of themselves.
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto