tools: replace DEFINE script to Makefile variable

In the past, predefined macros were generated by define.sh scripts
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2022-11-01 21:47:53 +08:00 committed by Xiang Xiao
parent cdeddcb028
commit 95d9abcf58
6 changed files with 14 additions and 12 deletions

View File

@ -27,11 +27,11 @@ ifeq ($(CONFIG_SEGGER_RTT),y)
CFLAGS += -Wno-shadow -Wno-array-bounds CFLAGS += -Wno-shadow -Wno-array-bounds
ifneq ($(CONFIG_SEGGER_RTT_SECTION),"") ifneq ($(CONFIG_SEGGER_RTT_SECTION),"")
CFLAGS += ${shell $(DEFINE) "$(CC)" SEGGER_RTT_SECTION=CONFIG_SEGGER_RTT_SECTION} CFLAGS += ${DEFINE_PREFIX}SEGGER_RTT_SECTION=CONFIG_SEGGER_RTT_SECTION
endif endif
ifneq ($(CONFIG_SEGGER_RTT_BUFFER_SECTION),"") ifneq ($(CONFIG_SEGGER_RTT_BUFFER_SECTION),"")
CFLAGS += ${shell $(DEFINE) "$(CC)" SEGGER_RTT_BUFFER_SECTION=CONFIG_SEGGER_RTT_BUFFER_SECTION} CFLAGS += ${DEFINE_PREFIX}SEGGER_RTT_BUFFER_SECTION=CONFIG_SEGGER_RTT_BUFFER_SECTION
endif endif
CFLAGS += ${shell $(INCDIR) "$(CC)" segger$(DELIM)config} CFLAGS += ${shell $(INCDIR) "$(CC)" segger$(DELIM)config}

View File

@ -38,7 +38,7 @@ ifeq ($(CONFIG_RAMLOG),y)
CSRCS += ramlog.c CSRCS += ramlog.c
ifneq ($(CONFIG_RAMLOG_BUFFER_SECTION),"") ifneq ($(CONFIG_RAMLOG_BUFFER_SECTION),"")
CFLAGS += ${shell $(DEFINE) "$(CC)" RAMLOG_BUFFER_SECTION=CONFIG_RAMLOG_BUFFER_SECTION} CFLAGS += ${DEFINE_PREFIX}RAMLOG_BUFFER_SECTION=CONFIG_RAMLOG_BUFFER_SECTION
endif endif
endif endif

View File

@ -50,10 +50,11 @@ ifeq ($(wildcard libcxx/.git),)
$(call DELDIR, libcxx) $(call DELDIR, libcxx)
endif endif
CXXFLAGS += -std=c++17 ${shell $(DEFINE) "$(CC)" _LIBCPP_BUILDING_LIBRARY} CXXFLAGS += -std=c++17
CXXFLAGS += ${DEFINE_PREFIX}_LIBCPP_BUILDING_LIBRARY
ifeq ($(CONFIG_LIBSUPCXX), y) ifeq ($(CONFIG_LIBSUPCXX), y)
CXXFLAGS += ${shell $(DEFINE) "$(CC)" __GLIBCXX__} CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__
endif endif
# Workaround the following warning with "c++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0" # Workaround the following warning with "c++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0"

View File

@ -40,7 +40,7 @@ context:: libcxxabi
endif endif
ifeq ($(CONFIG_LIBCXXABI), y) ifeq ($(CONFIG_LIBCXXABI), y)
CXXFLAGS += ${shell $(DEFINE) "$(CC)" LIBCXX_BUILDING_LIBCXXABI} CXXFLAGS += ${DEFINE_PREFIX}LIBCXX_BUILDING_LIBCXXABI
CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/include CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/include
endif endif
@ -53,7 +53,7 @@ CPPSRCS += stdlib_exception.cpp stdlib_new_delete.cpp stdlib_stdexcept.cpp stdli
CPPSRCS += abort_message.cpp fallback_malloc.cpp private_typeinfo.cpp CPPSRCS += abort_message.cpp fallback_malloc.cpp private_typeinfo.cpp
ifeq ($(CONFIG_CXX_EXCEPTION), y) ifeq ($(CONFIG_CXX_EXCEPTION), y)
CXXFLAGS += ${shell $(DEFINE) "$(CC)" LIBCXXABI_ENABLE_EXCEPTIONS} CXXFLAGS += ${DEFINE_PREFIX}LIBCXXABI_ENABLE_EXCEPTIONS
CPPSRCS += cxa_exception.cpp cxa_personality.cpp CPPSRCS += cxa_exception.cpp cxa_personality.cpp
else else
CPPSRCS += cxa_noexception.cpp CPPSRCS += cxa_noexception.cpp

View File

@ -39,7 +39,7 @@ ifeq ($(CONFIG_DEBUG_FEATURES),y)
endif endif
ifneq ($(CONFIG_IOB_SECTION),"") ifneq ($(CONFIG_IOB_SECTION),"")
CFLAGS += ${shell $(DEFINE) "$(CC)" IOB_SECTION=CONFIG_IOB_SECTION} CFLAGS += ${DEFINE_PREFIX}IOB_SECTION=CONFIG_IOB_SECTION
endif endif
# Include iob build support # Include iob build support

View File

@ -106,7 +106,7 @@ endif
# This define is passed as EXTRAFLAGS for kernel-mode builds. It is also passed # This define is passed as EXTRAFLAGS for kernel-mode builds. It is also passed
# during PASS1 (but not PASS2) context and depend targets. # during PASS1 (but not PASS2) context and depend targets.
KDEFINE ?= ${shell $(DEFINE) "$(CC)" __KERNEL__} KDEFINE ?= ${DEFINE_PREFIX}__KERNEL__
# DELIM - Path segment delimiter character # DELIM - Path segment delimiter character
# #
@ -577,11 +577,12 @@ $(1)_$(2):
endef endef
# ARCHxxx means the predefined setting(either toolchain, arch, or system specific) export DEFINE_PREFIX := $(subst X,,${shell $(DEFINE) "$(CC)" "X"})
ARCHDEFINES += ${shell $(DEFINE) "$(CC)" __NuttX__} # ARCHxxx means the predefined setting(either toolchain, arch, or system specific)
ARCHDEFINES += ${DEFINE_PREFIX}__NuttX__
ifeq ($(CONFIG_NDEBUG),y) ifeq ($(CONFIG_NDEBUG),y)
ARCHDEFINES += ${shell $(DEFINE) "$(CC)" NDEBUG} ARCHDEFINES += ${DEFINE_PREFIX}NDEBUG
endif endif
# The default C/C++ search path # The default C/C++ search path