From 37ef3c1cbc16622a932785d128e319b914ab0ddd Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Thu, 3 Oct 2019 06:49:17 -0600 Subject: [PATCH] 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 --- .../z16/z16f2811/z16f2800100zcog/scripts/Make.defs | 12 ++++++------ boards/z80/ez80/ez80f910200kitg/scripts/Make.defs | 12 ++++++------ boards/z80/ez80/ez80f910200zco/scripts/Make.defs | 12 ++++++------ boards/z80/ez80/makerlisp/scripts/Make.defs | 12 ++++++------ boards/z80/z180/p112/scripts/Make.defs | 2 +- .../z80/z8/z8encore000zco/configs/ostest/Make.defs | 12 ++++++------ .../z80/z8/z8f64200100kit/configs/ostest/Make.defs | 12 ++++++------ boards/z80/z80/z80sim/scripts/Make.defs | 2 +- tools/Config.mk | 8 ++++---- 9 files changed, 42 insertions(+), 42 deletions(-) diff --git a/boards/z16/z16f2811/z16f2800100zcog/scripts/Make.defs b/boards/z16/z16f2811/z16f2800100zcog/scripts/Make.defs index 54cd7096d3..2c4895a52e 100644 --- a/boards/z16/z16f2811/z16f2800100zcog/scripts/Make.defs +++ b/boards/z16/z16f2811/z16f2800100zcog/scripts/Make.defs @@ -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 diff --git a/boards/z80/ez80/ez80f910200kitg/scripts/Make.defs b/boards/z80/ez80/ez80f910200kitg/scripts/Make.defs index 12811cc60e..1448d1f519 100644 --- a/boards/z80/ez80/ez80f910200kitg/scripts/Make.defs +++ b/boards/z80/ez80/ez80f910200kitg/scripts/Make.defs @@ -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 diff --git a/boards/z80/ez80/ez80f910200zco/scripts/Make.defs b/boards/z80/ez80/ez80f910200zco/scripts/Make.defs index f10bf950f5..fad055381c 100644 --- a/boards/z80/ez80/ez80f910200zco/scripts/Make.defs +++ b/boards/z80/ez80/ez80f910200zco/scripts/Make.defs @@ -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 diff --git a/boards/z80/ez80/makerlisp/scripts/Make.defs b/boards/z80/ez80/makerlisp/scripts/Make.defs index 97a19a9d68..27d1713ee6 100644 --- a/boards/z80/ez80/makerlisp/scripts/Make.defs +++ b/boards/z80/ez80/makerlisp/scripts/Make.defs @@ -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 diff --git a/boards/z80/z180/p112/scripts/Make.defs b/boards/z80/z180/p112/scripts/Make.defs index 77ab423e80..91dba070b1 100644 --- a/boards/z80/z180/p112/scripts/Make.defs +++ b/boards/z80/z180/p112/scripts/Make.defs @@ -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 diff --git a/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs b/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs index 26ffaaca63..0ba8439459 100644 --- a/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs +++ b/boards/z80/z8/z8encore000zco/configs/ostest/Make.defs @@ -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 diff --git a/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs b/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs index e98b013807..5fddfd0b14 100644 --- a/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs +++ b/boards/z80/z8/z8f64200100kit/configs/ostest/Make.defs @@ -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 diff --git a/boards/z80/z80/z80sim/scripts/Make.defs b/boards/z80/z80/z80sim/scripts/Make.defs index cae4d93fd8..518cdcf3d3 100644 --- a/boards/z80/z80/z80sim/scripts/Make.defs +++ b/boards/z80/z80/z80sim/scripts/Make.defs @@ -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 diff --git a/tools/Config.mk b/tools/Config.mk index 3de0bc10d0..6b81de8367 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -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