Merge pull request #12340 from cladmi/pr/makefiles/board_cpu_macros

makefiles: CFLAGS convert to the uppercase function instead of using the shell
This commit is contained in:
benpicco 2019-09-30 19:53:28 +02:00 committed by GitHub
commit 5105a2e54d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 17 deletions

View File

@ -340,9 +340,9 @@ ifeq ($(RIOT_CI_BUILD),1)
endif
# if you want to publish the board into the sources as an uppercase #define
BOARDDEF := $(shell echo $(BOARD) | tr 'a-z' 'A-Z' | tr '-' '_')
CPUDEF := $(shell echo $(CPU) | tr 'a-z' 'A-Z' | tr '-' '_')
MCUDEF := $(shell echo $(MCU) | tr 'a-z' 'A-Z' | tr '-' '_')
BOARDDEF = $(call uppercase_and_underscore,$(BOARD))
CPUDEF = $(call uppercase_and_underscore,$(CPU))
MCUDEF = $(call uppercase_and_underscore,$(MCU))
CFLAGS += -DRIOT_APPLICATION=\"$(APPLICATION)\"
CFLAGS += -DBOARD_$(BOARDDEF)=\"$(BOARD)\" -DRIOT_BOARD=BOARD_$(BOARDDEF)
CFLAGS += -DCPU_$(CPUDEF)=\"$(CPU)\" -DRIOT_CPU=CPU_$(CPUDEF)

View File

@ -4,7 +4,7 @@ export CPU_ARCH = $(EFM32_ARCHITECTURE)
export CPU_FAM = $(EFM32_FAMILY)
# the em_device.h header requires a global define with the cpu model
CFLAGS += -D$(shell echo $(CPU_MODEL) | tr 'a-z' 'A-Z')
CFLAGS += -D$(call uppercase_and_underscore,$(CPU_MODEL))
# include Gecko SDK package
USEPKG += gecko_sdk

View File

@ -2,8 +2,7 @@ PSEUDOMODULES += msp430_malloc
INCLUDES += -I$(RIOTCPU)/msp430_common/include/
MODEL = $(shell echo $(CPU_MODEL) | tr 'a-z' 'A-Z')
CFLAGS += -DCPU_MODEL_$(MODEL)
CFLAGS += -DCPU_MODEL_$(call uppercase_and_underscore,$(CPU_MODEL))
export UNDEF += $(BINDIR)/msp430_common/startup.o
export USEMODULE += msp430_common msp430_common_periph msp430_malloc

View File

@ -1,5 +1,4 @@
FAM = $(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_')
CFLAGS += -DCPU_FAM_$(FAM)
CFLAGS += -DCPU_FAM_$(call uppercase_and_underscore,$(CPU_FAM))
# include nrf5x common periph drivers
USEMODULE += nrf5x_common_periph

View File

@ -1,5 +1,5 @@
# Define the CPU family so we can differentiate between them in the code
CFLAGS += -DCPU_FAM_$(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_')
CFLAGS += -DCPU_FAM_$(call uppercase_and_underscore,$(CPU_FAM))
# Set ROM and RAM lengths according to CPU model
ifneq (,$(filter samd21g18a samd21j18a saml21j18b saml21j18a samr21e18a \

View File

@ -1,5 +1,5 @@
# Define the CPU family so we can differentiate between them in the code
CFLAGS += -DCPU_FAM_$(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_')
CFLAGS += -DCPU_FAM_$(call uppercase_and_underscore,$(CPU_FAM))
# this CPU implementation doesn't use CMSIS initialization
CFLAGS += -DDONT_USE_CMSIS_INIT

View File

@ -1,5 +1,4 @@
FAM = $(shell echo $(CPU_FAM) | tr 'a-z-' 'A-Z_')
CFLAGS += -DCPU_FAM_$(FAM)
CFLAGS += -DCPU_FAM_$(call uppercase_and_underscore,$(CPU_FAM))
# All stm32 families provide pm support
USEMODULE += pm_layered

View File

@ -81,10 +81,8 @@ endif
endif
endif
MODEL = $(shell echo $(CPU_MODEL) | tr 'a-z' 'A-Z')
CFLAGS += -DCPU_MODEL_$(MODEL)
ARCH = $(shell echo $(CPU_ARCH) | tr 'a-z-' 'A-Z_')
CFLAGS += -DCPU_ARCH_$(ARCH)
CFLAGS += -DCPU_MODEL_$(call uppercase_and_underscore,$(CPU_MODEL))
CFLAGS += -DCPU_ARCH_$(call uppercase_and_underscore,$(CPU_ARCH))
# set the compiler specific CPU and FPU options
ifneq (,$(filter $(CPU_ARCH),cortex-m4f cortex-m7))

View File

@ -3,7 +3,7 @@ _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_'))
EXTDEFINES = $(addprefix -D,$(call uppercase_and_underscore,$(ED)))
# filter "pseudomodules" from "real modules", but not "no_pseudomodules"
REALMODULES += $(filter-out $(PSEUDOMODULES), $(_ALLMODULES))