Merge "Change LIBART_IMG_TARGET_BASE_ADDRESS to 0x70000000"
diff --git a/core/64_bit_blacklist.mk b/core/64_bit_blacklist.mk
index 9039f13..75e1e33 100644
--- a/core/64_bit_blacklist.mk
+++ b/core/64_bit_blacklist.mk
@@ -2,10 +2,8 @@
# JNI - needs 64-bit VM
_64_bit_directory_blacklist += \
- external/svox/ \
packages/
-
# Chromium/V8: needs 64-bit support
_64_bit_directory_blacklist += \
external/chromium-libpac \
@@ -18,16 +16,6 @@
device/generic/goldfish/opengl \
device/generic/goldfish/camera \
-# depends on frameworks/av
-_64_bit_directory_blacklist += \
- external/srec \
- frameworks/opt \
- frameworks/ex \
-
-# not needed yet, and too many directories to blacklist individually
-_64_bit_directory_blacklist += \
- frameworks/av/media/libeffects \
-
_64_bit_directory_blacklist_pattern := $(addsuffix %,$(_64_bit_directory_blacklist))
define directory_is_64_bit_blacklisted
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 32e6b73..43f351a 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -99,8 +99,21 @@
$(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
+
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
my_module_path := $(strip $(LOCAL_MODULE_PATH))
+endif
my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH))
ifeq ($(my_module_path),)
ifdef LOCAL_IS_HOST_MODULE
@@ -154,17 +167,7 @@
###########################################################
# Pick a name for the intermediate and final targets
###########################################################
-ifndef LOCAL_MODULE_STEM
- LOCAL_MODULE_STEM := $(LOCAL_MODULE)
-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)
-endif
+include $(BUILD_SYSTEM)/configure_module_stem.mk
# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
# internal SHARED_LIBRARIES build files.
diff --git a/core/binary.mk b/core/binary.mk
index 689181e..cc8de46 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1,10 +1,14 @@
###########################################################
## Standard rules for building binary object files from
-## asm/c/cpp/yacc/lex source files.
+## asm/c/cpp/yacc/lex/etc source files.
##
## The list of object files is exported in $(all_objects).
###########################################################
+#######################################
+include $(BUILD_SYSTEM)/base_rules.mk
+#######################################
+
my_ndk_version_root :=
ifdef LOCAL_SDK_VERSION
ifdef LOCAL_NDK_VERSION
@@ -56,9 +60,9 @@
my_ndk_stl_cppflags := -std=c++11
else
# LOCAL_NDK_STL_VARIANT is gnustl_static
- my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/include \
- $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
- my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libgnustl_static.a
+ my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GCC_VERSION)/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/include \
+ $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GCC_VERSION)/include
+ my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GCC_VERSION)/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libgnustl_static.a
endif
endif
endif
@@ -73,30 +77,18 @@
# supply that, for example, when building libc itself.
ifdef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
- LOCAL_SYSTEM_SHARED_LIBRARIES :=
+ my_system_shared_libraries :=
+ else
+ my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
endif
else
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
- LOCAL_SYSTEM_SHARED_LIBRARIES := $(TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
+ my_system_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES)
+ else
+ my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
endif
endif
-ifdef LOCAL_SDK_VERSION
- # Get the list of INSTALLED libraries as module names.
- # We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
- # they may cusomize their install path with LOCAL_MODULE_PATH
- installed_shared_library_module_names := \
- $(LOCAL_SHARED_LIBRARIES)
-else
- installed_shared_library_module_names := \
- $(LOCAL_SYSTEM_SHARED_LIBRARIES) $(LOCAL_SHARED_LIBRARIES)
-endif
-installed_shared_library_module_names := $(sort $(installed_shared_library_module_names))
-
-#######################################
-include $(BUILD_SYSTEM)/base_rules.mk
-#######################################
-
# The following LOCAL_ variables will be modified in this file.
# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
# we can't modify them in place.
@@ -114,8 +106,6 @@
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
ifndef LOCAL_IS_HOST_MODULE
-my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32)
-
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))
@@ -132,15 +122,6 @@
my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
endif
-# The real dependency will be added after all Android.mks are loaded and the install paths
-# of the shared libraries are determined.
-ifdef LOCAL_INSTALLED_MODULE
-ifdef installed_shared_library_module_names
-$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
- $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
-endif
-endif
-
# Add static HAL libraries
ifdef LOCAL_HAL_STATIC_LIBRARIES
$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
@@ -189,6 +170,31 @@
###########################################################
my_asflags += -D__ASSEMBLY__
+
+##########################################################
+## Set up installed module dependency
+## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for
+## they may cusomize their install path with LOCAL_MODULE_PATH
+##########################################################
+# Get the list of INSTALLED libraries as module names.
+ifdef LOCAL_SDK_VERSION
+ installed_shared_library_module_names := \
+ $(my_shared_libraries)
+else
+ installed_shared_library_module_names := \
+ $(my_system_shared_libraries) $(my_shared_libraries)
+endif
+installed_shared_library_module_names := $(sort $(installed_shared_library_module_names))
+
+# The real dependency will be added after all Android.mks are loaded and the install paths
+# of the shared libraries are determined.
+ifdef LOCAL_INSTALLED_MODULE
+ifdef installed_shared_library_module_names
+$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
+ $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(installed_shared_library_module_names))
+endif
+endif
+
###########################################################
## Define PRIVATE_ variables from global vars
###########################################################
@@ -811,19 +817,18 @@
$(addsuffix $(so_suffix), \
$(my_shared_libraries)))
+# Add the NDK libraries to the built module dependency
my_system_shared_libraries_fullpath := \
$(my_ndk_stl_shared_lib_fullpath) \
$(addprefix $(my_ndk_version_root)/usr/lib/, \
- $(addsuffix $(so_suffix), $(LOCAL_SYSTEM_SHARED_LIBRARIES)))
+ $(addsuffix $(so_suffix), $(my_system_shared_libraries)))
built_shared_libraries += $(my_system_shared_libraries_fullpath)
-my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
else
-my_shared_libraries += $(LOCAL_SYSTEM_SHARED_LIBRARIES)
built_shared_libraries := \
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
- $(my_shared_libraries)))
+ $(installed_shared_library_module_names)))
endif
built_static_libraries := \
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
index f38f04e..ee61e5e 100644
--- a/core/clang/HOST_x86.mk
+++ b/core/clang/HOST_x86.mk
@@ -1,8 +1,13 @@
include $(BUILD_SYSTEM)/clang/x86.mk
+include $(BUILD_SYSTEM)/clang/x86_common.mk
ifeq ($(HOST_OS),linux)
CLANG_CONFIG_x86_HOST_TRIPLE := i686-linux-gnu
+CLANG_CONFIG_x86_HOST_COMBO_EXTRA_ASFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS)
+CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS)
+CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS)
+CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS)
endif
ifeq ($(HOST_OS),darwin)
CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin
@@ -15,25 +20,29 @@
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
- -target $(CLANG_CONFIG_x86_HOST_TRIPLE) \
+ $(CLANG_CONFIG_x86_HOST_COMBO_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_TRIPLE)
CLANG_CONFIG_x86_HOST_EXTRA_CFLAGS := \
$(CLANG_CONFIG_EXTRA_CFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS)
CLANG_CONFIG_x86_HOST_EXTRA_CPPFLAGS := \
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_x86_HOST_COMBO_EXTRA_CPPFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_TRIPLE)
CLANG_CONFIG_x86_HOST_EXTRA_LDFLAGS := \
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
$(CLANG_CONFIG_x86_EXTRA_LDFLAGS) \
- -target $(CLANG_CONFIG_x86_HOST_TRIPLE) \
-
+ $(CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_TRIPLE)
define convert-to-host-clang-flags
$(strip \
diff --git a/core/clang/HOST_x86_64.mk b/core/clang/HOST_x86_64.mk
index ea33a46..d60e15f 100644
--- a/core/clang/HOST_x86_64.mk
+++ b/core/clang/HOST_x86_64.mk
@@ -1,8 +1,13 @@
include $(BUILD_SYSTEM)/clang/x86_64.mk
+include $(BUILD_SYSTEM)/clang/x86_common.mk
ifeq ($(HOST_OS),linux)
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-linux-gnu
+CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_ASFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS)
+CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS)
+CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CPPFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS)
+CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS := $(CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS)
endif
ifeq ($(HOST_OS),darwin)
CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-apple-darwin
@@ -15,25 +20,29 @@
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
$(CLANG_CONFIG_x86_64_EXTRA_ASFLAGS) \
- -target $(CLANG_CONFIG_x86_64_HOST_TRIPLE) \
+ $(CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_x86_64_HOST_TRIPLE)
CLANG_CONFIG_x86_64_HOST_EXTRA_CFLAGS := \
$(CLANG_CONFIG_EXTRA_CFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_64_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CFLAGS) \
$(CLANG_CONFIG_x86_64_HOST_EXTRA_ASFLAGS)
CLANG_CONFIG_x86_64_HOST_EXTRA_CPPFLAGS := \
$(CLANG_CONFIG_EXTRA_CPPFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
$(CLANG_CONFIG_x86_64_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_CPPFLAGS) \
+ -target $(CLANG_CONFIG_x86_64_HOST_TRIPLE)
CLANG_CONFIG_x86_64_HOST_EXTRA_LDFLAGS := \
$(CLANG_CONFIG_EXTRA_LDFLAGS) \
$(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
$(CLANG_CONFIG_x86_64_EXTRA_LDFLAGS) \
- -target $(CLANG_CONFIG_x86_64_HOST_TRIPLE) \
-
+ $(CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_64_HOST_TRIPLE)
define convert-to-host-clang-flags
$(strip \
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 96f860d..7a513c6 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -38,10 +38,10 @@
-Wno-unused-but-set-parameter
# Clang flags for all host rules
-CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=
-CLANG_CONFIG_HOST_EXTRA_CFLAGS :=
-CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
-CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
+CLANG_CONFIG_HOST_EXTRA_ASFLAGS := --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG)
+CLANG_CONFIG_HOST_EXTRA_CFLAGS := --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG)
+CLANG_CONFIG_HOST_EXTRA_CPPFLAGS := --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG)
+CLANG_CONFIG_HOST_EXTRA_LDFLAGS := --gcc-toolchain=$(HOST_TOOLCHAIN_FOR_CLANG)
# Clang flags for all target rules
CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
@@ -50,7 +50,11 @@
CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
# HOST config
+ifneq ($(strip $(BUILD_HOST_64bit)),)
+include $(BUILD_SYSTEM)/clang/HOST_x86_64.mk
+else
include $(BUILD_SYSTEM)/clang/HOST_$(HOST_ARCH).mk
+endif
# TARGET config
clang_2nd_arch_prefix :=
diff --git a/core/clang/x86_common.mk b/core/clang/x86_common.mk
new file mode 100644
index 0000000..d75d83f
--- /dev/null
+++ b/core/clang/x86_common.mk
@@ -0,0 +1,42 @@
+ifeq ($(HOST_OS),darwin)
+# nothing required here yet
+endif
+
+ifeq ($(HOST_OS),linux)
+
+ifneq ($(strip $(BUILD_HOST_64bit)),)
+# Needs to be updated along with gcc
+HOST_ARCH_DESCRIPTOR_FOR_CLANG := x86_64-linux
+else
+# Needs to be updated along with gcc
+HOST_ARCH_DESCRIPTOR_FOR_CLANG := i686-linux
+endif
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \
+ --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS :=
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
+ --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/include/c++/4.6.x-google \
+ -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/include/c++/4.6.x-google/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG) \
+ -isystem $(HOST_TOOLCHAIN_FOR_CLANG)/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/include/c++/4.6.x-google/backward \
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
+ --sysroot=$(HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -B$(HOST_TOOLCHAIN_FOR_CLANG)/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/bin \
+ -B$(HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/4.6.x-google \
+ -L$(HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/4.6.x-google
+
+ifneq ($(strip $(BUILD_HOST_64bit)),)
+# need to add lib64 if building 64-bit, otherwise lib
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS += -L$(HOST_TOOLCHAIN_FOR_CLANG)/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/lib64/
+else
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS += -L$(HOST_TOOLCHAIN_FOR_CLANG)/$(HOST_ARCH_DESCRIPTOR_FOR_CLANG)/lib/
+endif
+endif # linux
+
+ifeq ($(HOST_OS),windows)
+# nothing required here yet
+endif
\ No newline at end of file
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 4c403b4..ed692b9 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -197,6 +197,11 @@
LOCAL_ASFLAGS_64:=
LOCAL_C_INCLUDES_32:=
LOCAL_C_INCLUDES_64:=
+LOCAL_MODULE_PATH_32:=
+LOCAL_MODULE_PATH_64:=
+LOCAL_MODULE_STEM_32:=
+LOCAL_MODULE_STEM_64:=
+LOCAL_MULTILIB:=
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index 037dee6..994196a 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -156,3 +156,7 @@
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_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 129acb0..3c87264 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -41,10 +41,14 @@
# which can benefit from 64-bit host arch.
HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack
+# gcc location for clang; to be updated when clang is updated
+HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6/
else
# We expect SSE3 floating point math.
HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack
HOST_GLOBAL_LDFLAGS += -m32 -Wl,-z,noexecstack
+# gcc location for clang; to be updated when clang is updated
+HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6/
endif # BUILD_HOST_64bit
ifneq ($(strip $(BUILD_HOST_static)),)
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index cc2c872..8c24e4b 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -27,7 +27,7 @@
COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
$(common_flags)
else
- COMMON_JAVAC := $(JAVACC) -J-Xmx512M $(common_flags)
+ COMMON_JAVAC := $(JAVACC) -J-Xmx768M $(common_flags)
endif
# Eclipse.
diff --git a/core/config.mk b/core/config.mk
index 9e30c7d..9b9923a 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -455,6 +455,11 @@
TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
endif
+DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
+ifneq (,$(filter $(TARGET_CPU_VARIANT),cortex-a15 krait))
+DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
+endif
+
# define clang/llvm tools and global flags
include $(BUILD_SYSTEM)/clang/config.mk
diff --git a/core/configure_module_stem.mk b/core/configure_module_stem.mk
new file mode 100644
index 0000000..2823e37
--- /dev/null
+++ b/core/configure_module_stem.mk
@@ -0,0 +1,16 @@
+my_multilib_stem := $(LOCAL_MODULE_STEM_$(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_IS_64_BIT),64,32))
+ifdef my_multilib_stem
+LOCAL_MODULE_STEM := $(my_multilib_stem)
+endif
+
+ifndef LOCAL_MODULE_STEM
+ LOCAL_MODULE_STEM := $(LOCAL_MODULE)
+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)
+endif
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 160f128..4918a2b 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -3,9 +3,7 @@
#
####################################
-ifeq ($(DALVIK_VM_LIB),)
-$(error No value for DALVIK_VM_LIB)
-endif
+ifneq ($(DALVIK_VM_LIB),)
# list of boot classpath jars for dexpreopt
DEXPREOPT_BOOT_JARS := $(subst $(space),:,$(PRODUCT_BOOT_JARS))
@@ -70,3 +68,7 @@
DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OAT_DEPENDENCY)
DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE)
endif
+else
+$(warning No DALVIK_VM_LIB, disable dexpreopt.)
+WITH_DEXPREOPT := false
+endif # DALVIK_VM_LIB is defined.
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 413fcfc..d5ec40c 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -37,11 +37,6 @@
$(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@)
endif
-DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
-ifeq ($(TARGET_CPU_VARIANT),$(filter $(TARGET_CPU_VARIANT),cortex-a15 krait))
-DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
-endif
-
# start of image reserved address space
LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 32f2c91..b3ca4fc 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -13,20 +13,9 @@
endif
# The name of the target file, without any path prepended.
-# TODO: This duplicates logic from base_rules.mk because we need to
-# know its results before base_rules.mk is included.
-# Consolidate the duplicates.
-ifndef LOCAL_MODULE_STEM
- LOCAL_MODULE_STEM := $(LOCAL_MODULE)
-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)
-endif
+# This duplicates logic from base_rules.mk because we need to
+# know its results before base_rules.mk is included.
+include $(BUILD_SYSTEM)/configure_module_stem.mk
# base_rules.make defines $(intermediates), but we need its value
# before we include base_rules. Make a guess, and verify that
diff --git a/core/executable.mk b/core/executable.mk
index 899a02f..1e8d73a 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -1,31 +1,68 @@
# We don't automatically set up rules to build executables for both
# TARGET_ARCH and TARGET_2ND_ARCH.
# By default, an executable is built for TARGET_ARCH.
-# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_32_BIT_ONLY := true".
+# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32"
+# To build it for both set LOCAL_MULTILIB := both and specify
+# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
+# LOCAL_MODULE_STEM_64
+
+include $(BUILD_SYSTEM)/multilib.mk
ifeq ($(TARGET_PREFER_32_BIT),true)
-ifneq ($(LOCAL_NO_2ND_ARCH),true)
-LOCAL_32_BIT_ONLY := true
+ifeq (,$(filter $(my_module_multilib),first both)
+# if TARGET_PREFER_32_BIT is not explicitly set to "first" or "both"
+# build only for secondary
+my_module_multilib := 32
endif
endif
+ifndef my_module_multilib
+# executables default to building for the first architecture
+my_module_multilib := first
+endif
+
+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
-# check if primary arch is supported
+my_skip_secondary_arch :=
+
+# check if first arch is supported
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
-# primary arch is supported
+# first arch is supported
include $(BUILD_SYSTEM)/executable_internal.mk
-else ifneq (,$(TARGET_2ND_ARCH))
+ifneq ($(my_module_multilib),both)
+my_skip_secondary_arch := true
+endif
+endif
+
+# check if first arch was not supported or asked to build both
+ifndef my_skip_secondary_arch
+ifdef TARGET_2ND_ARCH
# check if secondary arch is supported
LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_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)/executable_internal.mk
endif
endif # TARGET_2ND_ARCH
-
+endif # !my_skip_secondary_arch || LOCAL_MULTILIB
LOCAL_2ND_ARCH_VAR_PREFIX :=
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
diff --git a/core/main.mk b/core/main.mk
index 2399d2e..3c4fd94 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -343,7 +343,7 @@
# Turn on Dalvik preoptimization for user builds, but only if not
# explicitly disabled and the build is running on Linux (since host
# Dalvik isn't built for non-Linux hosts).
- ifneq (true,$(DISABLE_DEXPREOPT))
+ ifeq (,$(WITH_DEXPREOPT))
ifeq ($(user_variant),user)
ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT := true
diff --git a/core/module_arch_supported.mk b/core/module_arch_supported.mk
index ddfd67d..1e03914 100644
--- a/core/module_arch_supported.mk
+++ b/core/module_arch_supported.mk
@@ -2,8 +2,7 @@
## Determine if a module can be built for an arch
##
## Inputs from module makefile:
-## LOCAL_32_BIT_ONLY
-## LOCAL_NO_2ND_ARCH
+## my_module_multilib
## LOCAL_MODULE_TARGET_ARCH
## LOCAL_MODULE_TARGET_ARCH_WARN
## LOCAL_MODULE_UNSUPPORTED_TARGET_ARCH
@@ -19,17 +18,21 @@
my_module_arch_supported := true
+ifeq ($(my_module_multilib),none)
+my_module_arch_supported := false
+endif
+
ifeq ($(LOCAL_2ND_ARCH_VAR_PREFIX),)
-ifeq ($(TARGET_IS_64_BIT)|$(LOCAL_32_BIT_ONLY),true|true)
+ifeq ($(TARGET_IS_64_BIT)|$(my_module_multilib),true|32)
my_module_arch_supported := false
else ifeq ($(call directory_is_64_bit_blacklisted,$(LOCAL_PATH)),true)
my_module_arch_supported := false
endif
else # LOCAL_2ND_ARCH_VAR_PREFIX
-ifeq ($(LOCAL_NO_2ND_ARCH),true)
+ifeq ($(my_module_multilib),first)
my_module_arch_supported := false
endif
-endif # !LOCAL_2ND_ARCH_VAR_PREFIX
+endif # LOCAL_2ND_ARCH_VAR_PREFIX
ifneq (,$(LOCAL_MODULE_TARGET_ARCH))
ifeq (,$(filter $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_TARGET_ARCH)))
diff --git a/core/multilib.mk b/core/multilib.mk
new file mode 100644
index 0000000..fa5397a
--- /dev/null
+++ b/core/multilib.mk
@@ -0,0 +1,26 @@
+# Translate LOCAL_32_BIT_ONLY and LOCAL_NO_2ND_ARCH 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.
+
+my_module_multilib := $(strip $(LOCAL_MULTILIB))
+ifndef my_module_multilib
+ifeq ($(LOCAL_32_BIT_ONLY)|$(LOCAL_NO_2ND_ARCH),true|true)
+ifdef TARGET_2ND_ARCH
+# Both LOCAL_32_BIT_ONLY and LOCAL_NO_2ND_ARCH specified on 64-bit target
+# skip the module completely
+my_module_multilib := none
+else
+# Both LOCAL_32_BIT_ONLY and LOCAL_NO_2ND_ARCH specified on 32-bit target
+# build for 32-bit
+my_module_multilib := 32
+endif
+else ifeq ($(LOCAL_32_BIT_ONLY),true)
+my_module_multilib := 32
+else ifeq ($(LOCAL_NO_2ND_ARCH),true)
+my_module_multilib := first
+endif
+else # my_module_multilib defined
+ifeq (,$(filter 32 first both none,$(my_module_multilib)))
+$(error $(LOCAL_PATH): Invalid LOCAL_MULTILIB specified for module $(LOCAL_MODULE))
+endif
+endif # my_module_multilib defined
diff --git a/core/package.mk b/core/package.mk
index b40ac37..337d3d0 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -1,15 +1,23 @@
# 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_32_BIT_ONLY := true".
+# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32".
+
+include $(BUILD_SYSTEM)/multilib.mk
+
+ifndef my_module_multilib
+# packages default to building for either architecture,
+# the first if its supported, otherwise the second.
+my_module_multilib := both
+endif
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
-# check if primary arch is supported
+# check if first arch is supported
LOCAL_2ND_ARCH_VAR_PREFIX :=
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
-# primary arch is supported
+# first arch is supported
include $(BUILD_SYSTEM)/package_internal.mk
else ifneq (,$(TARGET_2ND_ARCH))
# check if secondary arch is supported
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index 027c80a..5f91110 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -9,10 +9,19 @@
ifdef LOCAL_IS_HOST_MODULE
include $(BUILD_SYSTEM)/prebuilt_internal.mk
else #!LOCAL_IS_HOST_MODULE
-# check if primary arch is supported
+
+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
+
+# check if first arch is supported
include $(BUILD_SYSTEM)/module_arch_supported.mk
ifeq ($(my_module_arch_supported),true)
-# primary arch is supported
+# first arch is supported
include $(BUILD_SYSTEM)/prebuilt_internal.mk
else ifneq (,$(TARGET_2ND_ARCH))
# check if secondary arch is supported
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 87b6068..95a8d7b 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -10,6 +10,13 @@
endif
endif
+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
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index b5ac32a..3090d36 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -16,7 +16,7 @@
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)),)
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)$(LOCAL_MODULE_STEM_32)$(LOCAL_MODULE_STEM_64)),)
$(error $(LOCAL_PATH): Cannot set module stem for a library)
endif
diff --git a/core/static_library.mk b/core/static_library.mk
index d6e8d51..bedefd0 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -1,3 +1,10 @@
+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
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index db89582..c634bcd 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -24,7 +24,7 @@
# Enable dex-preoptimization to speed up the first boot sequence
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
-WITH_DEXPREOPT := true
+WITH_DEXPREOPT ?= true
endif
# Build OpenGLES emulation host and guest libraries
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index b58336a..7f2715e 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -30,7 +30,7 @@
# Enable dex-preoptimization to speed up the first boot sequence
# of an SDK AVD. Note that this operation only works on Linux for now
ifeq ($(HOST_OS),linux)
-WITH_DEXPREOPT := true
+WITH_DEXPREOPT ?= true
endif
# disable the emulator
diff --git a/target/board/vbox_x86/BoardConfig.mk b/target/board/vbox_x86/BoardConfig.mk
index 815ad9e..e5a1d3e 100644
--- a/target/board/vbox_x86/BoardConfig.mk
+++ b/target/board/vbox_x86/BoardConfig.mk
@@ -3,7 +3,6 @@
#
TARGET_ARCH=x86
-DISABLE_DEXPREOPT := true
TARGET_COMPRESS_MODULE_SYMBOLS := false
TARGET_NO_RECOVERY := true
TARGET_HARDWARE_3D := false
@@ -32,6 +31,7 @@
# Reserve 265M for the system partition
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 268435456
+WITH_DEXPREOPT := false
# The eth0 device should be started with dhcp on boot.
# Useful for emulators that don't provide a wifi connection.
diff --git a/target/product/base.mk b/target/product/base.mk
index 68e3ff3..8aa3bc0 100644
--- a/target/product/base.mk
+++ b/target/product/base.mk
@@ -34,6 +34,7 @@
framework2 \
fsck_msdos \
ime \
+ input \
javax.obex \
libandroid \
libandroid_runtime \
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index ada1323..32d479c 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -31,7 +31,6 @@
init \
init.environ.rc \
init.rc \
- input \
libEGL \
libETC1 \
libFFTEm \