From 9208176f600d0d04446531909bf05710716a5ee4 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 2 Nov 2020 00:13:56 +0800 Subject: [PATCH] build: Move __NuttX__ definition to tools/Config.mk ensure this critical macro get defined in all projects Signed-off-by: Xiang Xiao --- boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs | 2 +- boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs | 2 +- boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs | 2 +- boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs | 1 - .../arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs | 2 +- boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs | 2 +- tools/Config.mk | 4 ++++ 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs index d3b881b758..d45992426a 100644 --- a/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs +++ b/boards/arm/imxrt/imxrt1050-evk/configs/libcxxtest/Make.defs @@ -74,7 +74,7 @@ CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(AR CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) -CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 -D__NuttX__ +CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 CXXFLAGS += -fno-builtin -fno-exceptions -fcheck-new -fno-rtti CXXFLAGS += -pedantic -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_NO_EXCEPTIONS CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) diff --git a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs index 0f2715c927..6f8088b385 100644 --- a/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs +++ b/boards/arm/imxrt/imxrt1060-evk/configs/libcxxtest/Make.defs @@ -74,7 +74,7 @@ CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(AR CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) -CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 -D__NuttX__ +CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 CXXFLAGS += -fno-builtin -fno-exceptions -fcheck-new -fno-rtti CXXFLAGS += -pedantic -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_NO_EXCEPTIONS CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) diff --git a/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs b/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs index cf1663142d..371c73b08c 100644 --- a/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs +++ b/boards/arm/lpc43xx/bambino-200e/configs/netnsh/Make.defs @@ -84,7 +84,7 @@ ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) -CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 -D__NuttX__ +CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 CXXFLAGS += -fno-builtin -fno-exceptions -fcheck-new -fno-rtti CXXFLAGS += -pedantic -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_NO_EXCEPTIONS CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) diff --git a/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs b/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs index 5220596a9e..1302883a9c 100644 --- a/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs +++ b/boards/arm/stm32/b-g474e-dpow1/scripts/Make.defs @@ -48,7 +48,6 @@ ARCHCFLAGS = -fno-builtin -funwind-tables ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -funwind-tables ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef ARCHWARNINGSXX = -Wall -Wshadow -Wundef -ARCHDEFINES = -D__NuttX__ ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -ffunction-sections -fdata-sections -pipe diff --git a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs index 1e3a749d10..23416fff50 100644 --- a/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs +++ b/boards/arm/stm32/stm32f4discovery/configs/testlibcxx/Make.defs @@ -70,7 +70,7 @@ CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) \ CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) -CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 -D__NuttX__ +CXXFLAGS += $(ARCHDEFINES) $(EXTRAFLAGS) -pipe -std=c++11 CXXFLAGS += -fno-builtin -fno-exceptions -fcheck-new -fno-rtti CXXFLAGS += -pedantic -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_NO_EXCEPTIONS CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) diff --git a/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs b/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs index 3bc637228e..e196a82774 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs +++ b/boards/arm/stm32l4/nucleo-l476rg/scripts/Make.defs @@ -52,7 +52,7 @@ CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) AFLAGS := $(CFLAGS) -D__ASSEMBLY__ ifeq ($(CONFIG_LIBCXX),y) - CXXFLAGS += -std=c++14 -D__NuttX__ -D__GLIBCXX__ -DMB_LEN_MAX=8 -DHAVE_DEPENDENT_EH_ABI=0 \ + CXXFLAGS += -std=c++14 -D__GLIBCXX__ -DMB_LEN_MAX=8 -DHAVE_DEPENDENT_EH_ABI=0 \ -fno-builtin -D_DEBUG -D_LIBCPP_BUILD_STATIC -D_LIBCPP_STD_VER=14 ifneq ($(CONFIG_CXX_EXCEPTION),y) diff --git a/tools/Config.mk b/tools/Config.mk index 5d41186f8d..b3626b57c7 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -519,6 +519,10 @@ $(1)_$(2): endef +# ARCHxxx means the predefined setting(either toolchain, arch, or system specific) + +ARCHDEFINES += ${shell $(DEFINE) "$(CC)" __NuttX__} + # The default C/C++ search path ARCHINCLUDES += ${shell $(INCDIR) -s "$(CC)" $(TOPDIR)$(DELIM)include}