py/mkrules.mk: Try to detect and emulate make -B behavior for qstr extraction.

If make -B is run, the rule is run with $? empty. Extract fron all file in
this case. But this gets fragile, really "make clean" should be used instead
with such build complexity.
This commit is contained in:
Paul Sokolovsky 2016-04-19 12:18:46 +03:00
parent 098f3e2862
commit 0dc85c9f86
1 changed files with 6 additions and 1 deletions

View File

@ -83,7 +83,12 @@ $(OBJ): | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/mpversion.h
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) | $(HEADER_BUILD)/mpversion.h
$(ECHO) "GEN $@"
$(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $? >$(HEADER_BUILD)/qstr.i.last
if [ "$?" == "" ]; then \
echo "QSTR Looks like -B used, trying to emulate"; \
$(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $^ >$(HEADER_BUILD)/qstr.i.last; \
else \
$(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $? >$(HEADER_BUILD)/qstr.i.last; \
fi
$(QSTR_DEFS_COLLECTED): $(HEADER_BUILD)/qstr.i.last
$(ECHO) "GEN $@"