diff --git a/py/builtinhelp.c b/py/builtinhelp.c index 453c9bb118..7411c57aae 100644 --- a/py/builtinhelp.c +++ b/py/builtinhelp.c @@ -79,12 +79,8 @@ STATIC void mp_help_add_from_names(mp_obj_t list, const char *name) { // These externs were originally declared inside mp_help_print_modules(), // but they triggered -Wnested-externs, so they were moved outside. -#if MICROPY_MODULE_FROZEN_STR -extern const char mp_frozen_str_names[]; -#endif - -#if MICROPY_MODULE_FROZEN_MPY -extern const char mp_frozen_mpy_names[]; +#if MICROPY_MODULE_FROZEN +extern const char mp_frozen_names[]; #endif STATIC void mp_help_print_modules(void) { @@ -93,7 +89,6 @@ STATIC void mp_help_print_modules(void) { mp_help_add_from_map(list, &mp_builtin_module_map); #if MICROPY_MODULE_FROZEN - extern const char mp_frozen_names[]; mp_help_add_from_names(list, mp_frozen_names); #endif diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 14852580e5..42f7d29f33 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -489,6 +489,7 @@ CFLAGS += -DLONGINT_IMPL_LONGLONG else $(error LONGINT_IMPL set to surprising value: "$(LONGINT_IMPL)") endif +MPY_TOOL_FLAGS += $(MPY_TOOL_LONGINT_IMPL) ### ifeq ($(LONGINT_IMPL),NONE) @@ -497,3 +498,16 @@ else ifeq ($(LONGINT_IMPL),LONGLONG) else $(error LONGINT_IMPL set to surprising value: "$(LONGINT_IMPL)") endif + +PREPROCESS_FROZEN_MODULES = PYTHONPATH=$(TOP)/tools/python-semver $(TOP)/tools/preprocess_frozen_modules.py +ifneq ($(FROZEN_MPY_DIRS),) +$(BUILD)/frozen_mpy: $(FROZEN_MPY_DIRS) + $(ECHO) FREEZE $(FROZEN_MPY_DIRS) + $(Q)$(MKDIR) -p $@ + $(Q)$(PREPROCESS_FROZEN_MODULES) -o $@ $(FROZEN_MPY_DIRS) + +$(BUILD)/manifest.py: $(BUILD)/frozen_mpy | $(TOP)/py/circuitpy_mpconfig.mk mpconfigport.mk boards/$(BOARD)/mpconfigboard.mk + $(ECHO) MKMANIFEST $(FROZEN_MPY_DIRS) + (cd $(BUILD)/frozen_mpy && find * -name \*.py -exec printf 'freeze_as_mpy("frozen_mpy", "%s")\n' {} \; )> $@.tmp && mv -f $@.tmp $@ +FROZEN_MANIFEST=$(BUILD)/manifest.py +endif diff --git a/py/mkrules.mk b/py/mkrules.mk index d306cfabeb..6bef64fd82 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -135,7 +135,7 @@ endif ifneq ($(FROZEN_MANIFEST),) # to build frozen_content.c from a manifest -$(BUILD)/frozen_content.c: FORCE $(BUILD)/genhdr/qstrdefs.generated.h | $(MICROPY_MPYCROSS_DEPENDENCY) +$(BUILD)/frozen_content.c: FORCE $(FROZEN_MANIFEST) $(BUILD)/genhdr/qstrdefs.generated.h | $(MICROPY_MPYCROSS_DEPENDENCY) $(TOP)/tools/makemanifest.py $(Q)$(MAKE_MANIFEST) -o $@ -v "MPY_DIR=$(TOP)" -v "MPY_LIB_DIR=$(MPY_LIB_DIR)" -v "PORT_DIR=$(shell pwd)" -v "BOARD_DIR=$(BOARD_DIR)" -b "$(BUILD)" $(if $(MPY_CROSS_FLAGS),-f"$(MPY_CROSS_FLAGS)",) --mpy-tool-flags="$(MPY_TOOL_FLAGS)" $(FROZEN_MANIFEST) endif