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
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
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
CFLAGS += ${shell $(INCDIR) "$(CC)" segger$(DELIM)config}

View File

@ -38,7 +38,7 @@ ifeq ($(CONFIG_RAMLOG),y)
CSRCS += ramlog.c
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

View File

@ -50,10 +50,11 @@ ifeq ($(wildcard libcxx/.git),)
$(call DELDIR, libcxx)
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)
CXXFLAGS += ${shell $(DEFINE) "$(CC)" __GLIBCXX__}
CXXFLAGS += ${DEFINE_PREFIX}__GLIBCXX__
endif
# Workaround the following warning with "c++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0"

View File

@ -40,7 +40,7 @@ context:: libcxxabi
endif
ifeq ($(CONFIG_LIBCXXABI), y)
CXXFLAGS += ${shell $(DEFINE) "$(CC)" LIBCXX_BUILDING_LIBCXXABI}
CXXFLAGS += ${DEFINE_PREFIX}LIBCXX_BUILDING_LIBCXXABI
CXXFLAGS += -I $(TOPDIR)/libs/libxx/libcxxabi/include
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
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
else
CPPSRCS += cxa_noexception.cpp

View File

@ -39,7 +39,7 @@ ifeq ($(CONFIG_DEBUG_FEATURES),y)
endif
ifneq ($(CONFIG_IOB_SECTION),"")
CFLAGS += ${shell $(DEFINE) "$(CC)" IOB_SECTION=CONFIG_IOB_SECTION}
CFLAGS += ${DEFINE_PREFIX}IOB_SECTION=CONFIG_IOB_SECTION
endif
# 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
# during PASS1 (but not PASS2) context and depend targets.
KDEFINE ?= ${shell $(DEFINE) "$(CC)" __KERNEL__}
KDEFINE ?= ${DEFINE_PREFIX}__KERNEL__
# DELIM - Path segment delimiter character
#
@ -577,11 +577,12 @@ $(1)_$(2):
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)
ARCHDEFINES += ${shell $(DEFINE) "$(CC)" NDEBUG}
ARCHDEFINES += ${DEFINE_PREFIX}NDEBUG
endif
# The default C/C++ search path