summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2014-04-17 10:03:35 -0700
committerYing Wang <wangying@google.com>2014-05-14 16:55:04 -0700
commit6feb6d5607ce86a446645564212043964628f540 (patch)
tree082c2e4dfdcbfe7ff90dcee210b0de488cb54610
parentda492d7ed029b721bef02ca02d98148d5d9f4b3d (diff)
downloadbuild-6feb6d5607ce86a446645564212043964628f540.zip
build-6feb6d5607ce86a446645564212043964628f540.tar.gz
build-6feb6d5607ce86a446645564212043964628f540.tar.bz2
Support host multilib build
This change basically ported our target multilib to the host side. It supports 2 host build modes: x86 and x86_64 multilib build. For now you need to set "BUILD_HOST_64bit=true" to switch to x86_64 multilib build. Later we'll default to x86_64 build and have a flag to force 32-bit only build, which may be needed by SDK build. In host module definition, like in target ones, you can use the following LOCAL variables to set up multilib configuration: LOCAL_MULTILIB: can be "both", "first", "32" or "64". It also supports the same set of arch or 32-vs-64 specific LOCAL variables. By default, it builds only for the first arch. To keep path compatibility, in x86_64 build files are still output to out/host/linux-x86; Both 32-bit and 64-bit executables are in out/host/linux-86/bin; In x86_64 build 32-bit shared libraries are installed to out/host/linux-x86/lib32 and 64-bit shared libraries are installed to out/host/linux-x86/lib; 32-bit object files are output to out/host/linux-x86/obj32 and 64-bit object files are output to out/host/linux-x86/obj. Bug: 13751317 Change-Id: I6044f83b7db369a33e05209e8c588eb6dc83409f
-rw-r--r--core/base_rules.mk12
-rw-r--r--core/binary.mk40
-rw-r--r--core/clang/HOST_x86.mk16
-rw-r--r--core/clang/HOST_x86_64.mk2
-rw-r--r--core/clang/HOST_x86_common.mk56
-rw-r--r--core/clang/config.mk9
-rw-r--r--core/clear_vars.mk30
-rw-r--r--core/combo/HOST_darwin-x86.mk138
-rw-r--r--core/combo/HOST_darwin-x86_64.mk80
-rw-r--r--core/combo/HOST_linux-x86.mk55
-rw-r--r--core/combo/HOST_linux-x86_64.mk55
-rw-r--r--core/combo/HOST_windows-x86.mk36
-rw-r--r--core/combo/HOST_windows-x86_64.mk68
-rw-r--r--core/combo/mac_version.mk50
-rw-r--r--core/combo/select.mk10
-rw-r--r--core/config.mk20
-rw-r--r--core/configure_module_stem.mk2
-rw-r--r--core/definitions.mk30
-rw-r--r--core/dynamic_binary.mk2
-rw-r--r--core/envsetup.mk51
-rw-r--r--core/executable.mk1
-rw-r--r--core/host_executable.mk64
-rw-r--r--core/host_executable_internal.mk33
-rw-r--r--core/host_shared_library.mk66
-rw-r--r--core/host_shared_library_internal.mk46
-rw-r--r--core/host_static_library.mk49
-rw-r--r--core/host_static_library_internal.mk27
-rw-r--r--core/main.mk8
-rw-r--r--core/module_arch_supported.mk31
-rw-r--r--core/package.mk1
-rw-r--r--core/prebuilt.mk13
-rw-r--r--core/prebuilt_internal.mk9
-rw-r--r--core/product_config.mk2
-rw-r--r--core/shared_library.mk1
-rw-r--r--core/static_library.mk1
-rw-r--r--core/static_library_internal.mk1
-rw-r--r--libs/host/Android.mk2
-rw-r--r--tools/acp/Android.mk3
38 files changed, 775 insertions, 345 deletions
diff --git a/core/base_rules.mk b/core/base_rules.mk
index c68fba7..801e2c8 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -98,16 +98,10 @@ ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
endif
-ifndef LOCAL_IS_HOST_MODULE
-my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32)
-endif
+my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32)
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
-ifndef LOCAL_IS_HOST_MODULE
my_multilib_module_path := $(strip $(LOCAL_MODULE_PATH_$(my_32_64_bit_suffix)))
-else
-my_multilib_module_path :=
-endif
ifdef my_multilib_module_path
my_module_path := $(my_multilib_module_path)
else
@@ -148,7 +142,7 @@ endif
my_register_name := $(LOCAL_MODULE)
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX
-my_register_name := $(LOCAL_MODULE)$(TARGET_2ND_ARCH_MODULE_SUFFIX)
+my_register_name := $(LOCAL_MODULE)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX)
endif
endif
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
@@ -516,6 +510,8 @@ $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
+$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
+
# Tell the module and all of its sub-modules who it is.
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name)
diff --git a/core/binary.mk b/core/binary.mk
index 9dab23f..4af3da1 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -113,22 +113,20 @@ my_cxx := $(LOCAL_CXX)
my_c_includes := $(LOCAL_C_INCLUDES)
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
-ifndef LOCAL_IS_HOST_MODULE
-my_src_files += $(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
-my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix))
-my_cflags += $(LOCAL_CFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix))
-my_cppflags += $(LOCAL_CPPFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix))
-my_ldflags += $(LOCAL_LDFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix))
-my_asflags += $(LOCAL_ASFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix))
-my_c_includes += $(LOCAL_C_INCLUDES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix))
-my_generated_sources += $(LOCAL_GENERATED_SOURCES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix))
+my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
+my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix))
+my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix))
+my_cppflags += $(LOCAL_CPPFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CPPFLAGS_$(my_32_64_bit_suffix))
+my_ldflags += $(LOCAL_LDFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_LDFLAGS_$(my_32_64_bit_suffix))
+my_asflags += $(LOCAL_ASFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_ASFLAGS_$(my_32_64_bit_suffix))
+my_c_includes += $(LOCAL_C_INCLUDES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_C_INCLUDES_$(my_32_64_bit_suffix))
+my_generated_sources += $(LOCAL_GENERATED_SOURCES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_GENERATED_SOURCES_$(my_32_64_bit_suffix))
# arch-specific static libraries go first so that generic ones can depend on them
-my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$(TARGET_$(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_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
+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)
-my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
-endif
+my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
# Add static HAL libraries
ifdef LOCAL_HAL_STATIC_LIBRARIES
@@ -234,15 +232,15 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_glob
else # LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_CLANG),true)
-my_host_global_cflags := $(CLANG_HOST_GLOBAL_CFLAGS)
-my_host_global_cppflags := $(CLANG_HOST_GLOBAL_CPPFLAGS)
-my_host_global_ldflags := $(CLANG_HOST_GLOBAL_LDFLAGS)
-my_host_c_includes := $(HOST_C_INCLUDES) $(CLANG_CONFIG_EXTRA_HOST_C_INCLUDES)
+my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CFLAGS)
+my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_CPPFLAGS)
+my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_HOST_GLOBAL_LDFLAGS)
+my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_C_INCLUDES) $(CLANG_CONFIG_EXTRA_HOST_C_INCLUDES)
else
-my_host_global_cflags := $(HOST_GLOBAL_CFLAGS)
-my_host_global_cppflags := $(HOST_GLOBAL_CPPFLAGS)
-my_host_global_ldflags := $(HOST_GLOBAL_LDFLAGS)
-my_host_c_includes := $(HOST_C_INCLUDES)
+my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CFLAGS)
+my_host_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CPPFLAGS)
+my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LDFLAGS)
+my_host_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_C_INCLUDES)
endif # LOCAL_CLANG
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
index ee61e5e..510a74d 100644
--- a/core/clang/HOST_x86.mk
+++ b/core/clang/HOST_x86.mk
@@ -1,6 +1,6 @@
include $(BUILD_SYSTEM)/clang/x86.mk
-include $(BUILD_SYSTEM)/clang/x86_common.mk
+include $(BUILD_SYSTEM)/clang/HOST_x86_common.mk
ifeq ($(HOST_OS),linux)
CLANG_CONFIG_x86_HOST_TRIPLE := i686-linux-gnu
@@ -44,21 +44,21 @@ CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS := \
$(CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS) \
-target $(CLANG_CONFIG_x86_HOST_TRIPLE)
-define convert-to-host-clang-flags
+define $(clang_2nd_arch_prefix)convert-to-host-clang-flags
$(strip \
$(call subst-clang-incompatible-x86-flags,\
$(filter-out $(CLANG_CONFIG_x86_UNKNOWN_CFLAGS),\
$(1))))
endef
-CLANG_HOST_GLOBAL_CFLAGS := \
- $(call convert-to-host-clang-flags,$(HOST_GLOBAL_CFLAGS)) \
+$(clang_2nd_arch_prefix)CLANG_HOST_GLOBAL_CFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_GLOBAL_CFLAGS)) \
$(CLANG_CONFIG_x86_HOST_EXTRA_CFLAGS)
-CLANG_HOST_GLOBAL_CPPFLAGS := \
- $(call convert-to-host-clang-flags,$(HOST_GLOBAL_CPPFLAGS)) \
+$(clang_2nd_arch_prefix)CLANG_HOST_GLOBAL_CPPFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_GLOBAL_CPPFLAGS)) \
$(CLANG_CONFIG_x86_HOST_EXTRA_CPPFLAGS)
-CLANG_HOST_GLOBAL_LDFLAGS := \
- $(call convert-to-host-clang-flags,$(HOST_GLOBAL_LDFLAGS)) \
+$(clang_2nd_arch_prefix)CLANG_HOST_GLOBAL_LDFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-host-clang-flags,$($(clang_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS)) \
$(CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS)
diff --git a/core/clang/HOST_x86_64.mk b/core/clang/HOST_x86_64.mk
index d60e15f..6b94525 100644
--- a/core/clang/HOST_x86_64.mk
+++ b/core/clang/HOST_x86_64.mk
@@ -1,6 +1,6 @@
include $(BUILD_SYSTEM)/clang/x86_64.mk
-include $(BUILD_SYSTEM)/clang/x86_common.mk
+include $(BUILD_SYSTEM)/clang/HOST_x86_common.mk
ifeq ($(HOST_OS),linux)
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-linux-gnu
diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk
new file mode 100644
index 0000000..0241cb6
--- /dev/null
+++ b/core/clang/HOST_x86_common.mk
@@ -0,0 +1,56 @@
+# Shared by HOST_x86.mk and HOST_x86_64.mk.
+
+ifeq ($(HOST_OS),darwin)
+# nothing required here yet
+endif
+
+ifeq ($(HOST_OS),linux)
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -no-integrated-as
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ -no-integrated-as
+
+ifneq ($(strip $($(clang_2nd_arch_prefix)HOST_IS_64_BIT)),)
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \
+ -no-integrated-as
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \
+ -no-integrated-as
+else
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux/32 \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \
+ -no-integrated-as
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \
+ -no-integrated-as
+endif
+endif # Linux
+
+ifeq ($(HOST_OS),windows)
+# nothing required here yet
+endif
diff --git a/core/clang/config.mk b/core/clang/config.mk
index c598e7d..d44be52 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -47,10 +47,13 @@ CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc
CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
# HOST config
-ifneq ($(strip $(BUILD_HOST_64bit)),)
-include $(BUILD_SYSTEM)/clang/HOST_x86_64.mk
-else
+clang_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk
+
+# 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
endif
# TARGET config
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 5342fd2..682656b 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -148,6 +148,10 @@ LOCAL_MODULE_TARGET_ARCH:=
LOCAL_MODULE_TARGET_ARCH_WARN:=
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH:=
LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN:=
+LOCAL_MODULE_HOST_ARCH:=
+LOCAL_MODULE_HOST_ARCH_WARN:=
+LOCAL_MODULE_UNSUPPORTED_HOST_ARCH:=
+LOCAL_MODULE_UNSUPPORTED_HOST_ARCH_WARN:=
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=
@@ -176,6 +180,32 @@ LOCAL_WHOLE_STATIC_LIBRARIES_$(TARGET_2ND_ARCH):=
LOCAL_GENERATED_SOURCES_$(TARGET_2ND_ARCH):=
LOCAL_REQUIRED_MODULES_$(TARGET_2ND_ARCH):=
endif
+LOCAL_SRC_FILES_$(HOST_ARCH):=
+LOCAL_CFLAGS_$(HOST_ARCH):=
+LOCAL_CPPFLAGS_$(HOST_ARCH):=
+LOCAL_C_INCLUDES_$(HOST_ARCH):=
+LOCAL_ASFLAGS_$(HOST_ARCH):=
+LOCAL_NO_CRT_$(HOST_ARCH):=
+LOCAL_LDFLAGS_$(HOST_ARCH):=
+LOCAL_SHARED_LIBRARIES_$(HOST_ARCH):=
+LOCAL_STATIC_LIBRARIES_$(HOST_ARCH):=
+LOCAL_WHOLE_STATIC_LIBRARIES_$(HOST_ARCH):=
+LOCAL_GENERATED_SOURCES_$(HOST_ARCH):=
+LOCAL_REQUIRED_MODULES_$(HOST_ARCH):=
+ifdef HOST_2ND_ARCH
+LOCAL_SRC_FILES_$(HOST_2ND_ARCH):=
+LOCAL_CFLAGS_$(HOST_2ND_ARCH):=
+LOCAL_CPPFLAGS_$(HOST_2ND_ARCH):=
+LOCAL_C_INCLUDES_$(HOST_2ND_ARCH):=
+LOCAL_ASFLAGS_$(HOST_2ND_ARCH):=
+LOCAL_NO_CRT_$(HOST_2ND_ARCH):=
+LOCAL_LDFLAGS_$(HOST_2ND_ARCH):=
+LOCAL_SHARED_LIBRARIES_$(HOST_2ND_ARCH):=
+LOCAL_STATIC_LIBRARIES_$(HOST_2ND_ARCH):=
+LOCAL_WHOLE_STATIC_LIBRARIES_$(HOST_2ND_ARCH):=
+LOCAL_GENERATED_SOURCES_$(HOST_2ND_ARCH):=
+LOCAL_REQUIRED_MODULES_$(HOST_2ND_ARCH):=
+endif
LOCAL_SRC_FILES_32:=
LOCAL_SRC_FILES_64:=
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index b819f36..d665c76 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -17,115 +17,75 @@
# Configuration for Darwin (Mac OS X) on x86.
# Included by combo/select.mk
-ifneq ($(strip $(BUILD_HOST_64bit)),)
-# By default we build everything in 32-bit, because it gives us
-# more consistency between the host tools and the target.
-# BUILD_HOST_64bit=1 overrides it for tool like emulator
-# which can benefit from 64-bit host arch.
-HOST_GLOBAL_CFLAGS += -m64
-HOST_GLOBAL_LDFLAGS += -m64
-else
-HOST_GLOBAL_CFLAGS += -m32
-HOST_GLOBAL_LDFLAGS += -m32
-endif # BUILD_HOST_64bit
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -m32
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32
ifneq ($(strip $(BUILD_HOST_static)),)
# Statically-linked binaries are desirable for sandboxed environment
-HOST_GLOBAL_LDFLAGS += -static
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
endif # BUILD_HOST_static
# Workaround differences in inttypes.h between host and target.
# See bug 12708004.
-HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
-
-build_mac_version := $(shell sw_vers -productVersion)
-
-mac_sdk_versions_supported := 10.6 10.7 10.8
-ifneq ($(strip $(MAC_SDK_VERSION)),)
-mac_sdk_version := $(MAC_SDK_VERSION)
-ifeq ($(filter $(mac_sdk_version),$(mac_sdk_versions_supported)),)
-$(warning ****************************************************************)
-$(warning * MAC_SDK_VERSION $(MAC_SDK_VERSION) isn't one of the supported $(mac_sdk_versions_supported))
-$(warning ****************************************************************)
-$(error Stop.)
-endif
-else
-mac_sdk_versions_installed := $(shell xcodebuild -showsdks | grep macosx | sort | sed -e "s/.*macosx//g")
-mac_sdk_version := $(firstword $(filter $(mac_sdk_versions_installed), $(mac_sdk_versions_supported)))
-ifeq ($(mac_sdk_version),)
-mac_sdk_version := $(firstword $(mac_sdk_versions_supported))
-endif
-endif
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
-mac_sdk_path := $(shell xcode-select -print-path)
-# try /Applications/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.?.sdk
-# or /Volume/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.?.sdk
-mac_sdk_root := $(mac_sdk_path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(mac_sdk_version).sdk
-ifeq ($(wildcard $(mac_sdk_root)),)
-# try legacy /Developer/SDKs/MacOSX10.?.sdk
-mac_sdk_root := /Developer/SDKs/MacOSX$(mac_sdk_version).sdk
-endif
-ifeq ($(wildcard $(mac_sdk_root)),)
-$(warning *****************************************************)
-$(warning * Can not find SDK $(mac_sdk_version) at $(mac_sdk_root))
-$(warning *****************************************************)
-$(error Stop.)
-endif
-
-ifeq ($(mac_sdk_version),10.6)
- gcc_darwin_version := 10
-else
- gcc_darwin_version := 11
-endif
+include $(BUILD_COMBOS)/mac_version.mk
-HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1
-HOST_TOOLCHAIN_PREFIX := $(HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version)
+$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1
+$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version)
# Don't do anything if the toolchain is not there
-ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)-gcc)))
-HOST_CC := $(HOST_TOOLCHAIN_PREFIX)-gcc
-HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++
+ifneq (,$(strip $(wildcard $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-gcc)))
+$(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-gcc
+$(combo_2nd_arch_prefix)HOST_CXX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)-g++
ifeq ($(mac_sdk_version),10.8)
# Mac SDK 10.8 no longer has stdarg.h, etc
-host_toolchain_header := $(HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include
-HOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header)
+host_toolchain_header := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header)
endif
else
-HOST_CC := gcc
-HOST_CXX := g++
+$(combo_2nd_arch_prefix)HOST_CC := gcc
+$(combo_2nd_arch_prefix)HOST_CXX := g++
endif # $(HOST_TOOLCHAIN_PREFIX)-gcc exists
-HOST_AR := $(AR)
-HOST_STRIP := $(STRIP)
-HOST_STRIP_COMMAND = $(HOST_STRIP) --strip-all $< -o $@
-HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
-HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
+# gcc location for clang; to be updated when clang is updated
+# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
+HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT)
+
+$(combo_2nd_arch_prefix)HOST_AR := $(AR)
-HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
-HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
-HOST_SHLIB_SUFFIX := .dylib
-HOST_JNILIB_SUFFIX := .jnilib
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
+$(combo_2nd_arch_prefix)HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
-HOST_GLOBAL_CFLAGS += \
+$(combo_2nd_arch_prefix)HOST_SHLIB_SUFFIX := .dylib
+$(combo_2nd_arch_prefix)HOST_JNILIB_SUFFIX := .jnilib
+
+# TODO: add AndroidConfig.h for darwin-x86_64
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += \
-include $(call select-android-config-h,darwin-x86)
ifneq ($(filter 10.7 10.7.% 10.8 10.8.%, $(build_mac_version)),)
- HOST_RUN_RANLIB_AFTER_COPYING := false
+ $(combo_2nd_arch_prefix)HOST_RUN_RANLIB_AFTER_COPYING := false
else
- HOST_RUN_RANLIB_AFTER_COPYING := true
+ $(combo_2nd_arch_prefix)HOST_RUN_RANLIB_AFTER_COPYING := true
PRE_LION_DYNAMIC_LINKER_OPTIONS := -Wl,-dynamic
endif
-HOST_GLOBAL_ARFLAGS := cqs
+$(combo_2nd_arch_prefix)HOST_GLOBAL_ARFLAGS := cqs
+
+############################################################
+## Macros after this line are shared by the 64-bit config.
HOST_CUSTOM_LD_COMMAND := true
define transform-host-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-dynamiclib -single_module -read_only_relocs suppress \
- $(HOST_GLOBAL_LD_DIRS) \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
- ) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
+ $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
+ ) \
$(PRIVATE_ALL_OBJECTS) \
$(addprefix -force_load , $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
@@ -133,34 +93,28 @@ $(hide) $(PRIVATE_CXX) \
$(PRIVATE_LDLIBS) \
-o $@ \
-install_name @rpath/$(notdir $@) \
- -Wl,-rpath,@loader_path/../lib \
- $(PRIVATE_LDFLAGS) \
- $(HOST_LIBGCC)
+ -Wl,-rpath,@loader_path/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
+ $(PRIVATE_LDFLAGS)
endef
define transform-host-o-to-executable-inner
$(hide) $(PRIVATE_CXX) \
- -Wl,-rpath,@loader_path/../lib \
+ -Wl,-rpath,@loader_path/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
-o $@ \
$(PRE_LION_DYNAMIC_LINKER_OPTIONS) -Wl,-headerpad_max_install_names \
- $(HOST_GLOBAL_LD_DIRS) \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
- ) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
+ $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
+ ) \
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
$(PRIVATE_ALL_OBJECTS) \
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_LDLIBS) \
- $(HOST_LIBGCC)
+ $(PRIVATE_LDLIBS)
endef
# $(1): The file to check
define get-file-size
stat -f "%z" $(1)
endef
-
-# gcc location for clang; to be updated when clang is updated
-# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
-HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT) \ No newline at end of file
diff --git a/core/combo/HOST_darwin-x86_64.mk b/core/combo/HOST_darwin-x86_64.mk
new file mode 100644
index 0000000..8ad3ba7
--- /dev/null
+++ b/core/combo/HOST_darwin-x86_64.mk
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for Darwin (Mac OS X) on x86_64.
+# Included by combo/select.mk
+
+HOST_IS_64_BIT := true
+
+HOST_GLOBAL_CFLAGS += -m64
+HOST_GLOBAL_LDFLAGS += -m64
+
+ifneq ($(strip $(BUILD_HOST_static)),)
+# Statically-linked binaries are desirable for sandboxed environment
+HOST_GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+
+include $(BUILD_COMBOS)/mac_version.mk
+
+HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1
+HOST_TOOLCHAIN_PREFIX := $(HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version)
+# Don't do anything if the toolchain is not there
+ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)-gcc)))
+HOST_CC := $(HOST_TOOLCHAIN_PREFIX)-gcc
+HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++
+ifeq ($(mac_sdk_version),10.8)
+# Mac SDK 10.8 no longer has stdarg.h, etc
+host_toolchain_header := $(HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include
+HOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header)
+endif
+else
+HOST_CC := gcc
+HOST_CXX := g++
+endif # $(HOST_TOOLCHAIN_PREFIX)-gcc exists
+
+# gcc location for clang; to be updated when clang is updated
+# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
+HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT)
+
+HOST_AR := $(AR)
+
+HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
+HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
+
+HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
+HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
+
+HOST_SHLIB_SUFFIX := .dylib
+HOST_JNILIB_SUFFIX := .jnilib
+
+HOST_GLOBAL_CFLAGS += \
+ -include $(call select-android-config-h,darwin-x86)
+
+ifneq ($(filter 10.7 10.7.% 10.8 10.8.%, $(build_mac_version)),)
+ HOST_RUN_RANLIB_AFTER_COPYING := false
+else
+ HOST_RUN_RANLIB_AFTER_COPYING := true
+endif
+HOST_GLOBAL_ARFLAGS := cqs
+
+# We Reuse the following functions with the same name from HOST_darwin-x86.mk:
+# transform-host-o-to-shared-lib-inner
+# transform-host-o-to-executable-inner
+# get-file-size
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 1472849..c931937 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -17,49 +17,46 @@
# Configuration for builds hosted on linux-x86.
# Included by combo/select.mk
-# $(1): The file to check
-define get-file-size
-stat --format "%s" "$(1)" | tr -d '\n'
-endef
-
-ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),)
-HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-
+ifeq ($(strip $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)),)
+$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-
endif
# Don't do anything if the toolchain is not there
-ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc)))
-HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc
-HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++
-HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar
-endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists
+ifneq (,$(strip $(wildcard $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc)))
+$(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc
+$(combo_2nd_arch_prefix)HOST_CXX := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)g++
+$(combo_2nd_arch_prefix)HOST_AR := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)ar
+endif # $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc exists
+
+# gcc location for clang; to be updated when clang is updated
+$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/
-HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/
-ifneq ($(strip $(BUILD_HOST_64bit)),)
-# By default we build everything in 32-bit, because it gives us
-# more consistency between the host tools and the target.
-# BUILD_HOST_64bit=1 overrides it for tool like emulator
-# which can benefit from 64-bit host arch.
-HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
-HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack
-else
# We expect SSE3 floating point math.
-HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack
-HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack
-endif # BUILD_HOST_64bit
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack
ifneq ($(strip $(BUILD_HOST_static)),)
# Statically-linked binaries are desirable for sandboxed environment
-HOST_GLOBAL_LDFLAGS += -static
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
endif # BUILD_HOST_static
-HOST_GLOBAL_CFLAGS += -fPIC \
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -fPIC \
-no-canonical-prefixes \
-include $(call select-android-config-h,linux-x86)
# Disable new longjmp in glibc 2.11 and later. See bug 2967937.
-HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
# Workaround differences in inttypes.h between host and target.
# See bug 12708004.
-HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+
+$(combo_2nd_arch_prefix)HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
-HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+
+############################################################
+## Macros after this line are shared by the 64-bit config.
+
+# $(1): The file to check
+define get-file-size
+stat --format "%s" "$(1)" | tr -d '\n'
+endef
diff --git a/core/combo/HOST_linux-x86_64.mk b/core/combo/HOST_linux-x86_64.mk
new file mode 100644
index 0000000..8f3a311
--- /dev/null
+++ b/core/combo/HOST_linux-x86_64.mk
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for builds hosted on linux-x86_64.
+# Included by combo/select.mk
+
+HOST_IS_64_BIT := true
+
+ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),)
+HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-
+endif
+# Don't do anything if the toolchain is not there
+ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc)))
+HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc
+HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++
+HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar
+endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists
+
+# gcc location for clang; to be updated when clang is updated
+HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/
+
+HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
+HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack
+
+ifneq ($(strip $(BUILD_HOST_static)),)
+# Statically-linked binaries are desirable for sandboxed environment
+HOST_GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+# TODO: Add AndroidConfig.h for linux-x86_64
+HOST_GLOBAL_CFLAGS += -fPIC \
+ -no-canonical-prefixes \
+ -include $(call select-android-config-h,linux-x86)
+
+# Disable new longjmp in glibc 2.11 and later. See bug 2967937.
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+
+HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
diff --git a/core/combo/HOST_windows-x86.mk b/core/combo/HOST_windows-x86.mk
index cd047a1..4d871d8 100644
--- a/core/combo/HOST_windows-x86.mk
+++ b/core/combo/HOST_windows-x86.mk
@@ -27,32 +27,29 @@ ifneq ($(findstring Linux,$(UNAME)),)
ifneq ($(strip $(USE_MINGW)),)
HOST_ACP_UNAVAILABLE := true
TOOLS_EXE_SUFFIX :=
-HOST_GLOBAL_CFLAGS += -DUSE_MINGW
-ifneq ($(strip $(BUILD_HOST_64bit)),)
-TOOLS_PREFIX := /usr/bin/amd64-mingw32msvc-
-HOST_C_INCLUDES += /usr/lib/gcc/amd64-mingw32msvc/4.4.2/include
-HOST_GLOBAL_LD_DIRS += -L/usr/amd64-mingw32msvc/lib
-else
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -DUSE_MINGW
TOOLS_PREFIX := /usr/bin/i586-mingw32msvc-
-HOST_C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include
-HOST_GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib
-endif # BUILD_HOST_64bit
+$(combo_2nd_arch_prefix)HOST_C_INCLUDES += /usr/lib/gcc/i586-mingw32msvc/3.4.4/include
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LD_DIRS += -L/usr/i586-mingw32msvc/lib
endif # USE_MINGW
endif # Linux
# Workaround differences in inttypes.h between host and target.
# See bug 12708004.
-HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
-HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
-HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
-HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
+$(combo_2nd_arch_prefix)HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
+$(combo_2nd_arch_prefix)HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
+$(combo_2nd_arch_prefix)HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
+
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += \
+ -include $(call select-android-config-h,windows)
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += \
+ --enable-stdcall-fixup
-HOST_GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
-HOST_GLOBAL_LDFLAGS += --enable-stdcall-fixup
ifneq ($(strip $(BUILD_HOST_static)),)
# Statically-linked binaries are desirable for sandboxed environment
-HOST_GLOBAL_LDFLAGS += -static
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
endif # BUILD_HOST_static
# when building under Cygwin, ensure that we use Mingw compilation by default.
@@ -66,11 +63,14 @@ endif # BUILD_HOST_static
#
ifneq ($(findstring CYGWIN,$(UNAME)),)
ifeq ($(strip $(USE_CYGWIN)),)
-HOST_GLOBAL_CFLAGS += -mno-cygwin
-HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mno-cygwin
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
endif
endif
+############################################################
+## Macros after this line are shared by the 64-bit config.
+
HOST_SHLIB_SUFFIX := .dll
HOST_EXECUTABLE_SUFFIX := .exe
diff --git a/core/combo/HOST_windows-x86_64.mk b/core/combo/HOST_windows-x86_64.mk
new file mode 100644
index 0000000..9edc619
--- /dev/null
+++ b/core/combo/HOST_windows-x86_64.mk
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for Windows on x86_64.
+# Included by combo/select.make
+
+# right now we get these from the environment, but we should
+# pick them from the tree somewhere
+TOOLS_PREFIX := #prebuilt/windows/host/bin/
+TOOLS_EXE_SUFFIX := .exe
+
+HOST_IS_64_BIT := true
+
+# Settings to use MinGW has a cross-compiler under Linux
+ifneq ($(findstring Linux,$(UNAME)),)
+ifneq ($(strip $(USE_MINGW)),)
+HOST_ACP_UNAVAILABLE := true
+TOOLS_EXE_SUFFIX :=
+HOST_GLOBAL_CFLAGS += -DUSE_MINGW
+TOOLS_PREFIX := /usr/bin/amd64-mingw32msvc-
+HOST_C_INCLUDES += /usr/lib/gcc/amd64-mingw32msvc/4.4.2/include
+HOST_GLOBAL_LD_DIRS += -L/usr/amd64-mingw32msvc/lib
+endif # USE_MINGW
+endif # Linux
+
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
+
+HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
+HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
+HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
+
+HOST_GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
+HOST_GLOBAL_LDFLAGS += --enable-stdcall-fixup
+ifneq ($(strip $(BUILD_HOST_static)),)
+# Statically-linked binaries are desirable for sandboxed environment
+HOST_GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+# when building under Cygwin, ensure that we use Mingw compilation by default.
+# you can disable this (i.e. to generate Cygwin executables) by defining the
+# USE_CYGWIN variable in your environment, e.g.:
+#
+# export USE_CYGWIN=1
+#
+# note that the -mno-cygwin flags are not needed when cross-compiling the
+# Windows host tools on Linux
+#
+ifneq ($(findstring CYGWIN,$(UNAME)),)
+ifeq ($(strip $(USE_CYGWIN)),)
+HOST_GLOBAL_CFLAGS += -mno-cygwin
+HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
+endif
+endif
diff --git a/core/combo/mac_version.mk b/core/combo/mac_version.mk
new file mode 100644
index 0000000..b49feee
--- /dev/null
+++ b/core/combo/mac_version.mk
@@ -0,0 +1,50 @@
+# Detect Mac OS X and SDK versions.
+# Output variables:
+# build_mac_version
+# mac_sdk_version
+# mac_sdk_root
+# gcc_darwin_version
+
+ifndef build_mac_version
+
+build_mac_version := $(shell sw_vers -productVersion)
+
+mac_sdk_versions_supported := 10.6 10.7 10.8
+ifneq ($(strip $(MAC_SDK_VERSION)),)
+mac_sdk_version := $(MAC_SDK_VERSION)
+ifeq ($(filter $(mac_sdk_version),$(mac_sdk_versions_supported)),)
+$(warning ****************************************************************)
+$(warning * MAC_SDK_VERSION $(MAC_SDK_VERSION) isn't one of the supported $(mac_sdk_versions_supported))
+$(warning ****************************************************************)
+$(error Stop.)
+endif
+else
+mac_sdk_versions_installed := $(shell xcodebuild -showsdks | grep macosx | sort | sed -e "s/.*macosx//g")
+mac_sdk_version := $(firstword $(filter $(mac_sdk_versions_installed), $(mac_sdk_versions_supported)))
+ifeq ($(mac_sdk_version),)
+mac_sdk_version := $(firstword $(mac_sdk_versions_supported))
+endif
+endif
+
+mac_sdk_path := $(shell xcode-select -print-path)
+# try /Applications/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.?.sdk
+# or /Volume/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.?.sdk
+mac_sdk_root := $(mac_sdk_path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(mac_sdk_version).sdk
+ifeq ($(wildcard $(mac_sdk_root)),)
+# try legacy /Developer/SDKs/MacOSX10.?.sdk
+mac_sdk_root := /Developer/SDKs/MacOSX$(mac_sdk_version).sdk
+endif
+ifeq ($(wildcard $(mac_sdk_root)),)
+$(warning *****************************************************)
+$(warning * Can not find SDK $(mac_sdk_version) at $(mac_sdk_root))
+$(warning *****************************************************)
+$(error Stop.)
+endif
+
+ifeq ($(mac_sdk_version),10.6)
+ gcc_darwin_version := 10
+else
+ gcc_darwin_version := 11
+endif
+
+endif # ifndef build_mac_version
diff --git a/core/combo/select.mk b/core/combo/select.mk
index c1a7cc0..8234a8f 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -18,15 +18,11 @@
#
# Inputs:
# combo_target -- prefix for final variables (HOST_ or TARGET_)
-# combo_2nd_arch_prefix -- it's defined if this is loaded for TARGET_2ND_ARCH.
+# combo_2nd_arch_prefix -- it's defined if this is loaded for the 2nd arch.
#
# Build a target string like "linux-arm" or "darwin-x86".
-ifdef combo_2nd_arch_prefix
-combo_os_arch := $($(combo_target)OS)-$(TARGET_2ND_ARCH)
-else
-combo_os_arch := $($(combo_target)OS)-$($(combo_target)ARCH)
-endif
+combo_os_arch := $($(combo_target)OS)-$($(combo_target)$(combo_2nd_arch_prefix)ARCH)
combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target)
@@ -90,7 +86,7 @@ ifneq ($(USE_CCACHE),)
# If we are cross-compiling Windows binaries on Linux
# then use the linux ccache binary instead.
ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
- CCACHE_HOST_TAG := linux-$(BUILD_ARCH)
+ CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
endif
ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
# Check that the executable is here.
diff --git a/core/config.mk b/core/config.mk
index 2d387ef..84ff3fe 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -217,6 +217,13 @@ combo_target := HOST_
combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
+# Load the 2nd host arch if it's needed.
+ifdef HOST_2ND_ARCH
+combo_target := HOST_
+combo_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/combo/select.mk
+endif
+
# on windows, the tools have .exe at the end, and we depend on the
# host config stuff being done first
@@ -357,7 +364,7 @@ LEX := prebuilts/misc/$(BUILD_OS)-$(BUILD_ARCH)/flex/flex-2.5.39
# To run bison from elsewhere you need to set up enviromental variable
# BISON_PKGDATADIR.
BISON_PKGDATADIR := $(PWD)/external/bison/data
-BISON := prebuilts/misc/$(BUILD_OS)-$(BUILD_ARCH)/bison/bison
+BISON := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bison/bison
YACC := $(BISON) -d
DOXYGEN:= doxygen
@@ -501,6 +508,17 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS += $($(TARGET_2ND_ARCH_VAR_PRE
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS += $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_RELEASE_CPPFLAGS)
endif
+ifdef HOST_2ND_ARCH
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS += -L$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_INCLUDES := $(HOST_PROJECT_INCLUDES)
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CFLAGS += $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_RELEASE_CFLAGS)
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_CPPFLAGS += $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_RELEASE_CPPFLAGS)
+endif
+
# allow overriding default Java libraries on a per-target basis
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
diff --git a/core/configure_module_stem.mk b/core/configure_module_stem.mk
index 2823e37..1560055 100644
--- a/core/configure_module_stem.mk
+++ b/core/configure_module_stem.mk
@@ -1,4 +1,4 @@
-my_multilib_stem := $(LOCAL_MODULE_STEM_$(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32))
+my_multilib_stem := $(LOCAL_MODULE_STEM_$(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32))
ifdef my_multilib_stem
LOCAL_MODULE_STEM := $(my_multilib_stem)
endif
diff --git a/core/definitions.mk b/core/definitions.mk
index adf8d40..cc0fda5 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -426,7 +426,7 @@ $(strip \
$(eval _idf2ndArchPrefix := $(if $(call directory_is_64_bit_blacklisted,$(LOCAL_PATH))$(strip $(5)),$(TARGET_2ND_ARCH_VAR_PREFIX))) \
$(if $(filter $(_idfPrefix)-$(_idfClass),$(COMMON_MODULE_CLASSES))$(4), \
$(eval _idfIntBase := $($(_idfPrefix)_OUT_COMMON_INTERMEDIATES)) \
- ,$(if $(filter $(_idfPrefix)-$(_idfClass),TARGET-SHARED_LIBRARIES TARGET-STATIC_LIBRARIES TARGET-EXECUTABLES TARGET-GYP),\
+ ,$(if $(filter $(_idfClass),SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP),\
$(eval _idfIntBase := $($(_idf2ndArchPrefix)$(_idfPrefix)_OUT_INTERMEDIATES)) \
,$(eval _idfIntBase := $($(_idfPrefix)_OUT_INTERMEDIATES)) \
) \
@@ -1170,7 +1170,7 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;
rm -rf $$ldir; \
mkdir -p $$ldir; \
filelist=; \
- for f in `$(TARGET_AR) t $(1)`; do \
+ for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) t $(1)`; do \
$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) p $(1) $$f > $$ldir/$$f; \
filelist="$$filelist $$ldir/$$f"; \
done ; \
@@ -1191,7 +1191,8 @@ define transform-o-to-static-lib
@rm -f $@
$(extract-and-include-target-whole-static-libs)
@echo "target StaticLib: $(PRIVATE_MODULE) ($@)"
-$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
+$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \
$(PRIVATE_ARFLAGS) $@,$(filter %.o, $^))
endef
@@ -1206,11 +1207,12 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;
rm -rf $$ldir; \
mkdir -p $$ldir; \
filelist=; \
- for f in `$(HOST_AR) t $(1) | \grep '\.o$$'`; do \
- $(HOST_AR) p $(1) $$f > $$ldir/$$f; \
+ for f in `$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) t $(1) | \grep '\.o$$'`; do \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) p $(1) $$f > $$ldir/$$f; \
filelist="$$filelist $$ldir/$$f"; \
done ; \
- $(HOST_AR) $(HOST_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $$filelist
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
+ $(PRIVATE_ARFLAGS) $@ $$filelist
endef
@@ -1226,7 +1228,9 @@ define transform-host-o-to-static-lib
@rm -f $@
$(extract-and-include-host-whole-static-libs)
@echo "host StaticLib: $(PRIVATE_MODULE) ($@)"
-$(call split-long-arguments,$(HOST_AR) $(HOST_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^))
+$(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \
+ $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^))
endef
@@ -1239,10 +1243,10 @@ endef
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
- -Wl,-rpath-link=$(HOST_OUT_INTERMEDIATE_LIBRARIES) \
- -Wl,-rpath,\$$ORIGIN/../lib \
+ -Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
-shared -Wl,-soname,$(notdir $@) \
- $(HOST_GLOBAL_LD_DIRS) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
) \
@@ -1412,9 +1416,9 @@ $(hide) $(PRIVATE_CXX) \
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
- -Wl,-rpath-link=$(HOST_OUT_INTERMEDIATE_LIBRARIES) \
- -Wl,-rpath,\$$ORIGIN/../lib \
- $(HOST_GLOBAL_LD_DIRS) \
+ -Wl,-rpath-link=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
$(HOST_FPIE_FLAGS) \
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index b3ca4fc..e538d1e 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -41,8 +41,6 @@ LOCAL_INTERMEDIATE_TARGETS := $(linked_module)
include $(BUILD_SYSTEM)/binary.mk
###################################
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
-
# Make sure that our guess at the value of intermediates was correct.
ifneq ($(intermediates),$(guessed_intermediates))
$(error Internal error: guessed path '$(guessed_intermediates)' doesn't match '$(intermediates))
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 4cb389b..df76c51 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -40,16 +40,16 @@ UNAME := $(shell uname -sm)
# HOST_OS
ifneq (,$(findstring Linux,$(UNAME)))
- HOST_OS := linux
+ HOST_OS := linux
endif
ifneq (,$(findstring Darwin,$(UNAME)))
- HOST_OS := darwin
+ HOST_OS := darwin
endif
ifneq (,$(findstring Macintosh,$(UNAME)))
- HOST_OS := darwin
+ HOST_OS := darwin
endif
ifneq (,$(findstring CYGWIN,$(UNAME)))
- HOST_OS := windows
+ HOST_OS := windows
endif
# BUILD_OS is the real host doing the build.
@@ -59,7 +59,7 @@ BUILD_OS := $(HOST_OS)
# Windows SDK. Only a subset of tools and SDK will manage to build properly.
ifeq ($(HOST_OS),linux)
ifneq ($(USE_MINGW),)
- HOST_OS := windows
+ HOST_OS := windows
endif
endif
@@ -69,15 +69,24 @@ endif
# HOST_ARCH
-ifneq (,$(findstring 86,$(UNAME)))
- HOST_ARCH := x86
-endif
-
-ifneq (,$(findstring Power,$(UNAME)))
- HOST_ARCH := ppc
+ifneq (,$(findstring x86_64,$(UNAME)))
+ # TODO: Replace BUILD_HOST_64bit with a flag that forces 32-bit build,
+ # after we default to 64-bit host build.
+ ifeq (,$(BUILD_HOST_64bit))
+ HOST_ARCH := x86
+ HOST_2ND_ARCH :=
+ else
+ HOST_ARCH := x86_64
+ HOST_2ND_ARCH := x86
+ endif
+else ifneq (,$(findstring 86,$(UNAME)))
+ # It's not officially supported!
+ HOST_ARCH := x86
+ HOST_2ND_ARCH :=
endif
BUILD_ARCH := $(HOST_ARCH)
+BUILD_2ND_ARCH := $(HOST_2ND_ARCH)
ifeq ($(HOST_ARCH),)
$(error Unable to determine HOST_ARCH from uname -sm: $(UNAME)!)
@@ -94,12 +103,14 @@ $(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)
endif
endif
+# We don't want to move all the prebuilt host tools to a $(HOST_OS)-x86_64 dir.
+HOST_PREBUILT_ARCH := x86
# This is the standard way to name a directory containing prebuilt host
# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc
ifeq ($(HOST_OS),windows)
HOST_PREBUILT_TAG := windows
else
- HOST_PREBUILT_TAG := $(HOST_OS)-$(HOST_ARCH)
+ HOST_PREBUILT_TAG := $(HOST_OS)-$(HOST_PREBUILT_ARCH)
endif
# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT.
@@ -180,11 +191,12 @@ HOST_OUT_ROOT_release := $(OUT_DIR)/host
HOST_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/host
HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))
-HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_ARCH)
-HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_ARCH)
+# We want to avoid two host bin directories in multilib build.
+HOST_OUT_release := $(HOST_OUT_ROOT_release)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
+HOST_OUT_debug := $(HOST_OUT_ROOT_debug)/$(HOST_OS)-$(HOST_PREBUILT_ARCH)
HOST_OUT := $(HOST_OUT_$(HOST_BUILD_TYPE))
-BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(BUILD_ARCH)
+BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
@@ -211,6 +223,15 @@ HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
HOST_OUT_GEN := $(HOST_OUT)/gen
HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
+# Out for HOST_2ND_ARCH
+HOST_2ND_ARCH_VAR_PREFIX := 2ND_
+HOST_2ND_ARCH_MODULE_SUFFIX := _32
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES := $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES)/lib
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib32
+$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES := $(HOST_OUT_EXECUTABLES)
+
+
TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include
TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
diff --git a/core/executable.mk b/core/executable.mk
index 7a3e08e..4dd9a23 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -6,6 +6,7 @@
# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
# LOCAL_MODULE_STEM_64
+my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
ifeq ($(my_module_multilib),both)
diff --git a/core/host_executable.mk b/core/host_executable.mk
index ffb35d2..874bf87 100644
--- a/core/host_executable.mk
+++ b/core/host_executable.mk
@@ -1,33 +1,47 @@
-###########################################################
-## Standard rules for building an executable file.
-##
-## Additional inputs from base_rules.make:
-## None.
-###########################################################
-
-LOCAL_IS_HOST_MODULE := true
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := EXECUTABLES
-endif
-ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
-endif
-$(call host-executable-hook)
+my_prefix := HOST_
+include $(BUILD_SYSTEM)/multilib.mk
+
+ifndef my_module_multilib
+# By default we only build host module for the first arch.
+my_module_multilib := first
+endif
-skip_build_from_source :=
-ifdef LOCAL_PREBUILT_MODULE_FILE
-ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
-include $(BUILD_SYSTEM)/prebuilt_internal.mk
-skip_build_from_source := true
+ifeq ($(my_module_multilib),both)
+ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),)
+$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_32 or LOCAL_MODULE_PATH_32 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
endif
+ifeq ($(LOCAL_MODULE_PATH_64)$(LOCAL_MODULE_STEM_64),)
+$(error $(LOCAL_PATH): LOCAL_MODULE_STEM_64 or LOCAL_MODULE_PATH_64 is required for LOCAL_MULTILIB := both for module $(LOCAL_MODULE))
endif
+else #!LOCAL_MULTILIB == both
+LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
+endif
+
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+include $(BUILD_SYSTEM)/module_arch_supported.mk
-ifndef skip_build_from_source
+ifeq ($(my_module_arch_supported),true)
+include $(BUILD_SYSTEM)/host_executable_internal.mk
+endif
-include $(BUILD_SYSTEM)/binary.mk
+ifdef HOST_2ND_ARCH
+LOCAL_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# Build for HOST_2ND_ARCH
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_MODULE_STEM :=
+LOCAL_BUILT_MODULE_STEM :=
+LOCAL_INSTALLED_MODULE_STEM :=
+LOCAL_INTERMEDIATE_TARGETS :=
-$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
- $(transform-host-o-to-executable)
+include $(BUILD_SYSTEM)/host_executable_internal.mk
+endif
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+endif # HOST_2ND_ARCH
-endif # skip_build_from_source
+LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
+my_module_arch_supported :=
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
new file mode 100644
index 0000000..ffb35d2
--- /dev/null
+++ b/core/host_executable_internal.mk
@@ -0,0 +1,33 @@
+###########################################################
+## Standard rules for building an executable file.
+##
+## Additional inputs from base_rules.make:
+## None.
+###########################################################
+
+LOCAL_IS_HOST_MODULE := true
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := EXECUTABLES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
+endif
+
+$(call host-executable-hook)
+
+skip_build_from_source :=
+ifdef LOCAL_PREBUILT_MODULE_FILE
+ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
+include $(BUILD_SYSTEM)/prebuilt_internal.mk
+skip_build_from_source := true
+endif
+endif
+
+ifndef skip_build_from_source
+
+include $(BUILD_SYSTEM)/binary.mk
+
+$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
+ $(transform-host-o-to-executable)
+
+endif # skip_build_from_source
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index 56ced01..de5e6ad 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -1,49 +1,37 @@
-###########################################################
-## Standard rules for building a normal shared library.
-##
-## Additional inputs from base_rules.make:
-## None.
-##
-## LOCAL_MODULE_SUFFIX will be set for you.
-###########################################################
-
-LOCAL_IS_HOST_MODULE := true
+my_prefix := HOST_
+include $(BUILD_SYSTEM)/multilib.mk
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := SHARED_LIBRARIES
-endif
-ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
-endif
-ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
-$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
-endif
-ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
-$(error $(LOCAL_PATH): Cannot set module stem for a library)
+ifndef my_module_multilib
+# By default we only build host module for the first arch.
+my_module_multilib := first
endif
-$(call host-shared-library-hook)
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+include $(BUILD_SYSTEM)/module_arch_supported.mk
-skip_build_from_source :=
-ifdef LOCAL_PREBUILT_MODULE_FILE
-ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
-include $(BUILD_SYSTEM)/prebuilt_internal.mk
-skip_build_from_source := true
+ifeq ($(my_module_arch_supported),true)
+include $(BUILD_SYSTEM)/host_shared_library_internal.mk
endif
-endif
-
-ifndef skip_build_from_source
-
-# Put the built modules of all shared libraries in a common directory
-# to simplify the link line.
-OVERRIDE_BUILT_MODULE_PATH := $(HOST_OUT_INTERMEDIATE_LIBRARIES)
-include $(BUILD_SYSTEM)/binary.mk
-
-$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
- $(transform-host-o-to-shared-lib)
+ifdef HOST_2ND_ARCH
+LOCAL_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# Build for HOST_2ND_ARCH
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_MODULE_STEM :=
+LOCAL_BUILT_MODULE_STEM :=
+LOCAL_INSTALLED_MODULE_STEM :=
+LOCAL_INTERMEDIATE_TARGETS :=
+
+include $(BUILD_SYSTEM)/host_shared_library_internal.mk
+endif
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+endif # HOST_2ND_ARCH
-endif # skip_build_from_source
+my_module_arch_supported :=
###########################################################
## Copy headers to the install tree
diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk
new file mode 100644
index 0000000..d9769d3
--- /dev/null
+++ b/core/host_shared_library_internal.mk
@@ -0,0 +1,46 @@
+###########################################################
+## Standard rules for building a normal shared library.
+##
+## Additional inputs from base_rules.make:
+## None.
+##
+## LOCAL_MODULE_SUFFIX will be set for you.
+###########################################################
+
+LOCAL_IS_HOST_MODULE := true
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
+endif
+ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
+$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
+endif
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
+$(error $(LOCAL_PATH): Cannot set module stem for a library)
+endif
+
+$(call host-shared-library-hook)
+
+skip_build_from_source :=
+ifdef LOCAL_PREBUILT_MODULE_FILE
+ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
+include $(BUILD_SYSTEM)/prebuilt_internal.mk
+skip_build_from_source := true
+endif
+endif
+
+ifndef skip_build_from_source
+
+# Put the built modules of all shared libraries in a common directory
+# to simplify the link line.
+OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)
+
+include $(BUILD_SYSTEM)/binary.mk
+
+$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(transform-host-o-to-shared-lib)
+
+endif # skip_build_from_source
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index 7d9b375..ab3f16e 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -1,30 +1,37 @@
-###########################################################
-## Standard rules for building a static library for the host.
-##
-## Additional inputs from base_rules.make:
-## None.
-##
-## LOCAL_MODULE_SUFFIX will be set for you.
-###########################################################
+my_prefix := HOST_
+include $(BUILD_SYSTEM)/multilib.mk
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
-ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := .a
+ifndef my_module_multilib
+# By default we only build host module for the first arch.
+my_module_multilib := first
endif
-ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
-$(error $(LOCAL_PATH): Cannot set module stem for a library)
+
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+
+ifeq ($(my_module_arch_supported),true)
+include $(BUILD_SYSTEM)/host_static_library_internal.mk
endif
-LOCAL_UNINSTALLABLE_MODULE := true
-LOCAL_IS_HOST_MODULE := true
+ifdef HOST_2ND_ARCH
+LOCAL_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# Build for HOST_2ND_ARCH
+OVERRIDE_BUILT_MODULE_PATH :=
+LOCAL_BUILT_MODULE :=
+LOCAL_INSTALLED_MODULE :=
+LOCAL_MODULE_STEM :=
+LOCAL_BUILT_MODULE_STEM :=
+LOCAL_INSTALLED_MODULE_STEM :=
+LOCAL_INTERMEDIATE_TARGETS :=
-include $(BUILD_SYSTEM)/binary.mk
+include $(BUILD_SYSTEM)/host_static_library_internal.mk
+endif
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+endif # HOST_2ND_ARCH
-$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
-$(LOCAL_BUILT_MODULE): $(all_objects)
- $(transform-host-o-to-static-lib)
+my_module_arch_supported :=
###########################################################
## Copy headers to the install tree
diff --git a/core/host_static_library_internal.mk b/core/host_static_library_internal.mk
new file mode 100644
index 0000000..a533cf5
--- /dev/null
+++ b/core/host_static_library_internal.mk
@@ -0,0 +1,27 @@
+###########################################################
+## Standard rules for building a static library for the host.
+##
+## Additional inputs from base_rules.make:
+## None.
+##
+## LOCAL_MODULE_SUFFIX will be set for you.
+###########################################################
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := .a
+endif
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
+$(error $(LOCAL_PATH): Cannot set module stem for a library)
+endif
+LOCAL_UNINSTALLABLE_MODULE := true
+
+LOCAL_IS_HOST_MODULE := true
+
+include $(BUILD_SYSTEM)/binary.mk
+
+$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
+$(LOCAL_BUILT_MODULE): $(all_objects)
+ $(transform-host-o-to-static-lib)
diff --git a/core/main.mk b/core/main.mk
index e7a97be..fa8e872 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -110,7 +110,6 @@ ifneq ($(VERSION_CHECK_SEQUENCE_NUMBER),$(VERSIONS_CHECKED))
$(info Checking build tools versions...)
ifneq ($(HOST_OS),windows)
-ifneq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
# check for a case sensitive file system
ifneq (a,$(shell mkdir -p $(OUT_DIR) ; \
echo a > $(OUT_DIR)/casecheck.txt; \
@@ -123,7 +122,6 @@ $(warning ************************************************************)
$(error Case-insensitive filesystems not supported)
endif
endif
-endif
# Make sure that there are no spaces in the absolute path; the
# build system can't deal with them.
@@ -450,12 +448,6 @@ $(INTERNAL_MODIFIER_TARGETS): $(DEFAULT_GOAL)
endif
# Bring in all modules that need to be built.
-ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-ppc)
-SDK_ONLY := true
-$(info Building the SDK under darwin-ppc is actually obsolete and unsupported.)
-$(error stop)
-endif
-
ifeq ($(HOST_OS),windows)
SDK_ONLY := true
endif
diff --git a/core/module_arch_supported.mk b/core/module_arch_supported.mk
index 753a29e..15fd648 100644
--- a/core/module_arch_supported.mk
+++ b/core/module_arch_supported.mk
@@ -2,14 +2,15 @@
## Determine if a module can be built for an arch
##
## Inputs from module makefile:
+## my_prefix TARGET_ or HOST_
## my_module_multilib
-## LOCAL_MODULE_TARGET_ARCH
-## LOCAL_MODULE_TARGET_ARCH_WARN
-## LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH
-## LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN
+## LOCAL_MODULE_$(my_prefix)ARCH
+## LOCAL_MODULE_$(my_prefix)ARCH_WARN
+## LOCAL_MODULE_UNSUPPORTED_$(my_prefix)ARCH
+## LOCAL_MODULE_UNSUPPORTED_$(my_prefix)ARCH_WARN
##
## Inputs from build system:
-## TARGET_IS_64_BIT
+## $(my_prefix)IS_64_BIT
## LOCAL_2ND_ARCH_VAR_PREFIX
##
## Outputs:
@@ -23,9 +24,9 @@ my_module_arch_supported := false
endif
ifeq ($(LOCAL_2ND_ARCH_VAR_PREFIX),)
-ifeq ($(TARGET_IS_64_BIT)|$(my_module_multilib),true|32)
+ifeq ($($(my_prefix)IS_64_BIT)|$(my_module_multilib),true|32)
my_module_arch_supported := false
-else ifeq ($(TARGET_IS_64_BIT)|$(my_module_multilib),|64)
+else ifeq ($($(my_prefix)IS_64_BIT)|$(my_module_multilib),|64)
my_module_arch_supported := false
else ifeq ($(call directory_is_64_bit_blacklisted,$(LOCAL_PATH)),true)
my_module_arch_supported := false
@@ -38,24 +39,24 @@ my_module_arch_supported := false
endif
endif # LOCAL_2ND_ARCH_VAR_PREFIX
-ifneq (,$(LOCAL_MODULE_TARGET_ARCH))
-ifeq (,$(filter $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_TARGET_ARCH)))
+ifneq (,$(LOCAL_MODULE_$(my_prefix)ARCH))
+ifeq (,$(filter $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_$(my_prefix)ARCH)))
my_module_arch_supported := false
endif
endif
-ifneq (,$(LOCAL_MODULE_TARGET_ARCH_WARN))
-ifeq (,$(filter $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_TARGET_ARCH_WARN)))
+ifneq (,$(LOCAL_MODULE_$(my_prefix)ARCH_WARN))
+ifeq (,$(filter $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_$(my_prefix)ARCH_WARN)))
my_module_arch_supported := false
-$(warning $(LOCAL_MODULE): architecture $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) not supported)
+$(warning $(LOCAL_MODULE): architecture $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) not supported)
endif
endif
-ifneq (,$(filter $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH)))
+ifneq (,$(filter $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_UNSUPPORTED_$(my_prefix)ARCH)))
my_module_arch_supported := false
endif
-ifneq (,$(filter $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH_WARN)))
+ifneq (,$(filter $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_UNSUPPORTED_$(my_prefix)ARCH_WARN)))
my_module_arch_supported := false
-$(warning $(LOCAL_MODULE): architecture $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) unsupported)
+$(warning $(LOCAL_MODULE): architecture $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) unsupported)
endif
diff --git a/core/package.mk b/core/package.mk
index c7d68d9..0861a79 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -3,6 +3,7 @@
# By default, an package is built for TARGET_ARCH.
# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32".
+my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
ifeq ($(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS),true|true)
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index 5f91110..c280900 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -7,8 +7,10 @@
###########################################################
ifdef LOCAL_IS_HOST_MODULE
-include $(BUILD_SYSTEM)/prebuilt_internal.mk
-else #!LOCAL_IS_HOST_MODULE
+ my_prefix := HOST_
+else
+ my_prefix := TARGET_
+endif
include $(BUILD_SYSTEM)/multilib.mk
@@ -23,16 +25,15 @@ include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
# first arch is supported
include $(BUILD_SYSTEM)/prebuilt_internal.mk
-else ifneq (,$(TARGET_2ND_ARCH))
+else ifneq (,$($(my_prefix)2ND_ARCH))
# check if secondary arch is supported
-LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+LOCAL_2ND_ARCH_VAR_PREFIX := $($(my_prefix)2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
# secondary arch is supported
include $(BUILD_SYSTEM)/prebuilt_internal.mk
endif
-endif # TARGET_2ND_ARCH
-endif # !LOCAL_IS_HOST_MODULE
+endif # $(my_prefix)2ND_ARCH
LOCAL_2ND_ARCH_VAR_PREFIX :=
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index 8efb89e..089cc63 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -22,18 +22,13 @@ LOCAL_DONT_CHECK_MODULE := true
ifdef LOCAL_PREBUILT_MODULE_FILE
my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE)
else
- ifdef LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
- my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+ ifdef LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+ my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
else
my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
endif
endif
-ifdef LOCAL_IS_HOST_MODULE
- my_prefix := HOST_
-else
- my_prefix := TARGET_
-endif
ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
# Put the built targets of all shared libraries in a common directory
# to simplify the link line.
diff --git a/core/product_config.mk b/core/product_config.mk
index 61bdfb4..cb488c0 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -164,7 +164,7 @@ endif # unbundled_goals
# Default to building dalvikvm on hosts that support it...
ifeq ($(HOST_OS),linux)
-ifeq ($(BUILD_HOST_64bit),)
+ifneq ($(HOST_ARCH),x86_64)
# ... or if the if the option is already set
ifeq ($(WITH_HOST_DALVIK),)
WITH_HOST_DALVIK := true
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 95a8d7b..178e625 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -10,6 +10,7 @@ $(warning $(LOCAL_MODULE): LOCAL_UNSTRIPPED_PATH for shared libraries is unsuppo
endif
endif
+my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
ifndef my_module_multilib
diff --git a/core/static_library.mk b/core/static_library.mk
index bedefd0..854cbfc 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -1,3 +1,4 @@
+my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
ifndef my_module_multilib
diff --git a/core/static_library_internal.mk b/core/static_library_internal.mk
index 2d3468c..cabe823 100644
--- a/core/static_library_internal.mk
+++ b/core/static_library_internal.mk
@@ -28,7 +28,6 @@ $(all_objects) : PRIVATE_TARGET_GLOBAL_CFLAGS :=
$(all_objects) : PRIVATE_TARGET_GLOBAL_CPPFLAGS :=
endif
-$(LOCAL_BUILT_MODULE): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
$(LOCAL_BUILT_MODULE) : $(built_whole_libraries)
$(LOCAL_BUILT_MODULE) : $(all_objects)
$(transform-o-to-static-lib)
diff --git a/libs/host/Android.mk b/libs/host/Android.mk
index 74afa55..c67afbb 100644
--- a/libs/host/Android.mk
+++ b/libs/host/Android.mk
@@ -2,7 +2,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- CopyFile.c
+ CopyFile.c
ifeq ($(HOST_OS),cygwin)
LOCAL_CFLAGS += -DWIN32_EXE
diff --git a/tools/acp/Android.mk b/tools/acp/Android.mk
index 5e0e2e4..33c5567 100644
--- a/tools/acp/Android.mk
+++ b/tools/acp/Android.mk
@@ -6,7 +6,7 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- acp.c
+ acp.c
ifeq ($(HOST_OS),cygwin)
LOCAL_CFLAGS += -DWIN32_EXE
@@ -23,4 +23,3 @@ LOCAL_MODULE := acp
LOCAL_ACP_UNAVAILABLE := true
include $(BUILD_HOST_EXECUTABLE)
-