1# CROSS_COMPILE_$(sm) is derived from CROSS_COMPILE/CROSS_COMPILE32/ 2# CROSS_COMPILE64 and indicates the target that should be passed to clang. Path 3# components are ignored, as well as any command before the compiler name (for 4# instance "/some/path/ccache /other/path/arm-linux-gnueabihf-"). 5# We try to extract any ccache command if present. 6clang-target := $(patsubst %-,%,$(notdir $(lastword $(CROSS_COMPILE_$(sm))))) 7ifeq ($(clang-target),aarch64-linux) 8clang-target := aarch64-linux-gnu 9endif 10ccache-cmd := $(if $(findstring ccache,$(CROSS_COMPILE_$(sm))),$(firstword $(CROSS_COMPILE_$(sm))) ,) 11 12CC$(sm) := $(ccache-cmd)$(OPTEE_CLANG_COMPILER_PATH)clang --target=$(clang-target) 13CXX$(sm) := false # Untested yet 14# Due to the absence of clang-cpp in AOSP's prebuilt version of clang, 15# use the equivalent command of 'clang -E' 16CPP$(sm) := $(ccache-cmd)$(OPTEE_CLANG_COMPILER_PATH)clang --target=$(clang-target) -E 17LD$(sm) := $(ccache-cmd)$(OPTEE_CLANG_COMPILER_PATH)ld.lld 18 19AR$(sm) := $(ccache-cmd)$(OPTEE_CLANG_COMPILER_PATH)llvm-ar 20NM$(sm) := $(OPTEE_CLANG_COMPILER_PATH)llvm-nm 21OBJCOPY$(sm) := $(OPTEE_CLANG_COMPILER_PATH)llvm-objcopy 22OBJDUMP$(sm) := $(OPTEE_CLANG_COMPILER_PATH)llvm-objdump 23READELF$(sm) := $(OPTEE_CLANG_COMPILER_PATH)llvm-readelf 24 25nostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \ 26 -print-file-name=include 2> /dev/null) 27 28comp-cflags-warns-clang := -Wno-language-extension-token \ 29 -Wno-gnu-zero-variadic-macro-arguments \ 30 -Wno-gnu-alignof-expression 31 32# Core ASLR relies on the executable being ready to run from its preferred load 33# address, because some symbols are used before the MMU is enabled and the 34# relocations are applied. 35ldflag-apply-dynamic-relocs := --apply-dynamic-relocs 36 37# Define these to something to discover accidental use 38CC := false 39CXX := false 40CPP := false 41LD := false 42AR := false 43NM := false 44OBJCOPY := false 45OBJDUMP := false 46READELF := false 47nostdinc := --bad-nostdinc-variable 48libgcc := --bad-libgcc-variable 49 50