1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

makefiles: do not remove defines from CFLAGS

Do not remove the '-D' and '-U' values from CFLAGS.
This prevents issues where a '-D' could contain a space.

Some values way be duplicated from the 'riotbuild.h' header and the
command line but with the same value so without conflict.

To not put too many things in the command line, the -DMODULE_NAME are
only put in CFLAGS_WITH_MACROS.

Also, as now, the deferred value of CFLAGS is used for 'riotbuild.h',
macros set after the inclusion of `Makefile.include` will be taken into
account.
This commit is contained in:
Gaëtan Harter 2019-09-17 15:39:26 +02:00 committed by cladmi
parent da59fb0eda
commit 41d10cf005
No known key found for this signature in database
GPG Key ID: 76DF6BCF1B1F883B
2 changed files with 4 additions and 6 deletions

View File

@ -774,13 +774,11 @@ $(RIOTBUILD_CONFIG_HEADER_C): FORCE
$(Q)'$(RIOTTOOLS)/genconfigheader/genconfigheader.sh' $(CFLAGS_WITH_MACROS) \
| '$(LAZYSPONGE)' $(LAZYSPONGE_FLAGS) '$@'
# Immediate evaluation but keep CLAGS_WITH_MACROS deferred
_CFLAGS := $(CFLAGS)
CFLAGS_WITH_MACROS = $(_CFLAGS)
CFLAGS_WITH_MACROS += $(CFLAGS)
CFLAGS_WITH_MACROS += -DRIOT_VERSION=\"$(RIOT_VERSION)\"
# MODULE_NAME defines. Declared in 'makefiles/modules.inc.mk'
CFLAGS_WITH_MACROS += $(EXTDEFINES)
CFLAGS := $(patsubst -D%,,$(CFLAGS))
CFLAGS := $(patsubst -U%,,$(CFLAGS))
CFLAGS += -include '$(RIOTBUILD_CONFIG_HEADER_C)'
# include mcuboot support

View File

@ -2,8 +2,8 @@ _ALLMODULES = $(sort $(USEMODULE) $(USEPKG))
# Define MODULE_MODULE_NAME preprocessor macros for all modules.
ED = $(addprefix MODULE_,$(_ALLMODULES))
# EXTDEFINES will be put in CFLAGS_WITH_MACROS
EXTDEFINES = $(addprefix -D,$(shell echo '$(ED)' | tr 'a-z-' 'A-Z_'))
CFLAGS += $(EXTDEFINES)
# filter "pseudomodules" from "real modules", but not "no_pseudomodules"
REALMODULES += $(filter-out $(PSEUDOMODULES), $(_ALLMODULES))