py/makeqstrdefs.py: Don't include .h files explicitly in preprocessing.
Only include .c and .cpp files explicitly in the list of files passed to the preprocessor for QSTR extraction. All relevant .h files will be included in this process by "#include" from the .c(pp) files. In particular for moduledefs.h, this is included by py/objmodule.c (and doesn't actually contain any extractable MP_QSTR_xxx, but rather defines macros with MP_QSTR_xxx's in them which are then part of py/objmodule.c). The main reason for this change is to simplify the preprocessing step on the javascript port, which tries to compile .h files as C++ precompiled headers if they are passed with -E to clang. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
115acadf92
commit
08e0e065f4
@ -34,7 +34,7 @@ def preprocess():
|
|||||||
for source in sources:
|
for source in sources:
|
||||||
if source.endswith(".cpp"):
|
if source.endswith(".cpp"):
|
||||||
cxxsources.append(source)
|
cxxsources.append(source)
|
||||||
else:
|
elif source.endswith(".c"):
|
||||||
csources.append(source)
|
csources.append(source)
|
||||||
try:
|
try:
|
||||||
os.makedirs(os.path.dirname(args.output[0]))
|
os.makedirs(os.path.dirname(args.output[0]))
|
||||||
|
@ -100,7 +100,7 @@ $(OBJ): | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/mpversion.h $(OBJ
|
|||||||
# - else, if list of newer prerequisites ($?) is not empty, then process just these ($?)
|
# - 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]
|
# - else, process all source files ($^) [this covers "make -B" which can set $? to empty]
|
||||||
# See more information about this process in docs/develop/qstr.rst.
|
# See more information about this process in docs/develop/qstr.rst.
|
||||||
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(QSTR_GLOBAL_REQUIREMENTS)
|
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) $(HEADER_BUILD)/moduledefs.h | $(QSTR_GLOBAL_REQUIREMENTS)
|
||||||
$(ECHO) "GEN $@"
|
$(ECHO) "GEN $@"
|
||||||
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py pp $(CPP) output $(HEADER_BUILD)/qstr.i.last cflags $(QSTR_GEN_CFLAGS) cxxflags $(QSTR_GEN_CXXFLAGS) sources $^ dependencies $(QSTR_GLOBAL_DEPENDENCIES) changed_sources $?
|
$(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py pp $(CPP) output $(HEADER_BUILD)/qstr.i.last cflags $(QSTR_GEN_CFLAGS) cxxflags $(QSTR_GEN_CXXFLAGS) sources $^ dependencies $(QSTR_GLOBAL_DEPENDENCIES) changed_sources $?
|
||||||
|
|
||||||
|
2
py/py.mk
2
py/py.mk
@ -269,8 +269,6 @@ $(HEADER_BUILD)/moduledefs.h: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER
|
|||||||
@$(ECHO) "GEN $@"
|
@$(ECHO) "GEN $@"
|
||||||
$(Q)$(PYTHON) $(PY_SRC)/makemoduledefs.py --vpath="., $(TOP), $(USER_C_MODULES)" $(SRC_QSTR) > $@
|
$(Q)$(PYTHON) $(PY_SRC)/makemoduledefs.py --vpath="., $(TOP), $(USER_C_MODULES)" $(SRC_QSTR) > $@
|
||||||
|
|
||||||
SRC_QSTR += $(HEADER_BUILD)/moduledefs.h
|
|
||||||
|
|
||||||
# Standard C functions like memset need to be compiled with special flags so
|
# Standard C functions like memset need to be compiled with special flags so
|
||||||
# the compiler does not optimise these functions in terms of themselves.
|
# the compiler does not optimise these functions in terms of themselves.
|
||||||
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
|
CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto
|
||||||
|
Loading…
Reference in New Issue
Block a user