Fix misunderstanding of CPPFLAGS and CXXFLAGS.

This commit is contained in:
Nick Brassel 2020-01-04 12:21:08 +11:00
parent 6544bd2e65
commit b28ee6b039
6 changed files with 44 additions and 44 deletions

View File

@ -50,7 +50,7 @@ MSG_EXTENDED_LISTING = Creating Extended Listing:
MSG_SYMBOL_TABLE = Creating Symbol Table: MSG_SYMBOL_TABLE = Creating Symbol Table:
MSG_LINKING = Linking: MSG_LINKING = Linking:
MSG_COMPILING = Compiling: MSG_COMPILING = Compiling:
MSG_COMPILING_CPP = Compiling: MSG_COMPILING_CXX = Compiling:
MSG_ASSEMBLING = Assembling: MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project: MSG_CLEANING = Cleaning project:
MSG_CREATING_LIBRARY = Creating library: MSG_CREATING_LIBRARY = Creating library:

View File

@ -29,8 +29,8 @@ COMPILEFLAGS += -mthumb
CFLAGS += $(COMPILEFLAGS) CFLAGS += $(COMPILEFLAGS)
CPPFLAGS += $(COMPILEFLAGS) CXXFLAGS += $(COMPILEFLAGS)
CPPFLAGS += -fno-exceptions -std=c++11 CXXFLAGS += -fno-exceptions -std=c++11
LDFLAGS +=-Wl,--gc-sections LDFLAGS +=-Wl,--gc-sections
LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map" LDFLAGS += -Wl,-Map="%OUT%%PROJ_NAME%.map"

View File

@ -25,8 +25,8 @@ CFLAGS += $(COMPILEFLAGS)
CFLAGS += -fno-inline-small-functions CFLAGS += -fno-inline-small-functions
CFLAGS += -fno-strict-aliasing CFLAGS += -fno-strict-aliasing
CPPFLAGS += $(COMPILEFLAGS) CXXFLAGS += $(COMPILEFLAGS)
CPPFLAGS += -fno-exceptions -std=c++11 CXXFLAGS += -fno-exceptions -std=c++11
LDFLAGS +=-Wl,--gc-sections LDFLAGS +=-Wl,--gc-sections

View File

@ -167,8 +167,8 @@ CFLAGS += $(COMPILEFLAGS)
ASFLAGS += $(THUMBFLAGS) ASFLAGS += $(THUMBFLAGS)
CPPFLAGS += $(COMPILEFLAGS) CXXFLAGS += $(COMPILEFLAGS)
CPPFLAGS += -fno-rtti CXXFLAGS += -fno-rtti
LDFLAGS +=-Wl,--gc-sections LDFLAGS +=-Wl,--gc-sections
LDFLAGS +=-Wl,--no-wchar-size-warning LDFLAGS +=-Wl,--no-wchar-size-warning

View File

@ -1,13 +1,13 @@
SYSTEM_TYPE := $(shell gcc -dumpmachine) SYSTEM_TYPE := $(shell gcc -dumpmachine)
CC = gcc CC = gcc
OBJCOPY = OBJCOPY =
OBJDUMP = OBJDUMP =
SIZE = SIZE =
AR = AR =
NM = NM =
HEX = HEX =
EEP = EEP =
BIN = BIN =
@ -24,6 +24,6 @@ CFLAGS += $(COMPILEFLAGS)
CFLAGS += -fno-inline-small-functions CFLAGS += -fno-inline-small-functions
CFLAGS += -fno-strict-aliasing CFLAGS += -fno-strict-aliasing
CPPFLAGS += $(COMPILEFLAGS) CXXFLAGS += $(COMPILEFLAGS)
CPPFLAGS += -fno-exceptions CXXFLAGS += -fno-exceptions
CPPFLAGS += -std=gnu++11 CXXFLAGS += -std=gnu++11

View File

