Skip to content

Commit f28efa1

Browse files
committed
py: Move frozen modules rules from esp8266 port for reuse across ports.
A port now just needs to define FROZEN_DIR var and add $(BUILD)/frozen.c to SRC_C to support frozen modules.
1 parent 8ae885a commit f28efa1

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

esp8266/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ endif
171171

172172
$(BUILD)/uart.o: $(CONFVARS_FILE)
173173

174-
$(BUILD)/frozen.c: $(wildcard $(FROZEN_DIR)/*) $(CONFVARS_FILE)
175-
$(ECHO) "Generating $@"
176-
$(Q)$(MAKE_FROZEN) $(FROZEN_DIR) > $@
174+
FROZEN_EXTRA_DEPS = $(CONFVARS_FILE)
177175

178176
# to build .mpy files from .py files
179177
$(BUILD)/$(FROZEN_MPY_DIR)/%.mpy: $(FROZEN_MPY_DIR)/%.py

py/mkenv.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ CXX += -m32
5858
LD += -m32
5959
endif
6060

61+
MAKE_FROZEN = ../tools/make-frozen.py
62+
6163
all:
6264
.PHONY: all
6365

py/mkrules.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ $(OBJ_DIRS):
100100
$(HEADER_BUILD):
101101
$(MKDIR) -p $@
102102

103+
ifneq ($(FROZEN_DIR),)
104+
$(BUILD)/frozen.c: $(wildcard $(FROZEN_DIR)/*) $(HEADER_BUILD) $(FROZEN_EXTRA_DEPS)
105+
$(ECHO) "Generating $@"
106+
$(Q)$(MAKE_FROZEN) $(FROZEN_DIR) > $@
107+
endif
108+
103109
ifneq ($(PROG),)
104110
# Build a standalone executable (unix does this)
105111

0 commit comments

Comments
 (0)