diff --git a/Makefile.include b/Makefile.include index c1988d4f8b..cfac151c21 100644 --- a/Makefile.include +++ b/Makefile.include @@ -11,10 +11,6 @@ RIOTCPU := $(abspath $(RIOTCPU)) RIOTBOARD ?= $(RIOTBASE)/boards RIOTBOARD := $(abspath $(RIOTBOARD)) -ifeq ($(strip $(MCU)),) - MCU = $(CPU) -endif - ifeq (,$(filter buildtest,$(MAKECMDGOALS))) ifneq (,$(BOARD_WHITELIST)) ifeq (,$(filter $(BOARD),$(BOARD_WHITELIST))) @@ -27,11 +23,6 @@ $(error This application does not run on following boards: $(BOARD_BLACKLIST)) endif endif -# if you want to publish the board into the sources as an uppercase #define -BB = $(shell echo $(BOARD)|tr 'a-z' 'A-Z'|tr '-' '_') -CPUDEF = $(shell echo $(CPU)|tr 'a-z' 'A-Z'|tr '-' '_') -CFLAGS += -DBOARD_$(BB) -DCPU_$(CPUDEF) - BINDIRBASE ?= $(CURDIR)/bin BINDIR ?= $(abspath $(BINDIRBASE)/$(BOARD))/ @@ -50,6 +41,18 @@ include $(RIOTBOARD)/$(BOARD)/Makefile.include include $(RIOTCPU)/$(CPU)/Makefile.include include $(RIOTBASE)/Makefile.dep +ifeq ($(strip $(MCU)),) + MCU = $(CPU) +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 '-' '_') +CFLAGS += -DBOARD_$(BOARDDEF)='"$(BOARD)"' -DRIOT_BOARD=BOARD_$(BOARDDEF) +CFLAGS += -DCPU_$(CPUDEF)='"$(CPU)"' -DRIOT_CPU=CPU_$(CPUDEF) +CFLAGS += -DMCU_$(MCUDEF)='"$(MCU)"' -DRIOT_MCU=MCU_$(MCUDEF) + # OSX fails to create empty archives. Provide a wrapper to catch that error. ifneq (0, $(shell mkdir -p $(BINDIR); $(AR) -rc $(BINDIR)empty-archive.a 2> /dev/null; echo $$?)) AR := $(RIOTBASE)/dist/ar-wrapper $(AR) diff --git a/examples/hello-world/main.c b/examples/hello-world/main.c index 971dcf862c..f735bba3ee 100644 --- a/examples/hello-world/main.c +++ b/examples/hello-world/main.c @@ -24,5 +24,9 @@ int main(void) { puts("Hello World!"); + + printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD); + printf("This board features a(n) %s MCU.\n", RIOT_MCU); + return 0; }