1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-1721 C++ compile review comments

This commit is contained in:
abeck70 2015-02-19 12:45:21 +11:00
parent b61a76eeae
commit 171d335d76
2 changed files with 11 additions and 7 deletions

View File

@ -155,13 +155,13 @@ endif
CDEFS += $(BOARD_CDEFS)
ifeq ($(DEBUG), YES)
CFLAGS += -DDEBUG
CPPFLAGS += -DDEBUG
else
CFLAGS += -fdata-sections -ffunction-sections
endif
ifeq ($(USE_CXX), YES)
CFLAGS += -DPIOS_ENABLE_CXX
CPPFLAGS += -DPIOS_ENABLE_CXX
endif
@ -172,8 +172,12 @@ CFLAGS += -MD -MP -MF $(OUTDIR)/dep/$(@F).d
#CONLYFLAGS += -Wnested-externs
CONLYFLAGS += $(CSTANDARD) -Wunsuffixed-float-constants
# CPP Flags
CPPFLAGS += -fno-rtti -fno-exceptions -std=c++11 -fno-use-cxa-atexit
# C++ Flags
# Note C++ compilation also uses CFLAGS. CONLYFLAGS has exclusions that
# can not be used with C++ compiler. C++ specific compile options are
# as set in CXXFLAGS. Note CPPFLAGS is for C pre-process and has not been
# used correctly - longer term move CDEFS to CPPFLAGS.
CXXFLAGS += -fno-rtti -fno-exceptions -std=c++11 -fno-use-cxa-atexit
# Assembler flags.
# -Wa,...: tell GCC to pass this to the assembler.

View File

@ -168,14 +168,14 @@ endef
define COMPILE_C_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@$(ECHO) $(MSG_COMPILING) $$(call toprel, $$<)
$(V1) $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
$(V1) $(CC) -c $(THUMB) $$(CFLAGS) $$(CONLYFLAGS) $$(CPPFLAGS) $$< -o $$@
endef
# Compile: create object files from C source files. ARM-only
define COMPILE_C_ARM_TEMPLATE
$(OUTDIR)/$(notdir $(basename $(1))).o : $(1)
@$(ECHO) $(MSG_COMPILING_ARM) $$(call toprel, $$<)
$(V1) $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$< -o $$@
$(V1) $(CC) -c $$(CFLAGS) $$(CONLYFLAGS) $$(CPPFLAGS) $$< -o $$@
endef
# Compile: create object files from C++ source files.
@ -225,7 +225,7 @@ define LINK_TEMPLATE
.PRECIOUS : $(2) $(3)
$(1): $(2) $(3)
@$(ECHO) $(MSG_LINKING) $$(call toprel, $$@)
$(V1) $(CC) $(THUMB) $$(CFLAGS) $(2) $(3) --output $$@ $$(LDFLAGS)
$(V1) $(CC) $(THUMB) $$(CFLAGS) $$(CPPFLAGS) $(2) $(3) --output $$@ $$(LDFLAGS)
endef
# Link: create ELF output file from object files.