py/mkrules.mk: Regenerate all qstrs when config files change.

A port can define QSTR_GLOBAL_DEPENDENCIES to add extra files.
This commit is contained in:
Damien George 2018-06-09 15:23:13 +10:00
parent 0501427907
commit 7ad04d17da
2 changed files with 9 additions and 2 deletions

View File

@ -66,9 +66,13 @@ $(BUILD)/%.pp: %.c
# to get built before we try to compile any of them. # to get built before we try to compile any of them.
$(OBJ): | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/mpversion.h $(OBJ): | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/mpversion.h
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) | $(HEADER_BUILD)/mpversion.h # The logic for qstr regeneration is:
# - if anything in QSTR_GLOBAL_DEPENDENCIES is newer, then process all source files ($^)
# - else, if list of newer prerequisites ($?) is not empty, then process just these ($?)
# - else, process all source files ($^) [this covers "make -B" which can set $? to empty]
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER_BUILD)/mpversion.h
$(ECHO) "GEN $@" $(ECHO) "GEN $@"
$(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $(if $?,$?,$^) >$(HEADER_BUILD)/qstr.i.last; $(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $(if $(filter $?,$(QSTR_GLOBAL_DEPENDENCIES)),$^,$(if $?,$?,$^)) >$(HEADER_BUILD)/qstr.i.last;
$(HEADER_BUILD)/qstr.split: $(HEADER_BUILD)/qstr.i.last $(HEADER_BUILD)/qstr.split: $(HEADER_BUILD)/qstr.i.last
$(ECHO) "GEN $@" $(ECHO) "GEN $@"

View File

@ -13,6 +13,9 @@ ifneq ($(QSTR_AUTOGEN_DISABLE),1)
QSTR_DEFS_COLLECTED = $(HEADER_BUILD)/qstrdefs.collected.h QSTR_DEFS_COLLECTED = $(HEADER_BUILD)/qstrdefs.collected.h
endif endif
# Any files listed by this variable will cause a full regeneration of qstrs
QSTR_GLOBAL_DEPENDENCIES += $(PY_SRC)/mpconfig.h mpconfigport.h
# some code is performance bottleneck and compiled with other optimization options # some code is performance bottleneck and compiled with other optimization options
CSUPEROPT = -O3 CSUPEROPT = -O3