Skip to content

Commit fcda6a2

Browse files
committed
py: Strip leading dirs from frozen mpy files, so any path can be used.
With this patch one can now do "make FROZEN_MPY_DIR=../../frozen" to specify a directory containing scripts to be frozen (as well as absolute paths). The compiled .mpy files are now stored in $(BUILD)/frozen_mpy/.
1 parent bdf33bc commit fcda6a2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

py/mkrules.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ endif
108108

109109
ifneq ($(FROZEN_MPY_DIR),)
110110
# make a list of all the .py files that need compiling and freezing
111-
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
112-
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
111+
FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py' -printf '%P\n')
112+
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/frozen_mpy/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
113113

114114
# to build .mpy files from .py files
115-
$(BUILD)/$(FROZEN_MPY_DIR)/%.mpy: $(FROZEN_MPY_DIR)/%.py
115+
$(BUILD)/frozen_mpy/%.mpy: $(FROZEN_MPY_DIR)/%.py
116116
@$(ECHO) "MPY $<"
117117
$(Q)$(MKDIR) -p $(dir $@)
118118
$(Q)$(MPY_CROSS) -o $@ -s $(^:$(FROZEN_MPY_DIR)/%=%) $^

0 commit comments

Comments
 (0)