8000 py/mkrules.mk: Regenerate all qstrs when config files change. · micropython/micropython@7ad04d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ad04d1

Browse files
committed
py/mkrules.mk: Regenerate all qstrs when config files change.
A port can define QSTR_GLOBAL_DEPENDENCIES to add extra files.
1 parent 0501427 commit 7ad04d1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

py/mkrules.mk

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ $(BUILD)/%.pp: %.c
6666
# to get built before we try to compile any of them.
6767
$(OBJ): | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/mpversion.h
6868

69-
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) | $(HEADER_BUILD)/mpversion.h
69+
# The logic for qstr regeneration is:
70+
# - if anything in QSTR_GLOBAL_DEPENDENCIES is newer, then process all source files ($^)
71+
# - else, if list of newer prerequisites ($?) is not empty, then process just these ($?)
72+
# - else, process all source files ($^) [this covers "make -B" which can set $? to empty]
73+
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER_BUILD)/mpversion.h
7074
$(ECHO) "GEN $@"
71-
$(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $(if $?,$?,$^) >$(HEADER_BUILD)/qstr.i.last;
75+
$(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $(if $(filter $?,$(QSTR_GLOBAL_DEPENDENCIES)),$^,$(if $?,$?,$^)) >$(HEADER_BUILD)/qstr.i.last;
7276

7377
$(HEADER_BUILD)/qstr.split: $(HEADER_BUILD)/qstr.i.last
7478
$(ECHO) "GEN $@"

py/py.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ ifneq ($(QSTR_AUTOGEN_DISABLE),1)
1313
QSTR_DEFS_COLLECTED = $(HEADER_BUILD)/qstrdefs.collected.h
1414
endif
1515

16+
# Any files listed by this variable will cause a full regeneration of qstrs
17+
QSTR_GLOBAL_DEPENDENCIES += $(PY_SRC)/mpconfig.h mpconfigport.h
18+
1619
# some code is performance bottleneck and compiled with other optimization options
1720
CSUPEROPT = -O3
1821

0 commit comments

Comments
 (0)
0