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:
parent
edb19474bc
commit
37ef3c1cbc
@ -177,15 +177,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
|
||||
define PREPROCESS
|
||||
@echo CPP: $1->$2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
define MOVEOBJ
|
||||
@ -211,15 +211,15 @@ else
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
$(Q) "$(CC)" $(CFLAGS) `cygpath -w "$1"`
|
||||
$(Q) "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
$(Q) "$(AS)" $(AFLAGS) `cygpath -w "$1"`
|
||||
$(Q) "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define MOVEOBJ
|
||||
|
@ -187,15 +187,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
|
||||
define PREPROCESS
|
||||
@echo CPP: $1->$2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
define MOVEOBJ
|
||||
@ -222,15 +222,15 @@ else
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
$(Q) $(CC) $(CFLAGS) `cygpath -w "$1"`
|
||||
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
$(Q) $(AS) $(AFLAGS) `cygpath -w "$1"`
|
||||
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define MOVEOBJ
|
||||
|
@ -187,15 +187,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
|
||||
define PREPROCESS
|
||||
@echo CPP: $1->$2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
define MOVEOBJ
|
||||
@ -222,15 +222,15 @@ else
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
$(Q) $(CC) $(CFLAGS) `cygpath -w "$1"`
|
||||
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
$(Q) $(AS) $(AFLAGS) `cygpath -w "$1"`
|
||||
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define MOVEOBJ
|
||||
|
@ -195,15 +195,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
|
||||
define PREPROCESS
|
||||
@echo CPP: $1->$2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
define MOVEOBJ
|
||||
@ -230,15 +230,15 @@ else
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
$(Q) $(CC) $(CFLAGS) `cygpath -w "$1"`
|
||||
$(Q) $(CC) $(CFLAGS) $($(strip $1)_CFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
$(Q) $(AS) $(AFLAGS) `cygpath -w "$1"`
|
||||
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) `cygpath -w "$1"`
|
||||
endef
|
||||
|
||||
define MOVEOBJ
|
||||
|
@ -94,7 +94,7 @@ EXEEXT = .hex
|
||||
|
||||
define ASSEMBLE
|
||||
@echo "AS: $1"
|
||||
$(Q) $(AS) $(AFLAGS) $2 $1
|
||||
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) $2 $1
|
||||
endef
|
||||
|
||||
# Custom CLEAN definition
|
||||
|
@ -205,15 +205,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
|
||||
define PREPROCESS
|
||||
@echo CPP: $1->$2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
define MOVEOBJ
|
||||
@ -240,15 +240,15 @@ else
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $$wfile)
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) $$wfile)
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $$wfile)
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) $$wfile)
|
||||
endef
|
||||
|
||||
define MOVEOBJ
|
||||
|
@ -205,15 +205,15 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||
|
||||
define PREPROCESS
|
||||
@echo CPP: $1->$2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
define MOVEOBJ
|
||||
@ -246,15 +246,15 @@ else
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $1 -o $2
|
||||
$(Q) "$(CPP)" $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $$wfile)
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(CC)" $(CFLAGS) $($(strip $1)_CFLAGS) $$wfile)
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $$wfile)
|
||||
$(Q) (wfile=`cygpath -w "$1"`; "$(AS)" $(AFLAGS) $($(strip $1)_AFLAGS) $$wfile)
|
||||
endef
|
||||
|
||||
define ARCHIVE
|
||||
|
@ -93,7 +93,7 @@ EXEEXT = .hex
|
||||
|
||||
define ASSEMBLE
|
||||
@echo "AS: $1"
|
||||
$(Q) $(AS) $(AFLAGS) $2 $1
|
||||
$(Q) $(AS) $(AFLAGS) $($(strip $1)_AFLAGS) $2 $1
|
||||
endef
|
||||
|
||||
# Custom CLEAN definition
|
||||
|
@ -109,7 +109,7 @@ endif
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
$(Q) $(CPP) $(CPPFLAGS) $1 -o $2
|
||||
$(Q) $(CPP) $(CPPFLAGS) $($(strip $1)_CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
# COMPILE - Default macro to compile one C file
|
||||
@ -123,7 +123,7 @@ endef
|
||||
|
||||
define COMPILE
|
||||
@echo "CC: $1"
|
||||
$(Q) $(CC) -c $(CFLAGS) $1 -o $2
|
||||
$(Q) $(CC) -c $(CFLAGS) $($(strip $1)_CFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
# COMPILEXX - Default macro to compile one C++ file
|
||||
@ -137,7 +137,7 @@ endef
|
||||
|
||||
define COMPILEXX
|
||||
@echo "CXX: $1"
|
||||
$(Q) $(CXX) -c $(CXXFLAGS) $1 -o $2
|
||||
$(Q) $(CXX) -c $(CXXFLAGS) $($(strip $1)_CXXFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
# ASSEMBLE - Default macro to assemble one assembly language file
|
||||
@ -158,7 +158,7 @@ endef
|
||||
|
||||
define ASSEMBLE
|
||||
@echo "AS: $1"
|
||||
$(Q) $(CC) -c $(AFLAGS) $1 -o $2
|
||||
$(Q) $(CC) -c $(AFLAGS) $1 $($(strip $1)_AFLAGS) -o $2
|
||||
endef
|
||||
|
||||
# INSTALL_LIB - Install a library $1 into target $2
|
||||
|
Loading…
Reference in New Issue
Block a user