@ -65,9 +65,9 @@ CSTANDARD = -std=gnu99
# Place -D or -U options here for C++ sources # Place -D or -U options here for C++ sources
#CPPDEFS += -D__STDC_LIMIT_MACROS #CXXDEFS += -D__STDC_LIMIT_MACROS
#CPPDEFS += -D__STDC_CONSTANT_MACROS #CXXDEFS += -D__STDC_CONSTANT_MACROS
#CPPDEFS += #CXXDEFS +=
@ -111,24 +111,24 @@ CFLAGS += $(CSTANDARD)
# -Wa,...: tell GCC to pass this to the assembler. # -Wa,...: tell GCC to pass this to the assembler.
# -adhlns...: create assembler listing # -adhlns...: create assembler listing
ifndef SKIP_DEBUG_INFO ifndef SKIP_DEBUG_INFO
CPPFLAGS += -g$(DEBUG) CXXFLAGS += -g$(DEBUG)
endif endif
CPPFLAGS += $(CPPDEFS) CXXFLAGS += $(CXXDEFS)
CPPFLAGS += -O$(OPT) CXXFLAGS += -O$(OPT)
# to supress "warning: only initialized variables can be placed into program memory area" # to supress "warning: only initialized variables can be placed into program memory area"
CPPFLAGS += -w CXXFLAGS += -w
CPPFLAGS += -Wall CXXFLAGS += -Wall
CPPFLAGS += -Wundef CXXFLAGS += -Wundef
ifneq ($(strip $(ALLOW_WARNINGS)), yes) ifneq ($(strip $(ALLOW_WARNINGS)), yes)
CPPFLAGS += -Werror CXXFLAGS += -Werror
endif endif
#CPPFLAGS += -mshort-calls #CXXFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time #CXXFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes #CXXFLAGS += -Wstrict-prototypes
#CPPFLAGS += -Wunreachable-code #CXXFLAGS += -Wunreachable-code
#CPPFLAGS += -Wsign-compare #CXXFLAGS += -Wsign-compare
CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) CXXFLAGS += -Wa,-adhlns=$(@:%.o=%.lst)
#CPPFLAGS += $(CSTANDARD) #CXXFLAGS += $(CSTANDARD)
#---------------- Assembler Options ---------------- #---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler. # -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. # Add target processor to flags.
# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar # You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS) 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) ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
define NO_LTO define NO_LTO
@ -306,7 +306,7 @@ ifdef $1_CONFIG
$1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG)) $1_CONFIG_FLAGS += $$(patsubst %,-include %,$$($1_CONFIG))
endif endif
$1_CFLAGS = $$(ALL_CFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS) $$(NOLTO_CFLAGS) $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) $1_ASFLAGS= $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
# Compile: create object files from C source files. # 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) @$$(BUILD_CMD)
# Compile: create object files from C++ source files. # 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) @mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD) @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$($1_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$$(BUILD_CMD) @$$(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) @mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD) @$$(SILENT) || printf "$$(MSG_COMPILING_CXX) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$($1_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP)) $$(eval CMD=$$(CC) -c $$($1_CXXFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$$(BUILD_CMD) @$$(BUILD_CMD)
# Assemble: create object files from assembler source files. # Assemble: create object files from assembler source files.
@ -347,8 +347,8 @@ $1/force:
$1/cflags.txt: $1/force $1/cflags.txt: $1/force
echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@ echo '$$($1_CFLAGS)' | cmp -s - $$@ || echo '$$($1_CFLAGS)' > $$@
$1/cppflags.txt: $1/force $1/cxxflags.txt: $1/force
echo '$$($1_CPPFLAGS)' | cmp -s - $$@ || echo '$$($1_CPPFLAGS)' > $$@ echo '$$($1_CXXFLAGS)' | cmp -s - $$@ || echo '$$($1_CXXFLAGS)' > $$@
$1/asflags.txt: $1/force $1/asflags.txt: $1/force
echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@ echo '$$($1_ASFLAGS)' | cmp -s - $$@ || echo '$$($1_ASFLAGS)' > $$@