2014-03-11 02:23:08 +01:00
|
|
|
## Clang configurations.
|
|
|
|
|
|
|
|
# WITHOUT_CLANG covers both HOST and TARGET
|
|
|
|
ifeq ($(WITHOUT_CLANG),true)
|
|
|
|
WITHOUT_TARGET_CLANG := true
|
|
|
|
WITHOUT_HOST_CLANG := true
|
|
|
|
endif
|
|
|
|
|
2014-11-26 09:57:34 +01:00
|
|
|
LLVM_PREBUILTS_VERSION := 3.6
|
2014-09-17 07:55:08 +02:00
|
|
|
LLVM_PREBUILTS_PATH := prebuilts/clang/$(BUILD_OS)-x86/host/$(LLVM_PREBUILTS_VERSION)/bin
|
2014-02-19 18:03:00 +01:00
|
|
|
|
|
|
|
CLANG := $(LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
CLANG_CXX := $(LLVM_PREBUILTS_PATH)/clang++$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
LLVM_AS := $(LLVM_PREBUILTS_PATH)/llvm-as$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
LLVM_LINK := $(LLVM_PREBUILTS_PATH)/llvm-link$(BUILD_EXECUTABLE_SUFFIX)
|
2014-04-30 22:54:32 +02:00
|
|
|
|
2014-09-30 11:37:20 +02:00
|
|
|
CLANG_TBLGEN := $(BUILD_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
|
|
|
|
LLVM_TBLGEN := $(BUILD_OUT_EXECUTABLES)/llvm-tblgen$(BUILD_EXECUTABLE_SUFFIX)
|
2014-02-07 03:08:44 +01:00
|
|
|
|
2014-07-29 23:08:33 +02:00
|
|
|
# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars.
|
|
|
|
ifdef CC_WRAPPER
|
|
|
|
ifneq ($(CC_WRAPPER),$(firstword $(CLANG)))
|
|
|
|
CLANG := $(CC_WRAPPER) $(CLANG)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifdef CXX_WRAPPER
|
|
|
|
ifneq ($(CXX_WRAPPER),$(firstword $(CLANG_CXX)))
|
|
|
|
CLANG_CXX := $(CXX_WRAPPER) $(CLANG_CXX)
|
|
|
|
endif
|
|
|
|
endif
|
2014-02-07 03:08:44 +01:00
|
|
|
|
|
|
|
# Clang flags for all host or target rules
|
|
|
|
CLANG_CONFIG_EXTRA_ASFLAGS :=
|
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS :=
|
2014-11-26 09:57:34 +01:00
|
|
|
CLANG_CONFIG_EXTRA_CONLYFLAGS := -std=gnu99
|
2014-02-07 03:08:44 +01:00
|
|
|
CLANG_CONFIG_EXTRA_CPPFLAGS :=
|
|
|
|
CLANG_CONFIG_EXTRA_LDFLAGS :=
|
|
|
|
|
2014-06-17 23:36:05 +02:00
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS += \
|
2014-02-07 03:08:44 +01:00
|
|
|
-D__compiler_offsetof=__builtin_offsetof
|
|
|
|
|
2014-06-17 23:36:05 +02:00
|
|
|
# Help catch common 32/64-bit errors.
|
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS += \
|
|
|
|
-Werror=int-conversion
|
|
|
|
|
2014-10-18 00:07:24 +02:00
|
|
|
# Workaround for ccache with clang.
|
|
|
|
# See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
|
|
|
|
CLANG_CONFIG_EXTRA_CFLAGS += \
|
2014-11-04 08:39:49 +01:00
|
|
|
-Wno-unused-command-line-argument
|
2014-10-18 00:07:24 +02:00
|
|
|
|
2014-11-26 09:57:34 +01:00
|
|
|
# Disable -Winconsistent-missing-override until we can clean up the existing
|
|
|
|
# codebase for it.
|
|
|
|
CLANG_CONFIG_EXTRA_CPPFLAGS += \
|
|
|
|
-Wno-inconsistent-missing-override
|
|
|
|
|
2014-02-07 03:08:44 +01:00
|
|
|
CLANG_CONFIG_UNKNOWN_CFLAGS := \
|
2014-11-26 09:57:34 +01:00
|
|
|
-finline-functions \
|
2014-05-12 16:05:14 +02:00
|
|
|
-finline-limit=64 \
|
2014-08-27 01:37:00 +02:00
|
|
|
-fno-canonical-system-headers \
|
|
|
|
-fno-tree-sra \
|
|
|
|
-funswitch-loops \
|
|
|
|
-Wmaybe-uninitialized \
|
|
|
|
-Wno-error=maybe-uninitialized \
|
2014-10-24 01:39:09 +02:00
|
|
|
-Wno-free-nonheap-object \
|
2014-08-27 01:37:00 +02:00
|
|
|
-Wno-literal-suffix \
|
|
|
|
-Wno-maybe-uninitialized \
|
|
|
|
-Wno-old-style-declaration \
|
2014-02-07 03:08:44 +01:00
|
|
|
-Wno-psabi \
|
|
|
|
-Wno-unused-but-set-variable \
|
2014-05-09 08:13:13 +02:00
|
|
|
-Wno-unused-but-set-parameter \
|
2014-08-27 01:37:00 +02:00
|
|
|
-Wno-unused-local-typedefs
|
2014-02-07 03:08:44 +01:00
|
|
|
|
|
|
|
# Clang flags for all host rules
|
2014-04-21 23:00:31 +02:00
|
|
|
CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=
|
|
|
|
CLANG_CONFIG_HOST_EXTRA_CFLAGS :=
|
|
|
|
CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
|
|
|
|
CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
|
2014-02-07 03:08:44 +01:00
|
|
|
|
|
|
|
# Clang flags for all target rules
|
|
|
|
CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
|
|
|
|
CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
|
|
|
|
CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc
|
|
|
|
CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
|
|
|
|
|
|
|
|
# HOST config
|
2014-04-17 19:03:35 +02:00
|
|
|
clang_2nd_arch_prefix :=
|
2014-02-07 03:08:44 +01:00
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk
|
2014-04-17 19:03:35 +02:00
|
|
|
|
|
|
|
# HOST_2ND_ARCH config
|
|
|
|
ifdef HOST_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_2ND_ARCH).mk
|
2014-03-20 21:48:35 +01:00
|
|
|
endif
|
2014-02-07 03:08:44 +01:00
|
|
|
|
|
|
|
# TARGET config
|
|
|
|
clang_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk
|
|
|
|
|
|
|
|
# TARGET_2ND_ARCH config
|
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
clang_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Address sanitizer clang config
|
2014-02-21 15:10:53 +01:00
|
|
|
ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan_$(TARGET_ARCH)_android
|
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address -fno-omit-frame-pointer
|
2014-02-07 03:08:44 +01:00
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
|
2014-10-20 20:37:18 +02:00
|
|
|
|
2014-11-15 02:15:00 +01:00
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl $(ADDRESS_SANITIZER_RUNTIME_LIBRARY)
|
|
|
|
ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
|
2014-02-07 03:08:44 +01:00
|
|
|
|
|
|
|
# This allows us to use the superset of functionality that compiler-rt
|
|
|
|
# provides to Clang (for supporting features like -ftrapv).
|
|
|
|
COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
|
2014-11-06 23:11:33 +01:00
|
|
|
|
|
|
|
ifeq ($(HOST_PREFER_32_BIT),true)
|
|
|
|
# We don't have 32-bit prebuilt libLLVM/libclang, so force to build them from source.
|
|
|
|
FORCE_BUILD_LLVM_COMPONENTS := true
|
|
|
|
endif
|