From b28ee6b039841c387685ea54c8206cc6c2a6cb8a Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Sat, 4 Jan 2020 12:21:08 +1100 Subject: [PATCH] Fix misunderstanding of CPPFLAGS and CXXFLAGS. --- message.mk | 2 +- tmk_core/arm_atsam.mk | 4 ++-- tmk_core/avr.mk | 4 ++-- tmk_core/chibios.mk | 4 ++-- tmk_core/native.mk | 20 ++++++++-------- tmk_core/rules.mk | 54 +++++++++++++++++++++---------------------- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/message.mk b/message.mk index 53afba2065..94ab606ec6 100644 --- a/message.mk +++ b/message.mk @@ -50,7 +50,7 @@ MSG_EXTENDED_LISTING = Creating Extended Listing: MSG_SYMBOL_TABLE = Creating Symbol Table: MSG_LINKING = Linking: MSG_COMPILING = Compiling: -MSG_COMPILING_CPP = Compiling: +MSG_COMPILING_CXX = Compiling: MSG_ASSEMBLING = Assembling: MSG_CLEANING = Cleaning project: MSG_CREATING_LIBRARY = Creating library: diff --git a/tmk_core/arm_atsam.mk b/tmk_core/arm_atsam.mk index c9b14042f8..403ebf3a89 100644 --- a/tmk_core/arm_atsam.mk +++ b/tmk_core/arm_atsam.mk @@ -29,8 +29,8 @@ COMPILEFLAGS += -mthumb CFLAGS += $(COMPILEFLAGS) -CPPFLAGS += $(COMPILEFLAGS) -CPPFLAGS += -fno-exceptions -std=c++11 +CXXFLAGS += $(COMPILEFLAGS) +CXXFLAGS += -fno-exceptions -std=c++11 LDFLAGS +=-Wl,--gc-sections LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map" diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index ecd2fd39a4..d5ca3a4dd8 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -25,8 +25,8 @@ CFLAGS += $(COMPILEFLAGS) CFLAGS += -fno-inline-small-functions CFLAGS += -fno-strict-aliasing -CPPFLAGS += $(COMPILEFLAGS) -CPPFLAGS += -fno-exceptions -std=c++11 +CXXFLAGS += $(COMPILEFLAGS) +CXXFLAGS += -fno-exceptions -std=c++11 LDFLAGS +=-Wl,--gc-sections diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index b2e364f216..f9e52aed23 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -167,8 +167,8 @@ CFLAGS += $(COMPILEFLAGS) ASFLAGS += $(THUMBFLAGS) -CPPFLAGS += $(COMPILEFLAGS) -CPPFLAGS += -fno-rtti +CXXFLAGS += $(COMPILEFLAGS) +CXXFLAGS += -fno-rtti LDFLAGS +=-Wl,--gc-sections LDFLAGS +=-Wl,--no-wchar-size-warning diff --git a/tmk_core/native.mk b/tmk_core/native.mk index 530b50b84a..3caf644546 100644 --- a/tmk_core/native.mk +++ b/tmk_core/native.mk @@ -1,13 +1,13 @@ SYSTEM_TYPE := $(shell gcc -dumpmachine) CC = gcc -OBJCOPY = -OBJDUMP = -SIZE = -AR = -NM = -HEX = -EEP = +OBJCOPY = +OBJDUMP = +SIZE = +AR = +NM = +HEX = +EEP = BIN = @@ -24,6 +24,6 @@ CFLAGS += $(COMPILEFLAGS) CFLAGS += -fno-inline-small-functions CFLAGS += -fno-strict-aliasing -CPPFLAGS += $(COMPILEFLAGS) -CPPFLAGS += -fno-exceptions -CPPFLAGS += -std=gnu++11 \ No newline at end of file +CXXFLAGS += $(COMPILEFLAGS) +CXXFLAGS += -fno-exceptions +CXXFLAGS += -std=gnu++11 diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index 334ff314be..c1474a5c24 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -65,9 +65,9 @@ CSTANDARD = -std=gnu99 # Place -D or -U options here for C++ sources -#CPPDEFS += -D__STDC_LIMIT_MACROS -#CPPDEFS += -D__STDC_CONSTANT_MACROS -#CPPDEFS += +#CXXDEFS += -D__STDC_LIMIT_MACROS +#CXXDEFS += -D__STDC_CONSTANT_MACROS +#CXXDEFS += @@ -111,24 +111,24 @@ CFLAGS += $(CSTANDARD) # -Wa,...: tell GCC to pass this to the assembler. # -adhlns...: create assembler listing ifndef SKIP_DEBUG_INFO - CPPFLAGS += -g$(DEBUG) + CXXFLAGS += -g$(DEBUG) endif -CPPFLAGS += $(CPPDEFS) -CPPFLAGS += -O$(OPT) +CXXFLAGS += $(CXXDEFS) +CXXFLAGS += -O$(OPT) # to supress "warning: only initialized variables can be placed into program memory area" -CPPFLAGS += -w -CPPFLAGS += -Wall -CPPFLAGS += -Wundef +CXXFLAGS += -w +CXXFLAGS += -Wall +CXXFLAGS += -Wundef ifneq ($(strip $(ALLOW_WARNINGS)), yes) - CPPFLAGS += -Werror + CXXFLAGS += -Werror endif -#CPPFLAGS += -mshort-calls -#CPPFLAGS += -fno-unit-at-a-time -#CPPFLAGS += -Wstrict-prototypes -#CPPFLAGS += -Wunreachable-code -#CPPFLAGS += -Wsign-compare -CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) -#CPPFLAGS += $(CSTANDARD) +#CXXFLAGS += -mshort-calls +#CXXFLAGS += -fno-unit-at-a-time +#CXXFLAGS += -Wstrict-prototypes +#CXXFLAGS += -Wunreachable-code +#CXXFLAGS += -Wsign-compare +CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) +#CXXFLAGS += $(CSTANDARD) #---------------- Assembler Options ---------------- # -Wa,...: tell GCC to pass this to the assembler. @@ -213,7 +213,7 @@ GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@) # Add target processor to flags. # You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS) -ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(EXTRAFLAGS) +ALL_CXXFLAGS = $(MCUFLAGS) -x c++ $(CXXFLAGS) $(EXTRAFLAGS) ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) define NO_LTO @@ -306,7 +306,7 @@ ifdef $1_CONFIG $1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG)) endif $1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) -$1_CPPFLAGS= $$(ALL_CPPFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) +$1_CXXFLAGS= $$(ALL_CXXFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) $1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) # Compile: create object files from C source files. @@ -317,16 +317,16 @@ $1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN) @$$(BUILD_CMD) # Compile: create object files from C++ source files. -$1/%.o : %.cpp $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN) +$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) @mkdir -p $$(@D) - @$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD) - $$(eval CMD=$$(CC) -c $$($1_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) + @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) + $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) @$$(BUILD_CMD) -$1/%.o : %.cc $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN) +$1/%.o : %.cc $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN) @mkdir -p $$(@D) - @$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD) - $$(eval CMD=$$(CC) -c $$($1_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) + @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD) + $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) @$$(BUILD_CMD) # Assemble: create object files from assembler source files. @@ -347,8 +347,8 @@ $1/force: $1/cflags.txt: $1/force echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@ -$1/cppflags.txt: $1/force - echo '$$($1_CPPFLAGS)' | cmp -s - $$@ || echo '$$($1_CPPFLAGS)' > $$@ +$1/cxxflags.txt: $1/force + echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@ $1/asflags.txt: $1/force echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@