mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
tools/Config.mk: Support the ability to change the CFLAGS for the compilation of a single file. Set special compiler options as follows the rule:
sourcefile + fixed suffix "_[A|C|CPP|CXX]FLAGS" apps/examples/hello/Makefile: $(SRCDIR)/hello_main.c_CFLAGS = -DTEST
This commit is contained in:
@@ -177,15 +177,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo CPP: $1->$2
|
@echo CPP: $1->$2
|
||||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) "$(CC)" $(CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) "$(AS)" $(AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
@@ -211,15 +211,15 @@ else
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo "CPP: $1->$2"
|
@echo "CPP: $1->$2"
|
||||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) "$(CC)" $(CFLAGS) `cygpath -w "$1"`
|
$(Q) "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) "$(AS)" $(AFLAGS) `cygpath -w "$1"`
|
$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
|
|||||||
@@ -187,15 +187,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo CPP: $1->$2
|
@echo CPP: $1->$2
|
||||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) $(CC) $(CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) $(AS) $(AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
@@ -222,15 +222,15 @@ else
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo "CPP: $1->$2"
|
@echo "CPP: $1->$2"
|
||||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) $(CC) $(CFLAGS) `cygpath -w "$1"`
|
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) $(AS) $(AFLAGS) `cygpath -w "$1"`
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
|
|||||||
@@ -187,15 +187,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo CPP: $1->$2
|
@echo CPP: $1->$2
|
||||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) $(CC) $(CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) $(AS) $(AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
@@ -222,15 +222,15 @@ else
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo "CPP: $1->$2"
|
@echo "CPP: $1->$2"
|
||||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) $(CC) $(CFLAGS) `cygpath -w "$1"`
|
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) $(AS) $(AFLAGS) `cygpath -w "$1"`
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
|
|||||||
@@ -195,15 +195,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo CPP: $1->$2
|
@echo CPP: $1->$2
|
||||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) $(CC) $(CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) $(AS) $(AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
@@ -230,15 +230,15 @@ else
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo "CPP: $1->$2"
|
@echo "CPP: $1->$2"
|
||||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) $(CC) $(CFLAGS) `cygpath -w "$1"`
|
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) $(AS) $(AFLAGS) `cygpath -w "$1"`
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ EXEEXT = .hex
|
|||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
@echo "AS: $1"
|
@echo "AS: $1"
|
||||||
$(Q) $(AS) $(AFLAGS) $2 $1
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) $2 $1
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Custom CLEAN definition
|
# Custom CLEAN definition
|
||||||
|
|||||||
@@ -205,15 +205,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo CPP: $1->$2
|
@echo CPP: $1->$2
|
||||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) "$(CC)" $(CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) "$(AS)" $(AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
@@ -240,15 +240,15 @@ else
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo "CPP: $1->$2"
|
@echo "CPP: $1->$2"
|
||||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $$wfile)
|
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) $$wfile)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $$wfile)
|
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) $$wfile)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
|
|||||||
@@ -205,15 +205,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo CPP: $1->$2
|
@echo CPP: $1->$2
|
||||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) "$(CC)" $(CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) "$(AS)" $(AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) ${shell echo $1 | sed -e "s/\//\\/g"}
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define MOVEOBJ
|
define MOVEOBJ
|
||||||
@@ -246,15 +246,15 @@ else
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo "CPP: $1->$2"
|
@echo "CPP: $1->$2"
|
||||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $$wfile)
|
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) $$wfile)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $$wfile)
|
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) $$wfile)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define ARCHIVE
|
define ARCHIVE
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ EXEEXT = .hex
|
|||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
@echo "AS: $1"
|
@echo "AS: $1"
|
||||||
$(Q) $(AS) $(AFLAGS) $2 $1
|
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) $2 $1
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Custom CLEAN definition
|
# Custom CLEAN definition
|
||||||
|
|||||||
+4
-4
@@ -109,7 +109,7 @@ endif
|
|||||||
|
|
||||||
define PREPROCESS
|
define PREPROCESS
|
||||||
@echo "CPP: $1->$2"
|
@echo "CPP: $1->$2"
|
||||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# COMPILE - Default macro to compile one C file
|
# COMPILE - Default macro to compile one C file
|
||||||
@@ -123,7 +123,7 @@ endef
|
|||||||
|
|
||||||
define COMPILE
|
define COMPILE
|
||||||
@echo "CC: $1"
|
@echo "CC: $1"
|
||||||
$(Q) $(CC) -c $(CFLAGS) $1 -o $2
|
$(Q) $(CC) -c $(CFLAGS) $($(strip $1)_CFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# COMPILEXX - Default macro to compile one C++ file
|
# COMPILEXX - Default macro to compile one C++ file
|
||||||
@@ -137,7 +137,7 @@ endef
|
|||||||
|
|
||||||
define COMPILEXX
|
define COMPILEXX
|
||||||
@echo "CXX: $1"
|
@echo "CXX: $1"
|
||||||
$(Q) $(CXX) -c $(CXXFLAGS) $1 -o $2
|
$(Q) $(CXX) -c $(CXXFLAGS) $($(strip $1)_CXXFLAGS) $1 -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# ASSEMBLE - Default macro to assemble one assembly language file
|
# ASSEMBLE - Default macro to assemble one assembly language file
|
||||||
@@ -158,7 +158,7 @@ endef
|
|||||||
|
|
||||||
define ASSEMBLE
|
define ASSEMBLE
|
||||||
@echo "AS: $1"
|
@echo "AS: $1"
|
||||||
$(Q) $(CC) -c $(AFLAGS) $1 -o $2
|
$(Q) $(CC) -c $(AFLAGS) $1 $($(strip $1)_AFLAGS) -o $2
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# INSTALL_LIB - Install a library $1 into target $2
|
# INSTALL_LIB - Install a library $1 into target $2
|
||||||
|
|||||||
Reference in New Issue
Block a user