author | Matthew Shyu <matthew.shyu@amlogic.com> | 2017-07-21 04:46:07 (GMT) |
---|---|---|
committer | Matthew Shyu <matthew.shyu@amlogic.com> | 2017-08-03 02:34:57 (GMT) |
commit | f7eaf0ba4046005b9b3acdae046e9310a3191b6f (patch) | |
tree | 27bc343bcb619a19c3ae7327a9080c74ef15a537 | |
parent | d2828ab249855f00565bf5f5d25fe92af02e12ed (diff) | |
download | tdk-f7eaf0ba4046005b9b3acdae046e9310a3191b6f.zip tdk-f7eaf0ba4046005b9b3acdae046e9310a3191b6f.tar.gz tdk-f7eaf0ba4046005b9b3acdae046e9310a3191b6f.tar.bz2 |
Enable C++ compiler
Change-Id: I0377027132745b1939479f78944b8e19e6ba652d
Signed-off-by: Matthew Shyu <matthew.shyu@amlogic.com>
-rw-r--r-- | ta_export/mk/compile.mk | 46 | ||||
-rw-r--r-- | ta_export/mk/conf.mk | 1 | ||||
-rw-r--r-- | ta_export/mk/gcc.mk | 2 | ||||
-rw-r--r-- | ta_export/mk/subdir.mk | 16 | ||||
-rw-r--r-- | ta_export/mk/ta_dev_kit.mk | 1 |
5 files changed, 66 insertions, 0 deletions
diff --git a/ta_export/mk/compile.mk b/ta_export/mk/compile.mk index d4fb632..84cf62a 100644 --- a/ta_export/mk/compile.mk +++ b/ta_export/mk/compile.mk @@ -17,13 +17,16 @@ objs := .SUFFIXES: comp-cflags$(sm) = -std=gnu99 +comp-cxxflags$(sm) = -std=c++11 -fno-exceptions -Wno-psabi -fno-rtti comp-aflags$(sm) = comp-cppflags$(sm) = ifndef NOWERROR comp-cflags$(sm) += -Werror +comp-cxxflags$(sm) += -Werror endif comp-cflags$(sm) += -fdiagnostics-show-option +comp-cxxflags$(sm) += -fdiagnostics-show-option comp-cflags-warns-high = \ -Wall -Wcast-align \ @@ -46,9 +49,30 @@ comp-cflags-warns-1:= $(comp-cflags-warns-high) comp-cflags-warns-2:= $(comp-cflags-warns-1) $(comp-cflags-warns-medium) comp-cflags-warns-3:= $(comp-cflags-warns-2) $(comp-cflags-warns-low) +comp-cxxflags-warns-high = \ + -Wall -Wcast-align \ + -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ + -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ + -Wmissing-declarations -Wmissing-format-attribute \ + -Wmissing-include-dirs -Wmissing-noreturn \ + -Wpointer-arith \ + -Wshadow -Wswitch-default \ + -Wwrite-strings \ + -Wno-missing-field-initializers -Wno-format-zero-length +comp-cxxflags-warns-medium = \ + -Waggregate-return -Wredundant-decls +comp-cxxflags-warns-low = \ + -Wstrict-aliasing=2 \ + -Wundef + +comp-cxxflags-warns-1:= $(comp-cxxflags-warns-high) +comp-cxxflags-warns-2:= $(comp-cxxflags-warns-1) $(comp-cxxflags-warns-medium) +comp-cxxflags-warns-3:= $(comp-cxxflags-warns-2) $(comp-cxxflags-warns-low) + WARNS ?= 3 comp-cflags$(sm) += $(comp-cflags-warns-$(WARNS)) +comp-cxxflags$(sm) += $(comp-cxxflags-warns-$(WARNS)) CHECK ?= sparse @@ -89,6 +113,20 @@ comp-flags-$2 = -DASM=1 $$(filter-out $$(AFLAGS_REMOVE) $$(aflags-remove) \ $$(AFLAGS) $$(comp-aflags$$(comp-sm-$2)) \ $$(aflags$$(comp-sm-$2)) $$(aflags-$2)) +else ifeq ($$(filter %.cpp,$1),$1) +comp-q-$2 := CXX +comp-flags-$2 = $$(filter-out $$(CXXFLAGS_REMOVE) $$(cxxflags-remove) \ + $$(cxxflags-remove-$$(comp-sm-$2)) \ + $$(cxxflags-remove-$2), \ + $$(CXXFLAGS$$(arch-bits-$$(comp-sm-$2))) $$(CXXFLAGS_WARNS) \ + $$(comp-cxxflags$$(comp-sm-$2)) $$(cxxflags$$(comp-sm-$2)) \ + $$(cxxflags-lib$$(comp-lib-$2)) $$(cxxflags-$2)) +ifeq ($C,1) +check-cmd-$2 = $(CHECK) $$(comp-cppflags-$2) $$< +echo-check-$2 := $(cmd-echo-silent) +echo-check-cmd-$2 = $(cmd-echo) $$(subst \",\\\",$$(check-cmd-$2)) +endif + else $$(error "Don't know what to do with $1") endif @@ -171,6 +209,14 @@ comp-flags-$3 = $$(filter-out $$(CFLAGS_REMOVE) $$(cflags-remove) \ $$(comp-cflags$$(comp-sm-$3)) $$(cflags$$(comp-sm-$3)) \ $$(cflags-lib$$(comp-lib-$3)) $$(cflags-$3)) +comp-cxxflags-$3 = $$(filter-out $$(CXXFLAGS_REMOVE) $$(cxxflags-remove) \ + $$(cxxflags-remove-$$(comp-sm-$3)) \ + $$(cxxflags-remove-$3), \ + $$(CXXFLAGS) $$(CXXFLAGS_WARNS) \ + $$(comp-cxxflags$$(comp-sm-$3)) $$(cxxflags$$(comp-sm-$3)) \ + $$(cxxflags-lib$$(comp-lib-$3)) $$(cxxflags-$3)) + + comp-cppflags-$3 = $$(filter-out $$(CPPFLAGS_REMOVE) $$(cppflags-remove) \ $$(cppflags-remove-$$(comp-sm-$3)) \ $$(cppflags-remove-$3), \ diff --git a/ta_export/mk/conf.mk b/ta_export/mk/conf.mk index af6c90a..3a9238b 100644 --- a/ta_export/mk/conf.mk +++ b/ta_export/mk/conf.mk @@ -4,6 +4,7 @@ CFG_TA_FLOAT_SUPPORT := y CFG_ARM32_ta_arm32 := y ta_arm32-platform-cppflags := -DARM32=1 -D__ILP32__=1 ta_arm32-platform-cflags := -mcpu=cortex-a9 -Os -g3 -fpie -mthumb -mthumb-interwork -fno-short-enums -fno-common -mno-unaligned-access -mfloat-abi=hard -funsafe-math-optimizations +ta_arm32-platform-cxxflags := -mcpu=cortex-a9 -Os -g3 -fpie -mthumb -mthumb-interwork -fno-short-enums -fno-common -mno-unaligned-access -mfloat-abi=hard -funsafe-math-optimizations ta_arm32-platform-aflags := -mcpu=cortex-a9 CROSS_COMPILE32 ?= $(CROSS_COMPILE) CROSS_COMPILE_ta_arm32 ?= $(CROSS_COMPILE32) diff --git a/ta_export/mk/gcc.mk b/ta_export/mk/gcc.mk index 76ad125..867c8b2 100644 --- a/ta_export/mk/gcc.mk +++ b/ta_export/mk/gcc.mk @@ -1,5 +1,6 @@ CC$(sm) := $(CROSS_COMPILE_$(sm))gcc +CXX$(sm) := $(CROSS_COMPILE_$(sm))g++ CPP$(sm) := $(CROSS_COMPILE_$(sm))cpp LD$(sm) := $(CROSS_COMPILE_$(sm))ld AR$(sm) := $(CROSS_COMPILE_$(sm))ar @@ -18,6 +19,7 @@ libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) $(comp-cflags$(s # Define these to something to discover accidental use CC := false CPP := false +CXX := false LD := false AR := false NM := false diff --git a/ta_export/mk/subdir.mk b/ta_export/mk/subdir.mk index 0cb5f71..c38c426 100644 --- a/ta_export/mk/subdir.mk +++ b/ta_export/mk/subdir.mk @@ -34,6 +34,9 @@ endif cflags-$$(oname) := $$(cflags-y) $$(cflags-$(1)-y) cflags-remove-$$(oname) := $$(cflags-remove-y) \ $$(cflags-remove-$(1)-y) +cxxflags-$$(oname) := $$(cxxflags-y) $$(cxxflags-$(1)-y) +cxxflags-remove-$$(oname) := $$(cxxflags-remove-y) \ + $$(cxxflags-remove-$(1)-y) cppflags-$$(oname) := $$(cppflags-y) $$(cppflags-$(1)-y) cppflags-remove-$$(oname) := $$(cppflags-remove-y) \ $$(cppflags-remove-$(1)-y) @@ -46,6 +49,9 @@ incdirs-$$(oname) := $$(thissubdir-incdirs) $$(addprefix $(sub-dir)/,$$(incdirs cflags-$(1)-y := cflags-remove-$(1)-y := cflags-lib-y := +cxxflags-$(1)-y := +cxxflags-remove-$(1)-y := +cxxflags-lib-y := cppflags-$(1)-y := cppflags-remove-$(1)-y := cppflags-lib-y := @@ -79,6 +85,9 @@ $2: $$(depends-$1) cflags-$$(oname) := $$(cflags-y) $$(cflags-$(1)-y) cflags-remove-$$(oname) := $$(cflags-remove-y) \ $$(cflags-remove-$(1)-y) +cxxflags-$$(oname) := $$(cxxflags-y) $$(cxxflags-$(1)-y) +cxxflags-remove-$$(oname) := $$(cxxflags-remove-y) \ + $$(cxxflags-remove-$(1)-y) cppflags-$$(oname) := $$(cppflags-y) $$(cppflags-$(1)-y) cppflags-remove-$$(oname) := $$(cppflags-remove-y) \ $$(cppflags-remove-$(1)-y) @@ -91,6 +100,9 @@ incdirs-$$(oname) := $$(thissubdir-incdirs) $$(addprefix $(sub-dir)/,$$(incdirs cflags-$(1)-y := cflags-remove-$(1)-y := cflags-lib-y := +cxxflags-$(1)-y := +cxxflags-remove-$(1)-y := +cxxflags-lib-y := cppflags-$(1)-y := cppflags-remove-$(1)-y := cppflags-lib-y := @@ -121,6 +133,7 @@ thissubdir-incdirs := $(out-dir)/$(base-prefix)$1 $$(addprefix $1/,$$(incdirs-y) ifneq ($$(libname),) incdirs-lib$$(libname)-$$(sm) := $$(incdirs-lib$$(libname)-$$(sm)) $$(addprefix $1/,$$(incdirs-lib-y)) cflags-lib$$(libname)-$$(sm) := $$(cflags-lib$$(libname)-$$(sm)) $$(cflags-lib-y) +cxxflags-lib$$(libname)-$$(sm) := $$(cxxflags-lib$$(libname)-$$(sm)) $$(cxxflags-lib-y) cppflags-lib$$(libname)-$$(sm) := $$(cppflags-lib$$(libname)-$$(sm)) $$(cppflags-lib-y) endif @@ -131,10 +144,13 @@ $$(foreach s, $$(srcs-y), $$(eval $$(call process-subdir-srcs-y,$$(s)))) srcs-y := cflags-y := cflags-lib-y := +cxxflags-y := +cxxflags-lib-y := cppflags-y := cppflags-lib-y := aflags-y := cflags-remove-y := +cxxflags-remove-y := subdirs-y := global-incdirs-y := incdirs-lib-y := diff --git a/ta_export/mk/ta_dev_kit.mk b/ta_export/mk/ta_dev_kit.mk index fab5df0..c421c3e 100644 --- a/ta_export/mk/ta_dev_kit.mk +++ b/ta_export/mk/ta_dev_kit.mk @@ -49,6 +49,7 @@ endif cppflags$(sm) := $($(sm)-platform-cppflags) $(CPPFLAGS_$(sm)) aflags$(sm) := $($(sm)-platform-aflags) cflags$(sm) := $($(sm)-platform-cflags) $(CFLAGS_$(sm)) +cxxflags$(sm) := $($(sm)-platform-cxxflags) $(CXXFLAGS_$(sm)) CFG_TEE_TA_LOG_LEVEL ?= 2 cppflags$(sm) += -DTRACE_LEVEL=$(CFG_TEE_TA_LOG_LEVEL) |