Skip to content

Commit

Permalink
py: Move frozen modules rules from esp8266 port for reuse across ports.
Browse files Browse the repository at this point in the history
A port now just needs to define FROZEN_DIR var and add $(BUILD)/frozen.c
to SRC_C to support frozen modules.
  • Loading branch information
pfalcon committed Sep 17, 2016
1 parent 8ae885a commit f28efa1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 1 addition & 3 deletions esp8266/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ endif

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

$(BUILD)/frozen.c: $(wildcard $(FROZEN_DIR)/*) $(CONFVARS_FILE)
$(ECHO) "Generating $@"
$(Q)$(MAKE_FROZEN) $(FROZEN_DIR) > $@
FROZEN_EXTRA_DEPS = $(CONFVARS_FILE)

# to build .mpy files from .py files
$(BUILD)/$(FROZEN_MPY_DIR)/%.mpy: $(FROZEN_MPY_DIR)/%.py
Expand Down
2 changes: 2 additions & 0 deletions py/mkenv.mk
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ CXX += -m32
LD += -m32
endif

MAKE_FROZEN = ../tools/make-frozen.py

all:
.PHONY: all

Expand Down
6 changes: 6 additions & 0 deletions py/mkrules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ $(OBJ_DIRS):
$(HEADER_BUILD):
$(MKDIR) -p $@

ifneq ($(FROZEN_DIR),)
$(BUILD)/frozen.c: $(wildcard $(FROZEN_DIR)/*) $(HEADER_BUILD) $(FROZEN_EXTRA_DEPS)
$(ECHO) "Generating $@"
$(Q)$(MAKE_FROZEN) $(FROZEN_DIR) > $@
endif

ifneq ($(PROG),)
# Build a standalone executable (unix does this)

Expand Down

0 comments on commit f28efa1

Please sign in to comment.