aboutsummaryrefslogtreecommitdiff
path: root/py/mkenv.mk
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-08-03 22:30:15 +1000
committerDamien George <damien@micropython.org>2021-08-07 20:25:32 +1000
commit78718fffb1f3010c7a40bb4c29c6ddf5b8dadaa3 (patch)
treec5050606cc39e8e7af2a96b6ab0c0371bd85e3d4 /py/mkenv.mk
parentd290f369d08990cba4b5c2e0d207f8603c5166b0 (diff)
py/mkrules: Automatically build mpy-cross if it doesn't exist.
Commit 41739506589ec8397613c86d8f682fb7f86c0a9f removed automatic building of mpy-cross, which rebuilt it whenever any of its dependent source files changed. But needing to build mpy-cross, and not knowing how, is a frequent issue. This commit aims to help by automatically building mpy-cross only if it doesn't exist. For Makefiles it uses an order-only prerequisite, while for CMake it uses a custom command. If MICROPY_MPYCROSS (which is what makemanifest.py uses to locate the mpy-cross executable) is defined in the environment then automatic build will not be attempted, allowing a way to prevent this auto-build if needed. Thanks to Trammell Hudson aka @osresearch for the original idea; see #5760. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/mkenv.mk')
-rw-r--r--py/mkenv.mk6
1 files changed, 5 insertions, 1 deletions
diff --git a/py/mkenv.mk b/py/mkenv.mk
index d54f0a0d3..2b247974b 100644
--- a/py/mkenv.mk
+++ b/py/mkenv.mk
@@ -55,11 +55,15 @@ AR = $(CROSS_COMPILE)ar
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
MPY_LIB_DIR = $(TOP)/../micropython-lib
+ifeq ($(MICROPY_MPYCROSS),)
+MICROPY_MPYCROSS = $(TOP)/mpy-cross/mpy-cross
+MICROPY_MPYCROSS_DEPENDENCY = $(MICROPY_MPYCROSS)
+endif
+
all:
.PHONY: all