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))))) 7ccache-cmd := $(if $(findstring ccache,$(CROSS_COMPILE_$(sm))),$(firstword $(CROSS_COMPILE_$(sm))) ,) 8 9CC$(sm) := $(ccache-cmd)clang --target=$(clang-target) 10CXX$(sm) := false # Untested yet 11# Due to the absence of clang-cpp in AOSP's prebuilt version of clang, 12# use the equivalent command of 'clang -E' 13CPP$(sm) := $(ccache-cmd)clang --target=$(clang-target) -E 14LD$(sm) := $(ccache-cmd)ld.lld 15 16AR$(sm) := $(ccache-cmd)llvm-ar 17NM$(sm) := llvm-nm 18OBJCOPY$(sm) := llvm-objcopy 19OBJDUMP$(sm) := llvm-objdump 20READELF$(sm) := llvm-readelf 21 22nostdinc$(sm) := -nostdinc -isystem $(shell $(CC$(sm)) \ 23 -print-file-name=include 2> /dev/null) 24 25comp-cflags-warns-clang := -Wno-language-extension-token \ 26 -Wno-gnu-zero-variadic-macro-arguments 27 28# Note, use the compiler runtime library (libclang_rt.builtins.*.a) instead of 29# libgcc for clang 30libgcc$(sm) := $(shell $(CC$(sm)) $(CFLAGS$(arch-bits-$(sm))) \ 31 -rtlib=compiler-rt -print-libgcc-file-name 2> /dev/null) 32 33# Core ASLR relies on the executable being ready to run from its preferred load 34# address, because some symbols are used before the MMU is enabled and the 35# relocations are applied. 36ldflag-apply-dynamic-relocs := --apply-dynamic-relocs 37 38# Define these to something to discover accidental use 39CC := false 40CXX := false 41CPP := false 42LD := false 43AR := false 44NM := false 45OBJCOPY := false 46OBJDUMP := false 47READELF := false 48nostdinc := --bad-nostdinc-variable 49libgcc := --bad-libgcc-variable 50 51