Skip to content

Commit 4173950

Browse files
committed
mpy-cross: Do not automatically build mpy-cross, rather do it manually.
Building mpy-cross automatically leads to some issues with the build process and slows it down. Instead, require it to be built manually.
1 parent 0a6c479 commit 4173950

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ You will also need bash, gcc, and Python 3.3+ available as the command `python3`
6464
(if your system only has Python 2.7 then invoke make with the additional option
6565
`PYTHON=python2`).
6666

67+
The MicroPython cross-compiler, mpy-cross
68+
-----------------------------------------
69+
70+
Most ports require the MicroPython cross-compiler to be built first. This
71+
program, called mpy-cross, is used to pre-compile Python scripts to .mpy
72+
files which can then be included (frozen) into the firmware/executable for
73+
a port. To build mpy-cross use:
74+
75+
$ cd mpy-cross
76+
$ make
77+
6778
The Unix version
6879
----------------
6980

mpy-cross/Makefile

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
# The following is a temporary hack to forefully undefine vars that might have
2-
# be defined by a calling Makefile (from recursive make).
3-
# TODO: Find a better way to be able to call this Makefile recursively.
4-
ifneq ($(findstring undefine,$(.FEATURES)),)
5-
override undefine COPT
6-
override undefine CFLAGS_EXTRA
7-
override undefine LDFLAGS_EXTRA
8-
override undefine MICROPY_FORCE_32BIT
9-
override undefine CROSS_COMPILE
10-
override undefine FROZEN_DIR
11-
override undefine FROZEN_MPY_DIR
12-
override undefine USER_C_MODULES
13-
override undefine SRC_MOD
14-
override undefine BUILD
15-
override undefine PROG
16-
endif
17-
181
include ../py/mkenv.mk
192

203
# define main target

py/mkrules.mk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,12 @@ $(BUILD)/frozen.c: $(wildcard $(FROZEN_DIR)/*) $(HEADER_BUILD) $(FROZEN_EXTRA_DE
103103
endif
104104

105105
ifneq ($(FROZEN_MPY_DIR),)
106-
# to build the MicroPython cross compiler
107-
$(TOP)/mpy-cross/mpy-cross: $(TOP)/py/*.[ch] $(TOP)/mpy-cross/*.[ch] $(TOP)/ports/windows/fmode.c
108-
$(Q)$(MAKE) -C $(TOP)/mpy-cross
109-
110106
# make a list of all the .py files that need compiling and freezing
111107
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' | $(SED) -e 's=^$(FROZEN_MPY_DIR)/==')
112108
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
113109

114110
# to build .mpy files from .py files
115-
$(BUILD)/frozen_mpy/%.mpy: $(FROZEN_MPY_DIR)/%.py $(TOP)/mpy-cross/mpy-cross
111+
$(BUILD)/frozen_mpy/%.mpy: $(FROZEN_MPY_DIR)/%.py
116112
@$(ECHO) "MPY $<"
117113
$(Q)$(MKDIR) -p $(dir $@)
118114
$(Q)$(MPY_CROSS) -o $@ -s $(<:$(FROZEN_MPY_DIR)/%=%) $(MPY_CROSS_FLAGS) $<

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy