From d6e11825c4e0f0200e7a4ecf11ec3b27e1a31049 Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Mon, 12 May 2014 16:05:14 +0200 Subject: Add some more flags to CLANG_CONFIG_UNKNOWN_CFLAGS Add some more gcc specific flags that are used somewhere in the tree (e.g. external/chromium_org) to CLANG_CONFIG_UNKNOWN_CFLAGS Change-Id: Icc572fdb6ea4ba818c4d18e430296589eb61bf55 Signed-off-by: Bernhard Rosenkraenzer --- core/clang/config.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/clang/config.mk b/core/clang/config.mk index c598e7daba..ce6cedaaf8 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -29,9 +29,14 @@ CLANG_CONFIG_EXTRA_CFLAGS := \ CLANG_CONFIG_UNKNOWN_CFLAGS := \ -funswitch-loops \ + -fno-tree-sra \ + -finline-limit=64 \ -Wno-psabi \ -Wno-unused-but-set-variable \ -Wno-unused-but-set-parameter \ + -Wmaybe-uninitialized \ + -Wno-maybe-uninitialized \ + -Wno-error=maybe-uninitialized \ -fno-canonical-system-headers # Clang flags for all host rules -- cgit v1.2.3 From fb910ddb1dd1c40bbe1a885138d2e3d929005756 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Tue, 13 May 2014 09:02:56 -0700 Subject: Treat denver like cortex-a15. See also build/core/combo/arch/arm/armv7-a-neon.mk. Change-Id: Ie18e1f133f56a9f7da80e304052c92edad933a31 --- core/config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/config.mk b/core/config.mk index 322f258803..2d387efe30 100644 --- a/core/config.mk +++ b/core/config.mk @@ -522,7 +522,7 @@ ifdef TARGET_2ND_ARCH endif endif -ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait)) +ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait denver)) DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div endif -- cgit v1.2.3 From a93102d411525db2161e2df875a1064dc947f547 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Tue, 13 May 2014 09:46:23 -0700 Subject: Disable DEXPREOPT until we have multilib support Bug: 14694978 Change-Id: I31d0f1c78a668435646c99e659cec46cd2f3ddf7 --- target/product/core_64_bit.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/product/core_64_bit.mk b/target/product/core_64_bit.mk index 5d7abcb752..a21620c2a2 100644 --- a/target/product/core_64_bit.mk +++ b/target/product/core_64_bit.mk @@ -37,3 +37,6 @@ TARGET_PREFER_32_BIT_APPS := true TARGET_SUPPORTS_32_BIT_APPS := true TARGET_SUPPORTS_64_BIT_APPS := true + +# Disable DEXPREOPT until we have multilib support (bug 14694978). +WITH_DEXPREOPT := false -- cgit v1.2.3 From 4fb8122bcb6870babd55444d32899f3d591a837d Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Wed, 14 May 2014 18:26:48 +0100 Subject: Fix executable symlinks. 32 bit targets will leave TARGET_PREFER_{32,64}_BIT_APPS unset so adjust accordingly. Also clean up an explanatory comment. Change-Id: I1f6faa640e4e862631fff49f7c565766ef2c567f --- core/executable_prefer_symlink.mk | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk index c6abed4172..2f04d0dab6 100644 --- a/core/executable_prefer_symlink.mk +++ b/core/executable_prefer_symlink.mk @@ -5,12 +5,20 @@ # Note: now only limited to the binaries that will be installed under system/bin directory my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE)) -# create link to the one used for prefer version +# Create link to the one used depending on the target +# configuration. Note that we require the TARGET_IS_64_BIT +# check because 32 bit targets may not define TARGET_PREFER_32_BIT_APPS +# et al. since those variables make no sense in that context. +ifeq ($(TARGET_IS_64_BIT),true) ifneq ($(TARGET_PREFER_32_BIT_APPS),true) $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64) else $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) endif +else + $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) +endif + $(my_symlink): $(LOCAL_INSTALLED_MODULE) $(LOCAL_MODULE_MAKEFILE) @echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)" -- cgit v1.2.3 From a28021649406bd9dd7115f5c17198bdb9ee6701b Mon Sep 17 00:00:00 2001 From: Sreeram Ramachandran Date: Mon, 12 May 2014 11:51:29 -0700 Subject: Introduce netd_client, a dynamic library that talks to netd. (cherry picked from commit 440de6b9f715cb18b8ee888c58d5c7a659ff5073) Change-Id: Ib6198e19dbc306521a26fcecfdf6e8424d163fc9 --- target/product/base.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/target/product/base.mk b/target/product/base.mk index 8aa3bc06c5..0bc1366055 100644 --- a/target/product/base.mk +++ b/target/product/base.mk @@ -56,6 +56,7 @@ PRODUCT_PACKAGES += \ libmedia_jni \ libmediaplayerservice \ libmtp \ + libnetd_client \ libnetlink \ libnetutils \ libpac \ -- cgit v1.2.3 From 6feb6d5607ce86a446645564212043964628f540 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Thu, 17 Apr 2014 10:03:35 -0700 Subject: 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 --- core/base_rules.mk | 12 +-- core/binary.mk | 40 +++++----- core/clang/HOST_x86.mk | 16 ++-- core/clang/HOST_x86_64.mk | 2 +- core/clang/HOST_x86_common.mk | 56 ++++++++++++++ core/clang/config.mk | 9 ++- core/clear_vars.mk | 30 ++++++++ core/combo/HOST_darwin-x86.mk | 138 ++++++++++++----------------------- core/combo/HOST_darwin-x86_64.mk | 80 ++++++++++++++++++++ core/combo/HOST_linux-x86.mk | 55 +++++++------- core/combo/HOST_linux-x86_64.mk | 55 ++++++++++++++ core/combo/HOST_windows-x86.mk | 36 ++++----- core/combo/HOST_windows-x86_64.mk | 68 +++++++++++++++++ core/combo/mac_version.mk | 50 +++++++++++++ core/combo/select.mk | 10 +-- core/config.mk | 20 ++++- core/configure_module_stem.mk | 2 +- core/definitions.mk | 30 ++++---- core/dynamic_binary.mk | 2 - core/envsetup.mk | 51 +++++++++---- core/executable.mk | 1 + core/host_executable.mk | 64 +++++++++------- core/host_executable_internal.mk | 33 +++++++++ core/host_shared_library.mk | 66 +++++++---------- core/host_shared_library_internal.mk | 46 ++++++++++++ core/host_static_library.mk | 49 +++++++------ core/host_static_library_internal.mk | 27 +++++++ core/main.mk | 8 -- core/module_arch_supported.mk | 31 ++++---- core/package.mk | 1 + core/prebuilt.mk | 13 ++-- core/prebuilt_internal.mk | 9 +-- core/product_config.mk | 2 +- core/shared_library.mk | 1 + core/static_library.mk | 1 + core/static_library_internal.mk | 1 - libs/host/Android.mk | 2 +- tools/acp/Android.mk | 3 +- 38 files changed, 775 insertions(+), 345 deletions(-) create mode 100644 core/clang/HOST_x86_common.mk create mode 100644 core/combo/HOST_darwin-x86_64.mk create mode 100644 core/combo/HOST_linux-x86_64.mk create mode 100644 core/combo/HOST_windows-x86_64.mk create mode 100644 core/combo/mac_version.mk create mode 100644 core/host_executable_internal.mk create mode 100644 core/host_shared_library_internal.mk create mode 100644 core/host_static_library_internal.mk diff --git a/core/base_rules.mk b/core/base_rules.mk index c68fba7076..801e2c8117 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 9dab23f125..4af3da1168 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 ee61e5e028..510a74dc30 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 d60e15fea3..6b945258d9 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 0000000000..0241cb6636 --- /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 c598e7daba..d44be526b1 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 5342fd2d24..682656b91d 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 b819f36cb3..d665c76891 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 0000000000..8ad3ba76f1 --- /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 1472849020..c931937d85 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 0000000000..8f3a31106f --- /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 cd047a1283..4d871d879d 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 0000000000..9edc6195a1 --- /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 0000000000..b49feeefbe --- /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 c1a7cc05a6..8234a8fcb1 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 2d387efe30..84ff3fea4e 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 2823e3758d..156005537a 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 adf8d40df5..cc0fda5f2b 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 b3ca4fcbd5..e538d1e874 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 4cb389bf4e..df76c51215 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 7a3e08e0d7..4dd9a2349a 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 ffb35d2a13..874bf87574 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 0000000000..ffb35d2a13 --- /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 56ced01e45..de5e6ad5d7 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 0000000000..d9769d3846 --- /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 7d9b3750f8..ab3f16ee0e 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 0000000000..a533cf5ddf --- /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 e7a97be444..fa8e872947 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 753a29ec42..15fd6482a3 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 c7d68d95e5..0861a79bc7 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 5f91110cf6..c280900af6 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 8efb89e773..089cc6300f 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 61bdfb40e7..cb488c0af8 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 95a8d7b0e7..178e625b92 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 bedefd0993..854cbfcb96 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 2d3468c949..cabe823220 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 74afa5562f..c67afbbcd9 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 5e0e2e461e..33c55675f1 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) - -- cgit v1.2.3 From 4fe22ae9e86d3c22d0fafac1dffaf60a9cb860b2 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Wed, 14 May 2014 18:21:34 -0700 Subject: Print all 2ND variables. Change-Id: I11180a3ec3481d293100c59c331f05db9e6a689b --- core/dumpvar.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/dumpvar.mk b/core/dumpvar.mk index d3f3969115..510bc7d082 100644 --- a/core/dumpvar.mk +++ b/core/dumpvar.mk @@ -72,9 +72,11 @@ $(info TARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT)) $(info TARGET_BUILD_TYPE=$(TARGET_BUILD_TYPE)) $(info TARGET_BUILD_APPS=$(TARGET_BUILD_APPS)) $(info TARGET_ARCH=$(TARGET_ARCH)) -$(info TARGET_2ND_ARCH=$(TARGET_2ND_ARCH)) $(info TARGET_ARCH_VARIANT=$(TARGET_ARCH_VARIANT)) $(info TARGET_CPU_VARIANT=$(TARGET_CPU_VARIANT)) +$(info TARGET_2ND_ARCH=$(TARGET_2ND_ARCH)) +$(info TARGET_2ND_ARCH_VARIANT=$(TARGET_2ND_ARCH_VARIANT)) +$(info TARGET_2ND_CPU_VARIANT=$(TARGET_2ND_CPU_VARIANT)) $(info HOST_ARCH=$(HOST_ARCH)) $(info HOST_OS=$(HOST_OS)) $(info HOST_OS_EXTRA=$(HOST_OS_EXTRA)) -- cgit v1.2.3 From 0a5b178fc3b8e0efe8224024bb2a7f139604df1b Mon Sep 17 00:00:00 2001 From: Ji-Hwan Lee Date: Thu, 15 May 2014 20:59:01 +0900 Subject: Clear *.ini and skin directory on installclean Currently, skin directory remains across different emulator targets, and need manual removal. Also, clear hardware-qemu.ini and config.ini. (See https://android-review.googlesource.com/94692 for config.ini) Change-Id: Iaa5849ad043ed3f317325ba1d6df287953636f7a --- core/cleanbuild.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk index fa673320c9..46a312ab14 100644 --- a/core/cleanbuild.mk +++ b/core/cleanbuild.mk @@ -179,11 +179,13 @@ installclean_files := \ $(HOST_OUT)/obj/NOTICE_FILES \ $(HOST_OUT)/sdk \ $(PRODUCT_OUT)/*.img \ + $(PRODUCT_OUT)/*.ini \ $(PRODUCT_OUT)/*.txt \ $(PRODUCT_OUT)/*.xlb \ $(PRODUCT_OUT)/*.zip \ $(PRODUCT_OUT)/kernel \ $(PRODUCT_OUT)/data \ + $(PRODUCT_OUT)/skin \ $(PRODUCT_OUT)/obj/APPS \ $(PRODUCT_OUT)/obj/NOTICE_FILES \ $(PRODUCT_OUT)/obj/PACKAGING \ -- cgit v1.2.3 From 9f5d3dde17bd22430bdc99d836166c7792a99a84 Mon Sep 17 00:00:00 2001 From: Ji-Hwan Lee Date: Thu, 15 May 2014 22:03:08 +0900 Subject: Put prebuilt emulator path after host output So that built emulator is used instead of prebuilt one when BUILD_EMULATOR=true. Change-Id: I67dfbfc2c3bf9bf051e56de425caa07b08d4b2e4 --- envsetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index d02646630a..e4e2ece186 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -186,7 +186,7 @@ function setpaths() ;; esac if [ -n "$ANDROID_EMULATOR_PREBUILTS" -a -d "$ANDROID_EMULATOR_PREBUILTS" ]; then - ANDROID_BUILD_PATHS=$ANDROID_EMULATOR_PREBUILTS:$ANDROID_BUILD_PATHS + ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_EMULATOR_PREBUILTS export ANDROID_EMULATOR_PREBUILTS fi -- cgit v1.2.3 From 1d67eec191b76e299acfa54d95f3897e25536174 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 15 May 2014 09:54:26 -0700 Subject: make SignApk do zip alignment When signing an APK, make the SignApk tool align the stored entries to (by default) 4-byte boundaries. This obviates the need to run the separate zipalign tool, which currently does this job. The alignment byte count can be specified with the -a option. OTA package signing (with -w) never does alignment. The order of files in the output APK is changed so that all stored files come first in the output, followed by all non-stored files. This is not expected to have any impact in practice. Change-Id: Iaeef89b2a7283e25fadb99c0a0f0641f682d76b8 --- tools/signapk/SignApk.java | 76 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/tools/signapk/SignApk.java b/tools/signapk/SignApk.java index b2470722c8..e661e506f4 100644 --- a/tools/signapk/SignApk.java +++ b/tools/signapk/SignApk.java @@ -461,24 +461,75 @@ class SignApk { * reduce variation in the output file and make incremental OTAs * more efficient. */ - private static void copyFiles(Manifest manifest, - JarFile in, JarOutputStream out, long timestamp) throws IOException { + private static void copyFiles(Manifest manifest, JarFile in, JarOutputStream out, + long timestamp, int alignment) throws IOException { byte[] buffer = new byte[4096]; int num; Map entries = manifest.getEntries(); ArrayList names = new ArrayList(entries.keySet()); Collections.sort(names); + + boolean firstEntry = true; + long offset = 0L; + + // We do the copy in two passes -- first copying all the + // entries that are STORED, then copying all the entries that + // have any other compression flag (which in practice means + // DEFLATED). This groups all the stored entries together at + // the start of the file and makes it easier to do alignment + // on them (since only stored entries are aligned). + for (String name : names) { JarEntry inEntry = in.getJarEntry(name); JarEntry outEntry = null; - if (inEntry.getMethod() == JarEntry.STORED) { - // Preserve the STORED method of the input entry. - outEntry = new JarEntry(inEntry); - } else { - // Create a new entry so that the compressed len is recomputed. - outEntry = new JarEntry(name); + if (inEntry.getMethod() != JarEntry.STORED) continue; + // Preserve the STORED method of the input entry. + outEntry = new JarEntry(inEntry); + outEntry.setTime(timestamp); + + // 'offset' is the offset into the file at which we expect + // the file data to begin. This is the value we need to + // make a multiple of 'alignement'. + offset += JarFile.LOCHDR + outEntry.getName().length(); + if (firstEntry) { + // The first entry in a jar file has an extra field of + // four bytes that you can't get rid of; any extra + // data you specify in the JarEntry is appended to + // these forced four bytes. This is JAR_MAGIC in + // JarOutputStream; the bytes are 0xfeca0000. + offset += 4; + firstEntry = false; + } + if (alignment > 0 && (offset % alignment != 0)) { + // Set the "extra data" of the entry to between 1 and + // alignment-1 bytes, to make the file data begin at + // an aligned offset. + int needed = alignment - (int)(offset % alignment); + outEntry.setExtra(new byte[needed]); + offset += needed; + } + + out.putNextEntry(outEntry); + + InputStream data = in.getInputStream(inEntry); + while ((num = data.read(buffer)) > 0) { + out.write(buffer, 0, num); + offset += num; } + out.flush(); + } + + // Copy all the non-STORED entries. We don't attempt to + // maintain the 'offset' variable past this point; we don't do + // alignment on these entries. + + for (String name : names) { + JarEntry inEntry = in.getJarEntry(name); + JarEntry outEntry = null; + if (inEntry.getMethod() == JarEntry.STORED) continue; + // Create a new entry so that the compressed len is recomputed. + outEntry = new JarEntry(name); outEntry.setTime(timestamp); out.putNextEntry(outEntry); @@ -589,7 +640,7 @@ class SignApk { long timestamp = publicKey.getNotBefore().getTime() + 3600L * 1000; Manifest manifest = addDigestsToManifest(inputJar, hash); - copyFiles(manifest, inputJar, outputJar, timestamp); + copyFiles(manifest, inputJar, outputJar, timestamp, 0); addOtacert(outputJar, publicKeyFile, timestamp, manifest, hash); signFile(manifest, inputJar, @@ -778,6 +829,7 @@ class SignApk { private static void usage() { System.err.println("Usage: signapk [-w] " + + "[-a ] " + "[-providerClass ] " + "publickey.x509[.pem] privatekey.pk8 " + "[publickey2.x509[.pem] privatekey2.pk8 ...] " + @@ -794,6 +846,7 @@ class SignApk { boolean signWholeFile = false; String providerClass = null; String providerArg = null; + int alignment = 4; int argstart = 0; while (argstart < args.length && args[argstart].startsWith("-")) { @@ -806,6 +859,9 @@ class SignApk { } providerClass = args[++argstart]; ++argstart; + } else if ("-a".equals(args[argstart])) { + alignment = Integer.parseInt(args[++argstart]); + ++argstart; } else { usage(); } @@ -872,7 +928,7 @@ class SignApk { outputJar.setLevel(9); Manifest manifest = addDigestsToManifest(inputJar, hashes); - copyFiles(manifest, inputJar, outputJar, timestamp); + copyFiles(manifest, inputJar, outputJar, timestamp, alignment); signFile(manifest, inputJar, publicKey, privateKey, outputJar); outputJar.close(); } -- cgit v1.2.3 From f942e496a309ce8b0fd4f42cf3ddd478157944ac Mon Sep 17 00:00:00 2001 From: Ji-Hwan Lee Date: Thu, 17 Apr 2014 00:00:39 +0900 Subject: Increase system image size to 650M for generic_x86 Change-Id: I4457796bdaff8c2626eb0788199be75f3ab4cd47 --- target/board/generic_x86/BoardConfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk index 67f0ecff12..faf8600c9b 100644 --- a/target/board/generic_x86/BoardConfig.mk +++ b/target/board/generic_x86/BoardConfig.mk @@ -35,7 +35,7 @@ BUILD_EMULATOR_OPENGL := true USE_OPENGL_RENDERER := true TARGET_USERIMAGES_USE_EXT4 := true -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800 +BOARD_SYSTEMIMAGE_PARTITION_SIZE := 681574400 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 -- cgit v1.2.3 From a303c4f5461b367c5e72f69b8c0d1be9fe50499e Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Thu, 15 May 2014 18:50:06 -0700 Subject: x86_common.mk has been replaced by HOST_x86_common.mk Change-Id: I19eea82bb35d3f65a2d894c687131a1eafbe2cc9 --- core/clang/x86_common.mk | 54 ------------------------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 core/clang/x86_common.mk diff --git a/core/clang/x86_common.mk b/core/clang/x86_common.mk deleted file mode 100644 index 0bb565f52c..0000000000 --- a/core/clang/x86_common.mk +++ /dev/null @@ -1,54 +0,0 @@ -ifeq ($(HOST_OS),darwin) -# nothing required here yet -endif - -ifeq ($(HOST_OS),linux) -CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \ - --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG) \ - --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ - -no-integrated-as - -CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \ - --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG) \ - -no-integrated-as - -ifneq ($(strip $(BUILD_HOST_64bit)),) -CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ - --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG) \ - --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ - -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \ - -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux \ - -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \ - -no-integrated-as - -CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ - --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG) \ - --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ - -B$(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \ - -B$(HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \ - -L$(HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \ - -L$(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \ - -no-integrated-as -else -CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ - --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG) \ - --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ - -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \ - -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux/32 \ - -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \ - -no-integrated-as - -CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ - --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG) \ - --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ - -B$(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \ - -B$(HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \ - -L$(HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \ - -L$(HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \ - -no-integrated-as -endif -endif - -ifeq ($(HOST_OS),windows) -# nothing required here yet -endif \ No newline at end of file -- cgit v1.2.3 From 6374153fbf008f39ef5de03120de2b218d1d0701 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 16 May 2014 09:37:23 -0700 Subject: Force to build llvm from source in 64-bit host build. Bug: 13751317 Change-Id: I4a4150bfe21607eb7a2342bbd8120b431427eee5 --- core/clang/config.mk | 5 +++++ core/config.mk | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/clang/config.mk b/core/clang/config.mk index d44be526b1..227169d4e2 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -6,6 +6,11 @@ WITHOUT_TARGET_CLANG := true WITHOUT_HOST_CLANG := true endif +# We don't have 64-bit host prebuilts yet. +ifeq (true,$(HOST_IS_64_BIT)) +FORCE_BUILD_LLVM_COMPONENTS := true +endif + LLVM_PREBUILTS_PATH := prebuilts/clang/$(BUILD_OS)-x86/host/3.5/bin LLVM_PREBUILTS_HEADER_PATH := prebuilts/clang/$(BUILD_OS)-x86/host/3.5/lib/clang/3.5/include/ diff --git a/core/config.mk b/core/config.mk index 84ff3fea4e..287944e96e 100644 --- a/core/config.mk +++ b/core/config.mk @@ -358,7 +358,7 @@ endif # --------------------------------------------------------------- # Generic tools. -LEX := prebuilts/misc/$(BUILD_OS)-$(BUILD_ARCH)/flex/flex-2.5.39 +LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39 # The default PKGDATADIR built in the prebuilt bison is a relative path # external/bison/data. # To run bison from elsewhere you need to set up enviromental variable -- cgit v1.2.3 From 34d5f1b27e862bf0653d89b9111d38f7de1f9c95 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 16 May 2014 10:38:43 -0700 Subject: Real "LOCAL_MULTILIB := both" for prebuilts This uses the fact that unsetting LOCAL_MULTILIB equals "either". It's useful to build for both 32-bit and 64-bit in the same prebuilt module definition. Bug: 13751317 Change-Id: I4f1625a83e13f22f807039afebae73f69ed35918 --- core/multilib.mk | 2 +- core/package.mk | 1 - core/prebuilt.mk | 26 ++++++++++++++++++-------- core/prebuilt_internal.mk | 8 +++++++- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/core/multilib.mk b/core/multilib.mk index f630c94430..a3ced65d2c 100644 --- a/core/multilib.mk +++ b/core/multilib.mk @@ -1,4 +1,4 @@ -# Translate LOCAL_32_BIT_ONLY and LOCAL_NO_2ND_ARCH to LOCAL_MULTILIB, +# Translate LOCAL_32_BIT_ONLY to LOCAL_MULTILIB, # and check LOCAL_MULTILIB is a valid value. Returns module's multilib # setting in my_module_multilib, or empty if not set. diff --git a/core/package.mk b/core/package.mk index 0861a79bc7..78b65db107 100644 --- a/core/package.mk +++ b/core/package.mk @@ -1,6 +1,5 @@ # We don't automatically set up rules to build packages for both # TARGET_ARCH and TARGET_2ND_ARCH. -# 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_ diff --git a/core/prebuilt.mk b/core/prebuilt.mk index c280900af6..33f5dc6c2f 100644 --- a/core/prebuilt.mk +++ b/core/prebuilt.mk @@ -14,26 +14,36 @@ endif include $(BUILD_SYSTEM)/multilib.mk -ifndef my_module_multilib -# prebuilts default to building for either architecture, -# the first if its supported, otherwise the second. -my_module_multilib := both -endif +my_skip_non_preferred_arch := # check if first arch is supported 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 (,$($(my_prefix)2ND_ARCH)) +ifneq ($(my_module_multilib),both) +my_skip_non_preferred_arch := true +endif # $(my_module_multilib) +endif # $(my_module_arch_supported) + +ifndef my_skip_non_preferred_arch +ifneq (,$($(my_prefix)2ND_ARCH)) # check if secondary arch is supported 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 +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)/prebuilt_internal.mk -endif -endif # $(my_prefix)2ND_ARCH +endif # $(my_module_arch_supported) +endif # $($(my_prefix)2ND_ARCH) +endif # $(my_skip_non_preferred_arch) not true LOCAL_2ND_ARCH_VAR_PREFIX := diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 089cc6300f..f63d29184c 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -19,13 +19,19 @@ endif # Not much sense to check build prebuilts LOCAL_DONT_CHECK_MODULE := true +my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32) + ifdef LOCAL_PREBUILT_MODULE_FILE my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE) else 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) + ifdef LOCAL_SRC_FILES_$(my_32_64_bit_suffix) + my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) + else + my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES) + endif endif endif -- cgit v1.2.3 From 965bfefb6b5f7a89d10fa5c03d06591e99314c4d Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 14 May 2014 14:16:47 -0700 Subject: Use libc++ versions of gtest libs when needed Change-Id: I19aa58a83a9da680d441af5f3956a2fbdf18c4e4 --- core/host_test_internal.mk | 4 ++++ core/target_test_internal.mk | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk index 650b9c6f5c..c2c318656b 100644 --- a/core/host_test_internal.mk +++ b/core/host_test_internal.mk @@ -5,7 +5,11 @@ LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g LOCAL_C_INCLUDES += external/gtest/include +ifneq ($(filter libc++,$(LOCAL_SHARED_LIBRARIES)),) +LOCAL_STATIC_LIBRARIES += libgtest_libcxx_host libgtest_main_libcxx_host +else LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host LOCAL_SHARED_LIBRARIES += +endif LOCAL_LDLIBS += -lpthread diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk index 7b99678f9b..60a7c9efa9 100644 --- a/core/target_test_internal.mk +++ b/core/target_test_internal.mk @@ -5,6 +5,9 @@ LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING LOCAL_C_INCLUDES += external/gtest/include +ifneq ($(filter libc++,$(LOCAL_SHARED_LIBRARIES)),) +LOCAL_STATIC_LIBRARIES += libgtest_libcxx libgtest_main_libcxx +else LOCAL_STATIC_LIBRARIES += libgtest libgtest_main ifndef LOCAL_SDK_VERSION @@ -14,6 +17,7 @@ LOCAL_C_INCLUDES += bionic \ LOCAL_SHARED_LIBRARIES += libstlport LOCAL_STATIC_LIBRARIES += libstdc++ endif +endif ifndef LOCAL_MODULE_PATH LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE) -- cgit v1.2.3 From 9b0c6ff69c7f80fd1fd0346c7840a0ca3e640a75 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Wed, 14 May 2014 14:16:47 -0700 Subject: Use libc++ versions of gtest libs when needed Change-Id: Id8752ea946cbaa747dfa4fccf38d680dfeee5b45 --- core/host_test_internal.mk | 2 +- core/target_test_internal.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk index c2c318656b..426c400ad2 100644 --- a/core/host_test_internal.mk +++ b/core/host_test_internal.mk @@ -6,7 +6,7 @@ LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g LOCAL_C_INCLUDES += external/gtest/include ifneq ($(filter libc++,$(LOCAL_SHARED_LIBRARIES)),) -LOCAL_STATIC_LIBRARIES += libgtest_libcxx_host libgtest_main_libcxx_host +LOCAL_STATIC_LIBRARIES += libgtest_libc++_host libgtest_main_libc++_host else LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host LOCAL_SHARED_LIBRARIES += diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk index 60a7c9efa9..49ea518cfe 100644 --- a/core/target_test_internal.mk +++ b/core/target_test_internal.mk @@ -6,7 +6,7 @@ LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING LOCAL_C_INCLUDES += external/gtest/include ifneq ($(filter libc++,$(LOCAL_SHARED_LIBRARIES)),) -LOCAL_STATIC_LIBRARIES += libgtest_libcxx libgtest_main_libcxx +LOCAL_STATIC_LIBRARIES += libgtest_libc++ libgtest_main_libc++ else LOCAL_STATIC_LIBRARIES += libgtest libgtest_main -- cgit v1.2.3 From ef773d22ca2eaacda0a3e5101c76bde3efcf98aa Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 16 May 2014 16:22:32 -0700 Subject: Fix the missing 2nd arch prefix. Bug: 13751317 Change-Id: Ie5a323a0a89245576dbc91271d3178574942627d --- core/combo/HOST_darwin-x86.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk index d665c76891..4a2bfe3be2 100644 --- a/core/combo/HOST_darwin-x86.mk +++ b/core/combo/HOST_darwin-x86.mk @@ -49,7 +49,7 @@ 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) +$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT) $(combo_2nd_arch_prefix)HOST_AR := $(AR) -- cgit v1.2.3 From d4507067047fe6fdd68e941c97f71beb61e8c594 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 16 May 2014 16:27:11 -0700 Subject: Default TARGET_CPU_SMP to true. Change-Id: If8c52c8ed66d52452967d09885dfe1ca9da13688 --- core/config.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/config.mk b/core/config.mk index 287944e96e..b7f779e522 100644 --- a/core/config.mk +++ b/core/config.mk @@ -524,6 +524,8 @@ ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),) TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2 endif +TARGET_CPU_SMP ?= true + # Flags for DEX2OAT DEX2OAT_TARGET_ARCH := $(TARGET_ARCH) DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_CPU_VARIANT) -- cgit v1.2.3 From c89e1826bab7ec31dabc95453faef8e7bf4c462c Mon Sep 17 00:00:00 2001 From: Ji-Hwan Lee Date: Sun, 18 May 2014 02:41:41 +0900 Subject: Increase system image size to 650M for generic_arm64 Change-Id: I7969ec54dc4225bbe36651c4d9c6a09de1eb89f4 --- target/board/generic_arm64/BoardConfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk index 9d3bcc035c..7f8f3dc5d2 100644 --- a/target/board/generic_arm64/BoardConfig.mk +++ b/target/board/generic_arm64/BoardConfig.mk @@ -48,7 +48,7 @@ BUILD_EMULATOR_OPENGL := true USE_OPENGL_RENDERER := true TARGET_USERIMAGES_USE_EXT4 := true -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800 +BOARD_SYSTEMIMAGE_PARTITION_SIZE := 681574400 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 -- cgit v1.2.3 From b9aa5d43de114cecdf94fabb23d3f61f147b627d Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Tue, 13 May 2014 13:57:28 -0700 Subject: Multilib support for odex If the VM is libart and DEXPREOPT is enabled, - For a Java library and the boot image, we build for both 1st arch and 2nd arch. - For an app, we build for the multilib arch the module is targeted for. The odex file will be in /.odex inside the same dir where the jar/apk file gets installed. Nothing changed if it's built for libdvm. Bug: 14694978 Change-Id: I45118a83758b41d52d6c9e38f93f0ba2775a6c74 --- core/clear_vars.mk | 2 +- core/config.mk | 19 +++++------ core/dex_preopt.mk | 17 ++++----- core/dex_preopt_libart.mk | 76 +++++++++++++++++------------------------ core/dex_preopt_libart_boot.mk | 55 +++++++++++++++++++++++++++++ core/dex_preopt_odex_install.mk | 72 +++++++++++++++++++++++++++++++++++--- core/java_library.mk | 11 ++---- core/package_internal.mk | 8 +---- core/prebuilt_internal.mk | 8 +---- target/product/core_64_bit.mk | 3 -- 10 files changed, 178 insertions(+), 93 deletions(-) create mode 100644 core/dex_preopt_libart_boot.mk diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 682656b91d..1dd5cfe569 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -118,7 +118,7 @@ LOCAL_RENDERSCRIPT_SKIP_INSTALL:= LOCAL_RENDERSCRIPT_TARGET_API:= LOCAL_BUILD_HOST_DEX:= LOCAL_DEX_PREOPT:= # '',true,false,nostripping -LOCAL_DEX_PREOPT_IMAGE:= +LOCAL_DEX_PREOPT_IMAGE_LOCATION:= LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full LOCAL_PROTOC_FLAGS:= LOCAL_PROTO_JAVA_OUTPUT_PARAMS:= diff --git a/core/config.mk b/core/config.mk index 287944e96e..1c2db34388 100644 --- a/core/config.mk +++ b/core/config.mk @@ -528,20 +528,17 @@ endif DEX2OAT_TARGET_ARCH := $(TARGET_ARCH) DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_CPU_VARIANT) DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default +ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait denver)) + DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div +endif -# If for a 64bit build we have a 2nd architecture but the zygote isn't 64bit, -# assume DEX2OAT should DEXPREOPT for the 2nd architecture. ifdef TARGET_2ND_ARCH - ifeq (true,$(TARGET_IS_64_BIT)) - ifeq ($(filter ro.zygote=zygote64,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)),) - DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH) - DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_2ND_CPU_VARIANT) - endif - endif +$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH) +$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(TARGET_2ND_CPU_VARIANT) +$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default +ifneq (,$(filter $($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait denver)) + $(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div endif - -ifneq (,$(filter $(DEX2OAT_TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait denver)) - DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div endif # define clang/llvm tools and global flags diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk index 46a6479b36..ab970f917a 100644 --- a/core/dex_preopt.mk +++ b/core/dex_preopt.mk @@ -49,25 +49,26 @@ endif include $(BUILD_SYSTEM)/dex_preopt_libart.mk # Define dexpreopt-one-file based on current default runtime. -# $(1): the boot image to use (unused for libdvm) -# $(2): the input .jar or .apk file -# $(3): the input .jar or .apk target location (unused for libdvm) -# $(4): the output .odex file +# $(1): the input .jar or .apk file +# $(2): the output .odex file ifeq ($(DALVIK_VM_LIB),libdvm.so) define dexpreopt-one-file -$(call dexopt-one-file,$(2),$(4)) +$(call dexopt-one-file,$(1),$(2)) endef DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEXOPT_DEPENDENCY) DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEXPREOPT_BOOT_ODEXS) else define dexpreopt-one-file -$(call dex2oat-one-file,$(1),$(2),$(3),$(4)) +$(call dex2oat-one-file,$(1),$(2)) endef DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OATD_DEPENDENCY) -DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) -endif +DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) +ifdef TARGET_2ND_ARCH +$(TARGET_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) +endif # TARGET_2ND_ARCH +endif # DALVIK_VM_LIB else $(warning No DALVIK_VM_LIB, disable dexpreopt.) WITH_DEXPREOPT := false diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 7f3285ce16..7d8cee03a3 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -23,20 +23,6 @@ DEX2OATD_DEPENDENCY += $(LIBARTD_COMPILER) PRELOADED_CLASSES := frameworks/base/preloaded-classes -LIBART_BOOT_IMAGE := /$(DEXPREOPT_BOOT_JAR_DIR)/boot-$(DEX2OAT_TARGET_ARCH).art - -DEFAULT_DEX_PREOPT_BUILT_IMAGE := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot-$(DEX2OAT_TARGET_ARCH).art - -DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := -ifneq ($(PRODUCT_DEX_PREOPT_IMAGE_IN_DATA),true) -DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$(LIBART_BOOT_IMAGE) - -# The rule to install boot.art and boot.oat -$(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) | $(ACP) - $(call copy-file-to-target) - $(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@) -endif - # start of image reserved address space LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000 @@ -49,48 +35,50 @@ endif ######################################################################## # The full system boot classpath +# Returns the path to the .odex file +# $(1): the arch name. +# $(2): the full path (including file name) of the corresponding .jar or .apk. +define get-odex-file-path +$(dir $(2))$(1)/$(basename $(notdir $(2))).odex +endef + +# Returns the path to the image file (such as "/system/framework//boot.art" +# $(1): the arch name (such as "arm") +# $(2): the image location (such as "/system/framework/boot.art") +define get-image-file-path +$(dir $(2))$(1)/$(notdir $(2)) +endef + # note we use core-libart.jar in place of core.jar for ART. LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES)) LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar) -# The .oat with symbols -LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) - -# Use dex2oat debug version for better error reporting -$(DEFAULT_DEX_PREOPT_BUILT_IMAGE): $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OATD_DEPENDENCY) - @echo "target dex2oat: $@ ($?)" - @mkdir -p $(dir $@) - @mkdir -p $(dir $(LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) - $(hide) $(DEX2OATD) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) \ - $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ - $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ - --oat-symbols=$(LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \ - --oat-file=$(patsubst %.art,%.oat,$@) \ - --oat-location=$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) \ - --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ - --instruction-set=$(DEX2OAT_TARGET_ARCH) \ - --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ - --android-root=$(PRODUCT_OUT)/system +my_2nd_arch_prefix := +include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk + +ifdef TARGET_2ND_ARCH +my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX) +include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk +my_2nd_arch_prefix := +endif ######################################################################## # For a single jar or APK -# $(1): the boot image to use -# $(2): the input .jar or .apk file -# $(3): the input .jar or .apk target location -# $(4): the output .odex file +# $(1): the input .jar or .apk file +# $(2): the output .odex file define dex2oat-one-file -$(hide) rm -f $(4) -$(hide) mkdir -p $(dir $(4)) +$(hide) rm -f $(2) +$(hide) mkdir -p $(dir $(2)) $(hide) $(DEX2OATD) \ --runtime-arg -Xms64m --runtime-arg -Xmx64m \ - --boot-image=$(1) \ - --dex-file=$(2) \ - --dex-location=$(3) \ - --oat-file=$(4) \ + --boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \ + --dex-file=$(1) \ + --dex-location=$(PRIVATE_DEX_LOCATION) \ + --oat-file=$(2) \ --android-root=$(PRODUCT_OUT)/system \ - --instruction-set=$(DEX2OAT_TARGET_ARCH) \ - --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) + --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ + --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) endef diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk new file mode 100644 index 0000000000..70130b62fd --- /dev/null +++ b/core/dex_preopt_libart_boot.mk @@ -0,0 +1,55 @@ +# Rules to build boot.art +# Input variables: +# my_2nd_arch_prefix: indicates if this is to build for the 2nd arch. + +# The image "location" is a symbolic path that with multiarchitecture +# support doesn't really exist on the device. Typically it is +# /system/framework/boot.art and should be the same for all supported +# architectures on the device. The concrete architecture specific +# content actually ends up in a "filename" that contains an +# architecture specific directory name such as arm, arm64, mips, +# mips64, x86, x86_64. +# +# Here are some example values for an x86_64 / x86 configuration: +# +# DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION=out/target/product/generic_x86_64/dex_bootjars/system/framework/boot.art +# DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME=out/target/product/generic_x86_64/dex_bootjars/system/framework/x86_64/boot.art +# LIBART_BOOT_IMAGE=/system/framework/x86_64/boot.art +# +# 2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION=out/target/product/generic_x86_64/dex_bootjars/system/framework/boot.art +# 2ND_DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME=out/target/product/generic_x86_64/dex_bootjars/system/framework/x86/boot.art +# 2ND_LIBART_BOOT_IMAGE=/system/framework/x86/boot.art + +$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art +$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art +$(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME := /$(DEXPREOPT_BOOT_JAR_DIR)/$($(my_2nd_arch_prefix)DEX2OAT_TARGET_ARCH)/boot.art + +# The .oat with symbols +$(my_2nd_arch_prefix)LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)$(patsubst %.art,%.oat,$($(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME)) + +$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := +ifneq ($(PRODUCT_DEX_PREOPT_IMAGE_IN_DATA),true) +$(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$($(my_2nd_arch_prefix)LIBART_BOOT_IMAGE_FILENAME) +endif + +# The rule to install boot.art and boot.oat +$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) | $(ACP) + $(call copy-file-to-target) + $(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@) + +$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix) +# Use dex2oat debug version for better error reporting +$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OATD_DEPENDENCY) + @echo "target dex2oat: $@ ($?)" + @mkdir -p $(dir $@) + @mkdir -p $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) + $(hide) $(DEX2OATD) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) \ + $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ + $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ + --oat-symbols=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \ + --oat-file=$(patsubst %.art,%.oat,$@) \ + --oat-location=$(patsubst %.art,%.oat,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_BOOT_IMAGE_FILENAME)) \ + --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ + --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \ + --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ + --android-root=$(PRODUCT_OUT)/system diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index b0b73afaf2..6d70dde9c7 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -43,22 +43,86 @@ else # libdvm.so # For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE). # We use this installed_odex trick to get boot.art installed. installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) +# Append the odex for the 2nd arch if we have one. +installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) endif # libdvm.so else # boot jar +ifeq ($(DALVIK_VM_LIB),libdvm.so) built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex -ifneq ($(DALVIK_VM_LIB),libdvm.so) # libart -ifndef LOCAL_DEX_PREOPT_IMAGE -LOCAL_DEX_PREOPT_IMAGE := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) +$(built_odex) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \ + $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) +else # libart +ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) +# For a Java library, we build odex for both 1st arch and 2nd arch, if we have one. +# ################################################# +# Odex for the 1st arch +built_odex := $(call get-odex-file-path,$(DEX2OAT_TARGET_ARCH),$(LOCAL_BUILT_MODULE)) +ifdef LOCAL_DEX_PREOPT_IMAGE_LOCATION +my_dex_preopt_image_location := $(LOCAL_DEX_PREOPT_IMAGE_LOCATION) +else +my_dex_preopt_image_location := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION) +endif +my_dex_preopt_image_filename := $(call get-image-file-path,$(DEX2OAT_TARGET_ARCH),$(my_dex_preopt_image_location)) +$(built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := +$(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) +$(built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location) +$(built_odex) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \ + $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) \ + $(my_dex_preopt_image_filename) +installed_odex := $(call get-odex-file-path,$(DEX2OAT_TARGET_ARCH),$(LOCAL_INSTALLED_MODULE)) + +# ################################################# +# Odex for the 2nd arch +ifdef TARGET_2ND_ARCH +built_odex2 := $(call get-odex-file-path,$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(LOCAL_BUILT_MODULE)) +ifdef LOCAL_DEX_PREOPT_IMAGE_LOCATION +my_dex_preopt_image_location := $(LOCAL_DEX_PREOPT_IMAGE_LOCATION) +else +my_dex_preopt_image_location := $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION) +endif +my_dex_preopt_image_filename := $(call get-image-file-path,$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(my_dex_preopt_image_location)) +$(built_odex2): PRIVATE_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX) +$(built_odex2): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) +$(built_odex2): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location) +$(built_odex2) : $($(TARGET_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \ + $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) \ + $(my_dex_preopt_image_filename) + +built_odex += $(built_odex2) +installed_odex += $(call get-odex-file-path,$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(LOCAL_INSTALLED_MODULE)) +endif # TARGET_2ND_ARCH +# ################################################# +else # must be APPS +# For an app, we build for the multilib arch it's targeted for. +built_odex := $(call get-odex-file-path,$($(LOCAL_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(LOCAL_BUILT_MODULE)) +ifdef LOCAL_DEX_PREOPT_IMAGE_LOCATION +my_dex_preopt_image_location := $(LOCAL_DEX_PREOPT_IMAGE_LOCATION) +else +my_dex_preopt_image_location := $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION) endif +my_dex_preopt_image_filename := $(call get-image-file-path,$($(LOCAL_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(my_dex_preopt_image_location)) +# $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE) +$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX) +$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) +$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location) +$(LOCAL_BUILT_MODULE) $(built_odex) : $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \ + $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) \ + $(my_dex_preopt_image_filename) +installed_odex := $(call get-odex-file-path,$($(LOCAL_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(LOCAL_INSTALLED_MODULE)) +endif # LOCAL_MODULE_CLASS endif # libart endif # boot jar ifdef built_odex # We need $(LOCAL_BUILT_MODULE) in the deps to enforce reinstallation # even if $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE), such as in package.mk. -$(installed_odex) : $(built_odex) $(LOCAL_BUILT_MODULE) | $(ACP) +# Use pattern rule - we may have multiple installed odex files. +# Ugly syntax - See the definition get-odex-file-path. +$(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%/$(notdir $(word 1,$(installed_odex))) \ + : $(dir $(LOCAL_BUILT_MODULE))%/$(notdir $(word 1,$(built_odex))) \ + $(LOCAL_BUILT_MODULE) | $(ACP) @echo "Install: $@" $(copy-file-to-target) endif diff --git a/core/java_library.mk b/core/java_library.mk index 343b27e38b..dffc7d90aa 100644 --- a/core/java_library.mk +++ b/core/java_library.mk @@ -93,15 +93,10 @@ endif else # ! boot jar $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE) -$(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) -$(built_odex): PRIVATE_DEX_PREOPT_IMAGE := $(LOCAL_DEX_PREOPT_IMAGE) -# Make sure the boot jars get dex-preopt-ed first -$(built_odex) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) -$(built_odex) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) -$(built_odex) : $(LOCAL_DEX_PREOPT_IMAGE) -$(built_odex) : $(common_javalib.jar) +# Use pattern rule - we may have multiple built odex files. +$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar) @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)" - $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$<,$(PRIVATE_DEX_LOCATION),$@) + $(call dexpreopt-one-file,$<,$@) $(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) $(call copy-file-to-target) diff --git a/core/package_internal.mk b/core/package_internal.mk index 768032ebd4..f8d2f43655 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -337,13 +337,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\ # Define the rule to build the actual package. $(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN) ifdef LOCAL_DEX_PREOPT -$(LOCAL_BUILT_MODULE): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) $(LOCAL_BUILT_MODULE): PRIVATE_BUILT_ODEX := $(built_odex) -$(LOCAL_BUILT_MODULE): PRIVATE_DEX_PREOPT_IMAGE := $(LOCAL_DEX_PREOPT_IMAGE) -# Make sure the boot jars get dexpreopt-ed first -$(LOCAL_BUILT_MODULE) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) -$(LOCAL_BUILT_MODULE) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) -$(LOCAL_BUILT_MODULE) : $(LOCAL_DEX_PREOPT_IMAGE) # built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe. $(built_odex) : $(LOCAL_BUILT_MODULE) @@ -377,7 +371,7 @@ ifneq ($(extra_jar_args),) endif $(sign-package) ifdef LOCAL_DEX_PREOPT - $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$@,$(PRIVATE_DEX_LOCATION),$(PRIVATE_BUILT_ODEX)) + $(call dexpreopt-one-file,$@,$(PRIVATE_BUILT_ODEX)) ifneq (nostripping,$(LOCAL_DEX_PREOPT)) $(call dexpreopt-remove-classes.dex,$@) endif diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 089cc6300f..2445d0d1cc 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -157,13 +157,7 @@ LOCAL_DEX_PREOPT := false include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk ####################################### ifdef LOCAL_DEX_PREOPT -$(built_module): PRIVATE_DEX_PREOPT_IMAGE := $(LOCAL_DEX_PREOPT_IMAGE) -$(built_module): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) $(built_module): PRIVATE_BUILT_ODEX := $(built_odex) -# Make sure the boot jars get dexpreopt-ed first -$(built_module) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) -$(built_module) : $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) -(built_module) : $(LOCAL_DEX_PREOPT_IMAGE) # built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe. $(built_odex) : $(LOCAL_BUILT_MODULE) endif # LOCAL_DEX_PREOPT @@ -174,7 +168,7 @@ ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) $(sign-package) endif ifdef LOCAL_DEX_PREOPT - $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$@,$(PRIVATE_DEX_LOCATION),$(PRIVATE_BUILT_ODEX)) + $(call dexpreopt-one-file,$@,$(PRIVATE_BUILT_ODEX)) endif $(align-package) diff --git a/target/product/core_64_bit.mk b/target/product/core_64_bit.mk index a21620c2a2..5d7abcb752 100644 --- a/target/product/core_64_bit.mk +++ b/target/product/core_64_bit.mk @@ -37,6 +37,3 @@ TARGET_PREFER_32_BIT_APPS := true TARGET_SUPPORTS_32_BIT_APPS := true TARGET_SUPPORTS_64_BIT_APPS := true - -# Disable DEXPREOPT until we have multilib support (bug 14694978). -WITH_DEXPREOPT := false -- cgit v1.2.3 From 93e450767f6c4332f163e6c0886b0e435552a61d Mon Sep 17 00:00:00 2001 From: Ji-Hwan Lee Date: Mon, 19 May 2014 20:43:23 +0900 Subject: Allow qemu_device read-write access to various processes Basically, allow access of qemu_device where gpu_device is allowed, for the case when the emulator runs with OpenGL/ES emulation. Most noticably, surfaceflinger crashes without qemu_device access. Bug: 15052949 Change-Id: Ib891365a6d503309bced64e2512c4d8f29d9a07e --- target/board/generic/BoardConfig.mk | 4 +++- target/board/generic/sepolicy/app.te | 1 + target/board/generic/sepolicy/bootanim.te | 1 + target/board/generic/sepolicy/surfaceflinger.te | 1 + target/board/generic/sepolicy/zygote.te | 1 + target/board/generic_x86/BoardConfig.mk | 3 +++ target/board/generic_x86/sepolicy/app.te | 1 + target/board/generic_x86/sepolicy/bootanim.te | 1 + target/board/generic_x86/sepolicy/surfaceflinger.te | 1 + target/board/generic_x86/sepolicy/zygote.te | 1 + 10 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 target/board/generic/sepolicy/app.te create mode 100644 target/board/generic/sepolicy/zygote.te create mode 100644 target/board/generic_x86/sepolicy/app.te create mode 100644 target/board/generic_x86/sepolicy/bootanim.te create mode 100644 target/board/generic_x86/sepolicy/surfaceflinger.te diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk index c30cc75862..6d58b1c86b 100644 --- a/target/board/generic/BoardConfig.mk +++ b/target/board/generic/BoardConfig.mk @@ -78,6 +78,7 @@ TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy BOARD_SEPOLICY_UNION += \ adbd.te \ + app.te \ bootanim.te \ device.te \ domain.te \ @@ -88,4 +89,5 @@ BOARD_SEPOLICY_UNION += \ rild.te \ shell.te \ surfaceflinger.te \ - system_server.te + system_server.te \ + zygote.te diff --git a/target/board/generic/sepolicy/app.te b/target/board/generic/sepolicy/app.te new file mode 100644 index 0000000000..fd33453e6c --- /dev/null +++ b/target/board/generic/sepolicy/app.te @@ -0,0 +1 @@ +allow appdomain qemu_device:chr_file rw_file_perms; diff --git a/target/board/generic/sepolicy/bootanim.te b/target/board/generic/sepolicy/bootanim.te index d6506e11dd..a5a84f9fbb 100644 --- a/target/board/generic/sepolicy/bootanim.te +++ b/target/board/generic/sepolicy/bootanim.te @@ -1,2 +1,3 @@ allow bootanim self:process execmem; allow bootanim ashmem_device:chr_file execute; +allow bootanim qemu_device:chr_file rw_file_perms; diff --git a/target/board/generic/sepolicy/surfaceflinger.te b/target/board/generic/sepolicy/surfaceflinger.te index 4c354697ab..671278919d 100644 --- a/target/board/generic/sepolicy/surfaceflinger.te +++ b/target/board/generic/sepolicy/surfaceflinger.te @@ -1,2 +1,3 @@ allow surfaceflinger self:process execmem; allow surfaceflinger ashmem_device:chr_file execute; +allow surfaceflinger qemu_device:chr_file rw_file_perms; diff --git a/target/board/generic/sepolicy/zygote.te b/target/board/generic/sepolicy/zygote.te new file mode 100644 index 0000000000..a5da574060 --- /dev/null +++ b/target/board/generic/sepolicy/zygote.te @@ -0,0 +1 @@ +allow zygote qemu_device:chr_file rw_file_perms; diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk index faf8600c9b..727d3db734 100644 --- a/target/board/generic_x86/BoardConfig.mk +++ b/target/board/generic_x86/BoardConfig.mk @@ -44,7 +44,9 @@ TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true BOARD_SEPOLICY_DIRS += build/target/board/generic_x86/sepolicy BOARD_SEPOLICY_UNION += \ + app.te \ adbd.te \ + bootanim.te \ device.te \ domain.te \ file.te \ @@ -55,5 +57,6 @@ BOARD_SEPOLICY_UNION += \ qemud.te \ rild.te \ shell.te \ + surfaceflinger.te \ system_server.te \ zygote.te diff --git a/target/board/generic_x86/sepolicy/app.te b/target/board/generic_x86/sepolicy/app.te new file mode 100644 index 0000000000..fd33453e6c --- /dev/null +++ b/target/board/generic_x86/sepolicy/app.te @@ -0,0 +1 @@ +allow appdomain qemu_device:chr_file rw_file_perms; diff --git a/target/board/generic_x86/sepolicy/bootanim.te b/target/board/generic_x86/sepolicy/bootanim.te new file mode 100644 index 0000000000..762a57387f --- /dev/null +++ b/target/board/generic_x86/sepolicy/bootanim.te @@ -0,0 +1 @@ +allow bootanim qemu_device:chr_file rw_file_perms; diff --git a/target/board/generic_x86/sepolicy/surfaceflinger.te b/target/board/generic_x86/sepolicy/surfaceflinger.te new file mode 100644 index 0000000000..865405ce55 --- /dev/null +++ b/target/board/generic_x86/sepolicy/surfaceflinger.te @@ -0,0 +1 @@ +allow surfaceflinger qemu_device:chr_file rw_file_perms; diff --git a/target/board/generic_x86/sepolicy/zygote.te b/target/board/generic_x86/sepolicy/zygote.te index 93993a47f1..d34c4a1f9c 100644 --- a/target/board/generic_x86/sepolicy/zygote.te +++ b/target/board/generic_x86/sepolicy/zygote.te @@ -1,2 +1,3 @@ allow zygote self:process execmem; allow zygote self:capability sys_nice; +allow zygote qemu_device:chr_file rw_file_perms; -- cgit v1.2.3 From d033121431821c69e4c2faf5056bff3ee9c89974 Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Mon, 19 May 2014 16:22:21 -0700 Subject: Use aarch64-linux-android-4.9 for arm64 build (attempt #4) GCC: 4.9 (which supports -fstack-protector) Binutils: 2.24 (which supports gc-sections) GDB: 7.7 NDK libraries are still picked up from prebuilts/ndk/*/4.8/* GCC has been patched to disable codegen for calling __cxa_throw_bad_array_new_length. Source code has been sync'ed against the 2014-05-14 snapshot which contains many important fixes (devirtualization, codegen, ...). Change-Id: I43229360ad0132193d5208cb0d1acba55084853c --- core/combo/TARGET_linux-arm64.mk | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk index 6515eb5094..9518ba7da4 100644 --- a/core/combo/TARGET_linux-arm64.mk +++ b/core/combo/TARGET_linux-arm64.mk @@ -38,7 +38,7 @@ endif TARGET_NDK_GCC_VERSION := 4.8 ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),) -TARGET_GCC_VERSION := 4.8 +TARGET_GCC_VERSION := 4.9 else TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP) endif @@ -73,13 +73,9 @@ TARGET_GLOBAL_CFLAGS += \ android_config_h := $(call select-android-config-h,linux-arm64) -# HACK: globally disable -fstack-protector until the toolchain supports it -TARGET_GLOBAL_UNSUPPORTED_CFLAGS := \ - -fstack-protector \ - -fstack-protector-all \ - TARGET_GLOBAL_CFLAGS += \ -fpic -fPIE \ + -fstack-protector \ -ffunction-sections \ -fdata-sections \ -funwind-tables \ @@ -165,6 +161,7 @@ TARGET_CUSTOM_LD_COMMAND := true define transform-o-to-shared-lib-inner $(hide) $(PRIVATE_CXX) \ -nostdlib -Wl,-soname,$(notdir $@) \ + -Wl,--gc-sections \ -Wl,-shared,-Bsymbolic \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \ @@ -189,6 +186,7 @@ endef define transform-o-to-executable-inner $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \ -Wl,-dynamic-linker,/system/bin/linker64 \ + -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \ @@ -213,6 +211,7 @@ endef define transform-o-to-static-executable-inner $(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \ + -Wl,--gc-sections \ -o $@ \ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_STATIC_O)) \ -- cgit v1.2.3 From 7110f241ab0d59796970975f5807fea4fd896fd7 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Tue, 20 May 2014 13:56:00 -0700 Subject: Fix extra/missing : in path setup. Change-Id: I4d95efc781c58af704012922d95841e009bf6286 --- envsetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index e4e2ece186..9670a7f660 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -186,7 +186,7 @@ function setpaths() ;; esac if [ -n "$ANDROID_EMULATOR_PREBUILTS" -a -d "$ANDROID_EMULATOR_PREBUILTS" ]; then - ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_EMULATOR_PREBUILTS + ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS$ANDROID_EMULATOR_PREBUILTS: export ANDROID_EMULATOR_PREBUILTS fi -- cgit v1.2.3 From 0499399231ddba01e0e26f082631ebdbc699e34e Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 20 May 2014 14:37:51 -0700 Subject: The generic_arm64 system image is full. Change-Id: I454c674033525f2f7847d2c91979dff8093c335b --- target/board/generic_arm64/BoardConfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk index 7f8f3dc5d2..c383f87069 100644 --- a/target/board/generic_arm64/BoardConfig.mk +++ b/target/board/generic_arm64/BoardConfig.mk @@ -48,7 +48,7 @@ BUILD_EMULATOR_OPENGL := true USE_OPENGL_RENDERER := true TARGET_USERIMAGES_USE_EXT4 := true -BOARD_SYSTEMIMAGE_PARTITION_SIZE := 681574400 +BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000 BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800 BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016 BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 -- cgit v1.2.3 From 7cf9f28b5f064f309a5023eb73234cecb5cf3de9 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Fri, 18 Apr 2014 20:13:41 -0700 Subject: Support to extract JNI libs from prebuilt APK Use LOCAL_PREBUILT_JNI_LIBS to install prebuilt JNI libraries extracted from the prebuilt apk, or prebuilts as source, to the app specific lib path. LOCAL_PREBUILT_JNI_LIBS accepts 2 kinds of files: - Files like @path/to/libfoo.so (path inside the apk) are JNI libs extracted from the prebuilt apk. In this case, all embedded JNI libs inside the prebuilt apk are stripped. - Files like path/to/libfoo.so (path relative to LOCAL_PATH) are prebuilts in the source tree. Those prebuilt JNI libs are not defined as modules in the build system, so this works around possible module name conflict. Bug: 13170859 Change-Id: I91bb844cc11b3621a85733bc7e8910f168957ef0 --- core/clear_vars.mk | 1 + core/install_jni_libs.mk | 42 +++++++++++++++++++++++++++++++++++++++--- core/prebuilt_internal.mk | 3 +++ 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 1dd5cfe569..be1def1aae 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -88,6 +88,7 @@ LOCAL_COMPRESS_MODULE_SYMBOLS:= LOCAL_STRIP_MODULE:= LOCAL_JNI_SHARED_LIBRARIES:= LOCAL_JNI_SHARED_LIBRARIES_ABI:= +LOCAL_PREBUILT_JNI_LIBS:= LOCAL_JAR_MANIFEST:= LOCAL_INSTRUMENTATION_FOR:= LOCAL_APK_LIBRARIES:= diff --git a/core/install_jni_libs.mk b/core/install_jni_libs.mk index 464a2a20ee..b9e70b1403 100644 --- a/core/install_jni_libs.mk +++ b/core/install_jni_libs.mk @@ -5,9 +5,11 @@ # rs_compatibility_jni_libs (from java.mk) # my_module_path (from base_rules.mk) # partition_tag (from base_rules.mk) +# my_prebuilt_src_file (from prebuilt_internal.mk) # # Output variables: -# jni_shared_libraries, jni_shared_libraries_abi, if we are going to embed the libraries into the apk. +# jni_shared_libraries, jni_shared_libraries_abi, if we are going to embed the libraries into the apk; +# my_extracted_jni_libs, if we extract jni libs from prebuilt apk. # jni_shared_libraries := \ @@ -33,6 +35,10 @@ ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_ my_embed_jni := true endif +# App-specific lib path. +my_app_lib_path := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET$(partition_tag)_OUT_SHARED_LIBRARIES)/$(basename $(LOCAL_INSTALLED_MODULE_STEM)) +my_extracted_jni_libs := + ifdef my_embed_jni # App explicitly requires the prebuilt NDK stl shared libraies. # The NDK stl shared libraries should never go to the system image. @@ -74,12 +80,42 @@ my_leading_separator := ; else my_leading_separator := endif -my_app_lib_path := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET$(partition_tag)_OUT_SHARED_LIBRARIES)/$(basename $(LOCAL_INSTALLED_MODULE_STEM)) $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD += \ $(my_leading_separator)mkdir -p $(my_app_lib_path) \ $(foreach lib, $(my_jni_filenames), ;ln -sf ../$(lib) $(my_app_lib_path)/$(lib)) # Clear jni_shared_libraries to not embed it into the apk. jni_shared_libraries := -endif # $(jni_shared_libraries) not empty +endif # $(jni_shared_libraries) not empty endif # my_embed_jni + +ifdef LOCAL_PREBUILT_JNI_LIBS +# Install prebuilt JNI libs to the app specific lib path. +# Files like @path/to/libfoo.so (path inside the apk) are JNI libs extracted from the prebuilt apk; +# Files like path/to/libfoo.so (path relative to LOCAL_PATH) are prebuilts in the source tree. +my_extracted_jni_libs := $(patsubst @%,%, \ + $(filter @%, $(LOCAL_PREBUILT_JNI_LIBS))) +ifdef my_extracted_jni_libs +ifndef my_prebuilt_src_file +$(error No prebuilt apk to extract prebuilt jni libraries $(my_extracted_jni_libs)) +endif +# We use the first jni lib file as dependency. +my_installed_prebuilt_jni := $(my_app_lib_path)/$(notdir $(firstword $(my_extracted_jni_libs))) +$(my_installed_prebuilt_jni): PRIVATE_JNI_LIBS := $(my_extracted_jni_libs) +$(my_installed_prebuilt_jni): $(my_prebuilt_src_file) + @echo "Extract JNI libs ($@ <- $<)" + @mkdir -p $(dir $@) + $(hide) unzip -j -o -d $(dir $@) $< $(PRIVATE_JNI_LIBS) && touch $@ + +$(LOCAL_INSTALLED_MODULE) : | $(my_installed_prebuilt_jni) +endif + +my_prebulit_jni_libs := $(addprefix $(LOCAL_PATH)/, \ + $(filter-out @%, $(LOCAL_PREBUILT_JNI_LIBS))) +ifdef my_prebulit_jni_libs +$(foreach lib, $(my_prebulit_jni_libs), \ + $(eval $(call copy-one-file, $(lib), $(my_app_lib_path)/$(notdir $(lib))))) + +$(LOCAL_INSTALLED_MODULE) : | $(addprefix $(my_app_lib_path)/, $(notdir $(my_prebulit_jni_libs))) +endif +endif # LOCAL_PREBULT_JNI_LIBS diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index fcd3e55b19..6fe9818a2b 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -170,6 +170,9 @@ endif # LOCAL_DEX_PREOPT # Sign and align non-presigned .apks. $(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) $(transform-prebuilt-to-target) +ifdef my_extracted_jni_libs + $(hide) zip -d $@ 'lib/*.so' # strip embedded JNI libraries. +endif ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) $(sign-package) endif -- cgit v1.2.3 From 966c1e0cae6a59f15264d3b542af08e21e2dc06c Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Tue, 20 May 2014 14:43:51 -0700 Subject: Add HOST_PREFER_32_BIT to support 32-bit-by-default multilib build We already support pure 32-bit and 64-bit-by-default multilib build. With HOST_PREFER_32_BIT we can build 32-bit-by-default multilib build. This will be lest disruptive during the period we transition to 64-bit-by-default. Bug: 13751317 Change-Id: I0d56ce4abbe4afeaacfd70d709f6a349791c0722 --- core/base_rules.mk | 8 +++++--- core/configure_module_stem.mk | 22 +++++++++++++--------- core/definitions.mk | 3 ++- core/dex_preopt_libart.mk | 5 ----- core/dynamic_binary.mk | 6 +++--- core/envsetup.mk | 10 ++++++++++ core/host_executable.mk | 7 ++++--- core/host_shared_library.mk | 7 ++++--- core/host_static_library.mk | 7 ++++--- core/install_jni_libs.mk | 2 +- core/main.mk | 8 ++++++++ 11 files changed, 54 insertions(+), 31 deletions(-) diff --git a/core/base_rules.mk b/core/base_rules.mk index 801e2c8117..8b3614a3c8 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -173,11 +173,11 @@ ifdef OVERRIDE_BUILT_MODULE_PATH else built_module_path := $(intermediates) endif -LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM) +LOCAL_BUILT_MODULE := $(built_module_path)/$(my_built_module_stem) built_module_path := ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) - LOCAL_INSTALLED_MODULE := $(my_module_path)/$(LOCAL_INSTALLED_MODULE_STEM) + LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem) endif # Assemble the list of targets to create PRIVATE_ variables for. @@ -569,10 +569,12 @@ endif ifdef LOCAL_DONT_CHECK_MODULE LOCAL_CHECKED_MODULE := endif -# Don't check build the module defined for the 2nd arch +# Don't check build target module defined for the 2nd arch +ifndef LOCAL_IS_HOST_MODULE ifdef LOCAL_2ND_ARCH_VAR_PREFIX LOCAL_CHECKED_MODULE := endif +endif ########################################################### ## Register with ALL_MODULES diff --git a/core/configure_module_stem.mk b/core/configure_module_stem.mk index 156005537a..48b77871a0 100644 --- a/core/configure_module_stem.mk +++ b/core/configure_module_stem.mk @@ -1,16 +1,20 @@ 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) + my_module_stem := $(my_multilib_stem) +else ifdef LOCAL_MODULE_STEM + my_module_stem := $(LOCAL_MODULE_STEM) +else + my_module_stem := $(LOCAL_MODULE) endif -ifndef LOCAL_MODULE_STEM - LOCAL_MODULE_STEM := $(LOCAL_MODULE) +ifdef LOCAL_BUILT_MODULE_STEM + my_built_module_stem := $(LOCAL_BUILT_MODULE_STEM) +else + my_built_module_stem := $(my_module_stem)$(LOCAL_MODULE_SUFFIX) endif -ifndef LOCAL_BUILT_MODULE_STEM - LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) -endif - -ifndef LOCAL_INSTALLED_MODULE_STEM - LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) +ifdef LOCAL_INSTALLED_MODULE_STEM + my_installed_module_stem := $(LOCAL_INSTALLED_MODULE_STEM) +else + my_installed_module_stem := $(my_module_stem)$(LOCAL_MODULE_SUFFIX) endif diff --git a/core/definitions.mk b/core/definitions.mk index cc0fda5f2b..44336f2dfa 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -84,8 +84,9 @@ ALL_GPL_MODULE_LICENSE_FILES:= # Target and host installed module's dependencies on shared libraries. # They are list of "::lib1,lib2...". TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES := -2ND_TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARIES := HOST_DEPENDENCIES_ON_SHARED_LIBRARIES := +$(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES := # Generated class file names for Android resource. # They are escaped and quoted so can be passed safely to a bash command. diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk index 7d8cee03a3..411af7513d 100644 --- a/core/dex_preopt_libart.mk +++ b/core/dex_preopt_libart.mk @@ -6,20 +6,15 @@ DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX) DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX) -LIBART_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libart-compiler$(HOST_SHLIB_SUFFIX) -LIBARTD_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libartd-compiler$(HOST_SHLIB_SUFFIX) - # By default, do not run rerun dex2oat if the tool changes. # Comment out the | to force dex2oat to rerun on after all changes. DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number DEX2OAT_DEPENDENCY += | DEX2OAT_DEPENDENCY += $(DEX2OAT) -DEX2OAT_DEPENDENCY += $(LIBART_COMPILER) DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY) DEX2OATD_DEPENDENCY += $(DEX2OATD) -DEX2OATD_DEPENDENCY += $(LIBARTD_COMPILER) PRELOADED_CLASSES := frameworks/base/preloaded-classes diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk index e538d1e874..396199c1a9 100644 --- a/core/dynamic_binary.mk +++ b/core/dynamic_binary.mk @@ -26,7 +26,7 @@ guessed_intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PR # The basename of this target must be the same as the final output # binary name, because it's used to set the "soname" in the binary. # The includer of this file will define a rule to build this target. -linked_module := $(guessed_intermediates)/LINKED/$(LOCAL_BUILT_MODULE_STEM) +linked_module := $(guessed_intermediates)/LINKED/$(my_built_module_stem) ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module) @@ -57,7 +57,7 @@ endif ifeq ($(LOCAL_COMPRESS_MODULE_SYMBOLS),true) $(error Symbol compression not yet supported.) -compress_output := $(intermediates)/COMPRESSED-$(LOCAL_BUILT_MODULE_STEM) +compress_output := $(intermediates)/COMPRESSED-$(my_built_module_stem) #TODO: write the real $(STRIPPER) rule. #TODO: define a rule to build TARGET_SYMBOL_FILTER_FILE, and @@ -79,7 +79,7 @@ else my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH) endif symbolic_input := $(compress_output) -symbolic_output := $(my_unstripped_path)/$(LOCAL_INSTALLED_MODULE_STEM) +symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem) $(symbolic_output) : $(symbolic_input) | $(ACP) @echo "target Symbolic: $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) diff --git a/core/envsetup.mk b/core/envsetup.mk index df76c51215..a228fc7cd8 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -67,6 +67,10 @@ ifeq ($(HOST_OS),) $(error Unable to determine HOST_OS from uname -sm: $(UNAME)!) endif +ifeq ($(HOST_PREFER_32_BIT),true) +# User asks for multilib build, but use 32-bit as preferred arch. +BUILD_HOST_64bit := true +endif # HOST_ARCH ifneq (,$(findstring x86_64,$(UNAME))) @@ -228,7 +232,13 @@ 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 +ifeq ($(HOST_PREFER_32_BIT),true) +# To keep path compatibility, put 32-bit libs in lib/ and 64-bit libs in lib64/. +HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib64 +$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib +else $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib32 +endif $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES := $(HOST_OUT_EXECUTABLES) diff --git a/core/host_executable.mk b/core/host_executable.mk index 874bf87574..53b5fd1a34 100644 --- a/core/host_executable.mk +++ b/core/host_executable.mk @@ -3,9 +3,13 @@ my_prefix := HOST_ include $(BUILD_SYSTEM)/multilib.mk ifndef my_module_multilib +ifeq ($(HOST_PREFER_32_BIT),true) +my_module_multilib := 32 +else # By default we only build host module for the first arch. my_module_multilib := first endif +endif ifeq ($(my_module_multilib),both) ifeq ($(LOCAL_MODULE_PATH_32)$(LOCAL_MODULE_STEM_32),) @@ -33,9 +37,6 @@ ifeq ($(my_module_arch_supported),true) 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_executable_internal.mk diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk index de5e6ad5d7..2fdf61f86a 100644 --- a/core/host_shared_library.mk +++ b/core/host_shared_library.mk @@ -2,9 +2,13 @@ my_prefix := HOST_ include $(BUILD_SYSTEM)/multilib.mk ifndef my_module_multilib +ifeq ($(HOST_PREFER_32_BIT),true) +my_module_multilib := 32 +else # By default we only build host module for the first arch. my_module_multilib := first endif +endif LOCAL_2ND_ARCH_VAR_PREFIX := include $(BUILD_SYSTEM)/module_arch_supported.mk @@ -21,9 +25,6 @@ ifeq ($(my_module_arch_supported),true) 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 diff --git a/core/host_static_library.mk b/core/host_static_library.mk index ab3f16ee0e..c40cf7d29f 100644 --- a/core/host_static_library.mk +++ b/core/host_static_library.mk @@ -2,9 +2,13 @@ my_prefix := HOST_ include $(BUILD_SYSTEM)/multilib.mk ifndef my_module_multilib +ifeq ($(HOST_PREFER_32_BIT),true) +my_module_multilib := 32 +else # By default we only build host module for the first arch. my_module_multilib := first endif +endif LOCAL_2ND_ARCH_VAR_PREFIX := include $(BUILD_SYSTEM)/module_arch_supported.mk @@ -21,9 +25,6 @@ ifeq ($(my_module_arch_supported),true) 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_static_library_internal.mk diff --git a/core/install_jni_libs.mk b/core/install_jni_libs.mk index b9e70b1403..700d106c81 100644 --- a/core/install_jni_libs.mk +++ b/core/install_jni_libs.mk @@ -36,7 +36,7 @@ my_embed_jni := true endif # App-specific lib path. -my_app_lib_path := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET$(partition_tag)_OUT_SHARED_LIBRARIES)/$(basename $(LOCAL_INSTALLED_MODULE_STEM)) +my_app_lib_path := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET$(partition_tag)_OUT_SHARED_LIBRARIES)/$(basename $(my_installed_module_stem)) my_extracted_jni_libs := ifdef my_embed_jni diff --git a/core/main.mk b/core/main.mk index fa8e872947..b07d5a11e2 100644 --- a/core/main.mk +++ b/core/main.mk @@ -647,6 +647,14 @@ $(foreach m,$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_DEPENDENCIES_ON_SHARED_LIBRARI $(subst $(comma),$(space),$(lastword $(p))))))) \ $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) endif +ifdef HOST_2ND_ARCH +$(foreach m,$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_DEPENDENCIES_ON_SHARED_LIBRARIES), \ + $(eval p := $(subst :,$(space),$(m))) \ + $(eval r := $(filter $(HOST_OUT_ROOT)/%,$(call module-installed-files,\ + $(addsuffix $(HOST_2ND_ARCH_MODULE_SUFFIX), \ + $(subst $(comma),$(space),$(lastword $(p))))))) \ + $(eval $(call add-required-deps,$(word 2,$(p)),$(r)))) +endif m := r := -- cgit v1.2.3 From a7877a4674d23b982f5d0d9db83d1039ec1e0ce1 Mon Sep 17 00:00:00 2001 From: Sreeram Ramachandran Date: Wed, 21 May 2014 09:55:44 -0700 Subject: Remove netd_client. It has moved to the internal tree. Change-Id: Iffcdb4900373c05086fd1085b861b6520065b7a3 --- target/product/base.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/target/product/base.mk b/target/product/base.mk index 0bc1366055..8aa3bc06c5 100644 --- a/target/product/base.mk +++ b/target/product/base.mk @@ -56,7 +56,6 @@ PRODUCT_PACKAGES += \ libmedia_jni \ libmediaplayerservice \ libmtp \ - libnetd_client \ libnetlink \ libnetutils \ libpac \ -- cgit v1.2.3 From ae0d2411444e7618e2e41ce6e966e519cb6a0c9f Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Wed, 21 May 2014 13:27:58 -0700 Subject: libctest: zap Change-Id: Ia3ff0cad0995af428adf2dbdf10587dae904ec7d --- target/product/embedded.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/target/product/embedded.mk b/target/product/embedded.mk index 60a19da794..5d868615e4 100644 --- a/target/product/embedded.mk +++ b/target/product/embedded.mk @@ -38,7 +38,6 @@ PRODUCT_PACKAGES += \ libGLESv2 \ libbinder \ libc \ - libctest \ libcutils \ libdl \ libgui \ -- cgit v1.2.3 From 36142f64aef3da56a6e70589dad634b5babc0c31 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 21 May 2014 16:13:33 -0700 Subject: Split the rules to build the odex file Previously the odex file is byproduct generated by the package.apk rule. Though we have the odex file depend on the package.apk it doesn't have its own build recipe. In case package.apk isn't updated but we still need to update the odex file (such as changed LOCAL_MULTILIB), the odex file will never be rebuilt. This change split out the rules to build the odex file and make sure the build recipe get executed if the odex file needs rebuild. Change-Id: I60c2f32b536b3d59045301ee863aae1451734aad --- core/definitions.mk | 4 ++-- core/dex_preopt_odex_install.mk | 13 +++++-------- core/package_internal.mk | 19 ++++++++++++------- core/prebuilt_internal.mk | 16 ++++++++++------ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index cc0fda5f2b..a024c9aab5 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1679,10 +1679,10 @@ endef # so we need to give it something. define create-empty-package @mkdir -p $(dir $@) -$(hide) touch $(dir $@)/dummy +$(hide) touch $(dir $@)dummy $(hide) (cd $(dir $@) && jar cf $(notdir $@) dummy) $(hide) zip -qd $@ dummy -$(hide) rm $(dir $@)/dummy +$(hide) rm $(dir $@)dummy endef #TODO: we kinda want to build different asset packages for diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index 6d70dde9c7..db2314076e 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -103,11 +103,10 @@ else my_dex_preopt_image_location := $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_BUILT_IMAGE_LOCATION) endif my_dex_preopt_image_filename := $(call get-image-file-path,$($(LOCAL_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(my_dex_preopt_image_location)) -# $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE) -$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX) -$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) -$(LOCAL_BUILT_MODULE) $(built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location) -$(LOCAL_BUILT_MODULE) $(built_odex) : $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \ +$(built_odex): PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX) +$(built_odex): PRIVATE_DEX_LOCATION := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)) +$(built_odex): PRIVATE_DEX_PREOPT_IMAGE_LOCATION := $(my_dex_preopt_image_location) +$(built_odex) : $($(LOCAL_2ND_ARCH_VAR_PREFIX)DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT) \ $(DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS) \ $(my_dex_preopt_image_filename) installed_odex := $(call get-odex-file-path,$($(LOCAL_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH),$(LOCAL_INSTALLED_MODULE)) @@ -116,13 +115,11 @@ endif # libart endif # boot jar ifdef built_odex -# We need $(LOCAL_BUILT_MODULE) in the deps to enforce reinstallation -# even if $(built_odex) is byproduct of $(LOCAL_BUILT_MODULE), such as in package.mk. # Use pattern rule - we may have multiple installed odex files. # Ugly syntax - See the definition get-odex-file-path. $(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%/$(notdir $(word 1,$(installed_odex))) \ : $(dir $(LOCAL_BUILT_MODULE))%/$(notdir $(word 1,$(built_odex))) \ - $(LOCAL_BUILT_MODULE) | $(ACP) + | $(ACP) @echo "Install: $@" $(copy-file-to-target) endif diff --git a/core/package_internal.mk b/core/package_internal.mk index f8d2f43655..cb1e4244a5 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -336,12 +336,6 @@ $(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\ # Define the rule to build the actual package. $(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN) -ifdef LOCAL_DEX_PREOPT -$(LOCAL_BUILT_MODULE): PRIVATE_BUILT_ODEX := $(built_odex) - -# built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe. -$(built_odex) : $(LOCAL_BUILT_MODULE) -endif $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries) $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi) ifneq ($(TARGET_BUILD_APPS),) @@ -371,7 +365,6 @@ ifneq ($(extra_jar_args),) endif $(sign-package) ifdef LOCAL_DEX_PREOPT - $(call dexpreopt-one-file,$@,$(PRIVATE_BUILT_ODEX)) ifneq (nostripping,$(LOCAL_DEX_PREOPT)) $(call dexpreopt-remove-classes.dex,$@) endif @@ -379,6 +372,18 @@ endif @# Alignment must happen after all other zip operations. $(align-package) +############################### +## Rule to build the odex file +ifdef LOCAL_DEX_PREOPT +$(built_odex): PRIVATE_DEX_FILE := $(built_dex) +$(built_odex) : $(built_dex) + $(create-empty-package) + $(add-dex-to-package) + $(hide) mv $@ $@.input + $(call dexpreopt-one-file,$@.input,$@) + $(hide) rm $@.input +endif + # Save information about this package PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources) diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk index 6fe9818a2b..7229b3a467 100644 --- a/core/prebuilt_internal.mk +++ b/core/prebuilt_internal.mk @@ -162,11 +162,6 @@ LOCAL_DEX_PREOPT := false # defines built_odex along with rule to install odex include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk ####################################### -ifdef LOCAL_DEX_PREOPT -$(built_module): PRIVATE_BUILT_ODEX := $(built_odex) -# built_odex is byproduct of LOCAL_BUILT_MODULE without its own build recipe. -$(built_odex) : $(LOCAL_BUILT_MODULE) -endif # LOCAL_DEX_PREOPT # Sign and align non-presigned .apks. $(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) $(transform-prebuilt-to-target) @@ -177,10 +172,19 @@ ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) $(sign-package) endif ifdef LOCAL_DEX_PREOPT - $(call dexpreopt-one-file,$@,$(PRIVATE_BUILT_ODEX)) +ifneq (nostripping,$(LOCAL_DEX_PREOPT)) + $(call dexpreopt-remove-classes.dex,$@) +endif endif $(align-package) +############################### +## Rule to build the odex file +ifdef LOCAL_DEX_PREOPT +$(built_odex) : $(my_prebuilt_src_file) + $(call dexpreopt-one-file,$<,$@) +endif + else # LOCAL_MODULE_CLASS != APPS ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) $(built_module) : $(my_prebuilt_src_file) -- cgit v1.2.3 From 38bba065e096c18e12c0d08d586c1eee5c4179ae Mon Sep 17 00:00:00 2001 From: Dmitriy Ivanov Date: Wed, 21 May 2014 16:38:03 -0700 Subject: Clarify multiarch warnings * Show multiarch related warnings only if my_module_multilib is both Change-Id: If0c467c1d9b953bd3f40949ab4b97d9329ec021f --- core/shared_library.mk | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/core/shared_library.mk b/core/shared_library.mk index 178e625b92..71a3bb2681 100644 --- a/core/shared_library.mk +++ b/core/shared_library.mk @@ -1,3 +1,12 @@ +my_prefix := TARGET_ +include $(BUILD_SYSTEM)/multilib.mk + +ifndef my_module_multilib +# libraries default to building for both architecturess +my_module_multilib := both +endif + +ifeq ($(my_module_multilib),both) ifneq ($(LOCAL_MODULE_PATH),) ifneq ($(TARGET_2ND_ARCH),) $(warning $(LOCAL_MODULE): LOCAL_MODULE_PATH for shared libraries is unsupported in multiarch builds, use LOCAL_MODULE_RELATIVE_PATH instead) @@ -9,14 +18,8 @@ ifneq ($(TARGET_2ND_ARCH),) $(warning $(LOCAL_MODULE): LOCAL_UNSTRIPPED_PATH for shared libraries is unsupported in multiarch builds) endif endif +endif # my_module_multilib == both -my_prefix := TARGET_ -include $(BUILD_SYSTEM)/multilib.mk - -ifndef my_module_multilib -# libraries default to building for both architecturess -my_module_multilib := both -endif LOCAL_2ND_ARCH_VAR_PREFIX := include $(BUILD_SYSTEM)/module_arch_supported.mk -- cgit v1.2.3 From 03b424a50b4dbd22efdea17151e220020f7b2ceb Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 22 May 2014 11:57:43 -0700 Subject: fix paths when 2nd arch gcc is a different version arm64 is using gcc 4.9, arm is using gcc 4.8. Fix setpaths() to get a separate version for the 2nd arch. Change-Id: I7bde01308fc7718360e7d0fbd46b3ae8c5f55fa7 --- envsetup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index 9670a7f660..0f498af627 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -120,6 +120,7 @@ function setpaths() # defined in core/config.mk targetgccversion=$(get_build_var TARGET_GCC_VERSION) + targetgccversion2=$(get_build_var 2ND_TARGET_GCC_VERSION) export TARGET_GCC_VERSION=$targetgccversion # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it. @@ -134,7 +135,7 @@ function setpaths() arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin ;; arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin; - toolchaindir2=arm/arm-linux-androideabi-$targetgccversion/bin + toolchaindir2=arm/arm-linux-androideabi-$targetgccversion2/bin ;; mips) toolchaindir=mips/mipsel-linux-android-$targetgccversion/bin ;; -- cgit v1.2.3 From 6a5fa0684a5a79abcb0cf116fe102e8f79081ece Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 22 May 2014 11:58:40 -0700 Subject: add 2nd arch gcc to the path Add the 2nd arch gcc to the path so users can manually run gdb, addr2line, objdump, etc. Change-Id: I30ff439bb6548b897d13bfa87151991d5f2948b3 --- envsetup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index 0f498af627..e496c9c608 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -171,7 +171,7 @@ function setpaths() export ANDROID_QTOOLS=$T/development/emulator/qtools export ANDROID_DEV_SCRIPTS=$T/development/scripts:$T/prebuilts/devtools/tools - export ANDROID_BUILD_PATHS=$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_KERNEL_TOOLCHAIN_PATH$ANDROID_DEV_SCRIPTS: + export ANDROID_BUILD_PATHS=$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ANDROID_TOOLCHAIN_2ND_ARCH:$ANDROID_KERNEL_TOOLCHAIN_PATH$ANDROID_DEV_SCRIPTS: # If prebuilts/android-emulator// exists, prepend it to our PATH # to ensure that the corresponding 'emulator' binaries are used. -- cgit v1.2.3 From 3655a68565f17856b6f3a70df276f597b7eb0372 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 22 May 2014 11:59:10 -0700 Subject: add vendor directories to gdb shared library search path Change-Id: Ib4ccf3739d6b2f14597605ce06f00e4776f67976 --- envsetup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/envsetup.sh b/envsetup.sh index e496c9c608..6c25ebe91e 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -977,6 +977,7 @@ function gdbclient() local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT) local OUT_SYMBOLS=$(get_abs_build_var TARGET_OUT_UNSTRIPPED) local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED) + local OUT_VENDOR_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED) local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED) local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS) local ARCH=$(get_build_var TARGET_ARCH) @@ -1041,7 +1042,7 @@ function gdbclient() OUT_SO_SYMBOLS=$OUT_SO_SYMBOLS$USE64BIT echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS" - echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS:$OUT_SO_SYMBOLS/hw:$OUT_SO_SYMBOLS/ssl/engines:$OUT_SO_SYMBOLS/drm:$OUT_SO_SYMBOLS/egl:$OUT_SO_SYMBOLS/soundfx" + echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS:$OUT_SO_SYMBOLS/hw:$OUT_SO_SYMBOLS/ssl/engines:$OUT_SO_SYMBOLS/drm:$OUT_SO_SYMBOLS/egl:$OUT_SO_SYMBOLS/soundfx:$OUT_VENDOR_SO_SYMBOLS:$OUT_VENDOR_SO_SYMBOLS/hw:$OUT_VENDOR_SO_SYMBOLS/egl" echo >>"$OUT_ROOT/gdbclient.cmds" "source $ANDROID_BUILD_TOP/development/scripts/gdb/dalvik.gdb" echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT" echo >>"$OUT_ROOT/gdbclient.cmds" "" -- cgit v1.2.3 From 12d18eb563877e68da0041261fadde0a9ffaa147 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 22 May 2014 12:01:23 -0700 Subject: set a prebuilt directory name for the 2nd arch In order to install 32-bit gdbserver on a 64-bit build, prebuilts/misc/Android.mk needs to know the prebuilt directory name for the 2nd arch. Change-Id: Ibc943b758eb9404f7f5f9fbbd8720cc67f6a6f01 --- core/config.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/config.mk b/core/config.mk index b91ff7f5ea..715038053c 100644 --- a/core/config.mk +++ b/core/config.mk @@ -579,6 +579,9 @@ INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/publi # This is the standard way to name a directory containing prebuilt target # objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so TARGET_PREBUILT_TAG := android-$(TARGET_ARCH) +ifdef TARGET_2ND_ARCH +TARGET_2ND_PREBUILT_TAG := android-$(TARGET_2ND_ARCH) +endif # Set up RS prebuilt variables for compatibility library -- cgit v1.2.3