From 92d79cbb41d8757ffa165e26e8ae42f4335e85f6 Mon Sep 17 00:00:00 2001 From: Tim Murray Date: Fri, 4 Apr 2014 14:38:29 -0700 Subject: [PATCH] Switch host builds to use Clang by default. If LOCAL_CLANG is not set to false for a host module, clang will be used instead of gcc. This also enables the integrated assembler by default for Darwin host builds. bug 16172793 Change-Id: If7484c5dbcccce7d925bec97bff0a3e4c30e9434 --- CleanSpec.mk | 3 +++ core/binary.mk | 8 ++++++++ core/clang/HOST_x86.mk | 4 ++++ core/clang/HOST_x86_64.mk | 4 ++++ core/clang/HOST_x86_common.mk | 6 +++++- core/clang/config.mk | 3 ++- 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index 7b317e272..fef406ccc 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -244,6 +244,9 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop) # dalvik.vm.image-dex2oat-Xms, and dalvik.vm.image-dex2oat-Xmx $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop) + +# Switch host builds to Clang by default +$(call add-clean-step, rm -rf $(OUT_DIR)/host) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/binary.mk b/core/binary.mk index e84343508..ac7e14f7e 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -130,6 +130,14 @@ ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) my_clang := $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) endif +# clang is enabled by default for host builds +# enable it unless we've specifically disabled clang above +ifdef LOCAL_IS_HOST_MODULE +ifeq ($(my_clang),) + my_clang := true +endif +endif + # arch-specific static libraries go first so that generic ones can depend on them my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries) my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries) diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk index 510a74dc3..fb5cbf4cb 100644 --- a/core/clang/HOST_x86.mk +++ b/core/clang/HOST_x86.mk @@ -11,6 +11,10 @@ CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA endif ifeq ($(HOST_OS),darwin) CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_ASFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_ASFLAGS) +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS) +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS) +CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS) endif ifeq ($(HOST_OS),windows) CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32 diff --git a/core/clang/HOST_x86_64.mk b/core/clang/HOST_x86_64.mk index 6b945258d..5f70678af 100644 --- a/core/clang/HOST_x86_64.mk +++ b/core/clang/HOST_x86_64.mk @@ -11,6 +11,10 @@ CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EX endif ifeq ($(HOST_OS),darwin) CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-apple-darwin +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_ASFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_ASFLAGS) +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS) +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CPPFLAGS) +CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_LDFLAGS) endif ifeq ($(HOST_OS),windows) CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64 diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk index 0241cb663..88208548c 100644 --- a/core/clang/HOST_x86_common.mk +++ b/core/clang/HOST_x86_common.mk @@ -1,7 +1,11 @@ # Shared by HOST_x86.mk and HOST_x86_64.mk. ifeq ($(HOST_OS),darwin) -# nothing required here yet +CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_ASFLAGS := \ + -integrated-as + +CLANG_CONFIG_x86_DARWIN_HOST_EXTRA_CFLAGS := \ + -integrated-as endif ifeq ($(HOST_OS),linux) diff --git a/core/clang/config.mk b/core/clang/config.mk index f50a0cb1a..59cb38ecb 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -41,7 +41,8 @@ CLANG_CONFIG_UNKNOWN_CFLAGS := \ -Wmaybe-uninitialized \ -Wno-maybe-uninitialized \ -Wno-error=maybe-uninitialized \ - -fno-canonical-system-headers + -fno-canonical-system-headers \ + -Wno-unused-local-typedefs # Clang flags for all host rules CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=