am cfdf93c0: am 201cdd30: am 600e588e: Merge "css adjustments for headings with dynamic content" into klp-docs
* commit 'cfdf93c003a7afc18eb9a79921abf7b472e6d745':
css adjustments for headings with dynamic content
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 744a862..e00b6ec 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -211,16 +211,42 @@
# 4.4.2
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+# "L" and beyond.
+# Make libart the default runtime
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
+# Rename persist.sys.dalvik.vm.lib to allow new default
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
# KKWT development
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+# Add ro.product.cpu.abilist{32,64} to build.prop.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
+# Adding dalvik.vm.dex2oat-flags to eng builds
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
# 4.4.4 (KKWT)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
+# Unset TARGET_PREFER_32_BIT_APPS for 64 bit targets.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
+# Switching the x86 emulator over to a 64 bit primary zygote.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
+
+# Rename persist.sys.dalvik.vm.lib.1 to allow new default
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
+# Switching PRODUCT_RUNTIMES default for some devices
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/64_bit_blacklist.mk b/core/64_bit_blacklist.mk
new file mode 100644
index 0000000..b7420cd
--- /dev/null
+++ b/core/64_bit_blacklist.mk
@@ -0,0 +1,16 @@
+ifneq ($(TARGET_2ND_ARCH),)
+
+# misc build errors
+_64_bit_directory_blacklist += \
+ device/generic/goldfish/opengl \
+ device/generic/goldfish/camera \
+
+_64_bit_directory_blacklist_pattern := $(addsuffix %,$(_64_bit_directory_blacklist))
+
+define directory_is_64_bit_blacklisted
+$(if $(filter $(_64_bit_directory_blacklist_pattern),$(1)),true)
+endef
+else
+define directory_is_64_bit_blacklisted
+endef
+endif
diff --git a/core/Makefile b/core/Makefile
index 5c3e1ee..777c0f3 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -1,5 +1,9 @@
# Put some miscellaneous rules here
+# HACK: clear LOCAL_PATH from including last build target before calling
+# intermedites-dir-for
+LOCAL_PATH := $(BUILD_SYSTEM)
+
# Pick a reasonable string to use to identify files.
ifneq "" "$(filter eng.%,$(BUILD_NUMBER))"
# BUILD_NUMBER has a timestamp in it, which means that
@@ -9,8 +13,6 @@
FILE_NAME_TAG := $(BUILD_NUMBER)
endif
-is_tests_build := $(filter tests,$(MAKECMDGOALS))
-
# -----------------------------------------------------------------
# Define rules to copy PRODUCT_COPY_FILES defined by the product.
# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
@@ -187,6 +189,9 @@
TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
BUILD_FINGERPRINT="$(BUILD_FINGERPRINT)" \
TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
+ TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
+ TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
+ TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
@@ -645,6 +650,7 @@
INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
+recovery_sepolicy := $(call intermediates-dir-for,ETC,sepolicy.recovery)/sepolicy.recovery
recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
@@ -719,7 +725,7 @@
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(recovery_binary) \
- $(recovery_initrc) $(recovery_kernel) \
+ $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(recovery_build_prop) $(recovery_resource_deps) \
$(recovery_fstab) \
@@ -733,6 +739,8 @@
@echo Modifying ramdisk contents...
$(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/init*.rc
$(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
+ $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/sepolicy
+ $(hide) cp -f $(recovery_sepolicy) $(TARGET_RECOVERY_ROOT_OUT)/sepolicy
$(hide) -cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/
$(hide) cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
$(hide) cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
@@ -790,14 +798,6 @@
$(PDK_FUSION_SYSIMG_FILES) \
$(RECOVERY_RESOURCE_ZIP))
-ifdef is_tests_build
-# We don't want to install tests modules to the system partition
-# when building "tests", because now "tests" may be built in a user, userdebug
-# or eng build variant and we don't want to pollute the system partition.
-# INTERNAL_SYSTEMIMAGE_FILES += $(filter $(TARGET_OUT)/%, \
-# $(tests_MODULES))
-endif
-
FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
# -----------------------------------------------------------------
# installed file list
@@ -969,12 +969,6 @@
INTERNAL_USERDATAIMAGE_FILES := \
$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
-# If we build "tests" at the same time, make sure $(tests_MODULES) get covered.
-ifdef is_tests_build
-INTERNAL_USERDATAIMAGE_FILES += \
- $(filter $(TARGET_OUT_DATA)/%,$(tests_MODULES))
-endif
-
# Don't build userdata.img if it's extfs but no partition size
skip_userdata.img :=
ifdef INTERNAL_USERIMAGES_EXT_VARIANT
@@ -1355,45 +1349,6 @@
endif # TARGET_DEVICE != generic*
endif # TARGET_PRODUCT != sdk
-ifdef is_tests_build
-# -----------------------------------------------------------------
-# A zip of the tests that are built when running "make tests".
-# This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
-# only grab DATA, and it's called "*-tests-*.zip".
-#
-name := $(TARGET_PRODUCT)
-ifeq ($(TARGET_BUILD_TYPE),debug)
- name := $(name)_debug
-endif
-name := $(name)-tests-$(FILE_NAME_TAG)
-
-intermediates := $(call intermediates-dir-for,PACKAGING,tests_zip)
-BUILT_TESTS_ZIP_PACKAGE := $(intermediates)/$(name).zip
-$(BUILT_TESTS_ZIP_PACKAGE): intermediates := $(intermediates)
-$(BUILT_TESTS_ZIP_PACKAGE): zip_root := $(intermediates)/$(name)
-
-# Depending on the image dependency files, instead of the image files itself,
-# guarantees that the underlying directories are up-to-date,
-# but don't really build the image.
-$(BUILT_TESTS_ZIP_PACKAGE): \
- $(INTERNAL_USERDATAIMAGE_FILES) \
- | $(ACP)
- @echo "Package test files: $@"
- $(hide) rm -rf $@ $(zip_root)
- $(hide) mkdir -p $(dir $@) $(zip_root)
- @# Contents of the data image
- $(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_DATA),$(zip_root)/DATA)
- $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
-
-.PHONY: tests
-tests: $(BUILT_TESTS_ZIP_PACKAGE)
-
-ifneq (,$(filter tests, $(MAKECMDGOALS)))
- $(call dist-for-goals, tests, $(BUILT_TESTS_ZIP_PACKAGE))
-endif
-endif # is_tests_build
-
# -----------------------------------------------------------------
# A zip of the symbols directory. Keep the full paths to make it
# more obvious where these files came from.
@@ -1426,7 +1381,7 @@
@echo "Package apps: $@"
$(hide) rm -rf $@
$(hide) mkdir -p $(dir $@)
- $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
+ $(hide) zip -qj $@ $(TARGET_OUT_APPS)/* $(TARGET_OUT_APPS_PRIVILEGED)/*
#------------------------------------------------------------------
@@ -1501,7 +1456,7 @@
# The SDK
# The SDK includes host-specific components, so it belongs under HOST_OUT.
-sdk_dir := $(HOST_OUT)/sdk
+sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
# Build a name that looks like:
#
@@ -1539,26 +1494,10 @@
atree_dir := development/build
-# sdk/build/tools.atree contains the generic rules, while
-#
-# sdk/build/tools.$(TARGET_ARCH).atree contains target-specific rules
-# the latter is optional.
-#
-sdk_tools_atree_files := sdk/build/tools.atree
-ifneq (,$(strip $(wildcard sdk/build/tools.$(TARGET_ARCH).atree)))
- sdk_tools_atree_files += sdk/build/tools.$(TARGET_ARCH).atree
-endif
-ifneq (,$(strip $(wildcard sdk/build/tools.$(HOST_OS).atree)))
- sdk_tools_atree_files += sdk/build/tools.$(HOST_OS).atree
-endif
-ifneq (,$(strip $(wildcard sdk/build/tools.$(HOST_OS)-$(HOST_ARCH).atree)))
- sdk_tools_atree_files += sdk/build/tools.$(HOST_OS)-$(HOST_ARCH).atree
-endif
sdk_atree_files := \
$(atree_dir)/sdk.exclude.atree \
- $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \
- $(sdk_tools_atree_files)
+ $(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree
# development/build/sdk-android-<abi>.atree is used to differentiate
# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
@@ -1586,7 +1525,6 @@
$(INSTALLED_BUILD_PROP_TARGET) \
$(ATREE_FILES) \
$(sdk_atree_files) \
- $(sdk_tools_atree_files) \
$(HOST_OUT_EXECUTABLES)/atree \
$(HOST_OUT_EXECUTABLES)/line_endings
@@ -1629,7 +1567,6 @@
-o $(PRIVATE_DIR) && \
cp -f $(target_notice_file_txt) \
$(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
- cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
diff --git a/core/base_rules.mk b/core/base_rules.mk
index e87624a..8b3614a 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -84,11 +84,10 @@
# Add implicit tags.
#
# If the local directory or one of its parents contains a MODULE_LICENSE_GPL
-# file, tag the module as "gnu". Search for "*_GPL*" and "*_MPL*" so that we can also
-# find files like MODULE_LICENSE_GPL_AND_AFL but exclude files like
-# MODULE_LICENSE_LGPL.
+# file, tag the module as "gnu". Search for "*_GPL*", "*_LGPL*" and "*_MPL*"
+# so that we can also find files like MODULE_LICENSE_GPL_AND_AFL
#
-gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL*)
+gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)
ifneq ($(gpl_license_file),)
my_module_tags += gnu
ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
@@ -99,8 +98,15 @@
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
endif
+my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32)
+
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
+my_multilib_module_path := $(strip $(LOCAL_MODULE_PATH_$(my_32_64_bit_suffix)))
+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
@@ -135,7 +141,9 @@
my_register_name := $(LOCAL_MODULE)
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
-my_register_name := $(LOCAL_MODULE)$(TARGET_2ND_ARCH_MODULE_SUFFIX)
+ifndef LOCAL_NO_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.
module_id := MODULE.$(if \
@@ -152,17 +160,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.
@@ -175,11 +173,11 @@
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.
@@ -512,6 +510,8 @@
$(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)
@@ -569,10 +569,12 @@
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
@@ -594,8 +596,15 @@
$(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
ALL_MODULES.$(my_register_name).INSTALLED := \
$(strip $(ALL_MODULES.$(my_register_name).INSTALLED) $(LOCAL_INSTALLED_MODULE))
+ifdef LOCAL_PICKUP_FILES
+# Files or directories ready to pick up by the build system
+# when $(LOCAL_BUILT_MODULE) is done.
+ALL_MODULES.$(my_register_name).PICKUP_FILES := \
+ $(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
+endif
ALL_MODULES.$(my_register_name).REQUIRED := \
- $(ALL_MODULES.$(my_register_name).REQUIRED) $(LOCAL_REQUIRED_MODULES)
+ $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(LOCAL_REQUIRED_MODULES) \
+ $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
$(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \
@@ -606,6 +615,9 @@
ALL_MODULES.$(my_register_name).OWNER := \
$(sort $(ALL_MODULES.$(my_register_name).OWNER) $(LOCAL_MODULE_OWNER))
endif
+ifdef LOCAL_2ND_ARCH_VAR_PREFIX
+ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
+endif
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
diff --git a/core/binary.mk b/core/binary.mk
index adc2f44..45ab0c0 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1,11 +1,17 @@
###########################################################
## 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).
###########################################################
-my_ndk_version_root :=
+#######################################
+include $(BUILD_SYSTEM)/base_rules.mk
+#######################################
+
+my_ndk_sysroot :=
+my_ndk_sysroot_include :=
+my_ndk_sysroot_lib :=
ifdef LOCAL_SDK_VERSION
ifdef LOCAL_NDK_VERSION
$(error $(LOCAL_PATH): LOCAL_NDK_VERSION is now retired.)
@@ -14,7 +20,13 @@
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
endif
my_ndk_source_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources
- my_ndk_version_root := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+ my_ndk_sysroot := $(HISTORICAL_NDK_VERSIONS_ROOT)/current/platforms/android-$(LOCAL_SDK_VERSION)/arch-$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+ my_ndk_sysroot_include := $(my_ndk_sysroot)/usr/include
+ ifeq (x86_64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+ my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib64
+ else
+ my_ndk_sysroot_lib := $(my_ndk_sysroot)/usr/lib
+ endif
# Set up the NDK stl variant. Starting from NDK-r5 the c++ stl resides in a separate location.
# See ndk/docs/CPLUSPLUS-SUPPORT.html
@@ -22,10 +34,12 @@
my_ndk_stl_shared_lib_fullpath :=
my_ndk_stl_shared_lib :=
my_ndk_stl_static_lib :=
+ my_ndk_stl_cppflags :=
+ LOCAL_NDK_STL_VARIANT := $(strip $(LOCAL_NDK_STL_VARIANT))
ifeq (,$(LOCAL_NDK_STL_VARIANT))
LOCAL_NDK_STL_VARIANT := system
endif
- ifneq (1,$(words $(filter system stlport_static stlport_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
+ ifneq (1,$(words $(filter system stlport_static stlport_shared c++_static c++_shared gnustl_static, $(LOCAL_NDK_STL_VARIANT))))
$(error $(LOCAL_PATH): Unknown LOCAL_NDK_STL_VARIANT $(LOCAL_NDK_STL_VARIANT))
endif
ifeq (system,$(LOCAL_NDK_STL_VARIANT))
@@ -40,11 +54,24 @@
my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_shared.so
my_ndk_stl_shared_lib := -lstlport_shared
endif
+ else # LOCAL_NDK_STL_VARIANT is not stlport_* either
+ ifneq (,$(filter c++_%, $(LOCAL_NDK_STL_VARIANT)))
+ my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libcxx/include \
+ $(my_ndk_source_root)/cxx-stl/llvm-libc++/gabi++/include \
+ $(my_ndk_source_root)/android/support/include
+ ifeq (c++_static,$(LOCAL_NDK_STL_VARIANT))
+ my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libc++_static.a
+ else
+ my_ndk_stl_shared_lib_fullpath := $(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libc++_shared.so
+ my_ndk_stl_shared_lib := -lc++_shared
+ endif
+ 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_NDK_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_NDK_GCC_VERSION)/include
+ my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_NDK_GCC_VERSION)/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libgnustl_static.a
+ endif
endif
endif
endif
@@ -58,54 +85,62 @@
# 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.
-my_src_files := $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_src_files := $(LOCAL_SRC_FILES)
my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
+my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
-my_cflags := $(LOCAL_CFLAGS) $(LOCAL_CFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_cflags := $(LOCAL_CFLAGS)
my_cppflags := $(LOCAL_CPPFLAGS)
-my_ldflags := $(LOCAL_LDFLAGS) $(LOCAL_LDFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
-my_asflags := $(LOCAL_ASFLAGS) $(LOCAL_ASFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_ldflags := $(LOCAL_LDFLAGS)
+my_asflags := $(LOCAL_ASFLAGS)
my_cc := $(LOCAL_CC)
my_cxx := $(LOCAL_CXX)
-my_c_includes := $(LOCAL_C_INCLUDES) $(LOCAL_C_INCLUDES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_c_includes := $(LOCAL_C_INCLUDES)
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
-my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
+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))
-# 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))
+my_clang := $(LOCAL_CLANG)
+ifdef LOCAL_CLANG_$(my_32_64_bit_suffix)
+my_clang := $(LOCAL_CLANG_$(my_32_64_bit_suffix))
endif
+ifdef LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
+my_clang := $(LOCAL_CLANG_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+endif
+
+# arch-specific static libraries go first so that generic ones can depend on them
+my_static_libraries := $(LOCAL_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_static_libraries)
+my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_WHOLE_STATIC_LIBRARIES_$(my_32_64_bit_suffix)) $(my_whole_static_libraries)
+
+my_cflags := $(filter-out $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_UNSUPPORTED_CFLAGS),$(my_cflags))
+
+
+# Replace libstdc++ with libc++ if it's seen
+my_libcxx := $(filter libc++, $(my_shared_libraries))
+ifdef my_libcxx
+my_system_shared_libraries := $(filter-out libstdc++, $(my_system_shared_libraries))
endif
# Add static HAL libraries
@@ -118,15 +153,15 @@
endif
ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
- LOCAL_CLANG := true
+ my_clang := true
my_cflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
my_ldflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
endif
-ifeq ($(strip $(WITHOUT_CLANG)),true)
- LOCAL_CLANG :=
+ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_$(my_prefix)CLANG)),true)
+ my_clang :=
endif
# Add in libcompiler_rt for all regular device builds
@@ -135,9 +170,6 @@
endif
my_compiler_dependencies :=
-ifeq ($(strip $(LOCAL_CLANG)),true)
- my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
-endif
####################################################
## Add FDO flags if FDO is turned on and supported
@@ -156,28 +188,55 @@
###########################################################
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
###########################################################
ifndef LOCAL_IS_HOST_MODULE
ifdef LOCAL_SDK_VERSION
my_target_project_includes :=
-my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
+my_target_c_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include)
+my_target_global_cppflags := $(my_ndk_stl_cppflags)
else
my_target_project_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES)
my_target_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES)
+my_target_global_cppflags :=
endif # LOCAL_SDK_VERSION
-ifeq ($(LOCAL_CLANG),true)
-my_target_global_cflags := $(CLANG_TARGET_GLOBAL_CFLAGS)
-my_target_global_cppflags := $(CLANG_TARGET_GLOBAL_CPPFLAGS)
-my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
+ifeq ($(my_clang),true)
+my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CFLAGS)
+my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_CPPFLAGS)
+my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_TARGET_GLOBAL_LDFLAGS)
my_target_c_includes += $(CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES)
else
my_target_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS)
-my_target_global_cppflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS)
+my_target_global_cppflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS)
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
-endif # LOCAL_CLANG
+endif # my_clang
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_C_INCLUDES := $(my_target_c_includes)
@@ -187,17 +246,17 @@
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)
+ifeq ($(my_clang),true)
+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)
-endif # LOCAL_CLANG
+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 # my_clang
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_C_INCLUDES := $(my_host_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags)
@@ -226,7 +285,7 @@
endif
ifeq ($(strip $(my_cc)),)
- ifeq ($(strip $(LOCAL_CLANG)),true)
+ ifeq ($(strip $(my_clang)),true)
my_cc := $(CLANG)
else
my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC)
@@ -242,7 +301,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
ifeq ($(strip $(my_cxx)),)
- ifeq ($(strip $(LOCAL_CLANG)),true)
+ ifeq ($(strip $(my_clang)),true)
my_cxx := $(CLANG_CXX)
else
my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX)
@@ -291,9 +350,9 @@
# actually used (although they are usually empty).
arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS)
normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS)
-ifeq ($(strip $(LOCAL_CLANG)),true)
-arm_objects_cflags := $(call convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
-normal_objects_cflags := $(call convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
+ifeq ($(strip $(my_clang)),true)
+arm_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(arm_objects_cflags))
+normal_objects_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(normal_objects_cflags))
endif
else
@@ -366,6 +425,8 @@
$(notdir $(renderscript_sources)))))
$(rs_generated_cpps) : $(RenderScript_file_stamp)
+ # This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
+ @echo "Updated RS generated cpp file $@."
my_c_includes += $(renderscript_intermediate)
my_generated_sources += $(rs_generated_cpps)
@@ -396,23 +457,32 @@
proto_generated_headers :=
ifneq ($(proto_sources),)
proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
-proto_generated_cc_sources_dir := $(intermediates)/proto
+proto_generated_cc_sources_dir := $(generated_sources_dir)/proto
proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
$(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
-proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources))
+proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
+proto_generated_obj_dir := $(intermediates)/proto
+proto_generated_objects := $(addprefix $(proto_generated_obj_dir)/, \
+ $(patsubst %.proto,%.pb.o,$(proto_sources_fullpath)))
+# Ensure the transform-proto-to-cc rule is only defined once in multilib build.
+ifndef $(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
$(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
$(proto_generated_cc_sources): PRIVATE_PROTO_CC_OUTPUT_DIR := $(proto_generated_cc_sources_dir)
$(proto_generated_cc_sources): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
$(proto_generated_cc_sources): $(proto_generated_cc_sources_dir)/%.pb.cc: %.proto $(PROTOC)
$(transform-proto-to-cc)
-proto_generated_headers := $(patsubst %.pb.cc,%.pb.h, $(proto_generated_cc_sources))
$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
+ # This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
+ @echo "Updated header file $@."
+
+$(my_prefix)_$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true
+endif # transform-proto-to-cc rule included only once
$(proto_generated_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(proto_generated_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
+$(proto_generated_objects): $(proto_generated_obj_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(proto_generated_objects:%.o=%.P)
@@ -423,26 +493,42 @@
else
my_static_libraries += libprotobuf-cpp-2.3.0-lite
endif
-endif
+endif # $(proto_sources) non-empty
###########################################################
-## YACC: Compile .y files to .cpp and the to .o.
+## YACC: Compile .y and .yy files to .cpp and the to .o.
###########################################################
-yacc_sources := $(filter %.y,$(my_src_files))
-yacc_cpps := $(addprefix \
- $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
+y_yacc_sources := $(filter %.y,$(my_src_files))
+y_yacc_cpps := $(addprefix \
+ $(intermediates)/,$(y_yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
+
+yy_yacc_sources := $(filter %.yy,$(my_src_files))
+yy_yacc_cpps := $(addprefix \
+ $(intermediates)/,$(yy_yacc_sources:.yy=$(LOCAL_CPP_EXTENSION)))
+
+yacc_cpps := $(y_yacc_cpps) $(yy_yacc_cpps)
yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
-ifneq ($(strip $(yacc_cpps)),)
-$(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
+ifneq ($(strip $(y_yacc_cpps)),)
+$(y_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.y \
$(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
+endif
+ifneq ($(strip $(yy_yacc_cpps)),)
+$(yy_yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
+ $(TOPDIR)$(LOCAL_PATH)/%.yy \
+ $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
+$(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
+endif
+
+ifneq ($(strip $(yacc_cpps)),)
$(yacc_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(yacc_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(yacc_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
@@ -450,19 +536,33 @@
endif
###########################################################
-## LEX: Compile .l files to .cpp and then to .o.
+## LEX: Compile .l and .ll files to .cpp and then to .o.
###########################################################
-lex_sources := $(filter %.l,$(my_src_files))
-lex_cpps := $(addprefix \
- $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
+l_lex_sources := $(filter %.l,$(my_src_files))
+l_lex_cpps := $(addprefix \
+ $(intermediates)/,$(l_lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
+
+ll_lex_sources := $(filter %.ll,$(my_src_files))
+ll_lex_cpps := $(addprefix \
+ $(intermediates)/,$(ll_lex_sources:.ll=$(LOCAL_CPP_EXTENSION)))
+
+lex_cpps := $(l_lex_cpps) $(ll_lex_cpps)
lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
-ifneq ($(strip $(lex_cpps)),)
-$(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
+ifneq ($(strip $(l_lex_cpps)),)
+$(l_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
$(TOPDIR)$(LOCAL_PATH)/%.l
$(transform-l-to-cpp)
+endif
+ifneq ($(strip $(ll_lex_cpps)),)
+$(ll_lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
+ $(TOPDIR)$(LOCAL_PATH)/%.ll
+ $(transform-l-to-cpp)
+endif
+
+ifneq ($(strip $(lex_cpps)),)
$(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(lex_objects): $(intermediates)/%.o: \
@@ -651,7 +751,7 @@
import_includes_deps := $(strip \
$(foreach l, $(installed_shared_library_module_names), \
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes) \
- $(foreach l, $(my_static_libraries) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
+ $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes))
$(import_includes) : $(import_includes_deps)
@echo Import includes file: $@
@@ -685,7 +785,7 @@
all_objects := $(normal_objects) $(gen_o_objects)
-my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
+my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir)
ifndef LOCAL_SDK_VERSION
my_c_includes += $(JNI_H_INCLUDE)
@@ -699,12 +799,6 @@
$(all_objects) : | $(import_includes)
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
-###########################################################
-## Copy headers to the install tree
-###########################################################
-ifndef LOCAL_2ND_ARCH_VAR_PREFIX
-include $(BUILD_COPY_HEADERS)
-endif
###########################################################
# Standard library handling.
@@ -745,19 +839,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)))
+ $(addprefix $(my_ndk_sysroot_lib)/, \
+ $(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 := \
@@ -770,7 +863,7 @@
endif
built_whole_libraries := \
- $(foreach lib,$(LOCAL_WHOLE_STATIC_LIBRARIES), \
+ $(foreach lib,$(my_whole_static_libraries), \
$(call intermediates-dir-for, \
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
@@ -780,7 +873,7 @@
# libraries that we use. (see notice_files.mk)
installed_static_library_notice_file_targets := \
- $(foreach lib,$(my_static_libraries) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
+ $(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
# Default is -fno-rtti.
@@ -792,11 +885,11 @@
# Rule-specific variable definitions
###########################################################
-ifeq ($(LOCAL_CLANG),true)
-my_cflags := $(call convert-to-$(my_host)clang-flags,$(my_cflags))
-my_cppflags := $(call convert-to-$(my_host)clang-flags,$(my_cppflags))
-my_asflags := $(call convert-to-$(my_host)clang-flags,$(my_asflags))
-my_ldflags := $(call convert-to-$(my_host)clang-flags,$(my_ldflags))
+ifeq ($(my_clang),true)
+my_cflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cflags))
+my_cppflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_cppflags))
+my_asflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_asflags))
+my_ldflags := $(call $(LOCAL_2ND_ARCH_VAR_PREFIX)convert-to-$(my_host)clang-flags,$(my_ldflags))
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
@@ -811,6 +904,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LIBCXX := $(my_libcxx)
# this is really the way to get the files onto the command line instead
# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
new file mode 100644
index 0000000..510a74d
--- /dev/null
+++ b/core/clang/HOST_x86.mk
@@ -0,0 +1,64 @@
+
+include $(BUILD_SYSTEM)/clang/x86.mk
+include $(BUILD_SYSTEM)/clang/HOST_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
+endif
+ifeq ($(HOST_OS),windows)
+CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
+endif
+
+CLANG_CONFIG_x86_HOST_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
+ $(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) \
+ $(CLANG_CONFIG_x86_HOST_COMBO_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_HOST_TRIPLE)
+
+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_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_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_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
new file mode 100644
index 0000000..6b94525
--- /dev/null
+++ b/core/clang/HOST_x86_64.mk
@@ -0,0 +1,64 @@
+
+include $(BUILD_SYSTEM)/clang/x86_64.mk
+include $(BUILD_SYSTEM)/clang/HOST_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
+endif
+ifeq ($(HOST_OS),windows)
+CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64
+endif
+
+CLANG_CONFIG_x86_64_HOST_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_x86_64_EXTRA_ASFLAGS) \
+ $(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) \
+ $(CLANG_CONFIG_x86_64_HOST_COMBO_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_64_HOST_TRIPLE)
+
+define convert-to-host-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-x86_64-flags,\
+ $(filter-out $(CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+CLANG_HOST_GLOBAL_CFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_x86_64_HOST_EXTRA_CFLAGS)
+
+CLANG_HOST_GLOBAL_CPPFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_x86_64_HOST_EXTRA_CPPFLAGS)
+
+CLANG_HOST_GLOBAL_LDFLAGS := \
+ $(call convert-to-host-clang-flags,$(HOST_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_x86_64_HOST_EXTRA_LDFLAGS)
diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk
new file mode 100644
index 0000000..0241cb6
--- /dev/null
+++ b/core/clang/HOST_x86_common.mk
@@ -0,0 +1,56 @@
+# Shared by HOST_x86.mk and HOST_x86_64.mk.
+
+ifeq ($(HOST_OS),darwin)
+# nothing required here yet
+endif
+
+ifeq ($(HOST_OS),linux)
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -no-integrated-as
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ -no-integrated-as
+
+ifneq ($(strip $($(clang_2nd_arch_prefix)HOST_IS_64_BIT)),)
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \
+ -no-integrated-as
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \
+ -no-integrated-as
+else
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6 \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/x86_64-linux/32 \
+ -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.6/backward \
+ -no-integrated-as
+
+CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \
+ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
+ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \
+ -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6/32 \
+ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \
+ -no-integrated-as
+endif
+endif # Linux
+
+ifeq ($(HOST_OS),windows)
+# nothing required here yet
+endif
diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk
new file mode 100644
index 0000000..595fb56
--- /dev/null
+++ b/core/clang/TARGET_arm.mk
@@ -0,0 +1,55 @@
+
+include $(BUILD_SYSTEM)/clang/arm.mk
+
+CLANG_CONFIG_arm_TARGET_TRIPLE := arm-linux-androideabi
+CLANG_CONFIG_arm_TARGET_TOOLCHAIN_PREFIX := \
+ $($(clang_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_arm_TARGET_TRIPLE)/bin
+
+CLANG_CONFIG_arm_TARGET_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_arm_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_arm_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_arm_TARGET_TOOLCHAIN_PREFIX)
+
+CLANG_CONFIG_arm_TARGET_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_arm_EXTRA_CFLAGS) \
+ -target $(CLANG_CONFIG_arm_TARGET_TRIPLE) \
+ $(CLANG_CONFIG_arm_TARGET_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_arm_TARGET_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_arm_EXTRA_CPPFLAGS) \
+ -target $(CLANG_CONFIG_arm_TARGET_TRIPLE)
+
+CLANG_CONFIG_arm_TARGET_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_arm_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_arm_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_arm_TARGET_TOOLCHAIN_PREFIX)
+
+
+define $(clang_2nd_arch_prefix)convert-to-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-arm-flags,\
+ $(filter-out $(CLANG_CONFIG_arm_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_arm_TARGET_EXTRA_CFLAGS)
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_arm_TARGET_EXTRA_CPPFLAGS)
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_arm_TARGET_EXTRA_LDFLAGS)
+
+$(clang_2nd_arch_prefix)RS_TRIPLE := armv7-none-linux-gnueabi
diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk
new file mode 100644
index 0000000..98bbeb2
--- /dev/null
+++ b/core/clang/TARGET_arm64.mk
@@ -0,0 +1,53 @@
+
+include $(BUILD_SYSTEM)/clang/arm64.mk
+
+CLANG_CONFIG_arm64_TARGET_TRIPLE := aarch64-linux-android
+CLANG_CONFIG_arm64_TARGET_TOOLCHAIN_PREFIX := \
+ $(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_arm64_TARGET_TRIPLE)/bin
+
+CLANG_CONFIG_arm64_TARGET_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_arm64_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_arm64_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_arm64_TARGET_TOOLCHAIN_PREFIX)
+
+CLANG_CONFIG_arm64_TARGET_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_arm64_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_arm64_TARGET_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_arm64_TARGET_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_arm64_EXTRA_CPPFLAGS) \
+
+CLANG_CONFIG_arm64_TARGET_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_arm64_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_arm64_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_arm64_TARGET_TOOLCHAIN_PREFIX)
+
+
+define convert-to-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-arm64-flags,\
+ $(filter-out $(CLANG_CONFIG_arm64_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+CLANG_TARGET_GLOBAL_CFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_arm64_TARGET_EXTRA_CFLAGS)
+
+CLANG_TARGET_GLOBAL_CPPFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_arm64_TARGET_EXTRA_CPPFLAGS)
+
+CLANG_TARGET_GLOBAL_LDFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_arm64_TARGET_EXTRA_LDFLAGS)
+
+RS_TRIPLE := aarch64-linux-android
diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk
new file mode 100644
index 0000000..e70e254
--- /dev/null
+++ b/core/clang/TARGET_mips.mk
@@ -0,0 +1,53 @@
+
+include $(BUILD_SYSTEM)/clang/mips.mk
+
+CLANG_CONFIG_mips_TARGET_TRIPLE := mipsel-linux-android
+CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX := \
+ $($(clang_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_mips_TARGET_TRIPLE)/bin
+
+CLANG_CONFIG_mips_TARGET_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_mips_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_mips_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX)
+
+CLANG_CONFIG_mips_TARGET_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_mips_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_mips_TARGET_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_mips_TARGET_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_mips_EXTRA_CPPFLAGS) \
+
+CLANG_CONFIG_mips_TARGET_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_mips_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_mips_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX)
+
+
+define $(clang_2nd_arch_prefix)convert-to-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-mips-flags,\
+ $(filter-out $(CLANG_CONFIG_mips_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_mips_TARGET_EXTRA_CFLAGS)
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$(clang_2nd_arch_prefix)$(TARGET_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_mips_TARGET_EXTRA_CPPFLAGS)
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_mips_TARGET_EXTRA_LDFLAGS)
+
+$(clang_2nd_arch_prefix)RS_TRIPLE := mipsel-unknown-linux
diff --git a/core/clang/TARGET_mips64.mk b/core/clang/TARGET_mips64.mk
new file mode 100644
index 0000000..b2e536c
--- /dev/null
+++ b/core/clang/TARGET_mips64.mk
@@ -0,0 +1,53 @@
+
+include $(BUILD_SYSTEM)/clang/mips64.mk
+
+CLANG_CONFIG_mips64_TARGET_TRIPLE := mips64el-linux-android
+CLANG_CONFIG_mips64_TARGET_TOOLCHAIN_PREFIX := \
+ $(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_mips64_TARGET_TRIPLE)/bin
+
+CLANG_CONFIG_mips64_TARGET_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_mips64_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_mips64_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_mips64_TARGET_TOOLCHAIN_PREFIX)
+
+CLANG_CONFIG_mips64_TARGET_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_mips64_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_mips64_TARGET_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_mips64_TARGET_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_mips64_EXTRA_CPPFLAGS) \
+
+CLANG_CONFIG_mips64_TARGET_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_mips64_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_mips64_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_mips64_TARGET_TOOLCHAIN_PREFIX)
+
+
+define convert-to-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-mips64-flags,\
+ $(filter-out $(CLANG_CONFIG_mips64_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+CLANG_TARGET_GLOBAL_CFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_mips64_TARGET_EXTRA_CFLAGS)
+
+CLANG_TARGET_GLOBAL_CPPFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_mips64_TARGET_EXTRA_CPPFLAGS)
+
+CLANG_TARGET_GLOBAL_LDFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_mips64_TARGET_EXTRA_LDFLAGS)
+
+RS_TRIPLE := mips64el-unknown-linux
diff --git a/core/clang/TARGET_x86.mk b/core/clang/TARGET_x86.mk
new file mode 100644
index 0000000..70cb252
--- /dev/null
+++ b/core/clang/TARGET_x86.mk
@@ -0,0 +1,55 @@
+
+include $(BUILD_SYSTEM)/clang/x86.mk
+
+CLANG_CONFIG_x86_TARGET_TRIPLE := i686-linux-android
+# NOTE: There is no i686-linux-android prebuilt, so we must hardcode the
+# x86_64 target instead.
+CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX := \
+ $($(clang_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/x86_64-linux-android/bin
+
+CLANG_CONFIG_x86_TARGET_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_x86_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX)
+
+CLANG_CONFIG_x86_TARGET_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_TARGET_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_x86_TARGET_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_CPPFLAGS) \
+
+CLANG_CONFIG_x86_TARGET_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_x86_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX)
+
+
+define $(clang_2nd_arch_prefix)convert-to-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-x86-flags,\
+ $(filter-out $(CLANG_CONFIG_x86_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_x86_TARGET_EXTRA_CFLAGS)
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_x86_TARGET_EXTRA_CPPFLAGS)
+
+$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_x86_TARGET_EXTRA_LDFLAGS)
+
+$(clang_2nd_arch_prefix)RS_TRIPLE := i686-unknown-linux
diff --git a/core/clang/TARGET_x86_64.mk b/core/clang/TARGET_x86_64.mk
new file mode 100644
index 0000000..14944bd
--- /dev/null
+++ b/core/clang/TARGET_x86_64.mk
@@ -0,0 +1,53 @@
+
+include $(BUILD_SYSTEM)/clang/x86_64.mk
+
+CLANG_CONFIG_x86_64_TARGET_TRIPLE := x86_64-linux-android
+CLANG_CONFIG_x86_64_TARGET_TOOLCHAIN_PREFIX := \
+ $(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_x86_64_TARGET_TRIPLE)/bin
+
+CLANG_CONFIG_x86_64_TARGET_EXTRA_ASFLAGS := \
+ $(CLANG_CONFIG_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
+ $(CLANG_CONFIG_x86_64_EXTRA_ASFLAGS) \
+ -target $(CLANG_CONFIG_x86_64_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_x86_64_TARGET_TOOLCHAIN_PREFIX)
+
+CLANG_CONFIG_x86_64_TARGET_EXTRA_CFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_64_EXTRA_CFLAGS) \
+ $(CLANG_CONFIG_x86_64_TARGET_EXTRA_ASFLAGS)
+
+CLANG_CONFIG_x86_64_TARGET_EXTRA_CPPFLAGS := \
+ $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
+ $(CLANG_CONFIG_x86_64_EXTRA_CPPFLAGS) \
+
+CLANG_CONFIG_x86_64_TARGET_EXTRA_LDFLAGS := \
+ $(CLANG_CONFIG_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
+ $(CLANG_CONFIG_x86_64_EXTRA_LDFLAGS) \
+ -target $(CLANG_CONFIG_x86_64_TARGET_TRIPLE) \
+ -B$(CLANG_CONFIG_x86_64_TARGET_TOOLCHAIN_PREFIX)
+
+
+define convert-to-clang-flags
+ $(strip \
+ $(call subst-clang-incompatible-x86_64-flags,\
+ $(filter-out $(CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS),\
+ $(1))))
+endef
+
+CLANG_TARGET_GLOBAL_CFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_CFLAGS)) \
+ $(CLANG_CONFIG_x86_64_TARGET_EXTRA_CFLAGS)
+
+CLANG_TARGET_GLOBAL_CPPFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_CPPFLAGS)) \
+ $(CLANG_CONFIG_x86_64_TARGET_EXTRA_CPPFLAGS)
+
+CLANG_TARGET_GLOBAL_LDFLAGS := \
+ $(call convert-to-clang-flags,$(TARGET_GLOBAL_LDFLAGS)) \
+ $(CLANG_CONFIG_x86_64_TARGET_EXTRA_LDFLAGS)
+
+RS_TRIPLE := x86_64-unknown-linux
diff --git a/core/clang/arm.mk b/core/clang/arm.mk
new file mode 100644
index 0000000..22c7397
--- /dev/null
+++ b/core/clang/arm.mk
@@ -0,0 +1,32 @@
+# Clang flags for arm arch, target or host.
+
+CLANG_CONFIG_arm_EXTRA_ASFLAGS := \
+ -no-integrated-as
+
+CLANG_CONFIG_arm_EXTRA_CFLAGS := \
+ -no-integrated-as
+
+CLANG_CONFIG_arm_EXTRA_CPPFLAGS := \
+ -no-integrated-as
+
+CLANG_CONFIG_arm_EXTRA_LDFLAGS := \
+ -no-integrated-as
+
+# Include common unknown flags
+CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \
+ $(CLANG_CONFIG_UNKNOWN_CFLAGS) \
+ -mthumb-interwork \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers \
+ -fno-builtin-sin \
+ -fno-strict-volatile-bitfields \
+ -fno-align-jumps \
+ -Wa,--noexecstack
+
+define subst-clang-incompatible-arm-flags
+ $(subst -march=armv5te,-march=armv5t,\
+ $(subst -march=armv5e,-march=armv5,\
+ $(subst -mcpu=cortex-a15,-march=armv7-a,\
+ $(1))))
+endef
diff --git a/core/clang/arm64.mk b/core/clang/arm64.mk
new file mode 100644
index 0000000..9fb3670
--- /dev/null
+++ b/core/clang/arm64.mk
@@ -0,0 +1,24 @@
+# Clang flags for arm64 arch, target or host.
+
+CLANG_CONFIG_arm64_EXTRA_ASFLAGS := \
+ -no-integrated-as
+
+CLANG_CONFIG_arm64_EXTRA_CFLAGS := \
+ -no-integrated-as
+
+CLANG_CONFIG_arm64_EXTRA_LDFLAGS :=
+
+# Include common unknown flags
+CLANG_CONFIG_arm64_UNKNOWN_CFLAGS := \
+ $(CLANG_CONFIG_UNKNOWN_CFLAGS) \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers \
+ -fno-strict-volatile-bitfields \
+ -fno-align-jumps \
+ -Wa,--noexecstack
+
+# We don't have any arm64 flags to substitute yet.
+define subst-clang-incompatible-arm64-flags
+ $(1)
+endef
diff --git a/core/clang/config.mk b/core/clang/config.mk
new file mode 100644
index 0000000..9c5311d
--- /dev/null
+++ b/core/clang/config.mk
@@ -0,0 +1,92 @@
+## Clang configurations.
+
+# WITHOUT_CLANG covers both HOST and TARGET
+ifeq ($(WITHOUT_CLANG),true)
+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/
+
+CLANG := $(LLVM_PREBUILTS_PATH)/clang$(BUILD_EXECUTABLE_SUFFIX)
+CLANG_CXX := $(LLVM_PREBUILTS_PATH)/clang++$(BUILD_EXECUTABLE_SUFFIX)
+LLVM_AS := $(LLVM_PREBUILTS_PATH)/llvm-as$(BUILD_EXECUTABLE_SUFFIX)
+LLVM_LINK := $(LLVM_PREBUILTS_PATH)/llvm-link$(BUILD_EXECUTABLE_SUFFIX)
+
+CLANG_TBLGEN := $(HOST_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
+TBLGEN := $(HOST_OUT_EXECUTABLES)/tblgen$(BUILD_EXECUTABLE_SUFFIX)
+
+
+# Clang flags for all host or target rules
+CLANG_CONFIG_EXTRA_ASFLAGS :=
+CLANG_CONFIG_EXTRA_CFLAGS :=
+CLANG_CONFIG_EXTRA_CPPFLAGS :=
+CLANG_CONFIG_EXTRA_LDFLAGS :=
+
+CLANG_CONFIG_EXTRA_CFLAGS := \
+ -D__compiler_offsetof=__builtin_offsetof
+
+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
+CLANG_CONFIG_HOST_EXTRA_ASFLAGS :=
+CLANG_CONFIG_HOST_EXTRA_CFLAGS :=
+CLANG_CONFIG_HOST_EXTRA_CPPFLAGS :=
+CLANG_CONFIG_HOST_EXTRA_LDFLAGS :=
+
+# Clang flags for all target rules
+CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
+CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
+CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc
+CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
+
+# HOST config
+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
+clang_2nd_arch_prefix :=
+include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_ARCH).mk
+
+# TARGET_2ND_ARCH config
+ifdef TARGET_2ND_ARCH
+clang_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
+endif
+
+
+# Clang compiler-specific libc headers
+CLANG_CONFIG_EXTRA_HOST_C_INCLUDES := $(LLVM_PREBUILTS_HEADER_PATH)
+CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := $(LLVM_PREBUILTS_HEADER_PATH) $(TARGET_OUT_HEADERS)/clang
+
+# Address sanitizer clang config
+ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address
+ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
+ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload
+ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
+
+# This allows us to use the superset of functionality that compiler-rt
+# provides to Clang (for supporting features like -ftrapv).
+COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
diff --git a/core/clang/mips.mk b/core/clang/mips.mk
new file mode 100644
index 0000000..cef7823
--- /dev/null
+++ b/core/clang/mips.mk
@@ -0,0 +1,28 @@
+# Clang flags for mips arch, target or host.
+
+CLANG_CONFIG_mips_EXTRA_ASFLAGS :=
+CLANG_CONFIG_mips_EXTRA_CFLAGS :=
+CLANG_CONFIG_mips_EXTRA_LDFLAGS :=
+
+# Include common unknown flags
+CLANG_CONFIG_mips_UNKNOWN_CFLAGS := \
+ $(CLANG_CONFIG_UNKNOWN_CFLAGS) \
+ -EL \
+ -mips32 \
+ -mips32r2 \
+ -mhard-float \
+ -fno-strict-volatile-bitfields \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers \
+ -march=mips32r2 \
+ -mtune=mips32r2 \
+ -march=mips32 \
+ -mtune=mips32 \
+ -msynci \
+ -mno-fused-madd
+
+# We don't have any mips flags to substitute yet.
+define subst-clang-incompatible-mips-flags
+ $(1)
+endef
diff --git a/core/clang/mips64.mk b/core/clang/mips64.mk
new file mode 100644
index 0000000..9d1117b
--- /dev/null
+++ b/core/clang/mips64.mk
@@ -0,0 +1,30 @@
+# Clang flags for mips64 arch, target or host.
+
+$(warning Untested mips64 clang flags, fix me!)
+
+CLANG_CONFIG_mips64_EXTRA_ASFLAGS :=
+CLANG_CONFIG_mips64_EXTRA_CFLAGS :=
+CLANG_CONFIG_mips64_EXTRA_LDFLAGS :=
+
+# Include common unknown flags
+CLANG_CONFIG_mips64_UNKNOWN_CFLAGS := \
+ $(CLANG_CONFIG_UNKNOWN_CFLAGS) \
+ -EL \
+ -mips32 \
+ -mips32r2 \
+ -mhard-float \
+ -fno-strict-volatile-bitfields \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers \
+ -march=mips32r2 \
+ -mtune=mips32r2 \
+ -march=mips32 \
+ -mtune=mips32 \
+ -msynci \
+ -mno-fused-madd
+
+# We don't have any mips64 flags to substitute yet.
+define subst-clang-incompatible-mips64-flags
+ $(1)
+endef
diff --git a/core/clang/x86.mk b/core/clang/x86.mk
new file mode 100644
index 0000000..69c3fb2
--- /dev/null
+++ b/core/clang/x86.mk
@@ -0,0 +1,19 @@
+# Clang flags for x86 arch, target or host.
+
+CLANG_CONFIG_x86_EXTRA_ASFLAGS := \
+ -msse3
+CLANG_CONFIG_x86_EXTRA_CFLAGS :=
+CLANG_CONFIG_x86_EXTRA_LDFLAGS :=
+
+# Include common unknown flags
+CLANG_CONFIG_x86_UNKNOWN_CFLAGS := \
+ $(CLANG_CONFIG_UNKNOWN_CFLAGS) \
+ -finline-limit=300 \
+ -fno-inline-functions-called-once \
+ -mfpmath=sse \
+ -mbionic
+
+# We don't have any x86 flags to substitute yet.
+define subst-clang-incompatible-x86-flags
+ $(1)
+endef
diff --git a/core/clang/x86_64.mk b/core/clang/x86_64.mk
new file mode 100644
index 0000000..cba10d4
--- /dev/null
+++ b/core/clang/x86_64.mk
@@ -0,0 +1,18 @@
+# Clang flags for x86_64 arch, target or host.
+
+CLANG_CONFIG_x86_64_EXTRA_ASFLAGS :=
+CLANG_CONFIG_x86_64_EXTRA_CFLAGS :=
+CLANG_CONFIG_x86_64_EXTRA_LDFLAGS :=
+
+# Include common unknown flags
+CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS := \
+ $(CLANG_CONFIG_UNKNOWN_CFLAGS) \
+ -finline-limit=300 \
+ -fno-inline-functions-called-once \
+ -mfpmath=sse \
+ -mbionic
+
+# We don't have any x86_64 flags to substitute yet.
+define subst-clang-incompatible-x86_64-flags
+ $(1)
+endef
diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk
index dfdf43d..fc56604 100644
--- a/core/cleanbuild.mk
+++ b/core/cleanbuild.mk
@@ -179,11 +179,13 @@
$(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 \
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index c212c6d..dc04cb5 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -13,6 +13,7 @@
OVERRIDE_BUILT_MODULE_PATH:=
LOCAL_INSTALLED_MODULE:=
LOCAL_INSTALLED_MODULE_STEM:=
+LOCAL_PICKUP_FILES:=
LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_INTERMEDIATE_TARGETS:=
LOCAL_UNSTRIPPED_PATH:=
@@ -74,7 +75,6 @@
LOCAL_DROIDDOC_OPTIONS:=
LOCAL_DROIDDOC_HTML_DIR:=
LOCAL_ADDITIONAL_HTML_DIR:=
-LOCAL_ASSET_FILES:=
LOCAL_ASSET_DIR:=
LOCAL_RESOURCE_DIR:=
LOCAL_JAVA_RESOURCE_DIRS:=
@@ -88,6 +88,7 @@
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:=
@@ -120,7 +121,7 @@
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:=
@@ -145,24 +146,101 @@
LOCAL_HAL_STATIC_LIBRARIES:=
LOCAL_NO_SYNTAX_CHECK:=
LOCAL_NO_STATIC_ANALYZER:=
-LOCAL_32BIT_ONLY:= # '',true
-LOCAL_NO_2ND_ARCH:= # '',true
+LOCAL_32_BIT_ONLY:= # '',true
+LOCAL_MULTILIB:=
+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):=
LOCAL_CFLAGS_$(TARGET_ARCH):=
+LOCAL_CPPFLAGS_$(TARGET_ARCH):=
LOCAL_C_INCLUDES_$(TARGET_ARCH):=
LOCAL_ASFLAGS_$(TARGET_ARCH):=
LOCAL_NO_CRT_$(TARGET_ARCH):=
LOCAL_LDFLAGS_$(TARGET_ARCH):=
+LOCAL_SHARED_LIBRARIES_$(TARGET_ARCH):=
+LOCAL_STATIC_LIBRARIES_$(TARGET_ARCH):=
+LOCAL_WHOLE_STATIC_LIBRARIES_$(TARGET_ARCH):=
+LOCAL_GENERATED_SOURCES_$(TARGET_ARCH):=
+LOCAL_REQUIRED_MODULES_$(TARGET_ARCH):=
+LOCAL_CLANG_$(TARGET_ARCH):=
ifdef TARGET_2ND_ARCH
LOCAL_SRC_FILES_$(TARGET_2ND_ARCH):=
LOCAL_CFLAGS_$(TARGET_2ND_ARCH):=
+LOCAL_CPPFLAGS_$(TARGET_2ND_ARCH):=
LOCAL_C_INCLUDES_$(TARGET_2ND_ARCH):=
LOCAL_ASFLAGS_$(TARGET_2ND_ARCH):=
LOCAL_NO_CRT_$(TARGET_2ND_ARCH):=
LOCAL_LDFLAGS_$(TARGET_2ND_ARCH):=
+LOCAL_SHARED_LIBRARIES_$(TARGET_2ND_ARCH):=
+LOCAL_STATIC_LIBRARIES_$(TARGET_2ND_ARCH):=
+LOCAL_WHOLE_STATIC_LIBRARIES_$(TARGET_2ND_ARCH):=
+LOCAL_GENERATED_SOURCES_$(TARGET_2ND_ARCH):=
+LOCAL_REQUIRED_MODULES_$(TARGET_2ND_ARCH):=
+LOCAL_CLANG_$(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):=
+LOCAL_CLANG_$(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):=
+LOCAL_CLANG_$(HOST_2ND_ARCH):=
+endif
+
+LOCAL_SRC_FILES_32:=
+LOCAL_SRC_FILES_64:=
+LOCAL_SHARED_LIBRARIES_32:=
+LOCAL_SHARED_LIBRARIES_64:=
+LOCAL_STATIC_LIBRARIES_32:=
+LOCAL_STATIC_LIBRARIES_64:=
+LOCAL_WHOLE_STATIC_LIBRARIES_32:=
+LOCAL_WHOLE_STATIC_LIBRARIES_64:=
+LOCAL_GENERATED_SOURCES_32:=
+LOCAL_GENERATED_SOURCES_64:=
+LOCAL_CFLAGS_32:=
+LOCAL_CFLAGS_64:=
+LOCAL_CPPFLAGS_32:=
+LOCAL_CPPFLAGS_64:=
+LOCAL_LDFLAGS_32:=
+LOCAL_LDFLAGS_64:=
+LOCAL_ASFLAGS_32:=
+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_CLANG_32:=
+LOCAL_CLANG_64:=
# 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 ba61cbf..4a2bfe3 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -17,109 +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
-build_mac_version := $(shell sw_vers -productVersion)
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
-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
+include $(BUILD_COMBOS)/mac_version.mk
-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
-
-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-debug $< -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
+$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)
-HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
-HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
+$(combo_2nd_arch_prefix)HOST_AR := $(AR)
-HOST_SHLIB_SUFFIX := .dylib
-HOST_JNILIB_SUFFIX := .jnilib
+$(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_GLOBAL_CFLAGS += \
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
+$(combo_2nd_arch_prefix)HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
+
+$(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) \
- $(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)) \
@@ -127,25 +93,25 @@
$(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) -headerpad_max_install_names \
- $(HOST_GLOBAL_LD_DIRS) \
- $(HOST_GLOBAL_LDFLAGS) \
+ $(PRE_LION_DYNAMIC_LINKER_OPTIONS) -Wl,-headerpad_max_install_names \
+ $($(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
diff --git a/core/combo/HOST_darwin-x86_64.mk b/core/combo/HOST_darwin-x86_64.mk
new file mode 100644
index 0000000..8ad3ba7
--- /dev/null
+++ b/core/combo/HOST_darwin-x86_64.mk
@@ -0,0 +1,80 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for Darwin (Mac OS X) on x86_64.
+# Included by combo/select.mk
+
+HOST_IS_64_BIT := true
+
+HOST_GLOBAL_CFLAGS += -m64
+HOST_GLOBAL_LDFLAGS += -m64
+
+ifneq ($(strip $(BUILD_HOST_static)),)
+# Statically-linked binaries are desirable for sandboxed environment
+HOST_GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+
+include $(BUILD_COMBOS)/mac_version.mk
+
+HOST_TOOLCHAIN_ROOT := prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1
+HOST_TOOLCHAIN_PREFIX := $(HOST_TOOLCHAIN_ROOT)/bin/i686-apple-darwin$(gcc_darwin_version)
+# Don't do anything if the toolchain is not there
+ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)-gcc)))
+HOST_CC := $(HOST_TOOLCHAIN_PREFIX)-gcc
+HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)-g++
+ifeq ($(mac_sdk_version),10.8)
+# Mac SDK 10.8 no longer has stdarg.h, etc
+host_toolchain_header := $(HOST_TOOLCHAIN_ROOT)/lib/gcc/i686-apple-darwin$(gcc_darwin_version)/4.2.1/include
+HOST_GLOBAL_CFLAGS += -isystem $(host_toolchain_header)
+endif
+else
+HOST_CC := gcc
+HOST_CXX := g++
+endif # $(HOST_TOOLCHAIN_PREFIX)-gcc exists
+
+# gcc location for clang; to be updated when clang is updated
+# HOST_TOOLCHAIN_ROOT is a Darwin-specific define
+HOST_TOOLCHAIN_FOR_CLANG := $(HOST_TOOLCHAIN_ROOT)
+
+HOST_AR := $(AR)
+
+HOST_GLOBAL_CFLAGS += -isysroot $(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version) -DMACOSX_DEPLOYMENT_TARGET=$(mac_sdk_version)
+HOST_GLOBAL_LDFLAGS += -isysroot $(mac_sdk_root) -Wl,-syslibroot,$(mac_sdk_root) -mmacosx-version-min=$(mac_sdk_version)
+
+HOST_GLOBAL_CFLAGS += -fPIC -funwind-tables
+HOST_NO_UNDEFINED_LDFLAGS := -Wl,-undefined,error
+
+HOST_SHLIB_SUFFIX := .dylib
+HOST_JNILIB_SUFFIX := .jnilib
+
+HOST_GLOBAL_CFLAGS += \
+ -include $(call select-android-config-h,darwin-x86)
+
+ifneq ($(filter 10.7 10.7.% 10.8 10.8.%, $(build_mac_version)),)
+ HOST_RUN_RANLIB_AFTER_COPYING := false
+else
+ HOST_RUN_RANLIB_AFTER_COPYING := true
+endif
+HOST_GLOBAL_ARFLAGS := cqs
+
+# We Reuse the following functions with the same name from HOST_darwin-x86.mk:
+# transform-host-o-to-shared-lib-inner
+# transform-host-o-to-executable-inner
+# get-file-size
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index 578cd42..c931937 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -17,45 +17,46 @@
# Configuration for builds hosted on linux-x86.
# Included by combo/select.mk
+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 $($(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/
+
+# We expect SSE3 floating point math.
+$(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
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+$(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.
+$(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.
+$(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
+
+
+############################################################
+## 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
-
-# Previously the prebiult host toolchain is used only for the sdk build,
-# that's why we have "sdk" in the path name.
-ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),)
-HOST_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk
-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 $(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
-
-ifneq ($(strip $(BUILD_HOST_static)),)
-# Statically-linked binaries are desirable for sandboxed environment
-HOST_GLOBAL_LDFLAGS += -static
-endif # BUILD_HOST_static
-
-HOST_GLOBAL_CFLAGS += -fPIC \
- -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
-
-HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
diff --git a/core/combo/HOST_linux-x86_64.mk b/core/combo/HOST_linux-x86_64.mk
new file mode 100644
index 0000000..8f3a311
--- /dev/null
+++ b/core/combo/HOST_linux-x86_64.mk
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for builds hosted on linux-x86_64.
+# Included by combo/select.mk
+
+HOST_IS_64_BIT := true
+
+ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),)
+HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-
+endif
+# Don't do anything if the toolchain is not there
+ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc)))
+HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc
+HOST_CXX := $(HOST_TOOLCHAIN_PREFIX)g++
+HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar
+endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists
+
+# gcc location for clang; to be updated when clang is updated
+HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/
+
+HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack
+HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack
+
+ifneq ($(strip $(BUILD_HOST_static)),)
+# Statically-linked binaries are desirable for sandboxed environment
+HOST_GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+# TODO: Add AndroidConfig.h for linux-x86_64
+HOST_GLOBAL_CFLAGS += -fPIC \
+ -no-canonical-prefixes \
+ -include $(call select-android-config-h,linux-x86)
+
+# Disable new longjmp in glibc 2.11 and later. See bug 2967937.
+HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS
+
+HOST_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
diff --git a/core/combo/HOST_windows-x86.mk b/core/combo/HOST_windows-x86.mk
index 85bc1e0..4d871d8 100644
--- a/core/combo/HOST_windows-x86.mk
+++ b/core/combo/HOST_windows-x86.mk
@@ -27,28 +27,29 @@
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
-HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
-HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
-HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
-HOST_GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
-HOST_GLOBAL_LDFLAGS += --enable-stdcall-fixup
+$(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
+
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.
@@ -62,11 +63,14 @@
#
ifneq ($(findstring CYGWIN,$(UNAME)),)
ifeq ($(strip $(USE_CYGWIN)),)
-HOST_GLOBAL_CFLAGS += -mno-cygwin
-HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
+$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mno-cygwin
+$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
endif
endif
+############################################################
+## Macros after this line are shared by the 64-bit config.
+
HOST_SHLIB_SUFFIX := .dll
HOST_EXECUTABLE_SUFFIX := .exe
diff --git a/core/combo/HOST_windows-x86_64.mk b/core/combo/HOST_windows-x86_64.mk
new file mode 100644
index 0000000..9edc619
--- /dev/null
+++ b/core/combo/HOST_windows-x86_64.mk
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2006 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Configuration for Windows on x86_64.
+# Included by combo/select.make
+
+# right now we get these from the environment, but we should
+# pick them from the tree somewhere
+TOOLS_PREFIX := #prebuilt/windows/host/bin/
+TOOLS_EXE_SUFFIX := .exe
+
+HOST_IS_64_BIT := true
+
+# Settings to use MinGW has a cross-compiler under Linux
+ifneq ($(findstring Linux,$(UNAME)),)
+ifneq ($(strip $(USE_MINGW)),)
+HOST_ACP_UNAVAILABLE := true
+TOOLS_EXE_SUFFIX :=
+HOST_GLOBAL_CFLAGS += -DUSE_MINGW
+TOOLS_PREFIX := /usr/bin/amd64-mingw32msvc-
+HOST_C_INCLUDES += /usr/lib/gcc/amd64-mingw32msvc/4.4.2/include
+HOST_GLOBAL_LD_DIRS += -L/usr/amd64-mingw32msvc/lib
+endif # USE_MINGW
+endif # Linux
+
+# Workaround differences in inttypes.h between host and target.
+# See bug 12708004.
+HOST_GLOBAL_CFLAGS += -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -D__USE_MINGW_ANSI_STDIO
+
+HOST_CC := $(TOOLS_PREFIX)gcc$(TOOLS_EXE_SUFFIX)
+HOST_CXX := $(TOOLS_PREFIX)g++$(TOOLS_EXE_SUFFIX)
+HOST_AR := $(TOOLS_PREFIX)ar$(TOOLS_EXE_SUFFIX)
+
+HOST_GLOBAL_CFLAGS += -include $(call select-android-config-h,windows)
+HOST_GLOBAL_LDFLAGS += --enable-stdcall-fixup
+ifneq ($(strip $(BUILD_HOST_static)),)
+# Statically-linked binaries are desirable for sandboxed environment
+HOST_GLOBAL_LDFLAGS += -static
+endif # BUILD_HOST_static
+
+# when building under Cygwin, ensure that we use Mingw compilation by default.
+# you can disable this (i.e. to generate Cygwin executables) by defining the
+# USE_CYGWIN variable in your environment, e.g.:
+#
+# export USE_CYGWIN=1
+#
+# note that the -mno-cygwin flags are not needed when cross-compiling the
+# Windows host tools on Linux
+#
+ifneq ($(findstring CYGWIN,$(UNAME)),)
+ifeq ($(strip $(USE_CYGWIN)),)
+HOST_GLOBAL_CFLAGS += -mno-cygwin
+HOST_GLOBAL_LDFLAGS += -mno-cygwin -mconsole
+endif
+endif
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index f6971c5..4fe0bcd 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -34,6 +34,9 @@
TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv5te
endif
+# Decouple NDK library selection with platform compiler version
+$(combo_2nd_arch_prefix)TARGET_NDK_GCC_VERSION := 4.8
+
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.8
else
@@ -58,13 +61,8 @@
$(combo_2nd_arch_prefix)TARGET_AR := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
$(combo_2nd_arch_prefix)TARGET_OBJCOPY := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_READELF := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)readelf$(HOST_EXECUTABLE_SUFFIX)
$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
-ifeq ($(TARGET_BUILD_VARIANT),user)
- $(combo_2nd_arch_prefix)TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
-else
- $(combo_2nd_arch_prefix)TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
- $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
-endif
$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -105,6 +103,8 @@
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
-fno-short-enums \
+ -no-canonical-prefixes \
+ -fno-canonical-system-headers \
$(arch_variant_cflags) \
-include $(android_config_h) \
-I $(dir $(android_config_h))
@@ -162,6 +162,8 @@
# into account.
$(combo_2nd_arch_prefix)TARGET_LIBGCC := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) \
$($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
+$(combo_2nd_arch_prefix)TARGET_LIBATOMIC := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) \
+ $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-file-name=libatomic.a)
target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
-print-file-name=libgcov.a)
endif
@@ -225,6 +227,7 @@
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
-Wl,-shared,-Bsymbolic \
+ -shared \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -240,8 +243,10 @@
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \
+ $(PRIVATE_LDLIBS)
endef
define $(combo_2nd_arch_prefix)transform-o-to-executable-inner
@@ -250,7 +255,7 @@
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
- -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@@ -265,8 +270,10 @@
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_LDLIBS)
endef
define $(combo_2nd_arch_prefix)transform-o-to-static-executable-inner
@@ -286,7 +293,8 @@
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(PRIVATE_TARGET_FDO_LIB) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
index 76ee567..4bb665c 100644
--- a/core/combo/TARGET_linux-arm64.mk
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -34,8 +34,11 @@
TARGET_ARCH_VARIANT := armv8
endif
+# Decouple NDK library selection with platform compiler version
+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
@@ -47,9 +50,6 @@
$(error Unknown ARM architecture version: $(TARGET_ARCH_VARIANT))
endif
-# TODO: Enable Clang when aarch64 prebuilt is added
-WITHOUT_CLANG := true
-
include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
@@ -63,13 +63,8 @@
TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+TARGET_READELF := $(TARGET_TOOLS_PREFIX)readelf$(HOST_EXECUTABLE_SUFFIX)
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
-ifeq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
-else
- TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
- $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
-endif
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -80,6 +75,7 @@
TARGET_GLOBAL_CFLAGS += \
-fpic -fPIE \
+ -fstack-protector \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
@@ -87,15 +83,16 @@
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
-fno-short-enums \
+ -no-canonical-prefixes \
+ -fno-canonical-system-headers \
$(arch_variant_cflags) \
-include $(android_config_h) \
-I $(dir $(android_config_h))
-# HACK: globally disable -fstack-protector until the toolchain supports it
-TARGET_GLOBAL_UNSUPPORTED_CFLAGS := -fstack-protector
-
-# TODO - remove __ANDROID__ after the next aarch64 toolchain refresh
-TARGET_GLOBAL_CFLAGS += -D__ANDROID__=1
+# Help catch common 32/64-bit errors.
+TARGET_GLOBAL_CFLAGS += \
+ -Werror=pointer-to-int-cast \
+ -Werror=int-to-pointer-cast \
TARGET_GLOBAL_CFLAGS += -fno-strict-volatile-bitfields
@@ -109,12 +106,13 @@
#
TARGET_GLOBAL_CFLAGS += -Wno-psabi
-# TODO - temporarily remove "-Wl,-z,relro -Wl,-z,now" as they cause segmentation fault on the
-# v8 foundation model.
TARGET_GLOBAL_LDFLAGS += \
-Wl,-z,noexecstack \
+ -Wl,-z,relro \
+ -Wl,-z,now \
-Wl,--warn-shared-textrel \
-Wl,--fatal-warnings \
+ -Wl,-maarch64linux \
$(arch_variant_ldflags)
TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
@@ -134,6 +132,8 @@
TARGET_LIBGCC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
-print-libgcc-file-name)
+TARGET_LIBATOMIC := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+ -print-file-name=libatomic.a)
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH)
@@ -163,7 +163,9 @@
define transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
+ -Wl,--gc-sections \
-Wl,-shared,-Bsymbolic \
+ -shared \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -179,16 +181,19 @@
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \
+ $(PRIVATE_LDLIBS)
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=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@@ -203,12 +208,15 @@
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_LDLIBS)
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)) \
@@ -223,7 +231,8 @@
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(PRIVATE_TARGET_FDO_LIB) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index 637c8f6..f52c375 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -30,43 +30,41 @@
# include defines, and compiler settings for the given architecture
# version.
#
-ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
-TARGET_ARCH_VARIANT := mips32r2-fp
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
+TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := mips32r2-fp
endif
+# Decouple NDK library selection with platform compiler version
+$(combo_2nd_arch_prefix)TARGET_NDK_GCC_VERSION := 4.8
+
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.8
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.8
else
-TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
-TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
+TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT).mk
ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
-$(error Unknown MIPS architecture variant: $(TARGET_ARCH_VARIANT))
+$(error Unknown MIPS architecture variant: $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
endif
include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
-ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
-TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION)
-TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/mipsel-linux-android-
+ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),)
+$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
+$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/mipsel-linux-android-
endif
-TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
-TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
-TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
-TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
-TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
-ifeq ($(TARGET_BUILD_VARIANT),user)
- TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@
-else
- TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-all $< -o $@ && \
- $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
-endif
+$(combo_2nd_arch_prefix)TARGET_CC := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_CXX := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_AR := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_OBJCOPY := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_READELF := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)readelf$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
-TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
TARGET_mips_CFLAGS := -O2 \
-fomit-frame-pointer \
@@ -82,9 +80,9 @@
android_config_h := $(call select-android-config-h,linux-mips)
-TARGET_GLOBAL_CFLAGS += \
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
$(TARGET_mips_CFLAGS) \
- -Ulinux -U__unix -U__unix__ -Umips \
+ -U__unix -U__unix__ -Umips \
-fpic -fPIE\
-ffunction-sections \
-fdata-sections \
@@ -92,6 +90,8 @@
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
+ -no-canonical-prefixes \
+ -fno-canonical-system-headers \
$(arch_variant_cflags) \
-include $(android_config_h) \
-I $(dir $(android_config_h))
@@ -99,8 +99,8 @@
# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
# We cannot turn it off blindly since the option is not available
# in gcc-4.4.x.
-ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $(TARGET_GCC_VERSION)),)
-TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable \
+ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)),)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable \
-fno-strict-volatile-bitfields
endif
@@ -112,13 +112,13 @@
# in their exported C++ functions). Also, GCC 4.5 has already
# removed the warning from the compiler.
#
-TARGET_GLOBAL_CFLAGS += -Wno-psabi
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-psabi
ifneq ($(ARCH_MIPS_PAGE_SHIFT),)
-TARGET_GLOBAL_CFLAGS += -DPAGE_SHIFT=$(ARCH_MIPS_PAGE_SHIFT)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -DPAGE_SHIFT=$(ARCH_MIPS_PAGE_SHIFT)
endif
-TARGET_GLOBAL_LDFLAGS += \
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += \
-Wl,-z,noexecstack \
-Wl,-z,relro \
-Wl,-z,now \
@@ -126,10 +126,10 @@
-Wl,--fatal-warnings \
$(arch_variant_ldflags)
-TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
# More flags/options can be added here
-TARGET_RELEASE_CFLAGS := \
+$(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS := \
-DNDEBUG \
-g \
-Wstrict-aliasing=2 \
@@ -143,45 +143,47 @@
## on some hosts, the target cross-compiler is not available so do not run this command
-ifneq ($(wildcard $(TARGET_CC)),)
+ifneq ($(wildcard $($(combo_2nd_arch_prefix)TARGET_CC)),)
# We compile with the global cflags to ensure that
# any flags which affect libgcc are correctly taken
# into account.
-TARGET_LIBGCC := \
- $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-file-name=libgcc.a)
-LIBGCC_EH := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-file-name=libgcc_eh.a)
+$(combo_2nd_arch_prefix)TARGET_LIBGCC := \
+ $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-file-name=libgcc.a)
+$(combo_2nd_arch_prefix)TARGET_LIBATOMIC := \
+ $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-file-name=libatomic.a)
+LIBGCC_EH := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-file-name=libgcc_eh.a)
ifneq ($(LIBGCC_EH),libgcc_eh.a)
- TARGET_LIBGCC += $(LIBGCC_EH)
+ $(combo_2nd_arch_prefix)TARGET_LIBGCC += $(LIBGCC_EH)
endif
-target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
--print-file-name=libgcov.a)
endif
# Define FDO (Feedback Directed Optimization) options.
-TARGET_FDO_CFLAGS:=
-TARGET_FDO_LIB:=
+$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:=
+$(combo_2nd_arch_prefix)TARGET_FDO_LIB:=
ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
# Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
# The profile will be generated on /data/local/tmp/profile on the device.
- TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
else
# If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations.
# Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
- ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),)
- TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT)
+ ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),)
+ $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)
else
- ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
+ ifeq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(warning Custom $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
endif
endif
# If the FDO profile directory can't be found, then FDO is off.
- ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
endif
endif
@@ -190,7 +192,7 @@
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-mips # mips covers both mips and mips64.
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
-TARGET_C_INCLUDES := \
+$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
$(libc_root)/arch-mips/include \
$(libc_root)/include \
$(libstdc++_root)/include \
@@ -198,24 +200,25 @@
$(libm_root)/include \
$(libm_root)/include/mips \
-TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
-TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
-TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
-TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
-TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
-TARGET_STRIP_MODULE:=true
+$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
-TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
-TARGET_CUSTOM_LD_COMMAND := true
+$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
-define transform-o-to-shared-lib-inner
+define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
-Wl,-shared,-Bsymbolic \
+ -shared \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -225,23 +228,25 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \
+ $(PRIVATE_LDLIBS)
endef
-define transform-o-to-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
- -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@@ -250,17 +255,19 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_LDLIBS)
endef
-define transform-o-to-static-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-static-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \
-Wl,--gc-sections \
-o $@ \
@@ -277,7 +284,8 @@
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(PRIVATE_TARGET_FDO_LIB) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk
new file mode 100644
index 0000000..e9f5adb
--- /dev/null
+++ b/core/combo/TARGET_linux-mips64.mk
@@ -0,0 +1,300 @@
+#
+# Copyright (C) 2013 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 Linux on MIPS64.
+# Included by combo/select.mk
+
+# You can set TARGET_ARCH_VARIANT to use an arch version other
+# than mips64. Each value should correspond to a file named
+# $(BUILD_COMBOS)/arch/<name>.mk which must contain
+# makefile variable definitions similar to the preprocessor
+# defines in build/core/combo/include/arch/<combo>/AndroidConfig.h. Their
+# purpose is to allow module Android.mk files to selectively compile
+# different versions of code based upon the funtionality and
+# instructions available in a given architecture version.
+#
+# The blocks also define specific arch_variant_cflags, which
+# include defines, and compiler settings for the given architecture
+# version.
+#
+ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
+TARGET_ARCH_VARIANT := mips64r2
+endif
+
+# Decouple NDK library selection with platform compiler version
+TARGET_NDK_GCC_VERSION := 4.8
+
+ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
+TARGET_GCC_VERSION := 4.8
+else
+TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
+endif
+
+TARGET_IS_64_BIT := true
+
+TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
+ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
+$(error Unknown MIPS architecture variant: $(TARGET_ARCH_VARIANT))
+endif
+
+# TODO: Enable Clang when its mips64 prebuilt is added
+WITHOUT_TARGET_CLANG := true
+
+include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
+
+# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
+ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
+TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mips64el-linux-android-$(TARGET_GCC_VERSION)
+TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/mips64el-linux-android-
+endif
+
+TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+TARGET_READELF := $(TARGET_TOOLS_PREFIX)readelf$(HOST_EXECUTABLE_SUFFIX)
+TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+
+TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+
+TARGET_mips_CFLAGS := -O2 \
+ -fomit-frame-pointer \
+ -fno-strict-aliasing \
+ -funswitch-loops
+
+# Set FORCE_MIPS_DEBUGGING to "true" in your buildspec.mk
+# or in your environment to gdb debugging easier.
+# Don't forget to do a clean build.
+ifeq ($(FORCE_MIPS_DEBUGGING),true)
+ TARGET_mips_CFLAGS += -fno-omit-frame-pointer
+endif
+
+android_config_h := $(call select-android-config-h,linux-mips64)
+
+TARGET_GLOBAL_CFLAGS += \
+ $(TARGET_mips_CFLAGS) \
+ -U__unix -U__unix__ -Umips \
+ -fpic -fPIE\
+ -ffunction-sections \
+ -fdata-sections \
+ -funwind-tables \
+ -Wa,--noexecstack \
+ -Werror=format-security \
+ -D_FORTIFY_SOURCE=2 \
+ -no-canonical-prefixes \
+ -fno-canonical-system-headers \
+ $(arch_variant_cflags) \
+ -include $(android_config_h) \
+ -I $(dir $(android_config_h))
+
+# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
+# We cannot turn it off blindly since the option is not available
+# in gcc-4.4.x.
+ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $(TARGET_GCC_VERSION)),)
+TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable \
+ -fno-strict-volatile-bitfields
+endif
+
+# This is to avoid the dreaded warning compiler message:
+# note: the mangling of 'va_list' has changed in GCC 4.4
+#
+# The fact that the mangling changed does not affect the NDK ABI
+# very fortunately (since none of the exposed APIs used va_list
+# in their exported C++ functions). Also, GCC 4.5 has already
+# removed the warning from the compiler.
+#
+TARGET_GLOBAL_CFLAGS += -Wno-psabi
+
+ifneq ($(ARCH_MIPS_PAGE_SHIFT),)
+TARGET_GLOBAL_CFLAGS += -DPAGE_SHIFT=$(ARCH_MIPS_PAGE_SHIFT)
+endif
+
+TARGET_GLOBAL_LDFLAGS += \
+ -Wl,-z,noexecstack \
+ -Wl,-z,relro \
+ -Wl,-z,now \
+ -Wl,--warn-shared-textrel \
+ -Wl,--fatal-warnings \
+ $(arch_variant_ldflags)
+
+TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
+
+# More flags/options can be added here
+TARGET_RELEASE_CFLAGS := \
+ -DNDEBUG \
+ -g \
+ -Wstrict-aliasing=2 \
+ -fgcse-after-reload \
+ -frerun-cse-after-loop \
+ -frename-registers
+
+libc_root := bionic/libc
+libm_root := bionic/libm
+libstdc++_root := bionic/libstdc++
+libthread_db_root := bionic/libthread_db
+
+
+## on some hosts, the target cross-compiler is not available so do not run this command
+ifneq ($(wildcard $(TARGET_CC)),)
+# We compile with the global cflags to ensure that
+# any flags which affect libgcc are correctly taken
+# into account.
+TARGET_LIBGCC := \
+ $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-file-name=libgcc.a)
+TARGET_LIBATOMIC := \
+ $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-file-name=libatomic.a)
+LIBGCC_EH := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) -print-file-name=libgcc_eh.a)
+ifneq ($(LIBGCC_EH),libgcc_eh.a)
+ TARGET_LIBGCC += $(LIBGCC_EH)
+endif
+target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+ --print-file-name=libgcov.a)
+endif
+
+# Define FDO (Feedback Directed Optimization) options.
+
+TARGET_FDO_CFLAGS:=
+TARGET_FDO_LIB:=
+
+ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
+ # Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
+ # The profile will be generated on /data/local/tmp/profile on the device.
+ TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
+ TARGET_FDO_LIB := $(target_libgcov)
+else
+ # If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations.
+ # Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
+ ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),)
+ TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT)
+ else
+ ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
+ $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
+ endif
+ endif
+
+ # If the FDO profile directory can't be found, then FDO is off.
+ ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
+ TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
+ TARGET_FDO_LIB := $(target_libgcov)
+ endif
+endif
+
+
+KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
+KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-mips
+# TODO: perhaps use $(libc_root)/kernel/uapi/asm-$(TARGET_ARCH) instead of asm-mips ?
+KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
+
+TARGET_C_INCLUDES := \
+ $(libc_root)/arch-mips64/include \
+ $(libc_root)/include \
+ $(libstdc++_root)/include \
+ $(KERNEL_HEADERS) \
+ $(libm_root)/include \
+ $(libm_root)/include/mips \
+ $(libthread_db_root)/include
+# TODO: perhaps use $(libm_root)/include/mips64 instead of mips ?
+
+TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
+TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
+TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
+
+TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
+TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
+
+TARGET_STRIP_MODULE:=true
+
+TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+
+TARGET_CUSTOM_LD_COMMAND := true
+
+define transform-o-to-shared-lib-inner
+$(hide) $(PRIVATE_CXX) \
+ -nostdlib -Wl,-soname,$(notdir $@) \
+ -Wl,--gc-sections \
+ -shared \
+ -Wl,-shared,-Bsymbolic \
+ $(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ -o $@ \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \
+ $(PRIVATE_LDLIBS)
+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) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
+ -o $@ \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_LDLIBS)
+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)) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(call normalize-target-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
+ -Wl,--no-whole-archive \
+ $(call normalize-target-libraries,$(filter-out %libc_nomalloc.a,$(filter-out %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)))) \
+ -Wl,--start-group \
+ $(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
+ $(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
+ $(PRIVATE_TARGET_FDO_LIB) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ -Wl,--end-group \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+endef
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
old mode 100755
new mode 100644
index 801f882..bc13fb9
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -18,56 +18,55 @@
# Included by combo/select.mk
# Provide a default variant.
-ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
-TARGET_ARCH_VARIANT := x86
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
+TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := x86
endif
+# Decouple NDK library selection with platform compiler version
+$(combo_2nd_arch_prefix)TARGET_NDK_GCC_VERSION := 4.8
+
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.8
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.8
else
-TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
# Include the arch-variant-specific configuration file.
# Its role is to define various ARCH_X86_HAVE_XXX feature macros,
# plus initial values for TARGET_GLOBAL_CFLAGS
#
-TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
+TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT).mk
ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
-$(error Unknown $(TARGET_ARCH) architecture version: $(TARGET_ARCH_VARIANT))
+$(error Unknown $(TARGET_$(combo_2nd_arch_prefix)ARCH) architecture version: $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
endif
include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
-ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
-TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$(TARGET_GCC_VERSION)
-TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/x86_64-linux-android-
+ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),)
+$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
+$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/x86_64-linux-android-
endif
-TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
-TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
-TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
-TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
-TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_CC := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_CXX := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_AR := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_OBJCOPY := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_LD := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_READELF := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)readelf$(HOST_EXECUTABLE_SUFFIX)
+$(combo_2nd_arch_prefix)TARGET_STRIP := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
-ifeq ($(TARGET_BUILD_VARIANT),user)
-TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@
-else
-TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@ && \
- $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
-endif
-
-ifneq ($(wildcard $(TARGET_CC)),)
-TARGET_LIBGCC := \
- $(shell $(TARGET_CC) -m32 -print-file-name=libgcc.a)
-target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
+ifneq ($(wildcard $($(combo_2nd_arch_prefix)TARGET_CC)),)
+$(combo_2nd_arch_prefix)TARGET_LIBGCC := \
+ $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libgcc.a)
+$(combo_2nd_arch_prefix)TARGET_LIBATOMIC := \
+ $(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libatomic.a)
+target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
-print-file-name=libgcov.a)
endif
-TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
+$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
libc_root := bionic/libc
libm_root := bionic/libm
@@ -75,29 +74,29 @@
# Define FDO (Feedback Directed Optimization) options.
-TARGET_FDO_CFLAGS:=
-TARGET_FDO_LIB:=
+$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:=
+$(combo_2nd_arch_prefix)TARGET_FDO_LIB:=
ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
# Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
# The profile will be generated on /data/local/tmp/profile on the device.
- TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/profile -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
else
# If BUILD_FDO_INSTRUMENT is turned off, then consider doing the FDO optimizations.
# Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
- ifeq ($(strip $(TARGET_FDO_PROFILE_PATH)),)
- TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT)
+ ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),)
+ $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo/profiles/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT)
else
- ifeq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- $(warning Custom TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
+ ifeq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(warning Custom $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH supplied, but directory does not exist. Turn off FDO.)
endif
endif
# If the FDO profile directory can't be found, then FDO is off.
- ifneq ($(strip $(wildcard $(TARGET_FDO_PROFILE_PATH))),)
- TARGET_FDO_CFLAGS := -fprofile-use=$(TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
- TARGET_FDO_LIB := $(target_libgcov)
+ ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO
+ $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
endif
endif
@@ -107,9 +106,8 @@
android_config_h := $(call select-android-config-h,target_linux-x86)
-TARGET_GLOBAL_CFLAGS += \
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
-O2 \
- -Ulinux \
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
@@ -125,39 +123,42 @@
-funwind-tables \
-fstack-protector \
-m32 \
+ -msse2 \
+ -no-canonical-prefixes \
+ -fno-canonical-system-headers \
-include $(android_config_h) \
-I $(dir $(android_config_h))
-TARGET_GLOBAL_CFLAGS += $(arch_variant_cflags)
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(arch_variant_cflags)
ifeq ($(ARCH_X86_HAVE_SSSE3),true) # yes, really SSSE3, not SSE3!
- TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3 -mssse3
+ $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3 -mssse3
endif
ifeq ($(ARCH_X86_HAVE_SSE4),true)
- TARGET_GLOBAL_CFLAGS += -msse4
+ $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -msse4
endif
ifeq ($(ARCH_X86_HAVE_SSE4_1),true)
- TARGET_GLOBAL_CFLAGS += -msse4.1
+ $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -msse4.1
endif
ifeq ($(ARCH_X86_HAVE_SSE4_2),true)
- TARGET_GLOBAL_CFLAGS += -msse4.2
+ $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -msse4.2
endif
ifeq ($(ARCH_X86_HAVE_AVX),true)
- TARGET_GLOBAL_CFLAGS += -mavx
+ $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -mavx
endif
ifeq ($(ARCH_X86_HAVE_AES_NI),true)
- TARGET_GLOBAL_CFLAGS += -maes
+ $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -maes
endif
-TARGET_GLOBAL_LDFLAGS += -m32
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -m32
-TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack
-TARGET_GLOBAL_LDFLAGS += -Wl,-z,relro -Wl,-z,now
-TARGET_GLOBAL_LDFLAGS += -Wl,--warn-shared-textrel
-TARGET_GLOBAL_LDFLAGS += -Wl,--fatal-warnings
-TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,-z,relro -Wl,-z,now
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--warn-shared-textrel
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--fatal-warnings
+$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections
-TARGET_C_INCLUDES := \
+$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
$(libc_root)/arch-x86/include \
$(libc_root)/include \
$(libstdc++_root)/include \
@@ -165,24 +166,23 @@
$(libm_root)/include \
$(libm_root)/include/i387 \
-TARGET_CRTBEGIN_STATIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
-TARGET_CRTBEGIN_DYNAMIC_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
-TARGET_CRTEND_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_STATIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_static.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_DYNAMIC_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_dynamic.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_android.o
-TARGET_CRTBEGIN_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
-TARGET_CRTEND_SO_O := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTBEGIN_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtbegin_so.o
+$(combo_2nd_arch_prefix)TARGET_CRTEND_SO_O := $($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)/crtend_so.o
-TARGET_STRIP_MODULE:=true
+$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
-TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
+$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
-TARGET_CUSTOM_LD_COMMAND := true
-define transform-o-to-shared-lib-inner
+$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
+define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Wl,-soname,$(notdir $@) \
-shared -Bsymbolic \
- $(TARGET_GLOBAL_CFLAGS) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -192,23 +192,25 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O)) \
+ $(PRIVATE_LDLIBS)
endef
-define transform-o-to-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Bdynamic \
-Wl,-z,nocopyreloc \
-fPIE -pie \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
- -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@@ -217,16 +219,18 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_LDLIBS)
endef
-define transform-o-to-static-executable-inner
+define $(combo_2nd_arch_prefix)transform-o-to-static-executable-inner
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Bstatic \
@@ -241,7 +245,8 @@
-Wl,--start-group \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_TARGET_FDO_LIB) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef
diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk
old mode 100755
new mode 100644
index 82e25e0..e24f548
--- a/core/combo/TARGET_linux-x86_64.mk
+++ b/core/combo/TARGET_linux-x86_64.mk
@@ -22,8 +22,11 @@
TARGET_ARCH_VARIANT := x86_64
endif
+# Decouple NDK library selection with platform compiler version
+TARGET_NDK_GCC_VERSION := 4.8
+
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.7
+TARGET_GCC_VERSION := 4.8
else
TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
@@ -53,18 +56,14 @@
TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+TARGET_READELF := $(TARGET_TOOLS_PREFIX)readelf$(HOST_EXECUTABLE_SUFFIX)
TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
-ifeq ($(TARGET_BUILD_VARIANT),user)
-TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@
-else
-TARGET_STRIP_COMMAND = $(PRIVATE_STRIP) --strip-debug $< -o $@ && \
- $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
-endif
-
ifneq ($(wildcard $(TARGET_CC)),)
TARGET_LIBGCC := \
$(shell $(TARGET_CC) -m64 -print-file-name=libgcc.a)
+TARGET_LIBATOMIC := \
+ $(shell $(TARGET_CC) -m64 -print-file-name=libatomic.a)
target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
-print-file-name=libgcov.a)
endif
@@ -109,7 +108,6 @@
TARGET_GLOBAL_CFLAGS += \
-O2 \
- -Ulinux \
-Wa,--noexecstack \
-Werror=format-security \
-D_FORTIFY_SOURCE=2 \
@@ -124,7 +122,14 @@
-funswitch-loops \
-funwind-tables \
-fstack-protector \
- -m64
+ -m64 \
+ -no-canonical-prefixes \
+ -fno-canonical-system-headers
+
+# Help catch common 32/64-bit errors.
+TARGET_GLOBAL_CFLAGS += \
+ -Werror=pointer-to-int-cast \
+ -Werror=int-to-pointer-cast \
android_config_h := $(call select-android-config-h,target_linux-x86)
TARGET_ANDROID_CONFIG_CFLAGS := -include $(android_config_h) -I $(dir $(android_config_h))
@@ -183,7 +188,6 @@
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Wl,-soname,$(notdir $@) \
-shared -Bsymbolic \
- $(TARGET_GLOBAL_CFLAGS) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -193,12 +197,13 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_SO_O))
endef
@@ -209,7 +214,7 @@
-Wl,-z,nocopyreloc \
-fPIE -pie \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
- -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
@@ -218,13 +223,15 @@
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
$(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_LDLIBS)
endef
define transform-o-to-static-executable-inner
@@ -242,7 +249,9 @@
-Wl,--start-group \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_TARGET_FDO_LIB) \
- $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
- $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
+ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O)) \
+ $(PRIVATE_LDLIBS)
endef
diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk
index 53d9220..c6603db 100644
--- a/core/combo/arch/arm/armv7-a-neon.mk
+++ b/core/combo/arch/arm/armv7-a-neon.mk
@@ -1,18 +1,18 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher with NEON
#
-$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_ARMV7A := true
-$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP := true
-$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP_D32 := true
-$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_NEON := true
+ARCH_ARM_HAVE_ARMV7A := true
+ARCH_ARM_HAVE_VFP := true
+ARCH_ARM_HAVE_VFP_D32 := true
+ARCH_ARM_HAVE_NEON := true
-ifeq ($(TARGET_CPU_VARIANT),$(filter $(TARGET_CPU_VARIANT),cortex-a15 krait))
+ifneq (,$(filter cortex-a15 krait denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a15
else
-ifeq ($(strip $(TARGET_CPU_VARIANT)),cortex-a8)
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a8)
arch_variant_cflags := -mcpu=cortex-a8
else
-ifeq ($(strip $(TARGET_CPU_VARIANT)),cortex-a7)
+ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a7)
arch_variant_cflags := -mcpu=cortex-a7
else
arch_variant_cflags := -march=armv7-a
diff --git a/core/combo/arch/arm/armv7-a.mk b/core/combo/arch/arm/armv7-a.mk
index 9549478..4a51977 100644
--- a/core/combo/arch/arm/armv7-a.mk
+++ b/core/combo/arch/arm/armv7-a.mk
@@ -1,8 +1,8 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher
#
-$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_ARMV7A := true
-$(combo_2nd_arch_prefix)ARCH_ARM_HAVE_VFP := true
+ARCH_ARM_HAVE_ARMV7A := true
+ARCH_ARM_HAVE_VFP := true
# Note: Hard coding the 'tune' value here is probably not ideal,
# and a better solution should be found in the future.
diff --git a/core/combo/arch/mips64/mips64r2.mk b/core/combo/arch/mips64/mips64r2.mk
new file mode 100644
index 0000000..298aeaf
--- /dev/null
+++ b/core/combo/arch/mips64/mips64r2.mk
@@ -0,0 +1,14 @@
+# Configuration for Android on mips64r2.
+
+ARCH_MIPS_HAS_FPU :=true
+ARCH_HAVE_ALIGNED_DOUBLES :=true
+arch_variant_cflags := \
+ -EL \
+ -march=mips64r2 \
+ -mtune=mips64r2 \
+ -mips64r2 \
+ -mhard-float \
+ -msynci
+
+arch_variant_ldflags := \
+ -EL
diff --git a/core/combo/arch/x86/silvermont.mk b/core/combo/arch/x86/silvermont.mk
new file mode 100644
index 0000000..3a8718d
--- /dev/null
+++ b/core/combo/arch/x86/silvermont.mk
@@ -0,0 +1,20 @@
+# This file contains feature macro definitions specific to the
+# silvermont arch variant.
+#
+# See build/core/combo/arch/x86/x86-atom.mk for differences.
+#
+
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AES_NI := true
+ARCH_X86_HAVE_POPCNT := true
+ARCH_X86_HAVE_MOVBE := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=slm \
+ -mstackrealign \
+ -mfpmath=sse \
+
diff --git a/core/combo/arch/x86_64/silvermont.mk b/core/combo/arch/x86_64/silvermont.mk
new file mode 100644
index 0000000..6c953a3
--- /dev/null
+++ b/core/combo/arch/x86_64/silvermont.mk
@@ -0,0 +1,17 @@
+# This file contains feature macro definitions specific to the
+# silvermont arch variant.
+#
+# See build/core/combo/arch/x86/x86-atom.mk for differences.
+#
+
+ARCH_X86_HAVE_SSSE3 := true
+ARCH_X86_HAVE_SSE4 := true
+ARCH_X86_HAVE_SSE4_1 := true
+ARCH_X86_HAVE_SSE4_2 := true
+ARCH_X86_HAVE_AES_NI := true
+ARCH_X86_HAVE_POPCNT := true
+ARCH_X86_HAVE_MOVBE := true
+
+# CFLAGS for this arch
+arch_variant_cflags := \
+ -march=slm \
diff --git a/core/combo/include/arch/darwin-x86/AndroidConfig.h b/core/combo/include/arch/darwin-x86/AndroidConfig.h
index 012f014..44de4cd 100644
--- a/core/combo/include/arch/darwin-x86/AndroidConfig.h
+++ b/core/combo/include/arch/darwin-x86/AndroidConfig.h
@@ -132,12 +132,6 @@
/* #define HAVE_POSIX_CLOCKS */
/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-/* #define HAVE_TIMEDWAIT_MONOTONIC */
-
-/*
* Endianness of the target machine. Choose one:
*
* HAVE_ENDIAN_H -- have endian.h header we can include.
diff --git a/core/combo/include/arch/freebsd-x86/AndroidConfig.h b/core/combo/include/arch/freebsd-x86/AndroidConfig.h
index 6f50918..0734661 100644
--- a/core/combo/include/arch/freebsd-x86/AndroidConfig.h
+++ b/core/combo/include/arch/freebsd-x86/AndroidConfig.h
@@ -140,12 +140,6 @@
#define HAVE_POSIX_CLOCKS
/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-/* #define HAVE_TIMEDWAIT_MONOTONIC */
-
-/*
* Define this if we have linux style epoll()
*/
/* #define HAVE_EPOLL */
diff --git a/core/combo/include/arch/linux-arm/AndroidConfig.h b/core/combo/include/arch/linux-arm/AndroidConfig.h
index 9257d3e..9253e7c 100644
--- a/core/combo/include/arch/linux-arm/AndroidConfig.h
+++ b/core/combo/include/arch/linux-arm/AndroidConfig.h
@@ -145,12 +145,6 @@
#define HAVE_POSIX_CLOCKS
/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-#define HAVE_TIMEDWAIT_MONOTONIC
-
-/*
* Define this if we have linux style epoll()
*/
#define HAVE_EPOLL
diff --git a/core/combo/include/arch/linux-arm64/AndroidConfig.h b/core/combo/include/arch/linux-arm64/AndroidConfig.h
index d649b2e..6f85555 100644
--- a/core/combo/include/arch/linux-arm64/AndroidConfig.h
+++ b/core/combo/include/arch/linux-arm64/AndroidConfig.h
@@ -145,12 +145,6 @@
#define HAVE_POSIX_CLOCKS
/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-#define HAVE_TIMEDWAIT_MONOTONIC
-
-/*
* Define this if we have linux style epoll()
*/
#define HAVE_EPOLL
diff --git a/core/combo/include/arch/linux-mips/AndroidConfig.h b/core/combo/include/arch/linux-mips/AndroidConfig.h
index e24f3ea..2758153 100644
--- a/core/combo/include/arch/linux-mips/AndroidConfig.h
+++ b/core/combo/include/arch/linux-mips/AndroidConfig.h
@@ -145,12 +145,6 @@
#define HAVE_POSIX_CLOCKS
/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-#define HAVE_TIMEDWAIT_MONOTONIC
-
-/*
* Define this if we have linux style epoll()
*/
#define HAVE_EPOLL
diff --git a/core/combo/include/arch/linux-mips64/AndroidConfig.h b/core/combo/include/arch/linux-mips64/AndroidConfig.h
new file mode 100644
index 0000000..bfc0351
--- /dev/null
+++ b/core/combo/include/arch/linux-mips64/AndroidConfig.h
@@ -0,0 +1,363 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+/*
+ * Android config -- "android-mips64". Used for MIPS device builds.
+ */
+#ifndef _ANDROID_CONFIG_H
+#define _ANDROID_CONFIG_H
+
+/*
+ * ===========================================================================
+ * !!! IMPORTANT !!!
+ * ===========================================================================
+ *
+ * This file is included by ALL C/C++ source files. Don't put anything in
+ * here unless you are absolutely certain it can't go anywhere else.
+ *
+ * Any C++ stuff must be wrapped with "#ifdef __cplusplus". Do not use "//"
+ * comments.
+ */
+
+/*
+ * Threading model. Choose one:
+ *
+ * HAVE_PTHREADS - use the pthreads library.
+ * HAVE_WIN32_THREADS - use Win32 thread primitives.
+ * -- combine HAVE_CREATETHREAD, HAVE_CREATEMUTEX, and HAVE__BEGINTHREADEX
+ */
+#define HAVE_PTHREADS
+
+/*
+ * Do we have pthread_setname_np()?
+ *
+ * (HAVE_PTHREAD_SETNAME_NP is used by WebKit to enable a function with
+ * the same name but different parameters, so we can't use that here.)
+ */
+#define HAVE_ANDROID_PTHREAD_SETNAME_NP
+
+/*
+ * Do we have the futex syscall?
+ */
+#define HAVE_FUTEX
+
+/*
+ * Define if we already have the futex wrapper functions defined. Yes if
+ * compiling against bionic.
+ */
+#define HAVE_FUTEX_WRAPPERS 1
+
+/*
+ * Process creation model. Choose one:
+ *
+ * HAVE_FORKEXEC - use fork() and exec()
+ * HAVE_WIN32_PROC - use CreateProcess()
+ */
+#define HAVE_FORKEXEC
+
+/*
+ * Process out-of-memory adjustment. Set if running on Linux,
+ * where we can write to /proc/<pid>/oom_adj to modify the out-of-memory
+ * badness adjustment.
+ */
+#define HAVE_OOM_ADJ
+
+/*
+ * IPC model. Choose one:
+ *
+ * HAVE_SYSV_IPC - use the classic SysV IPC mechanisms (semget, shmget).
+ * HAVE_MACOSX_IPC - use Macintosh IPC mechanisms (sem_open, mmap).
+ * HAVE_WIN32_IPC - use Win32 IPC (CreateSemaphore, CreateFileMapping).
+ * HAVE_ANDROID_IPC - use Android versions (?, mmap).
+ */
+#define HAVE_ANDROID_IPC
+
+/*
+ * Memory-mapping model. Choose one:
+ *
+ * HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h
+ * HAVE_WIN32_FILEMAP - use Win32 filemaps
+ */
+#define HAVE_POSIX_FILEMAP
+
+/*
+ * Define this if you have <termio.h>
+ */
+#define HAVE_TERMIO_H 1
+
+/*
+ * Define this if you have <sys/sendfile.h>
+ */
+#define HAVE_SYS_SENDFILE_H 1
+
+/*
+ * Define this if you build against MSVCRT.DLL
+ */
+/* #define HAVE_MS_C_RUNTIME */
+
+/*
+ * Define this if you have sys/uio.h
+ */
+#define HAVE_SYS_UIO_H 1
+
+/*
+ * Define this if your platforms implements symbolic links
+ * in its filesystems
+ */
+#define HAVE_SYMLINKS
+
+/*
+ * Define this if we have localtime_r().
+ */
+/* #define HAVE_LOCALTIME_R */
+
+/*
+ * Define this if we have gethostbyname_r().
+ */
+/* #define HAVE_GETHOSTBYNAME_R */
+
+/*
+ * Define this if we have ioctl().
+ */
+#define HAVE_IOCTL
+
+/*
+ * Define this if we want to use WinSock.
+ */
+/* #define HAVE_WINSOCK */
+
+/*
+ * Define this if have clock_gettime() and friends
+ */
+#define HAVE_POSIX_CLOCKS
+
+/*
+ * Define this if we have linux style epoll()
+ */
+#define HAVE_EPOLL
+
+/*
+ * Endianness of the target machine. Choose one:
+ *
+ * HAVE_ENDIAN_H -- have endian.h header we can include.
+ * HAVE_LITTLE_ENDIAN -- we are little endian.
+ * HAVE_BIG_ENDIAN -- we are big endian.
+ */
+#define HAVE_ENDIAN_H
+#define HAVE_LITTLE_ENDIAN
+
+#define _FILE_OFFSET_BITS 64
+/* #define _LARGEFILE_SOURCE 1 */
+
+/*
+ * Define if platform has off64_t (and lseek64 and other xxx64 functions)
+ */
+#define HAVE_OFF64_T
+
+/*
+ * Defined if we have the backtrace() call for retrieving a stack trace.
+ * Needed for CallStack to operate; if not defined, CallStack is
+ * non-functional.
+ */
+#define HAVE_BACKTRACE 0
+
+/*
+ * Defined if we have the cxxabi.h header for demangling C++ symbols. If
+ * not defined, stack crawls will be displayed with raw mangled symbols
+ */
+#define HAVE_CXXABI 0
+
+/*
+ * Defined if we have the gettid() system call.
+ */
+#define HAVE_GETTID
+
+/*
+ * Defined if we have the sched_setscheduler() call
+ */
+#define HAVE_SCHED_SETSCHEDULER
+
+/*
+ * Add any extra platform-specific defines here.
+ */
+#ifndef __linux__
+#define __linux__ 1
+#endif
+
+#ifndef __linux
+#define __linux 1
+#endif
+
+#ifdef __unix__
+#undef __unix__
+#endif
+
+#ifdef __unix
+#undef __unix
+#endif
+
+/*
+ * Define if we have <malloc.h> header
+ */
+#define HAVE_MALLOC_H
+
+/*
+ * Define if we're running on *our* linux on device or emulator.
+ */
+#define HAVE_ANDROID_OS 1
+
+/*
+ * Define if we have Linux-style non-filesystem Unix Domain Sockets
+ */
+#define HAVE_LINUX_LOCAL_SOCKET_NAMESPACE 1
+
+/*
+ * Define if we have Linux's inotify in <sys/inotify.h>.
+ */
+#define HAVE_INOTIFY 1
+
+/*
+ * Define if we have madvise() in <sys/mman.h>
+ */
+#define HAVE_MADVISE 1
+
+/*
+ * Define if tm struct has tm_gmtoff field
+ */
+#define HAVE_TM_GMTOFF 1
+
+/*
+ * Define if dirent struct has d_type field
+ */
+#define HAVE_DIRENT_D_TYPE 1
+
+/*
+ * Define if libc includes Android system properties implementation.
+ */
+#define HAVE_LIBC_SYSTEM_PROPERTIES 1
+
+/*
+ * Define if system provides a system property server (should be
+ * mutually exclusive with HAVE_LIBC_SYSTEM_PROPERTIES).
+ */
+/* #define HAVE_SYSTEM_PROPERTY_SERVER */
+
+/*
+ * What CPU architecture does this platform use?
+ */
+#define ARCH_MIPS64 1
+
+/*
+ * Define if the size of enums is as short as possible,
+ */
+/* #define HAVE_SHORT_ENUMS */
+
+/*
+ * sprintf() format string for shared library naming.
+ */
+#define OS_SHARED_LIB_FORMAT_STR "lib%s.so"
+
+/*
+ * Do we have __memcmp16()?
+ */
+#define HAVE__MEMCMP16 1
+
+/*
+ * type for the third argument to mincore().
+ */
+#define MINCORE_POINTER_TYPE unsigned char *
+
+/*
+ * Do we have the sigaction flag SA_NOCLDWAIT?
+ */
+#define HAVE_SA_NOCLDWAIT
+
+/*
+ * The default path separator for the platform
+ */
+#define OS_PATH_SEPARATOR '/'
+
+/*
+ * Is the filesystem case sensitive?
+ */
+#define OS_CASE_SENSITIVE
+
+/*
+ * Define if <sys/socket.h> exists.
+ */
+#define HAVE_SYS_SOCKET_H 1
+
+/*
+ * Define if the strlcpy() function exists on the system.
+ */
+#define HAVE_STRLCPY 1
+
+/*
+ * Define if the open_memstream() function exists on the system.
+ */
+/* #define HAVE_OPEN_MEMSTREAM 1 */
+
+/*
+ * Define if the BSD funopen() function exists on the system.
+ */
+#define HAVE_FUNOPEN 1
+
+/*
+ * Define if prctl() exists
+ */
+#define HAVE_PRCTL 1
+
+/*
+ * Define if writev() exists
+ */
+#define HAVE_WRITEV 1
+
+/*
+ * Define if <stdint.h> exists.
+ */
+#define HAVE_STDINT_H 1
+
+/*
+ * Define if <stdbool.h> exists.
+ */
+#define HAVE_STDBOOL_H 1
+
+/*
+ * Define if <sched.h> exists.
+ */
+#define HAVE_SCHED_H 1
+
+/*
+ * Define if pread() exists
+ */
+#define HAVE_PREAD 1
+
+/*
+ * Define if we have st_mtim in struct stat
+ */
+#define HAVE_STAT_ST_MTIM 1
+
+/*
+ * Define if printf() supports %zd for size_t arguments
+ */
+#define HAVE_PRINTF_ZD 1
+
+/*
+ * Whether or not _Unwind_Context is defined as a struct.
+ */
+#define HAVE_UNWIND_CONTEXT_STRUCT 1
+
+#endif /* _ANDROID_CONFIG_H */
diff --git a/core/combo/include/arch/linux-ppc/AndroidConfig.h b/core/combo/include/arch/linux-ppc/AndroidConfig.h
index a12ef47..e6f9489 100644
--- a/core/combo/include/arch/linux-ppc/AndroidConfig.h
+++ b/core/combo/include/arch/linux-ppc/AndroidConfig.h
@@ -135,12 +135,6 @@
/*#define HAVE_POSIX_CLOCKS*/
/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-/* #define HAVE_TIMEDWAIT_MONOTONIC */
-
-/*
* Define this if we have linux style epoll()
*/
#define HAVE_EPOLL
diff --git a/core/combo/include/arch/linux-x86/AndroidConfig.h b/core/combo/include/arch/linux-x86/AndroidConfig.h
index 2db66a2..0740186 100644
--- a/core/combo/include/arch/linux-x86/AndroidConfig.h
+++ b/core/combo/include/arch/linux-x86/AndroidConfig.h
@@ -128,17 +128,8 @@
/*
* Define this if have clock_gettime() and friends
- *
- * Desktop Linux has this in librt, but it's broken in goobuntu, yielding
- * mildly or wildly inaccurate results.
*/
-/*#define HAVE_POSIX_CLOCKS*/
-
-/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-/* #define HAVE_TIMEDWAIT_MONOTONIC */
+#define HAVE_POSIX_CLOCKS
/*
* Define this if we have linux style epoll()
diff --git a/core/combo/include/arch/target_linux-x86/AndroidConfig.h b/core/combo/include/arch/target_linux-x86/AndroidConfig.h
index 25a1f5d..f55134a 100644
--- a/core/combo/include/arch/target_linux-x86/AndroidConfig.h
+++ b/core/combo/include/arch/target_linux-x86/AndroidConfig.h
@@ -132,12 +132,6 @@
#define HAVE_POSIX_CLOCKS
/*
- * Define this if we have pthread_cond_timedwait_monotonic() and
- * clock_gettime(CLOCK_MONOTONIC).
- */
-#define HAVE_TIMEDWAIT_MONOTONIC
-
-/*
* Define this if we have linux style epoll()
*/
#define HAVE_EPOLL
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index cc2c872..7f91aa9 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -1,7 +1,7 @@
# Selects a Java compiler.
#
# Inputs:
-# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
+# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
# default
# ALTERNATE_JAVAC -- the alternate java compiler to use
#
@@ -9,10 +9,10 @@
# COMMON_JAVAC -- Java compiler command with common arguments
#
-ifeq ($(EXPERIMENTAL_USE_JAVA7),)
-common_flags := -target 1.5 -Xmaxerrs 9999999
+ifneq ($(LEGACY_USE_JAVA6),)
+common_jdk_flags := -target 1.5 -Xmaxerrs 9999999
else
-common_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
+common_jdk_flags := -source 1.7 -target 1.7 -Xmaxerrs 9999999
endif
# Use the indexer wrapper to index the codebase instead of the javac compiler
@@ -22,12 +22,19 @@
JAVACC := $(ALTERNATE_JAVAC)
endif
+# The actual compiler can be wrapped by setting the JAVAC_WRAPPER var.
+ifdef JAVAC_WRAPPER
+ ifneq ($(JAVAC_WRAPPER),$(firstword $(JAVACC)))
+ JAVACC := $(JAVAC_WRAPPER) $(JAVACC)
+ endif
+endif
+
# Whatever compiler is on this system.
ifeq ($(BUILD_OS), windows)
COMMON_JAVAC := development/host/windows/prebuilt/javawrap.exe -J-Xmx256m \
- $(common_flags)
+ $(common_jdk_flags)
else
- COMMON_JAVAC := $(JAVACC) -J-Xmx512M $(common_flags)
+ COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
endif
# Eclipse.
diff --git a/core/combo/mac_version.mk b/core/combo/mac_version.mk
new file mode 100644
index 0000000..b49feee
--- /dev/null
+++ b/core/combo/mac_version.mk
@@ -0,0 +1,50 @@
+# Detect Mac OS X and SDK versions.
+# Output variables:
+# build_mac_version
+# mac_sdk_version
+# mac_sdk_root
+# gcc_darwin_version
+
+ifndef build_mac_version
+
+build_mac_version := $(shell sw_vers -productVersion)
+
+mac_sdk_versions_supported := 10.6 10.7 10.8
+ifneq ($(strip $(MAC_SDK_VERSION)),)
+mac_sdk_version := $(MAC_SDK_VERSION)
+ifeq ($(filter $(mac_sdk_version),$(mac_sdk_versions_supported)),)
+$(warning ****************************************************************)
+$(warning * MAC_SDK_VERSION $(MAC_SDK_VERSION) isn't one of the supported $(mac_sdk_versions_supported))
+$(warning ****************************************************************)
+$(error Stop.)
+endif
+else
+mac_sdk_versions_installed := $(shell xcodebuild -showsdks | grep macosx | sort | sed -e "s/.*macosx//g")
+mac_sdk_version := $(firstword $(filter $(mac_sdk_versions_installed), $(mac_sdk_versions_supported)))
+ifeq ($(mac_sdk_version),)
+mac_sdk_version := $(firstword $(mac_sdk_versions_supported))
+endif
+endif
+
+mac_sdk_path := $(shell xcode-select -print-path)
+# try /Applications/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.?.sdk
+# or /Volume/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.?.sdk
+mac_sdk_root := $(mac_sdk_path)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX$(mac_sdk_version).sdk
+ifeq ($(wildcard $(mac_sdk_root)),)
+# try legacy /Developer/SDKs/MacOSX10.?.sdk
+mac_sdk_root := /Developer/SDKs/MacOSX$(mac_sdk_version).sdk
+endif
+ifeq ($(wildcard $(mac_sdk_root)),)
+$(warning *****************************************************)
+$(warning * Can not find SDK $(mac_sdk_version) at $(mac_sdk_root))
+$(warning *****************************************************)
+$(error Stop.)
+endif
+
+ifeq ($(mac_sdk_version),10.6)
+ gcc_darwin_version := 10
+else
+ gcc_darwin_version := 11
+endif
+
+endif # ifndef build_mac_version
diff --git a/core/combo/select.mk b/core/combo/select.mk
index c1a7cc0..98697e0 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,19 +86,26 @@
# 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.
ccache := $(strip $(wildcard $(ccache)))
ifdef ccache
- # prepend ccache if necessary
- ifneq ($(ccache),$(firstword $($(combo_var_prefix)CC)))
- $(combo_var_prefix)CC := $(ccache) $($(combo_var_prefix)CC)
- endif
- ifneq ($(ccache),$(firstword $($(combo_var_prefix)CXX)))
- $(combo_var_prefix)CXX := $(ccache) $($(combo_var_prefix)CXX)
- endif
+ CC_WRAPPER ?= $(ccache)
+ CXX_WRAPPER ?= $(ccache)
ccache =
endif
endif
+
+# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars.
+ifdef CC_WRAPPER
+ ifneq ($(CC_WRAPPER),$(firstword $($(combo_var_prefix)CC)))
+ $(combo_var_prefix)CC := $(CC_WRAPPER) $($(combo_var_prefix)CC)
+ endif
+endif
+ifdef CXX_WRAPPER
+ ifneq ($(CXX_WRAPPER),$(firstword $($(combo_var_prefix)CXX)))
+ $(combo_var_prefix)CXX := $(CXX_WRAPPER) $($(combo_var_prefix)CXX)
+ endif
+endif
diff --git a/core/config.mk b/core/config.mk
index 08cd818..7e86126 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -78,6 +78,12 @@
BUILD_COPY_HEADERS := $(BUILD_SYSTEM)/copy_headers.mk
BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
+
+BUILD_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/shared_test_lib.mk
+BUILD_HOST_SHARED_TEST_LIBRARY := $(BUILD_SYSTEM)/host_shared_test_lib.mk
+BUILD_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/static_test_lib.mk
+BUILD_HOST_STATIC_TEST_LIBRARY := $(BUILD_SYSTEM)/host_static_test_lib.mk
+
BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
BUILD_HOST_DALVIK_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_java_library.mk
BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY := $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
@@ -211,6 +217,13 @@
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
@@ -225,6 +238,59 @@
include $(BUILD_SYSTEM)/combo/select.mk
endif
+ifdef TARGET_PREFER_32_BIT
+TARGET_PREFER_32_BIT_APPS := true
+TARGET_PREFER_32_BIT_EXECUTABLES := true
+endif
+
+ifeq (,$(TARGET_SUPPORTS_32_BIT_APPS)$(TARGET_SUPPORTS_64_BIT_APPS))
+ TARGET_SUPPORTS_32_BIT_APPS := true
+endif
+
+# "ro.product.cpu.abilist32" and "ro.product.cpu.abilist64" are
+# comma separated lists of the 32 and 64 bit ABIs (in order of
+# preference) that the target supports. If TARGET_CPU_ABI_LIST_{32,64}_BIT
+# are defined by the board config, we use them. Else, we construct
+# these lists based on whether TARGET_IS_64_BIT is set.
+#
+# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target
+# is always 32 bits. If this isn't the case, these variables should
+# be overriden in the boarc configuration.
+ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
+ ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
+ TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
+ endif
+endif
+
+ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT))
+ ifneq (true,$(TARGET_IS_64_BIT))
+ TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
+ else
+ ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS))
+ # For a 64 bit target, assume that the 2ND_CPU_ABI
+ # is a 32 bit ABI.
+ TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
+ endif
+ endif
+endif
+
+# "ro.product.cpu.abilist" is a comma separated list of ABIs (in order
+# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
+# is specified by the board configuration, we use that. If not, we
+# build a list out of the TARGET_CPU_ABIs specified by the config.
+ifeq (,$(TARGET_CPU_ABI_LIST))
+ ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true)
+ TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT)
+ else
+ TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT)
+ endif
+endif
+
+# Strip whitespace from the ABI list string.
+TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST)))
+TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT)))
+TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT)))
+
# Compute TARGET_TOOLCHAIN_ROOT from TARGET_TOOLS_PREFIX
# if only TARGET_TOOLS_PREFIX is passed to the make command.
ifndef TARGET_TOOLCHAIN_ROOT
@@ -242,7 +308,7 @@
endif
# Disable WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK if tool can't be found
-SYNTAX_TOOLS_PREFIX := prebuilts/clang/$(HOST_PREBUILT_TAG)/host/3.3/bin
+SYNTAX_TOOLS_PREFIX := prebuilts/misc/$(HOST_PREBUILT_TAG)/analyzer/bin
ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer),)
$(warning *** Disable WITH_STATIC_ANALYZER because $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer does not exist)
@@ -292,13 +358,13 @@
# ---------------------------------------------------------------
# Generic tools.
-LEX := flex
+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
# 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
@@ -353,10 +419,8 @@
COLUMN:= column
endif
-OLD_FLEX := prebuilts/misc/$(HOST_PREBUILT_TAG)/flex/flex-2.5.4a$(HOST_EXECUTABLE_SUFFIX)
-
ifeq ($(HOST_OS),darwin)
-ifneq ($(EXPERIMENTAL_USE_JAVA7),)
+ifeq ($(LEGACY_USE_JAVA6),)
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
else
# Deliberately set to blank for Java 6 installations on MacOS. These
@@ -369,7 +433,7 @@
ifneq ($(HOST_JDK_TOOLS_JAR),)
ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
-$(error Error: could not find jdk tools.jar, please install JDK6)
+$(error Error: could not find jdk tools.jar, please check if your JDK was installed correctly)
endif
endif
@@ -435,16 +499,27 @@
TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
ifdef TARGET_2ND_ARCH
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
-$(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
-$(combo_2nd_arch_prefix)TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_LD_DIRS += -L$($(combo_2nd_arch_prefix)TARGET_OUT_INTERMEDIATE_LIBRARIES)
-$(combo_2nd_arch_prefix)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += $($(combo_2nd_arch_prefix)TARGET_RELEASE_CFLAGS)
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += $($(combo_2nd_arch_prefix)TARGET_RELEASE_CPPFLAGS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS += -L$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_CFLAGS += $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_RELEASE_CFLAGS)
+$(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
@@ -452,8 +527,27 @@
TARGET_DEFAULT_JAVA_LIBRARIES := core core-junit ext framework framework2
endif
-# define llvm tools and global flags
-include $(BUILD_SYSTEM)/llvm_config.mk
+TARGET_CPU_SMP ?= true
+
+# Flags for DEX2OAT
+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
+
+ifdef TARGET_2ND_ARCH
+$(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
+endif
+
+# define clang/llvm tools and global flags
+include $(BUILD_SYSTEM)/clang/config.mk
# ###############################################################
# Collect a list of the SDK versions that we could compile against
@@ -488,6 +582,9 @@
# 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
diff --git a/core/configure_module_stem.mk b/core/configure_module_stem.mk
new file mode 100644
index 0000000..48b7787
--- /dev/null
+++ b/core/configure_module_stem.mk
@@ -0,0 +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
+ my_module_stem := $(my_multilib_stem)
+else ifdef LOCAL_MODULE_STEM
+ my_module_stem := $(LOCAL_MODULE_STEM)
+else
+ my_module_stem := $(LOCAL_MODULE)
+endif
+
+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
+
+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 dada61e..5d76285 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -84,7 +84,9 @@
# Target and host installed module's dependencies on shared libraries.
# They are list of "<module_name>:<installed_file>:lib1,lib2...".
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.
@@ -117,14 +119,15 @@
###########################################################
## Retrieve the directory of the current makefile
+## Must be called before including any other makefile!!
###########################################################
# Figure out where we are.
define my-dir
$(strip \
$(eval LOCAL_MODULE_MAKEFILE := $$(lastword $$(MAKEFILE_LIST))) \
- $(if $(filter $(CLEAR_VARS),$(LOCAL_MODULE_MAKEFILE)), \
- $(error LOCAL_PATH must be set before including $$(CLEAR_VARS)) \
+ $(if $(filter $(BUILD_SYSTEM)/% $(OUT_DIR)/%,$(LOCAL_MODULE_MAKEFILE)), \
+ $(error my-dir must be called before including any other makefile.) \
, \
$(patsubst %/,%,$(dir $(LOCAL_MODULE_MAKEFILE))) \
) \
@@ -153,6 +156,7 @@
###########################################################
## Retrieve a list of all makefiles immediately below your directory
+## Must be called before including any other makefile!!
###########################################################
define all-subdir-makefiles
@@ -162,6 +166,7 @@
###########################################################
## Look in the named list of directories for makefiles,
## relative to the current directory.
+## Must be called before including any other makefile!!
###########################################################
# $(1): List of directories to look for under this directory
@@ -274,6 +279,19 @@
endef
###########################################################
+## Find all of the S files under the named directories.
+## Meant to be used like:
+## SRC_FILES := $(call all-c-files-under,src tests)
+###########################################################
+
+define all-S-files-under
+$(patsubst ./%,%, \
+ $(shell cd $(LOCAL_PATH) ; \
+ find -L $(1) -name "*.S" -and -not -name ".*") \
+ )
+endef
+
+###########################################################
## Find all of the html files under the named directories.
## Meant to be used like:
## SRC_FILES := $(call all-html-files-under,src tests)
@@ -385,36 +403,6 @@
endef
###########################################################
-## Set up the dependencies for a prebuilt target
-## $(call add-prebuilt-file, srcfile, [targetclass])
-###########################################################
-
-define add-prebuilt-file
- $(eval $(include-prebuilt))
-endef
-
-define include-prebuilt
- include $$(CLEAR_VARS)
- LOCAL_SRC_FILES := $(1)
- LOCAL_BUILT_MODULE_STEM := $(1)
- LOCAL_MODULE_SUFFIX := $$(suffix $(1))
- LOCAL_MODULE := $$(basename $(1))
- LOCAL_MODULE_CLASS := $(2)
- include $$(BUILD_PREBUILT)
-endef
-
-###########################################################
-## do multiple prebuilts
-## $(call target class, files ...)
-###########################################################
-
-define add-prebuilt-files
- $(foreach f,$(2),$(call add-prebuilt-file,$f,$(1)))
-endef
-
-
-
-###########################################################
## The intermediates directory. Where object files go for
## a given target. We could technically get away without
## the "_intermediates" suffix on the directory, but it's
@@ -436,11 +424,13 @@
$(if $(_idfName),, \
$(error $(LOCAL_PATH): Name not defined in call to intermediates-dir-for)) \
$(eval _idfPrefix := $(if $(strip $(3)),HOST,TARGET)) \
- $(eval _idf2ndArchPrefix := $(if $(strip $(5)),$(TARGET_2ND_ARCH_VAR_PREFIX))) \
+ $(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)) \
- , \
- $(eval _idfIntBase := $($(_idf2ndArchPrefix)$(_idfPrefix)_OUT_INTERMEDIATES)) \
+ ,$(if $(filter $(_idfClass),SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP),\
+ $(eval _idfIntBase := $($(_idf2ndArchPrefix)$(_idfPrefix)_OUT_INTERMEDIATES)) \
+ ,$(eval _idfIntBase := $($(_idfPrefix)_OUT_INTERMEDIATES)) \
+ ) \
) \
$(_idfIntBase)/$(_idfClass)/$(_idfName)_intermediates \
)
@@ -861,7 +851,6 @@
echo '#define '$(@F:$1=_h) >> $(@:$1=.h)
cat $(@:$1=$(YACC_HEADER_SUFFIX)) >> $(@:$1=.h)
echo '#endif' >> $(@:$1=.h)
-rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
endef
###########################################################
@@ -914,7 +903,7 @@
-a $@ -MD \
-reflect-c++ \
$(PRIVATE_RS_FLAGS) \
- $(foreach inc,$(PRIVATE_RS_INCLUDES),$(addprefix -I , $(inc))) \
+ $(addprefix -I , $(PRIVATE_RS_INCLUDES)) \
$(PRIVATE_RS_SOURCE_FILES)
$(hide) mkdir -p $(dir $@)
$(hide) touch $@
@@ -1182,7 +1171,7 @@
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 ; \
@@ -1203,7 +1192,8 @@
@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
@@ -1218,11 +1208,12 @@
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
@@ -1238,7 +1229,9 @@
@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
@@ -1251,14 +1244,14 @@
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 $@) \
- $(PRIVATE_LDFLAGS) \
- $(HOST_GLOBAL_LD_DIRS) \
+ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS) \
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
$(PRIVATE_HOST_GLOBAL_LDFLAGS) \
) \
+ $(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_OBJECTS) \
-Wl,--whole-archive \
$(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
@@ -1304,7 +1297,7 @@
define transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
- -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../lib \
-shared -Wl,-soname,$(notdir $@) \
$(PRIVATE_LDFLAGS) \
@@ -1333,10 +1326,23 @@
## Commands for filtering a target executable or library
###########################################################
+ifneq ($(TARGET_BUILD_VARIANT),user)
+ TARGET_STRIP_EXTRA = && $(PRIVATE_OBJCOPY) --add-gnu-debuglink=$< $@
+ TARGET_STRIP_KEEP_SYMBOLS_EXTRA = --add-gnu-debuglink=$<
+endif
+
define transform-to-stripped
@mkdir -p $(dir $@)
@echo "target Strip: $(PRIVATE_MODULE) ($@)"
-$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_STRIP_COMMAND)
+$(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ $(TARGET_STRIP_EXTRA)
+endef
+
+define transform-to-stripped-keep-symbols
+@mkdir -p $(dir $@)
+@echo "target Strip (keep symbols): $(PRIVATE_MODULE) ($@)"
+$(hide) $(PRIVATE_OBJCOPY) \
+ `$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "-R " $$2}' | xargs` \
+ $(TARGET_STRIP_KEEP_SYMBOLS_EXTRA) $< $@
endef
@@ -1349,7 +1355,7 @@
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
- -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \
+ -Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../lib \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_ALL_OBJECTS) \
@@ -1394,6 +1400,11 @@
###########################################################
## Commands for running gcc to link a host executable
###########################################################
+ifdef BUILD_HOST_static
+HOST_FPIE_FLAGS :=
+else
+HOST_FPIE_FLAGS := -fPIE -pie
+endif
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-executable-inner
@@ -1406,14 +1417,14 @@
$(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) \
- $(PRIVATE_LDFLAGS) \
+ -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) \
- -fPIE -pie \
+ $(HOST_FPIE_FLAGS) \
) \
+ $(PRIVATE_LDFLAGS) \
-o $@ \
$(PRIVATE_LDLIBS)
endef
@@ -1669,10 +1680,10 @@
# 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
@@ -2160,6 +2171,13 @@
$(if $(call if-build-from-source,$(2),$(3)),$(eval include $(1)))
endef
+## Return the arch for the source file of a prebuilt
+# $(1) the list of archs supported by the prebuilt
+define get-prebuilt-src-arch
+$(strip $(if $(filter $(TARGET_ARCH),$(1)),$(TARGET_ARCH),\
+ $(if $(filter $(TARGET_2ND_ARCH),$(1)),$(TARGET_2ND_ARCH))))
+endef
+
###########################################################
## Other includes
###########################################################
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 160f128..ab970f9 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))
@@ -51,22 +49,27 @@
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 := $(DEX2OAT_DEPENDENCY)
-DEXPREOPT_ONE_FILE_DEPENDENCY_BUILT_BOOT_PREOPT := $(DEFAULT_DEX_PREOPT_BUILT_IMAGE)
-endif
+DEXPREOPT_ONE_FILE_DEPENDENCY_TOOLS := $(DEX2OATD_DEPENDENCY)
+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
+endif # DALVIK_VM_LIB is defined.
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 841d3db..411af75 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -6,95 +6,74 @@
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)
-
-# TODO: for now, override with debug version for better error reporting
-DEX2OAT := $(DEX2OATD)
-LIBART_COMPILER := $(LIBARTD_COMPILER)
-
# 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)
PRELOADED_CLASSES := frameworks/base/preloaded-classes
-LIBART_BOOT_IMAGE := /$(DEXPREOPT_BOOT_JAR_DIR)/boot.art
-
-DEFAULT_DEX_PREOPT_BUILT_IMAGE := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.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
-
-DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
-ifeq ($(TARGET_CPU_VARIANT),$(filter $(TARGET_CPU_VARIANT),cortex-a7 cortex-a15 krait))
-DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div
-endif
-
# start of image reserved address space
LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
ifeq ($(TARGET_ARCH),mips)
LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
else
-LIBART_IMG_TARGET_BASE_ADDRESS := 0x60000000
+LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
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/<arch>/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))
+my_2nd_arch_prefix :=
+include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
-$(DEFAULT_DEX_PREOPT_BUILT_IMAGE): $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY)
- @echo "target dex2oat: $@ ($?)"
- @mkdir -p $(dir $@)
- @mkdir -p $(dir $(LIBART_TARGET_BOOT_OAT_UNSTRIPPED))
- $(hide) $(DEX2OAT) --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=$(TARGET_ARCH) --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
- --host-prefix=$(DEXPREOPT_PRODUCT_DIR_FULL_PATH) --android-root=$(PRODUCT_OUT)/system
+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) $(DEX2OAT) \
+$(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) \
- --host-prefix=$(DEXPREOPT_PRODUCT_DIR_FULL_PATH) \
+ --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=$(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 0000000..70130b6
--- /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 b0b73af..713f595 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -43,22 +43,83 @@
# 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): 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))
+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))) \
+ | $(ACP)
@echo "Install: $@"
$(copy-file-to-target)
endif
diff --git a/core/droiddoc.mk b/core/droiddoc.mk
index 93b56d4..d5ddf08 100644
--- a/core/droiddoc.mk
+++ b/core/droiddoc.mk
@@ -51,25 +51,22 @@
LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets
endif
-
+ifeq ($(LOCAL_IS_HOST_MODULE),true)
$(full_target): PRIVATE_BOOTCLASSPATH :=
-ifeq ($(BUILD_OS),linux)
-# You have to set bootclasspath for javadoc manually on linux since Java 6.
-host_jdk_rt_jar := $(dir $(HOST_JDK_TOOLS_JAR))../jre/lib/rt.jar
-$(full_target): PRIVATE_BOOTCLASSPATH := $(host_jdk_rt_jar)
-endif
-
-ifneq ($(LOCAL_IS_HOST_MODULE),true)
+else
ifneq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# Use android_stubs_current if LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
LOCAL_JAVA_LIBRARIES := android_stubs_current $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_stubs_current)
else
LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, sdk_v$(LOCAL_SDK_VERSION))
endif
else
LOCAL_JAVA_LIBRARIES := core ext framework framework2 $(LOCAL_JAVA_LIBRARIES)
+ $(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core)
endif # LOCAL_SDK_VERSION
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
@@ -165,6 +162,7 @@
-encoding UTF-8 \
\@$(PRIVATE_SRC_LIST_FILE) \
-J-Xmx1280m \
+ -XDignore.symbol.file \
$(PRIVATE_PROFILING_OPTIONS) \
-quiet \
-doclet com.google.doclava.Doclava \
@@ -200,8 +198,10 @@
$(PRIVATE_DROIDDOC_OPTIONS) \
\@$(PRIVATE_SRC_LIST_FILE) \
-J-Xmx1024m \
+ -XDignore.symbol.file \
$(PRIVATE_PROFILING_OPTIONS) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
+ $(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
-sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
-d $(PRIVATE_OUT_DIR) \
-quiet \
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index 2612e06..510bc7d 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -9,31 +9,6 @@
ABP:=$(PWD)/$(HOST_OUT_EXECUTABLES)
endif
-# Add the ARM toolchain bin dir if it actually exists
-ifeq ($(TARGET_ARCH),arm)
- ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin),)
- # this should be copied to HOST_OUT_EXECUTABLES instead
- ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$(TARGET_GCC_VERSION)/bin
- endif
- ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-eabi-$(TARGET_GCC_VERSION)/bin),)
- # this should be copied to HOST_OUT_EXECUTABLES instead
- ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-eabi-$(TARGET_GCC_VERSION)/bin
- endif
-else ifeq ($(TARGET_ARCH),x86)
-
-# Add the x86 toolchain bin dir if it actually exists
- ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$(TARGET_GCC_VERSION)/bin),)
- # this should be copied to HOST_OUT_EXECUTABLES instead
- ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/x86_64-linux-android-$(TARGET_GCC_VERSION)/bin
- endif
-endif
-
-# Add the mips toolchain bin dir if it actually exists
-ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION)/bin),)
- # this should be copied to HOST_OUT_EXECUTABLES instead
- ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$(TARGET_GCC_VERSION)/bin
-endif
-
ANDROID_BUILD_PATHS := $(ABP)
ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
@@ -99,6 +74,9 @@
$(info TARGET_ARCH=$(TARGET_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))
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 6d3d2b5..396199c 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
@@ -37,7 +26,7 @@
# 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)
@@ -52,8 +41,6 @@
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))
@@ -70,7 +57,7 @@
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
@@ -92,7 +79,7 @@
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)
@@ -104,17 +91,26 @@
strip_input := $(symbolic_output)
strip_output := $(LOCAL_BUILT_MODULE)
-ifeq ($(strip $(LOCAL_STRIP_MODULE)),)
- LOCAL_STRIP_MODULE := $(strip $(TARGET_STRIP_MODULE))
+my_strip_module := $(LOCAL_STRIP_MODULE)
+ifeq ($(my_strip_module),)
+ my_strip_module := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP_MODULE)
endif
-ifeq ($(LOCAL_STRIP_MODULE),true)
+ifeq ($(my_strip_module),true)
# Strip the binary
$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped)
else
+ifeq ($(my_strip_module),keep_symbols)
+# Strip only the debug frames, but leave the symbol table.
+$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
+$(strip_output): PRIVATE_READELF := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_READELF)
+$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+ $(transform-to-stripped-keep-symbols)
+else
# Don't strip the binary, just copy it. We can't skip this step
# because a copy of the binary must appear at LOCAL_BUILT_MODULE.
#
@@ -129,7 +125,8 @@
@echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target-with-cp)
endif
-endif # LOCAL_STRIP_MODULE
+endif
+endif # my_strip_module
$(cleantarget): PRIVATE_CLEAN_FILES += \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 4cb389b..a228fc7 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -40,16 +40,16 @@
# 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 @@
# 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
@@ -67,17 +67,30 @@
$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)
endif
-
-# HOST_ARCH
-ifneq (,$(findstring 86,$(UNAME)))
- HOST_ARCH := x86
+ifeq ($(HOST_PREFER_32_BIT),true)
+# User asks for multilib build, but use 32-bit as preferred arch.
+BUILD_HOST_64bit := true
endif
-ifneq (,$(findstring Power,$(UNAME)))
- HOST_ARCH := ppc
+# HOST_ARCH
+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 +107,14 @@
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 +195,12 @@
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 +227,21 @@
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
+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)
+
+
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 baa6a74..4dd9a23 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -1,13 +1,73 @@
# 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_32BIT_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
-ifeq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
+my_prefix := TARGET_
+include $(BUILD_SYSTEM)/multilib.mk
+
+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
+
+# if TARGET_PREFER_32_BIT_EXECUTABLES is set, try to build 32-bit first
+ifdef TARGET_2ND_ARCH
+ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
else
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif
+endif
+my_skip_non_preferred_arch :=
+
+# check if preferred arch is supported
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# first arch is supported
include $(BUILD_SYSTEM)/executable_internal.mk
+ifneq ($(my_module_multilib),both)
+my_skip_non_preferred_arch := true
+endif
+endif
+
+# check if preferred arch was not supported or asked to build both
+ifndef my_skip_non_preferred_arch
+ifdef TARGET_2ND_ARCH
+
+# check if the non-preferred arch is the primary or secondary
+ifeq ($(TARGET_PREFER_32_BIT_EXECUTABLES),true)
LOCAL_2ND_ARCH_VAR_PREFIX :=
+else
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+endif
+
+# check if non-preferred arch is supported
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# non-preferred 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_non_preferred_arch || LOCAL_MULTILIB
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
+
+my_module_arch_supported :=
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 33a573f..2e380b6 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -17,7 +17,7 @@
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
-include $(BUILD_PREBUILT)
+include $(BUILD_SYSTEM)/prebuilt_internal.mk
skip_build_from_source := true
endif
endif
@@ -28,13 +28,9 @@
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
-ifeq ($(LOCAL_CLANG),true)
-my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
-else
-my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
-endif
my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
+my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_DYNAMIC_O)
my_target_crtbegin_static_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_STATIC_O)
my_target_crtend_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_O)
@@ -43,20 +39,22 @@
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
my_target_global_ld_dirs := \
$(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
- $(my_ndk_version_root)/usr/lib) \
+ $(my_ndk_sysroot_lib)) \
$(my_target_global_ld_dirs)
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
-my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_dynamic.o)
-my_target_crtbegin_static_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_static.o)
-my_target_crtend_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_android.o)
+my_target_crtbegin_dynamic_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_dynamic.o)
+my_target_crtbegin_static_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_static.o)
+my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o)
endif
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
+$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_STATIC_O := $(my_target_crtbegin_static_o)
$(linked_module): PRIVATE_TARGET_CRTEND_O := $(my_target_crtend_o)
+$(linked_module): PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk
new file mode 100644
index 0000000..2f04d0d
--- /dev/null
+++ b/core/executable_prefer_symlink.mk
@@ -0,0 +1,33 @@
+# include this makefile to create the LOCAL_MODULE symlink to the primary version binary.
+# but this requires the primary version name specified via LOCAL_MODULE_STEM_32 or LOCAL_MODULE_STEM_64,
+# and different with the LOCAL_MODULE value
+#
+# 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 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)"
+ @mkdir -p $(dir $@)
+ @rm -rf $@
+ $(hide) ln -sf $(PRIVATE_SRC_BINARY_NAME) $@
+
+# We need this so that the installed files could be picked up based on the
+# local module name
+ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_symlink)
+
+my_symlink :=
diff --git a/core/host_executable.mk b/core/host_executable.mk
index ab0f8f3..53b5fd1 100644
--- a/core/host_executable.mk
+++ b/core/host_executable.mk
@@ -1,33 +1,48 @@
-###########################################################
-## 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
+my_prefix := HOST_
+include $(BUILD_SYSTEM)/multilib.mk
-$(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_PREBUILT)
-skip_build_from_source := true
+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
-ifndef skip_build_from_source
+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
-include $(BUILD_SYSTEM)/binary.mk
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+include $(BUILD_SYSTEM)/module_arch_supported.mk
-$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
- $(transform-host-o-to-executable)
+ifeq ($(my_module_arch_supported),true)
+include $(BUILD_SYSTEM)/host_executable_internal.mk
+endif
-endif # skip_build_from_source
+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_INTERMEDIATE_TARGETS :=
+
+include $(BUILD_SYSTEM)/host_executable_internal.mk
+endif
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+endif # HOST_2ND_ARCH
+
+LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
+my_module_arch_supported :=
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
new file mode 100644
index 0000000..ffb35d2
--- /dev/null
+++ b/core/host_executable_internal.mk
@@ -0,0 +1,33 @@
+###########################################################
+## Standard rules for building an executable file.
+##
+## Additional inputs from base_rules.make:
+## None.
+###########################################################
+
+LOCAL_IS_HOST_MODULE := true
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := EXECUTABLES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := $(HOST_EXECUTABLE_SUFFIX)
+endif
+
+$(call host-executable-hook)
+
+skip_build_from_source :=
+ifdef LOCAL_PREBUILT_MODULE_FILE
+ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
+include $(BUILD_SYSTEM)/prebuilt_internal.mk
+skip_build_from_source := true
+endif
+endif
+
+ifndef skip_build_from_source
+
+include $(BUILD_SYSTEM)/binary.mk
+
+$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
+ $(transform-host-o-to-executable)
+
+endif # skip_build_from_source
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
index a631364..b54bd3a 100644
--- a/core/host_native_test.mk
+++ b/core/host_native_test.mk
@@ -3,13 +3,6 @@
## Common flags for host native tests are added.
################################################
-LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
-LOCAL_C_INCLUDES += \
- external/gtest/include
-
-LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
-LOCAL_SHARED_LIBRARIES +=
-
-LOCAL_LDFLAGS += -lpthread
+include $(BUILD_SYSTEM)/host_test_internal.mk
include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_shared_library.mk b/core/host_shared_library.mk
index a29e14c..2fdf61f 100644
--- a/core/host_shared_library.mk
+++ b/core/host_shared_library.mk
@@ -1,46 +1,40 @@
+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
+
+ifeq ($(my_module_arch_supported),true)
+include $(BUILD_SYSTEM)/host_shared_library_internal.mk
+endif
+
+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_INTERMEDIATE_TARGETS :=
+
+include $(BUILD_SYSTEM)/host_shared_library_internal.mk
+endif
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+endif # HOST_2ND_ARCH
+
+my_module_arch_supported :=
+
###########################################################
-## Standard rules for building a normal shared library.
-##
-## Additional inputs from base_rules.make:
-## None.
-##
-## LOCAL_MODULE_SUFFIX will be set for you.
+## Copy headers to the install tree
###########################################################
-
-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_PREBUILT)
-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 := $(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
+include $(BUILD_COPY_HEADERS)
diff --git a/core/host_shared_library_internal.mk b/core/host_shared_library_internal.mk
new file mode 100644
index 0000000..d9769d3
--- /dev/null
+++ b/core/host_shared_library_internal.mk
@@ -0,0 +1,46 @@
+###########################################################
+## Standard rules for building a normal shared library.
+##
+## Additional inputs from base_rules.make:
+## None.
+##
+## LOCAL_MODULE_SUFFIX will be set for you.
+###########################################################
+
+LOCAL_IS_HOST_MODULE := true
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := $(HOST_SHLIB_SUFFIX)
+endif
+ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
+$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
+endif
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
+$(error $(LOCAL_PATH): Cannot set module stem for a library)
+endif
+
+$(call host-shared-library-hook)
+
+skip_build_from_source :=
+ifdef LOCAL_PREBUILT_MODULE_FILE
+ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
+include $(BUILD_SYSTEM)/prebuilt_internal.mk
+skip_build_from_source := true
+endif
+endif
+
+ifndef skip_build_from_source
+
+# Put the built modules of all shared libraries in a common directory
+# to simplify the link line.
+OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)
+
+include $(BUILD_SYSTEM)/binary.mk
+
+$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(transform-host-o-to-shared-lib)
+
+endif # skip_build_from_source
diff --git a/core/host_shared_test_lib.mk b/core/host_shared_test_lib.mk
new file mode 100644
index 0000000..1eb9b26
--- /dev/null
+++ b/core/host_shared_test_lib.mk
@@ -0,0 +1,8 @@
+##################################################
+## A thin wrapper around BUILD_HOST_SHARED_LIBRARY
+## Common flags for host native tests are added.
+##################################################
+
+include $(BUILD_SYSTEM)/host_test_internal.mk
+
+include $(BUILD_HOST_SHARED_LIBRARY)
diff --git a/core/host_static_library.mk b/core/host_static_library.mk
index a533cf5..c40cf7d 100644
--- a/core/host_static_library.mk
+++ b/core/host_static_library.mk
@@ -1,27 +1,40 @@
+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
+
+ifeq ($(my_module_arch_supported),true)
+include $(BUILD_SYSTEM)/host_static_library_internal.mk
+endif
+
+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_INTERMEDIATE_TARGETS :=
+
+include $(BUILD_SYSTEM)/host_static_library_internal.mk
+endif
+LOCAL_2ND_ARCH_VAR_PREFIX :=
+endif # HOST_2ND_ARCH
+
+my_module_arch_supported :=
+
###########################################################
-## 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.
+## Copy headers to the install tree
###########################################################
-
-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)
+include $(BUILD_COPY_HEADERS)
diff --git a/core/host_static_library_internal.mk b/core/host_static_library_internal.mk
new file mode 100644
index 0000000..a533cf5
--- /dev/null
+++ b/core/host_static_library_internal.mk
@@ -0,0 +1,27 @@
+###########################################################
+## Standard rules for building a static library for the host.
+##
+## Additional inputs from base_rules.make:
+## None.
+##
+## LOCAL_MODULE_SUFFIX will be set for you.
+###########################################################
+
+ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+endif
+ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+LOCAL_MODULE_SUFFIX := .a
+endif
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
+$(error $(LOCAL_PATH): Cannot set module stem for a library)
+endif
+LOCAL_UNINSTALLABLE_MODULE := true
+
+LOCAL_IS_HOST_MODULE := true
+
+include $(BUILD_SYSTEM)/binary.mk
+
+$(LOCAL_BUILT_MODULE): $(built_whole_libraries)
+$(LOCAL_BUILT_MODULE): $(all_objects)
+ $(transform-host-o-to-static-lib)
diff --git a/core/host_static_test_lib.mk b/core/host_static_test_lib.mk
new file mode 100644
index 0000000..5423dc6
--- /dev/null
+++ b/core/host_static_test_lib.mk
@@ -0,0 +1,8 @@
+##################################################
+## A thin wrapper around BUILD_HOST_STATIC_LIBRARY
+## Common flags for host native tests are added.
+##################################################
+
+include $(BUILD_SYSTEM)/host_test_internal.mk
+
+include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk
new file mode 100644
index 0000000..426c400
--- /dev/null
+++ b/core/host_test_internal.mk
@@ -0,0 +1,15 @@
+#####################################################
+## Shared definitions for all host test compilations.
+#####################################################
+
+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_libc++_host libgtest_main_libc++_host
+else
+LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
+LOCAL_SHARED_LIBRARIES +=
+endif
+
+LOCAL_LDLIBS += -lpthread
diff --git a/core/install_jni_libs.mk b/core/install_jni_libs.mk
new file mode 100644
index 0000000..700d106
--- /dev/null
+++ b/core/install_jni_libs.mk
@@ -0,0 +1,121 @@
+# Decides how to install the jni libraries needed by an apk.
+# Input variables:
+# LOCAL_JNI_SHARED_LIBRARIES
+# LOCAL_INSTALLED_MODULE
+# 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;
+# my_extracted_jni_libs, if we extract jni libs from prebuilt apk.
+#
+
+jni_shared_libraries := \
+ $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)/, \
+ $(addsuffix .so, \
+ $(LOCAL_JNI_SHARED_LIBRARIES)))
+
+# Include RS dynamically-generated libraries as well
+# Keep this ifneq, as the += otherwise adds spaces that need to be stripped.
+ifneq ($(rs_compatibility_jni_libs),)
+jni_shared_libraries += $(rs_compatibility_jni_libs)
+endif
+
+my_embed_jni :=
+ifneq ($(TARGET_BUILD_APPS),)
+my_embed_jni := true
+endif
+ifneq ($(filter tests samples, $(LOCAL_MODULE_TAGS)),)
+my_embed_jni := true
+endif
+ifeq ($(filter $(TARGET_OUT)/% $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_OEM)/%, $(my_module_path)),)
+# If this app isn't to be installed to system partitions.
+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 $(my_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.
+ifneq ($(filter $(LOCAL_NDK_STL_VARIANT), stlport_shared c++_shared),)
+ifndef LOCAL_SDK_VERSION
+$(error LOCAL_SDK_VERSION must be defined with LOCAL_NDK_STL_VARIANT, \
+ LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
+endif
+endif
+ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT))
+jni_shared_libraries += \
+ $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_shared.so
+else ifeq (c++_shared,$(LOCAL_NDK_STL_VARIANT))
+jni_shared_libraries += \
+ $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/llvm-libc++/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libc++_shared.so
+endif
+
+# Set the abi directory used by the local JNI shared libraries.
+# (Doesn't change how the local shared libraries are compiled, just
+# sets where they are stored in the apk.)
+ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
+ jni_shared_libraries_abi := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
+else
+ jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
+endif
+
+else # not my_embed_jni
+
+jni_shared_libraries := $(strip $(jni_shared_libraries))
+ifneq ($(jni_shared_libraries),)
+# The jni libaries will be installed to the system.img.
+my_jni_filenames := $(notdir $(jni_shared_libraries))
+# Make sure the JNI libraries get installed
+$(LOCAL_INSTALLED_MODULE) : | $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET$(partition_tag)_OUT_SHARED_LIBRARIES)/, $(my_jni_filenames))
+
+# Create symlink in the app specific lib path
+ifdef LOCAL_POST_INSTALL_CMD
+my_leading_separator := ;
+else
+my_leading_separator :=
+endif
+$(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 # 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/java_library.mk b/core/java_library.mk
index 343b27e..dffc7d9 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -93,15 +93,10 @@
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/llvm_config.mk b/core/llvm_config.mk
deleted file mode 100644
index 33b1d06..0000000
--- a/core/llvm_config.mk
+++ /dev/null
@@ -1,196 +0,0 @@
-CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX)
-CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX)
-LLVM_AS := $(HOST_OUT_EXECUTABLES)/llvm-as$(HOST_EXECUTABLE_SUFFIX)
-LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX)
-
-# Clang flags for all host or target rules
-CLANG_CONFIG_EXTRA_ASFLAGS :=
-CLANG_CONFIG_EXTRA_CPPFLAGS :=
-CLANG_CONFIG_EXTRA_LDFLAGS :=
-
-CLANG_CONFIG_EXTRA_CFLAGS := \
- -D__compiler_offsetof=__builtin_offsetof
-
-CLANG_CONFIG_UNKNOWN_CFLAGS := \
- -funswitch-loops \
- -Wno-psabi \
- -Wno-unused-but-set-variable \
- -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 flags for all target rules
-CLANG_CONFIG_TARGET_EXTRA_ASFLAGS :=
-CLANG_CONFIG_TARGET_EXTRA_CFLAGS := -nostdlibinc
-CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS := -nostdlibinc
-CLANG_CONFIG_TARGET_EXTRA_LDFLAGS :=
-
-# ARM
-llvm_arch := arm
-CLANG_CONFIG_arm_EXTRA_ASFLAGS :=
-CLANG_CONFIG_arm_EXTRA_CFLAGS := \
- -mllvm -arm-enable-ehabi
-CLANG_CONFIG_arm_EXTRA_LDFLAGS :=
-CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \
- -mthumb-interwork \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -fno-builtin-sin \
- -fno-strict-volatile-bitfields \
- -fno-align-jumps \
- -Wa,--noexecstack
-
-CLANG_CONFIG_arm_HOST_TRIPLE :=
-CLANG_CONFIG_arm_TARGET_TRIPLE := arm-linux-androideabi
-
-include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
-
-# MIPS
-llvm_arch := mips
-CLANG_CONFIG_mips_EXTRA_ASFLAGS :=
-CLANG_CONFIG_mips_EXTRA_CFLAGS :=
-CLANG_CONFIG_mips_EXTRA_LDFLAGS :=
-CLANG_CONFIG_mips_UNKNOWN_CFLAGS := \
- -EL \
- -mips32 \
- -mips32r2 \
- -mhard-float \
- -fno-strict-volatile-bitfields \
- -fgcse-after-reload \
- -frerun-cse-after-loop \
- -frename-registers \
- -march=mips32r2 \
- -mtune=mips32r2 \
- -march=mips32 \
- -mtune=mips32 \
- -msynci \
- -mno-fused-madd
-
-CLANG_CONFIG_mips_HOST_TRIPLE :=
-CLANG_CONFIG_mips_TARGET_TRIPLE := mipsel-linux-android
-
-include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
-
-# X86
-llvm_arch := x86
-CLANG_CONFIG_x86_EXTRA_ASFLAGS := \
- -msse3
-CLANG_CONFIG_x86_EXTRA_CFLAGS :=
-CLANG_CONFIG_x86_EXTRA_LDFLAGS :=
-CLANG_CONFIG_x86_UNKNOWN_CFLAGS := \
- -finline-limit=300 \
- -fno-inline-functions-called-once \
- -mfpmath=sse \
- -mbionic
-
-ifeq ($(HOST_OS),linux)
-CLANG_CONFIG_x86_HOST_TRIPLE := i686-linux-gnu
-endif
-ifeq ($(HOST_OS),darwin)
-CLANG_CONFIG_x86_HOST_TRIPLE := i686-apple-darwin
-endif
-ifeq ($(HOST_OS),windows)
-CLANG_CONFIG_x86_HOST_TRIPLE := i686-pc-mingw32
-endif
-
-CLANG_CONFIG_x86_TARGET_TRIPLE := i686-linux-android
-CLANG_CONFIG_x86_TARGET_TOOLCHAIN_PREFIX := \
- $(TARGET_TOOLCHAIN_ROOT)/x86_64-linux-android/bin
-
-include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
-
-# X86_64
-llvm_arch := x86_64
-CLANG_CONFIG_x86_64_EXTRA_ASFLAGS :=
-CLANG_CONFIG_x86_64_EXTRA_CFLAGS :=
-CLANG_CONFIG_x86_64_EXTRA_LDFLAGS :=
-CLANG_CONFIG_x86_64_UNKNOWN_CFLAGS := \
- -finline-limit=300 \
- -fno-inline-functions-called-once \
- -mfpmath=sse \
- -mbionic
-
-ifeq ($(HOST_OS),linux)
-CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-linux-gnu
-endif
-ifeq ($(HOST_OS),darwin)
-CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-apple-darwin
-endif
-ifeq ($(HOST_OS),windows)
-CLANG_CONFIG_x86_64_HOST_TRIPLE := x86_64-pc-mingw64
-endif
-CLANG_CONFIG_x86_64_TARGET_TRIPLE := x86_64-linux-android
-
-include $(BUILD_SYSTEM)/llvm_config_define_clang_flags.mk
-
-# Clang compiler-specific libc headers
-CLANG_CONFIG_EXTRA_HOST_C_INCLUDES := external/clang/lib/include
-CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := external/clang/lib/include $(TARGET_OUT_HEADERS)/clang
-
-# Address sanitizer clang config
-ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address
-ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
-ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload
-ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
-
-# This allows us to use the superset of functionality that compiler-rt
-# provides to Clang (for supporting features like -ftrapv).
-COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
-
-# Macros to convert gcc flags to clang flags
-define subst-clang-incompatible-flags
- $(subst -march=armv5te,-march=armv5t,\
- $(subst -march=armv5e,-march=armv5,\
- $(subst -mcpu=cortex-a15,-march=armv7-a,\
- $(1))))
-endef
-
-define convert-to-host-clang-flags
- $(strip \
- $(call subst-clang-incompatible-flags,\
- $(filter-out $(CLANG_CONFIG_$(HOST_ARCH)_UNKNOWN_CFLAGS),\
- $(1))))
-endef
-
-define convert-to-clang-flags
- $(strip \
- $(call subst-clang-incompatible-flags,\
- $(filter-out $(CLANG_CONFIG_$(TARGET_ARCH)_UNKNOWN_CFLAGS),\
- $(1))))
-endef
-
-# Define clang global flags
-define get-clang-host-global-flags
- $(call convert-to-host-clang-flags,$(HOST_GLOBAL_$(1))) $(CLANG_CONFIG_$(HOST_ARCH)_HOST_EXTRA_$(1))
-endef
-
-define get-clang-global-flags
- $(call convert-to-clang-flags,$(TARGET_GLOBAL_$(1))) $(CLANG_CONFIG_$(TARGET_ARCH)_TARGET_EXTRA_$(1))
-endef
-
-CLANG_HOST_GLOBAL_CFLAGS := $(call get-clang-host-global-flags,CFLAGS)
-CLANG_HOST_GLOBAL_CPPFLAGS := $(call get-clang-host-global-flags,CPPFLAGS)
-CLANG_HOST_GLOBAL_LDFLAGS := $(call get-clang-host-global-flags,LDFLAGS)
-
-CLANG_TARGET_GLOBAL_CFLAGS := $(call get-clang-global-flags,CFLAGS)
-CLANG_TARGET_GLOBAL_CPPFLAGS := $(call get-clang-global-flags,CPPFLAGS)
-CLANG_TARGET_GLOBAL_LDFLAGS := $(call get-clang-global-flags,LDFLAGS)
-
-# Renderscript clang target triple
-ifeq ($(TARGET_ARCH),arm)
- RS_TRIPLE := armv7-none-linux-gnueabi
-endif
-ifeq ($(TARGET_ARCH),mips)
- RS_TRIPLE := mipsel-unknown-linux
-endif
-ifeq ($(TARGET_ARCH),x86)
- RS_TRIPLE := i686-unknown-linux
-endif
-ifeq ($(TARGET_ARCH),x86_64)
- RS_TRIPLE := x86_64-unknown-linux
-endif
diff --git a/core/llvm_config_define_clang_flags.mk b/core/llvm_config_define_clang_flags.mk
deleted file mode 100644
index b7b57e2..0000000
--- a/core/llvm_config_define_clang_flags.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-ifeq ($(strip $(llvm_arch)),)
- $(error "$$(llvm_arch) should be defined.")
-endif
-
-ifeq ($(strip $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE)),)
- $(error "$$(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) should be defined.")
-endif
-
-ifeq ($(strip $(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)),)
-CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX := \
- $(TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE)/bin
-endif
-
-# Include common unknown flags
-CLANG_CONFIG_$(llvm_arch)_UNKNOWN_CFLAGS += \
- $(CLANG_CONFIG_UNKNOWN_CFLAGS)
-
-# Clang extra flags for host
-CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS := \
- $(CLANG_CONFIG_EXTRA_ASFLAGS) \
- $(CLANG_CONFIG_HOST_EXTRA_ASFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_ASFLAGS)
-
-ifneq ($(strip $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)),)
-CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS += \
- -target $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)
-endif
-
-CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_CFLAGS := \
- $(CLANG_CONFIG_EXTRA_CFLAGS) \
- $(CLANG_CONFIG_HOST_EXTRA_CFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_ASFLAGS)
-
-CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_CPPFLAGS := \
- $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
- $(CLANG_CONFIG_HOST_EXTRA_CPPFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CPPFLAGS)
-
-CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_LDFLAGS := \
- $(CLANG_CONFIG_EXTRA_LDFLAGS) \
- $(CLANG_CONFIG_HOST_EXTRA_LDFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_LDFLAGS)
-
-ifneq ($(strip $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)),)
-CLANG_CONFIG_$(llvm_arch)_HOST_EXTRA_LDFLAGS += \
- -target $(CLANG_CONFIG_$(llvm_arch)_HOST_TRIPLE)
-endif
-
-# Clang extra flags for target
-CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_ASFLAGS := \
- $(CLANG_CONFIG_EXTRA_ASFLAGS) \
- $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_ASFLAGS) \
- -target $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) \
- -B$(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)
-
-CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_CFLAGS := \
- $(CLANG_CONFIG_EXTRA_CFLAGS) \
- $(CLANG_CONFIG_TARGET_EXTRA_CFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_ASFLAGS)
-
-CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_CPPFLAGS := \
- $(CLANG_CONFIG_EXTRA_CPPFLAGS) \
- $(CLANG_CONFIG_TARGET_EXTRA_CPPFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_CPPFLAGS)
-
-CLANG_CONFIG_$(llvm_arch)_TARGET_EXTRA_LDFLAGS := \
- $(CLANG_CONFIG_EXTRA_LDFLAGS) \
- $(CLANG_CONFIG_TARGET_EXTRA_LDFLAGS) \
- $(CLANG_CONFIG_$(llvm_arch)_EXTRA_LDFLAGS) \
- -target $(CLANG_CONFIG_$(llvm_arch)_TARGET_TRIPLE) \
- -B$(CLANG_CONFIG_$(llvm_arch)_TARGET_TOOLCHAIN_PREFIX)
-
-llvm_arch :=
diff --git a/core/main.mk b/core/main.mk
index bb81a9a..7b0b3e4 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -92,6 +92,8 @@
# and host information.
include $(BUILD_SYSTEM)/config.mk
+include $(BUILD_SYSTEM)/64_bit_blacklist.mk
+
# This allows us to force a clean build - included after the config.mk
# environment setup is done, but before we generate any dependencies. This
# file does the rm -rf inline so the deps which are all done below will
@@ -101,14 +103,13 @@
# Include the google-specific config
-include vendor/google/build/config.mk
-VERSION_CHECK_SEQUENCE_NUMBER := 3
+VERSION_CHECK_SEQUENCE_NUMBER := 5
-include $(OUT_DIR)/versions_checked.mk
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; \
@@ -121,7 +122,6 @@
$(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.
@@ -138,31 +138,66 @@
$(error Directory names containing spaces not supported)
endif
+java_version_str := $(shell unset _JAVA_OPTIONS && java -version 2>&1)
+javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1)
+
+# Check for the correct version of java, should be 1.7 by
+# default, and 1.6 if LEGACY_USE_JAVA6 is set.
+ifeq ($(LEGACY_USE_JAVA6),)
+required_version := "1.7.x"
+required_javac_version := "1.7"
+java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]')
+javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]')
+else # if LEGACY_USE_JAVA6
+required_version := "1.6.x"
+required_javac_version := "1.6"
+java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.6[\. "$$]')
+javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.6[\. "$$]')
+endif # if LEGACY_USE_JAVA6
+
+ifeq ($(strip $(java_version)),)
+$(info ************************************************************)
+$(info You are attempting to build with the incorrect version)
+$(info of java.)
+$(info $(space))
+$(info Your version is: $(java_version_str).)
+$(info The required version is: $(required_version))
+$(info $(space))
+$(info Please follow the machine setup instructions at)
+$(info $(space)$(space)$(space)$(space)https://source.android.com/source/initializing.html)
+$(info ************************************************************)
+$(error stop)
+endif
+
# Check for the current JDK.
#
# For Java 1.7, we require OpenJDK on linux and Oracle JDK on Mac OS.
# For Java 1.6, we require Oracle for all host OSes.
requires_openjdk := false
-ifneq ($(EXPERIMENTAL_USE_JAVA7),)
+ifeq ($(LEGACY_USE_JAVA6),)
ifeq ($(HOST_OS), linux)
requires_openjdk := true
endif
endif
+
+# Check for the current jdk
ifeq ($(requires_openjdk), true)
-ifeq ($(shell java -version 2>&1 | grep -i openjdk),)
+# The user asked for java7 openjdk, so check that the host
+# java version is really openjdk
+ifeq ($(shell echo '$(java_version_str)' | grep -i openjdk),)
$(info ************************************************************)
$(info You are attempting to build with an unsupported JDK.)
$(info $(space))
$(info This build requires OpenJDK, but you are using:)
-$(info $(shell java -version 2>&1 | head -n 2).)
+$(info $(java_version_str).)
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
$(info ************************************************************)
$(error stop)
endif # java version is not OpenJdk
else # if requires_openjdk
-ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
+ifneq ($(shell echo '$(java_version_str)' | grep -i openjdk),)
$(info ************************************************************)
$(info You are attempting to build with an unsupported JDK.)
$(info $(space))
@@ -174,40 +209,14 @@
endif # java version is not Sun Oracle JDK
endif # if requires_openjdk
-# Check for the correct version of java, should be 1.7 if
-# EXPERIMENTAL_USE_JAVA7 is set, 1.6 otherwise.
-ifneq ($(EXPERIMENTAL_USE_JAVA7),)
-required_version := "1.7.x"
-java_version := $(shell java -version 2>&1 | head -n 1 | grep '^java .*[ "]1\.7[\. "$$]')
-javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.7[\. "$$]')
-else # if EXPERIMENTAL_USE_JAVA7
-required_version := "1.6.x"
-java_version := $(shell java -version 2>&1 | head -n 1 | grep '^java .*[ "]1\.6[\. "$$]')
-javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
-endif # if EXPERIMENTAL_USE_JAVA7
-
-ifeq ($(strip $(java_version)),)
-$(info ************************************************************)
-$(info You are attempting to build with the incorrect version)
-$(info of java.)
-$(info $(space))
-$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
-$(info The required version is: $(required_version))
-$(info $(space))
-$(info Please follow the machine setup instructions at)
-$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
-$(info ************************************************************)
-$(error stop)
-endif
-
# Check for the correct version of javac
ifeq ($(strip $(javac_version)),)
$(info ************************************************************)
$(info You are attempting to build with the incorrect version)
$(info of javac.)
$(info $(space))
-$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
-$(info The required version is: $(required_java_version))
+$(info Your version is: $(javac_version_str).)
+$(info The required version is: $(required_javac_version))
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
@@ -215,23 +224,10 @@
$(error stop)
endif
+
ifndef BUILD_EMULATOR
-ifeq (darwin,$(HOST_OS))
-GCC_REALPATH = $(realpath $(shell which $(HOST_CC)))
-ifneq ($(findstring llvm-gcc,$(GCC_REALPATH)),)
- # Using LLVM GCC results in a non functional emulator due to it
- # not honouring global register variables
- $(warning ****************************************)
- $(warning * gcc is linked to llvm-gcc which will *)
- $(warning * not create a useable emulator. *)
- $(warning ****************************************)
+ # Emulator binaries are now provided under prebuilts/android-emulator/
BUILD_EMULATOR := false
-else
- BUILD_EMULATOR := true
-endif
-else # HOST_OS is not darwin
- BUILD_EMULATOR := true
-endif # HOST_OS is darwin
endif
$(shell echo 'VERSIONS_CHECKED := $(VERSION_CHECK_SEQUENCE_NUMBER)' \
@@ -338,13 +334,15 @@
enable_target_debugging :=
endif
- # Turn on Dalvik preoptimization for user builds, but only if not
+ # Turn on Dalvik preoptimization for libdvm.so 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 ($(user_variant),user)
- ifeq ($(HOST_OS),linux)
- WITH_DEXPREOPT := true
+ ifeq (,$(WITH_DEXPREOPT))
+ ifeq ($(DALVIK_VM_LIB),libdvm.so)
+ ifeq ($(user_variant),user)
+ ifeq ($(HOST_OS),linux)
+ WITH_DEXPREOPT := true
+ endif
endif
endif
endif
@@ -381,6 +379,10 @@
$(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))) \
ro.setupwizard.mode=OPTIONAL
endif
+# Don't even verify the image on eng builds to speed startup
+ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-flags=--compiler-filter=verify-none
+# Don't compile apps on eng builds to speed startup
+ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dex2oat-flags=--compiler-filter=interpret-only
endif
## sdk ##
@@ -448,12 +450,6 @@
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
@@ -571,9 +567,49 @@
# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
# BUG: the system image won't know to depend on modules that are
# brought in as requirements of other modules.
+#
+# Resolve the required module name to 32-bit or 64-bit variant.
+ifeq ($(TARGET_IS_64_BIT),true)
+# Get a list of corresponding 32-bit module names, if one exists.
+define get-32-bit-modules
+$(strip $(foreach m,$(1),\
+ $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\
+ $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX))))
+endef
+# Get a list of corresponding 32-bit module names, if one exists;
+# otherwise return the original module name
+define get-32-bit-modules-if-we-can
+$(strip $(foreach m,$(1),\
+ $(if $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).CLASS),\
+ $(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX),
+ $(m))))
+endef
+
+# If a module is built for 32-bit, the required modules must be 32-bit too;
+# Otherwise if the module is an exectuable or shared library,
+# the required modules must be 64-bit;
+# otherwise we require both 64-bit and 32-bit variant, if one exists.
+$(foreach m,$(ALL_MODULES),\
+ $(eval r := $(ALL_MODULES.$(m).REQUIRED))\
+ $(if $(r),\
+ $(if $(ALL_MODULES.$(m).FOR_2ND_ARCH),\
+ $(eval r_r := $(call get-32-bit-modules-if-we-can,$(r))),\
+ $(if $(filter EXECUTABLES SHARED_LIBRARIES,$(ALL_MODULES.$(m).CLASS)),\
+ $(eval r_r := $(r)),\
+ $(eval r_r := $(r) $(call get-32-bit-modules,$(r)))\
+ )\
+ )\
+ $(eval ALL_MODULES.$(m).REQUIRED := $(r_r))\
+ )\
+)
+r_r :=
+endif
+
+
define add-required-deps
$(1): | $(2)
endef
+
$(foreach m,$(ALL_MODULES), \
$(eval r := $(ALL_MODULES.$(m).REQUIRED)) \
$(if $(r), \
@@ -582,6 +618,8 @@
$(eval h_m := $(filter $(HOST_OUT_ROOT)/%, $(ALL_MODULES.$(m).INSTALLED))) \
$(eval t_r := $(filter $(TARGET_OUT_ROOT)/%, $(r))) \
$(eval h_r := $(filter $(HOST_OUT_ROOT)/%, $(r))) \
+ $(eval t_m := $(filter-out $(t_r), $(t_m))) \
+ $(eval h_m := $(filter-out $(h_r), $(h_m))) \
$(if $(t_m), $(eval $(call add-required-deps, $(t_m),$(t_r)))) \
$(if $(h_m), $(eval $(call add-required-deps, $(h_m),$(h_r)))) \
) \
@@ -611,6 +649,14 @@
$(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 :=
@@ -626,11 +672,26 @@
ifdef FULL_BUILD
# The base list of modules to build for this product is specified
# by the appropriate product definition file, which was included
- # by product_config.make.
+ # by product_config.mk.
product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
# Filter out the overridden packages before doing expansion
product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
$(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
+
+ # Resolve the :32 :64 module name
+ modules_32 := $(patsubst %:32,%,$(filter %:32, $(product_MODULES)))
+ modules_64 := $(patsubst %:64,%,$(filter %:64, $(product_MODULES)))
+ modules_rest := $(filter-out %:32 %:64,$(product_MODULES))
+ ifeq ($(TARGET_IS_64_BIT),true)
+ product_MODULES := $(addsuffix $(TARGET_2ND_ARCH_MODULE_SUFFIX),$(modules_32))
+ product_MODULES += $(modules_64)
+ # For the rest we add both
+ product_MODULES += $(call get-32-bit-modules, $(modules_rest))
+ product_MODULES += $(modules_rest)
+ else
+ product_MODULES := $(modules_32) $(modules_64) $(modules_rest)
+ endif
+
$(call expand-required-modules,product_MODULES,$(product_MODULES))
product_FILES := $(call module-installed-files, $(product_MODULES))
ifeq (0,1)
@@ -700,8 +761,12 @@
$(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES), \
$(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\
$(eval dangling_modules += $(m))))
+ ifneq ($(TARGET_IS_64_BIT),true)
+ # We know those 64-bit modules don't exist in the 32-bit SDK build.
+ dangling_modules := $(filter-out %64,$(dangling_modules))
+ endif
ifneq ($(dangling_modules),)
- $(warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES has nothing to install!)
+ $(warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES have nothing to install!)
endif
$(foreach m, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES_DEBUG), \
$(if $(strip $(ALL_MODULES.$(m).INSTALLED)),,\
@@ -927,7 +992,7 @@
# umbrella targets to assit engineers in verifying builds
.PHONY: java native target host java-host java-target native-host native-target \
java-host-tests java-target-tests native-host-tests native-target-tests \
- java-tests native-tests host-tests target-tests
+ java-tests native-tests host-tests target-tests tests
# some synonyms
.PHONY: host-java target-java host-native target-native \
target-java-tests target-native-tests
@@ -937,10 +1002,12 @@
target-native : native-target
target-java-tests : java-target-tests
target-native-tests : native-target-tests
+tests : host-tests target-tests
.PHONY: lintall
+ifneq (,$(filter samplecode, $(MAKECMDGOALS)))
.PHONY: samplecode
sample_MODULES := $(sort $(call get-tagged-modules,samples))
sample_APKS_DEST_PATH := $(TARGET_COMMON_OUT_ROOT)/samples
@@ -954,6 +1021,7 @@
@echo "Collect sample code apks: $^"
# remove apks that are not intended to be installed.
rm -f $(sample_ADDITIONAL_INSTALLED)
+endif # samplecode in $(MAKECMDGOALS)
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
diff --git a/core/module_arch_supported.mk b/core/module_arch_supported.mk
new file mode 100644
index 0000000..15fd648
--- /dev/null
+++ b/core/module_arch_supported.mk
@@ -0,0 +1,62 @@
+###########################################################
+## Determine if a module can be built for an arch
+##
+## Inputs from module makefile:
+## my_prefix TARGET_ or HOST_
+## my_module_multilib
+## 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:
+## $(my_prefix)IS_64_BIT
+## LOCAL_2ND_ARCH_VAR_PREFIX
+##
+## Outputs:
+## my_module_arch_supported := (true|false)
+###########################################################
+
+my_module_arch_supported := true
+
+ifeq ($(my_module_multilib),none)
+my_module_arch_supported := false
+endif
+
+ifeq ($(LOCAL_2ND_ARCH_VAR_PREFIX),)
+ifeq ($($(my_prefix)IS_64_BIT)|$(my_module_multilib),true|32)
+my_module_arch_supported := false
+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
+endif
+else # LOCAL_2ND_ARCH_VAR_PREFIX
+ifeq ($(my_module_multilib),first)
+my_module_arch_supported := false
+else ifeq ($(my_module_multilib),64)
+my_module_arch_supported := false
+endif
+endif # LOCAL_2ND_ARCH_VAR_PREFIX
+
+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_$(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 $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) not supported)
+endif
+endif
+
+ifneq (,$(filter $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),$(LOCAL_MODULE_UNSUPPORTED_$(my_prefix)ARCH)))
+my_module_arch_supported := false
+endif
+
+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 $($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) unsupported)
+endif
diff --git a/core/multilib.mk b/core/multilib.mk
new file mode 100644
index 0000000..a3ced65
--- /dev/null
+++ b/core/multilib.mk
@@ -0,0 +1,15 @@
+# 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.
+
+my_module_multilib := $(strip $(LOCAL_MULTILIB))
+
+ifndef my_module_multilib
+ifeq ($(LOCAL_32_BIT_ONLY),true)
+my_module_multilib := 32
+endif
+else # my_module_multilib defined
+ifeq (,$(filter 32 64 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/native_test.mk b/core/native_test.mk
index 12cf4af..fc08f79 100644
--- a/core/native_test.mk
+++ b/core/native_test.mk
@@ -3,20 +3,6 @@
## Common flags for native tests are added.
###########################################
-LOCAL_CFLAGS += -DGTEST_OS_LINUX_ANDROID -DGTEST_HAS_STD_STRING
-
-LOCAL_C_INCLUDES += external/gtest/include
-LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
-
-ifndef LOCAL_SDK_VERSION
-LOCAL_C_INCLUDES += bionic \
- bionic/libstdc++/include \
- external/stlport/stlport
-LOCAL_SHARED_LIBRARIES += libstlport
-endif
-
-ifndef LOCAL_MODULE_PATH
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
-endif
+include $(BUILD_SYSTEM)/target_test_internal.mk
include $(BUILD_EXECUTABLE)
diff --git a/core/package.mk b/core/package.mk
index 1cdb2fd..78b65db 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -1,474 +1,76 @@
-#
-# Copyright (C) 2008 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.
-#
+# We don't automatically set up rules to build packages for both
+# TARGET_ARCH and TARGET_2ND_ARCH.
+# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32".
-###########################################################
-## Standard rules for building an application package.
-##
-## Additional inputs from base_rules.make:
-## LOCAL_PACKAGE_NAME: The name of the package; the directory
-## will be called this.
-##
-## MODULE, MODULE_PATH, and MODULE_SUFFIX will
-## be set for you.
-###########################################################
+my_prefix := TARGET_
+include $(BUILD_SYSTEM)/multilib.mk
-ifeq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
+ifeq ($(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS),true|true)
+ # packages default to building for either architecture,
+ # the preferred if its supported, otherwise the non-preferred.
+else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
+ # only 64-bit apps supported
+ ifeq ($(filter $(my_module_multilib),64 both first),$(my_module_multilib))
+ # if my_module_multilib was 64, both, first, or unset, build for 64-bit
+ my_module_multilib := 64
+ else
+ # otherwise don't build this app
+ my_module_multilib := none
+ endif
+else
+ # only 32-bit apps supported
+ ifeq ($(filter $(my_module_multilib),32 both),$(my_module_multilib))
+ # if my_module_multilib was 32, both, or unset, build for 32-bit
+ my_module_multilib := 32
+ else ifeq ($(my_module_multilib),first)
+ ifndef TARGET_IS_64_BIT
+ # if my_module_multilib was first and this is a 32-bit build, build for
+ # 32-bit
+ my_module_multilib := 32
+ else
+ # if my_module_multilib was first and this is a 64-bit build, don't build
+ # this app
+ my_module_multilib := none
+ endif
+ else
+ # my_module_mulitlib was 64 or none, don't build this app
+ my_module_multilib := none
+ endif
+endif
+
+LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
+
+# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first
+ifdef TARGET_2ND_ARCH
+ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
else
LOCAL_2ND_ARCH_VAR_PREFIX :=
endif
-
-# If this makefile is being read from within an inheritance,
-# use the new values.
-skip_definition:=
-ifdef LOCAL_PACKAGE_OVERRIDES
- package_overridden := $(call set-inherited-package-variables)
- ifeq ($(strip $(package_overridden)),)
- skip_definition := true
- endif
endif
-ifndef skip_definition
-
-LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
-ifeq ($(LOCAL_PACKAGE_NAME),)
-$(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
-endif
-
-ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX)
-endif
-LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
-
-ifneq ($(strip $(LOCAL_MODULE)),)
-$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE)
-endif
-LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
-
-ifneq ($(strip $(LOCAL_MODULE_CLASS)),)
-$(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
-endif
-LOCAL_MODULE_CLASS := APPS
-
-# Package LOCAL_MODULE_TAGS default to optional
-LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
-ifeq ($(LOCAL_MODULE_TAGS),)
-LOCAL_MODULE_TAGS := optional
-endif
-
-ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
-# Force localization check if it's not tagged as tests.
-LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
-endif
-
-ifeq (,$(LOCAL_ASSET_DIR))
-LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
-endif
-
-ifeq (,$(LOCAL_RESOURCE_DIR))
- LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-endif
-
-package_resource_overlays := $(strip \
- $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
- $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
- $(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
- $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
-
-LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
-
-all_assets := $(strip \
- $(foreach dir, $(LOCAL_ASSET_DIR), \
- $(addprefix $(dir)/, \
- $(patsubst assets/%,%, \
- $(call find-subdir-assets, $(dir)) \
- ) \
- ) \
- ))
-
-all_resources := $(strip \
- $(foreach dir, $(LOCAL_RESOURCE_DIR), \
- $(addprefix $(dir)/, \
- $(patsubst res/%,%, \
- $(call find-subdir-assets,$(dir)) \
- ) \
- ) \
- ))
-
-all_res_assets := $(strip $(all_assets) $(all_resources))
-
-package_expected_intermediates_COMMON := $(call local-intermediates-dir,COMMON)
-# If no assets or resources were found, clear the directory variables so
-# we don't try to build them.
-ifeq (,$(all_assets))
-LOCAL_ASSET_DIR:=
-endif
-ifeq (,$(all_resources))
-LOCAL_RESOURCE_DIR:=
-R_file_stamp :=
+# check if preferred arch is supported
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# first arch is supported
+include $(BUILD_SYSTEM)/package_internal.mk
+else ifneq (,$(TARGET_2ND_ARCH))
+# check if the non-preferred arch is the primary or secondary
+ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
+LOCAL_2ND_ARCH_VAR_PREFIX :=
else
-# Make sure that R_file_stamp inherits the proper PRIVATE vars.
-# If R.stamp moves, be sure to update the framework makefile,
-# which has intimate knowledge of its location.
-R_file_stamp := $(package_expected_intermediates_COMMON)/src/R.stamp
-LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
endif
-LOCAL_BUILT_MODULE_STEM := package.apk
-
-LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED))
-ifndef LOCAL_PROGUARD_ENABLED
-ifneq ($(DISABLE_PROGUARD),true)
- LOCAL_PROGUARD_ENABLED :=full
+# check if non-preferred arch is supported
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+ifeq ($(my_module_arch_supported),true)
+# secondary arch is supported
+include $(BUILD_SYSTEM)/package_internal.mk
endif
-endif
-ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
- # the package explicitly request to disable proguard.
- LOCAL_PROGUARD_ENABLED :=
-endif
-proguard_options_file :=
-ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
-ifneq ($(all_resources),)
- proguard_options_file := $(package_expected_intermediates_COMMON)/proguard_options
-endif # all_resources
-endif # !custom
-LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
-
-ifeq (true,$(EMMA_INSTRUMENT))
-ifndef LOCAL_EMMA_INSTRUMENT
-# No emma for test apks.
-ifeq (,$(filer tests,$(LOCAL_MODULE_TAGS))$(LOCAL_INSTRUMENTATION_FOR))
-LOCAL_EMMA_INSTRUMENT := true
-endif # No test apk
-endif # LOCAL_EMMA_INSTRUMENT is not set
-else
-LOCAL_EMMA_INSTRUMENT := false
-endif # EMMA_INSTRUMENT is true
-
-ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
-ifeq (true,$(EMMA_INSTRUMENT_STATIC))
-LOCAL_STATIC_JAVA_LIBRARIES += emma
-else
-ifdef LOCAL_SDK_VERSION
-ifdef TARGET_BUILD_APPS
-# In unbundled build merge the emma library into the apk.
-LOCAL_STATIC_JAVA_LIBRARIES += emma
-else
-# If build against the SDK in full build, core.jar is not used,
-# we have to use prebiult emma.jar to make Proguard happy;
-# Otherwise emma classes are included in core.jar.
-LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
-endif # full build
-endif # LOCAL_SDK_VERSION
-endif # EMMA_INSTRUMENT_STATIC
-endif # LOCAL_EMMA_INSTRUMENT
-
-rs_compatibility_jni_libs :=
-
-#################################
-include $(BUILD_SYSTEM)/java.mk
-#################################
-
-LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
-ifeq ($(LOCAL_SDK_RES_VERSION),)
- LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
-endif
-
-include $(BUILD_SYSTEM)/android_manifest.mk
-
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
-ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION)))
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
-else
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
-endif
-
-ifneq ($(all_resources),)
-
-# Since we don't know where the real R.java file is going to end up,
-# we need to use another file to stand in its place. We'll just
-# copy the generated file to src/R.stamp, which means it will
-# have the same contents and timestamp as the actual file.
-#
-# At the same time, this will copy the R.java file to a central
-# 'R' directory to make it easier to add the files to an IDE.
-#
-#TODO: use PRIVATE_SOURCE_INTERMEDIATES_DIR instead of
-# $(intermediates.COMMON)/src
-ifneq ($(package_expected_intermediates_COMMON),$(intermediates.COMMON))
- $(error $(LOCAL_MODULE): internal error: expected intermediates.COMMON "$(package_expected_intermediates_COMMON)" != intermediates.COMMON "$(intermediates.COMMON)")
-endif
-
-$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
- $(intermediates.COMMON)/public_resources.xml
-$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
-$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
- @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
- @rm -f $@
- $(create-resource-java-files)
- $(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
- -name Manifest.java 2> /dev/null`; do \
- dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
- mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
- $(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
- done;
- $(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
- -name R.java 2> /dev/null`; do \
- dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
- mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
- $(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
- || exit 31; \
- $(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \
- done; \
-
-$(proguard_options_file): $(R_file_stamp)
-
-ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
-# Put this module's resources into a PRODUCT-agnositc package that
-# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
-# files.
-resource_export_package := $(intermediates.COMMON)/package-export.apk
-$(R_file_stamp): $(resource_export_package)
-
-# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
-# can't know anything about PRODUCT. Clear it out just for this target.
-$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
-$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
-$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
- @echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
- $(create-empty-package)
- $(add-assets-to-package)
-endif
-
-# Other modules should depend on the BUILT module if
-# they want to use this module's R.java file.
-$(LOCAL_BUILT_MODULE): $(R_file_stamp)
-
-ifneq ($(full_classes_jar),)
-# If full_classes_jar is non-empty, we're building sources.
-# If we're building sources, the initial javac step (which
-# produces full_classes_compiled_jar) needs to ensure the
-# R.java and Manifest.java files have been generated first.
-$(full_classes_compiled_jar): $(R_file_stamp)
-endif
-
-endif # all_resources
-
-ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
-# We need to explicitly clear this var so that we don't
-# inherit the value from whomever caused us to be built.
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES :=
-else
-# Most packages should link against the resources defined by framework-res.
-# Even if they don't have their own resources, they may use framework
-# resources.
-ifneq ($(filter-out current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current,$(LOCAL_SDK_RES_VERSION))),)
-# for released sdk versions, the platform resources were built into android.jar.
-framework_res_package_export := \
- $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar
-framework_res_package_export_deps := $(framework_res_package_export)
-else # LOCAL_SDK_RES_VERSION
-framework_res_package_export := \
- $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
-# We can't depend directly on the export.apk file; it won't get its
-# PRIVATE_ vars set up correctly if we do. Instead, depend on the
-# corresponding R.stamp file, which lists the export.apk as a dependency.
-framework_res_package_export_deps := \
- $(dir $(framework_res_package_export))src/R.stamp
-endif # LOCAL_SDK_RES_VERSION
-$(R_file_stamp): $(framework_res_package_export_deps)
-$(LOCAL_INTERMEDIATE_TARGETS): \
- PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
-endif # LOCAL_NO_STANDARD_LIBRARIES
-
-ifneq ($(full_classes_jar),)
-$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
-$(LOCAL_BUILT_MODULE): $(built_dex)
-endif # full_classes_jar
-
-
-# Get the list of jni libraries to be included in the apk file.
-
-so_suffix := $($(my_prefix)SHLIB_SUFFIX)
-
-jni_shared_libraries := \
- $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
- $(addsuffix $(so_suffix), \
- $(LOCAL_JNI_SHARED_LIBRARIES)))
-
-# Include RS dynamically-generated libraries as well
-# Keep this ifneq, as the += otherwise adds spaces that need to be stripped.
-ifneq ($(rs_compatibility_jni_libs),)
-jni_shared_libraries += $(rs_compatibility_jni_libs)
-endif
-
-# App explicitly requires the prebuilt NDK libstlport_shared.so.
-# libstlport_shared.so should never go to the system image.
-# Instead it should be packaged into the apk.
-ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT))
-ifndef LOCAL_SDK_VERSION
-$(error LOCAL_SDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \
- LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
-endif
-jni_shared_libraries += \
- $(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_shared.so
-endif
-
-# Set the abi directory used by the local JNI shared libraries.
-# (Doesn't change how the local shared libraries are compiled, just
-# sets where they are stored in the apk.)
-
-ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
- jni_shared_libraries_abi := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)
-else
- jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
-endif
-
-# Pick a key to sign the package with. If this package hasn't specified
-# an explicit certificate, use the default.
-# Secure release builds will have their packages signed after the fact,
-# so it's ok for these private keys to be in the clear.
-ifeq ($(LOCAL_CERTIFICATE),)
- LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
-endif
-
-ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
- # The special value "EXTERNAL" means that we will sign it with the
- # default devkey, apply predexopt, but then expect the final .apk
- # (after dexopting) to be signed by an outside tool.
- LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
- PACKAGES.$(LOCAL_PACKAGE_NAME).EXTERNAL_KEY := 1
-endif
-
-# If this is not an absolute certificate, assign it to a generic one.
-ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
- LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
-endif
-private_key := $(LOCAL_CERTIFICATE).pk8
-certificate := $(LOCAL_CERTIFICATE).x509.pem
-
-$(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
-$(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
-$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
-
-PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key)
-PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
-
-$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
- $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
-
-# 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)
-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),)
- # Include all resources for unbundled apps.
- LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
-endif
-ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true)
- $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG :=
- $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
-else
- $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG)
- $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
-endif
-$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
- @echo "target Package: $(PRIVATE_MODULE) ($@)"
- $(create-empty-package)
- $(add-assets-to-package)
-ifneq ($(jni_shared_libraries),)
- $(add-jni-shared-libs-to-package)
-endif
-ifneq ($(full_classes_jar),)
- $(add-dex-to-package)
-endif
- $(add-carried-java-resources)
-ifneq ($(extra_jar_args),)
- $(add-java-resources-to-package)
-endif
- $(sign-package)
-ifdef LOCAL_DEX_PREOPT
- $(call dexpreopt-one-file,$(PRIVATE_DEX_PREOPT_IMAGE),$@,$(PRIVATE_DEX_LOCATION),$(PRIVATE_BUILT_ODEX))
-ifneq (nostripping,$(LOCAL_DEX_PREOPT))
- $(call dexpreopt-remove-classes.dex,$@)
-endif
-endif
- @# Alignment must happen after all other zip operations.
- $(align-package)
-
-# Save information about this package
-PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
-PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
-ifdef package_resource_overlays
-PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_OVERLAYS := $(package_resource_overlays)
-endif
-
-PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
-
-# Dist the files that can be bundled in system.img.
-# They include the jni shared libraries and the apk with jni libraries stripped.
-ifeq ($(LOCAL_DIST_BUNDLED_BINARIES),true)
-ifneq ($(filter $(LOCAL_PACKAGE_NAME),$(TARGET_BUILD_APPS)),)
-ifneq ($(strip $(jni_shared_libraries)),)
-dist_subdir := bundled_$(LOCAL_PACKAGE_NAME)
-$(foreach f, $(jni_shared_libraries), \
- $(call dist-for-goals, apps_only, $(f):$(dist_subdir)/$(notdir $(f))))
-
-apk_jni_stripped := $(intermediates)/jni_stripped/package.apk
-$(apk_jni_stripped): PRIVATE_JNI_SHARED_LIBRARIES := $(notdir $(jni_shared_libraries))
-$(apk_jni_stripped) : $(LOCAL_BUILT_MODULE) | $(ZIPALIGN)
- @rm -rf $(dir $@) && mkdir -p $(dir $@)
- $(hide) cp $< $@
- $(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f))
- $(call align-package)
-
-$(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk)
-
-endif # jni_shared_libraries
-endif # apps_only build
-endif # LOCAL_DIST_BUNDLED_BINARIES
-
-# Lint phony targets
-.PHONY: lint-$(LOCAL_PACKAGE_NAME)
-lint-$(LOCAL_PACKAGE_NAME): PRIVATE_PATH := $(LOCAL_PATH)
-lint-$(LOCAL_PACKAGE_NAME): PRIVATE_LINT_FLAGS := $(LOCAL_LINT_FLAGS)
-lint-$(LOCAL_PACKAGE_NAME) :
- @echo lint $(PRIVATE_PATH)
- $(LINT) $(PRIVATE_LINT_FLAGS) $(PRIVATE_PATH)
-
-lintall : lint-$(LOCAL_PACKAGE_NAME)
-
-endif # skip_definition
-
-# Reset internal variables.
-all_res_assets :=
+endif # TARGET_2ND_ARCH
LOCAL_2ND_ARCH_VAR_PREFIX :=
+LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
+
+my_module_arch_supported :=
diff --git a/core/package_internal.mk b/core/package_internal.mk
new file mode 100644
index 0000000..0f8c655
--- /dev/null
+++ b/core/package_internal.mk
@@ -0,0 +1,429 @@
+#
+# Copyright (C) 2008 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.
+#
+
+###########################################################
+## Standard rules for building an application package.
+##
+## Additional inputs from base_rules.make:
+## LOCAL_PACKAGE_NAME: The name of the package; the directory
+## will be called this.
+##
+## MODULE, MODULE_PATH, and MODULE_SUFFIX will
+## be set for you.
+###########################################################
+
+# If this makefile is being read from within an inheritance,
+# use the new values.
+skip_definition:=
+ifdef LOCAL_PACKAGE_OVERRIDES
+ package_overridden := $(call set-inherited-package-variables)
+ ifeq ($(strip $(package_overridden)),)
+ skip_definition := true
+ endif
+endif
+
+ifndef skip_definition
+
+LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
+ifeq ($(LOCAL_PACKAGE_NAME),)
+$(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
+endif
+
+ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),)
+$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX)
+endif
+LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
+
+ifneq ($(strip $(LOCAL_MODULE)),)
+$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE)
+endif
+LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
+
+ifneq ($(strip $(LOCAL_MODULE_CLASS)),)
+$(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
+endif
+LOCAL_MODULE_CLASS := APPS
+
+# Package LOCAL_MODULE_TAGS default to optional
+LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
+ifeq ($(LOCAL_MODULE_TAGS),)
+LOCAL_MODULE_TAGS := optional
+endif
+
+ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
+# Force localization check if it's not tagged as tests.
+LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
+endif
+
+ifeq (,$(LOCAL_ASSET_DIR))
+LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
+endif
+
+ifeq (,$(LOCAL_RESOURCE_DIR))
+ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
+endif
+
+package_resource_overlays := $(strip \
+ $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
+ $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
+ $(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
+ $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
+
+LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
+
+all_assets := $(strip \
+ $(foreach dir, $(LOCAL_ASSET_DIR), \
+ $(addprefix $(dir)/, \
+ $(patsubst assets/%,%, \
+ $(call find-subdir-assets, $(dir)) \
+ ) \
+ ) \
+ ))
+
+all_resources := $(strip \
+ $(foreach dir, $(LOCAL_RESOURCE_DIR), \
+ $(addprefix $(dir)/, \
+ $(patsubst res/%,%, \
+ $(call find-subdir-assets,$(dir)) \
+ ) \
+ ) \
+ ))
+
+all_res_assets := $(strip $(all_assets) $(all_resources))
+
+package_expected_intermediates_COMMON := $(call local-intermediates-dir,COMMON)
+# If no assets or resources were found, clear the directory variables so
+# we don't try to build them.
+ifeq (,$(all_assets))
+LOCAL_ASSET_DIR:=
+endif
+ifeq (,$(all_resources))
+LOCAL_RESOURCE_DIR:=
+R_file_stamp :=
+else
+# Make sure that R_file_stamp inherits the proper PRIVATE vars.
+# If R.stamp moves, be sure to update the framework makefile,
+# which has intimate knowledge of its location.
+R_file_stamp := $(package_expected_intermediates_COMMON)/src/R.stamp
+LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
+endif
+
+LOCAL_BUILT_MODULE_STEM := package.apk
+
+LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED))
+ifndef LOCAL_PROGUARD_ENABLED
+ifneq ($(DISABLE_PROGUARD),true)
+ LOCAL_PROGUARD_ENABLED :=full
+endif
+endif
+ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
+ # the package explicitly request to disable proguard.
+ LOCAL_PROGUARD_ENABLED :=
+endif
+proguard_options_file :=
+ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
+ifneq ($(all_resources),)
+ proguard_options_file := $(package_expected_intermediates_COMMON)/proguard_options
+endif # all_resources
+endif # !custom
+LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
+
+ifeq (true,$(EMMA_INSTRUMENT))
+ifndef LOCAL_EMMA_INSTRUMENT
+# No emma for test apks.
+ifeq (,$(filer tests,$(LOCAL_MODULE_TAGS))$(LOCAL_INSTRUMENTATION_FOR))
+LOCAL_EMMA_INSTRUMENT := true
+endif # No test apk
+endif # LOCAL_EMMA_INSTRUMENT is not set
+else
+LOCAL_EMMA_INSTRUMENT := false
+endif # EMMA_INSTRUMENT is true
+
+ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
+ifeq (true,$(EMMA_INSTRUMENT_STATIC))
+LOCAL_STATIC_JAVA_LIBRARIES += emma
+else
+ifdef LOCAL_SDK_VERSION
+ifdef TARGET_BUILD_APPS
+# In unbundled build merge the emma library into the apk.
+LOCAL_STATIC_JAVA_LIBRARIES += emma
+else
+# If build against the SDK in full build, core.jar is not used,
+# we have to use prebiult emma.jar to make Proguard happy;
+# Otherwise emma classes are included in core.jar.
+LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
+endif # full build
+endif # LOCAL_SDK_VERSION
+endif # EMMA_INSTRUMENT_STATIC
+endif # LOCAL_EMMA_INSTRUMENT
+
+rs_compatibility_jni_libs :=
+
+#################################
+include $(BUILD_SYSTEM)/java.mk
+#################################
+
+LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
+ifeq ($(LOCAL_SDK_RES_VERSION),)
+ LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
+endif
+
+include $(BUILD_SYSTEM)/android_manifest.mk
+
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
+ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION)))
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
+else
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
+endif
+
+ifneq ($(all_resources),)
+
+# Since we don't know where the real R.java file is going to end up,
+# we need to use another file to stand in its place. We'll just
+# copy the generated file to src/R.stamp, which means it will
+# have the same contents and timestamp as the actual file.
+#
+# At the same time, this will copy the R.java file to a central
+# 'R' directory to make it easier to add the files to an IDE.
+#
+#TODO: use PRIVATE_SOURCE_INTERMEDIATES_DIR instead of
+# $(intermediates.COMMON)/src
+ifneq ($(package_expected_intermediates_COMMON),$(intermediates.COMMON))
+ $(error $(LOCAL_MODULE): internal error: expected intermediates.COMMON "$(package_expected_intermediates_COMMON)" != intermediates.COMMON "$(intermediates.COMMON)")
+endif
+
+$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
+ $(intermediates.COMMON)/public_resources.xml
+$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
+$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
+ @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
+ @rm -f $@
+ $(create-resource-java-files)
+ $(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
+ -name Manifest.java 2> /dev/null`; do \
+ dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
+ mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
+ $(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
+ done;
+ $(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
+ -name R.java 2> /dev/null`; do \
+ dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
+ mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
+ $(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
+ || exit 31; \
+ $(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \
+ done; \
+
+$(proguard_options_file): $(R_file_stamp)
+
+ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
+# Put this module's resources into a PRODUCT-agnositc package that
+# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
+# files.
+resource_export_package := $(intermediates.COMMON)/package-export.apk
+$(R_file_stamp): $(resource_export_package)
+
+# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
+# can't know anything about PRODUCT. Clear it out just for this target.
+$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
+$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
+$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
+ @echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
+ $(create-empty-package)
+ $(add-assets-to-package)
+endif
+
+# Other modules should depend on the BUILT module if
+# they want to use this module's R.java file.
+$(LOCAL_BUILT_MODULE): $(R_file_stamp)
+
+ifneq ($(full_classes_jar),)
+# If full_classes_jar is non-empty, we're building sources.
+# If we're building sources, the initial javac step (which
+# produces full_classes_compiled_jar) needs to ensure the
+# R.java and Manifest.java files have been generated first.
+$(full_classes_compiled_jar): $(R_file_stamp)
+endif
+
+endif # all_resources
+
+ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
+# We need to explicitly clear this var so that we don't
+# inherit the value from whomever caused us to be built.
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES :=
+else
+# Most packages should link against the resources defined by framework-res.
+# Even if they don't have their own resources, they may use framework
+# resources.
+ifneq ($(filter-out current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current,$(LOCAL_SDK_RES_VERSION))),)
+# for released sdk versions, the platform resources were built into android.jar.
+framework_res_package_export := \
+ $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar
+framework_res_package_export_deps := $(framework_res_package_export)
+else # LOCAL_SDK_RES_VERSION
+framework_res_package_export := \
+ $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
+# We can't depend directly on the export.apk file; it won't get its
+# PRIVATE_ vars set up correctly if we do. Instead, depend on the
+# corresponding R.stamp file, which lists the export.apk as a dependency.
+framework_res_package_export_deps := \
+ $(dir $(framework_res_package_export))src/R.stamp
+endif # LOCAL_SDK_RES_VERSION
+$(R_file_stamp): $(framework_res_package_export_deps)
+$(LOCAL_INTERMEDIATE_TARGETS): \
+ PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
+endif # LOCAL_NO_STANDARD_LIBRARIES
+
+ifneq ($(full_classes_jar),)
+$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
+$(LOCAL_BUILT_MODULE): $(built_dex)
+endif # full_classes_jar
+
+include $(BUILD_SYSTEM)/install_jni_libs.mk
+
+# Pick a key to sign the package with. If this package hasn't specified
+# an explicit certificate, use the default.
+# Secure release builds will have their packages signed after the fact,
+# so it's ok for these private keys to be in the clear.
+ifeq ($(LOCAL_CERTIFICATE),)
+ LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
+endif
+
+ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
+ # The special value "EXTERNAL" means that we will sign it with the
+ # default devkey, apply predexopt, but then expect the final .apk
+ # (after dexopting) to be signed by an outside tool.
+ LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
+ PACKAGES.$(LOCAL_PACKAGE_NAME).EXTERNAL_KEY := 1
+endif
+
+# If this is not an absolute certificate, assign it to a generic one.
+ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
+ LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
+endif
+private_key := $(LOCAL_CERTIFICATE).pk8
+certificate := $(LOCAL_CERTIFICATE).x509.pem
+
+$(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
+$(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
+$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
+
+PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key)
+PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
+
+$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
+ $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
+
+# Define the rule to build the actual package.
+$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
+$(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),)
+ # Include all resources for unbundled apps.
+ LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
+endif
+ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true)
+ $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG :=
+ $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
+else
+ $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG)
+ $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
+endif
+$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
+ @echo "target Package: $(PRIVATE_MODULE) ($@)"
+ $(create-empty-package)
+ $(add-assets-to-package)
+ifneq ($(jni_shared_libraries),)
+ $(add-jni-shared-libs-to-package)
+endif
+ifneq ($(full_classes_jar),)
+ $(add-dex-to-package)
+endif
+ $(add-carried-java-resources)
+ifneq ($(extra_jar_args),)
+ $(add-java-resources-to-package)
+endif
+ $(sign-package)
+ifdef LOCAL_DEX_PREOPT
+ifneq (nostripping,$(LOCAL_DEX_PREOPT))
+ $(call dexpreopt-remove-classes.dex,$@)
+endif
+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)
+ $(hide) mkdir -p $(dir $@) && rm -f $@
+ $(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)
+ifdef package_resource_overlays
+PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_OVERLAYS := $(package_resource_overlays)
+endif
+
+PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
+
+# Dist the files that can be bundled in system.img.
+# They include the jni shared libraries and the apk with jni libraries stripped.
+ifeq ($(LOCAL_DIST_BUNDLED_BINARIES),true)
+ifneq ($(filter $(LOCAL_PACKAGE_NAME),$(TARGET_BUILD_APPS)),)
+ifneq ($(strip $(jni_shared_libraries)),)
+dist_subdir := bundled_$(LOCAL_PACKAGE_NAME)
+$(foreach f, $(jni_shared_libraries), \
+ $(call dist-for-goals, apps_only, $(f):$(dist_subdir)/$(notdir $(f))))
+
+apk_jni_stripped := $(intermediates)/jni_stripped/package.apk
+$(apk_jni_stripped): PRIVATE_JNI_SHARED_LIBRARIES := $(notdir $(jni_shared_libraries))
+$(apk_jni_stripped) : $(LOCAL_BUILT_MODULE) | $(ZIPALIGN)
+ @rm -rf $(dir $@) && mkdir -p $(dir $@)
+ $(hide) cp $< $@
+ $(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f))
+ $(call align-package)
+
+$(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk)
+
+endif # jni_shared_libraries
+endif # apps_only build
+endif # LOCAL_DIST_BUNDLED_BINARIES
+
+# Lint phony targets
+.PHONY: lint-$(LOCAL_PACKAGE_NAME)
+lint-$(LOCAL_PACKAGE_NAME): PRIVATE_PATH := $(LOCAL_PATH)
+lint-$(LOCAL_PACKAGE_NAME): PRIVATE_LINT_FLAGS := $(LOCAL_LINT_FLAGS)
+lint-$(LOCAL_PACKAGE_NAME) :
+ @echo lint $(PRIVATE_PATH)
+ $(LINT) $(PRIVATE_LINT_FLAGS) $(PRIVATE_PATH)
+
+lintall : lint-$(LOCAL_PACKAGE_NAME)
+
+endif # skip_definition
+
+# Reset internal variables.
+all_res_assets :=
diff --git a/core/pathmap.mk b/core/pathmap.mk
index efa8c0b..ee79647 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -89,6 +89,7 @@
telephony \
wifi \
keystore \
+ rs \
)
#
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index d5fa4ba..33f5dc6 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -6,221 +6,45 @@
##
###########################################################
-ifneq ($(LOCAL_PREBUILT_LIBS),)
-$(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH))
-endif
-ifneq ($(LOCAL_PREBUILT_EXECUTABLES),)
-$(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH))
-endif
-ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),)
-$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH))
-endif
-
-ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
-# Build for TARGET_ARCH
-LOCAL_2ND_ARCH_VAR_PREFIX :=
-else
-# Build for TARGET_2ND_ARCH
-LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
-endif
-
-
-# Not much sense to check build prebuilts
-LOCAL_DONT_CHECK_MODULE := true
-
-ifdef LOCAL_PREBUILT_MODULE_FILE
-my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE)
-else
-my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
-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.
- OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
-endif
-ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
- prebuilt_module_is_a_library := true
-else
- prebuilt_module_is_a_library :=
-endif
+include $(BUILD_SYSTEM)/multilib.mk
-# Don't install static libraries by default.
-ifndef LOCAL_UNINSTALLABLE_MODULE
-ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS))
- LOCAL_UNINSTALLABLE_MODULE := true
-endif
-endif
+my_skip_non_preferred_arch :=
-ifeq ($(LOCAL_STRIP_MODULE),true)
- ifdef LOCAL_IS_HOST_MODULE
- $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
- endif
- ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
- $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
- endif
- ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
- $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
- endif
- include $(BUILD_SYSTEM)/dynamic_binary.mk
- built_module := $(linked_module)
-else # LOCAL_STRIP_MODULE not true
- include $(BUILD_SYSTEM)/base_rules.mk
- built_module := $(LOCAL_BUILT_MODULE)
+# 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
+ifneq ($(my_module_multilib),both)
+my_skip_non_preferred_arch := true
+endif # $(my_module_multilib)
+endif # $(my_module_arch_supported)
-ifdef prebuilt_module_is_a_library
-export_includes := $(intermediates)/export_includes
-$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
-$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
- @echo Export includes file: $< -- $@
- $(hide) mkdir -p $(dir $@) && rm -f $@
-ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
- $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
- echo "-I $$d" >> $@; \
- done
-else
- $(hide) touch $@
-endif
-
-$(LOCAL_BUILT_MODULE) : | $(intermediates)/export_includes
-endif # prebuilt_module_is_a_library
-
-# 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 LOCAL_SHARED_LIBRARIES
-$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
-
-# We also need the LOCAL_BUILT_MODULE dependency,
-# since we use -rpath-link which points to the built module's path.
-built_shared_libraries := \
- $(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
- $(addsuffix $($(my_prefix)SHLIB_SUFFIX), \
- $(LOCAL_SHARED_LIBRARIES)))
-$(LOCAL_BUILT_MODULE) : $(built_shared_libraries)
-endif
-endif
-
-endif # LOCAL_STRIP_MODULE not true
-
-PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
-
-ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
- # The magic string "EXTERNAL" means this package will be signed with
- # the default dev key throughout the build process, but we expect
- # the final package to be signed with a different key.
- #
- # This can be used for packages where we don't have access to the
- # keys, but want the package to be predexopt'ed.
- LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
- PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
-
- $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
- $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
-endif
-ifeq ($(LOCAL_CERTIFICATE),)
- ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
- # It is now a build error to add a prebuilt .apk without
- # specifying a key for it.
- $(error No LOCAL_CERTIFICATE specified for prebuilt "$(my_prebuilt_src_file)")
- endif
-else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
- # The magic string "PRESIGNED" means this package is already checked
- # signed with its release key.
- #
- # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
- # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
- # but the dexpreopt process will not try to re-sign the app.
- PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
- PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
-else
- # If this is not an absolute certificate, assign it to a generic one.
- ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
- LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
- endif
-
- PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
- PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
- PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
-
- $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
- $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
-endif
-
-ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
-
-# Disable dex-preopt of prebuilts to save space
-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_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
-# Sign and align non-presigned .apks.
-$(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
- $(transform-prebuilt-to-target)
-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))
-endif
- $(align-package)
-
-else # LOCAL_MODULE_CLASS != APPS
-ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
-$(built_module) : $(my_prebuilt_src_file)
- $(transform-prebuilt-to-target-strip-comments)
-else
-$(built_module) : $(my_prebuilt_src_file) | $(ACP)
- $(transform-prebuilt-to-target)
-ifneq ($(prebuilt_module_is_a_library),)
- ifneq ($(LOCAL_IS_HOST_MODULE),)
- $(transform-host-ranlib-copy-hack)
- else
- $(transform-ranlib-copy-hack)
- endif
-endif
-endif
-endif # LOCAL_MODULE_CLASS != APPS
-
-ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
-# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
-# while the deps should be in the common dir, so we make a copy in the common dir.
-# For nonstatic library, $(common_javalib_jar) is the dependency file,
-# while $(common_classes_jar) is used to link.
-common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
-common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
-
-$(common_classes_jar) : $(my_prebuilt_src_file) | $(ACP)
- $(transform-prebuilt-to-target)
-
-$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
- $(transform-prebuilt-to-target)
-
-# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
-$(built_module) : $(common_javalib_jar)
-endif # TARGET JAVA_LIBRARIES
-
-$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES)
-
-my_prebuilt_src_file :=
+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 # $(my_module_arch_supported)
+endif # $($(my_prefix)2ND_ARCH)
+endif # $(my_skip_non_preferred_arch) not true
LOCAL_2ND_ARCH_VAR_PREFIX :=
+
+my_module_arch_supported :=
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
new file mode 100644
index 0000000..7229b3a
--- /dev/null
+++ b/core/prebuilt_internal.mk
@@ -0,0 +1,225 @@
+###########################################################
+## Standard rules for copying files that are prebuilt
+##
+## Additional inputs from base_rules.make:
+## None.
+##
+###########################################################
+
+ifneq ($(LOCAL_PREBUILT_LIBS),)
+$(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH))
+endif
+ifneq ($(LOCAL_PREBUILT_EXECUTABLES),)
+$(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH))
+endif
+ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),)
+$(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH))
+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
+ 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
+
+ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
+ # Put the built targets of all shared libraries in a common directory
+ # to simplify the link line.
+ OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
+endif
+
+ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
+ prebuilt_module_is_a_library := true
+else
+ prebuilt_module_is_a_library :=
+endif
+
+# Don't install static libraries by default.
+ifndef LOCAL_UNINSTALLABLE_MODULE
+ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS))
+ LOCAL_UNINSTALLABLE_MODULE := true
+endif
+endif
+
+ifeq ($(LOCAL_STRIP_MODULE),true)
+ ifdef LOCAL_IS_HOST_MODULE
+ $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
+ endif
+ ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
+ $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
+ endif
+ ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
+ $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
+ endif
+ include $(BUILD_SYSTEM)/dynamic_binary.mk
+ built_module := $(linked_module)
+else # LOCAL_STRIP_MODULE not true
+ include $(BUILD_SYSTEM)/base_rules.mk
+ built_module := $(LOCAL_BUILT_MODULE)
+
+ifdef prebuilt_module_is_a_library
+export_includes := $(intermediates)/export_includes
+$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
+$(export_includes) : $(LOCAL_MODULE_MAKEFILE)
+ @echo Export includes file: $< -- $@
+ $(hide) mkdir -p $(dir $@) && rm -f $@
+ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
+ $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
+ echo "-I $$d" >> $@; \
+ done
+else
+ $(hide) touch $@
+endif
+
+$(LOCAL_BUILT_MODULE) : | $(intermediates)/export_includes
+endif # prebuilt_module_is_a_library
+
+# 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 LOCAL_SHARED_LIBRARIES
+$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
+ $(LOCAL_MODULE):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
+
+# We also need the LOCAL_BUILT_MODULE dependency,
+# since we use -rpath-link which points to the built module's path.
+built_shared_libraries := \
+ $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
+ $(addsuffix $($(my_prefix)SHLIB_SUFFIX), \
+ $(LOCAL_SHARED_LIBRARIES)))
+$(LOCAL_BUILT_MODULE) : $(built_shared_libraries)
+endif
+endif
+
+endif # LOCAL_STRIP_MODULE not true
+
+PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
+
+rs_compatibility_jni_libs :=
+include $(BUILD_SYSTEM)/install_jni_libs.mk
+
+ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
+ # The magic string "EXTERNAL" means this package will be signed with
+ # the default dev key throughout the build process, but we expect
+ # the final package to be signed with a different key.
+ #
+ # This can be used for packages where we don't have access to the
+ # keys, but want the package to be predexopt'ed.
+ LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
+ PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
+
+ $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
+ $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
+endif
+ifeq ($(LOCAL_CERTIFICATE),)
+ ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
+ # It is now a build error to add a prebuilt .apk without
+ # specifying a key for it.
+ $(error No LOCAL_CERTIFICATE specified for prebuilt "$(my_prebuilt_src_file)")
+ endif
+else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
+ # The magic string "PRESIGNED" means this package is already checked
+ # signed with its release key.
+ #
+ # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
+ # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
+ # but the dexpreopt process will not try to re-sign the app.
+ PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
+ PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
+else
+ # If this is not an absolute certificate, assign it to a generic one.
+ ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
+ LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
+ endif
+
+ PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
+ PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
+ PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
+
+ $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
+ $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
+endif
+
+ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
+
+# Disable dex-preopt of prebuilts to save space
+LOCAL_DEX_PREOPT := false
+
+#######################################
+# defines built_odex along with rule to install odex
+include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
+#######################################
+# 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
+ifdef LOCAL_DEX_PREOPT
+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)
+ $(transform-prebuilt-to-target-strip-comments)
+else
+$(built_module) : $(my_prebuilt_src_file) | $(ACP)
+ $(transform-prebuilt-to-target)
+ifneq ($(prebuilt_module_is_a_library),)
+ ifneq ($(LOCAL_IS_HOST_MODULE),)
+ $(transform-host-ranlib-copy-hack)
+ else
+ $(transform-ranlib-copy-hack)
+ endif
+endif
+endif
+endif # LOCAL_MODULE_CLASS != APPS
+
+ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
+# for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
+# while the deps should be in the common dir, so we make a copy in the common dir.
+# For nonstatic library, $(common_javalib_jar) is the dependency file,
+# while $(common_classes_jar) is used to link.
+common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
+common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
+
+$(common_classes_jar) : $(my_prebuilt_src_file) | $(ACP)
+ $(transform-prebuilt-to-target)
+
+$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
+ $(transform-prebuilt-to-target)
+
+# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
+$(built_module) : $(common_javalib_jar)
+endif # TARGET JAVA_LIBRARIES
+
+$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES)
+
+my_prebuilt_src_file :=
diff --git a/core/product.mk b/core/product.mk
index 3b6b27e..174b429 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -253,7 +253,8 @@
_product_stash_var_list += \
- DEFAULT_SYSTEM_DEV_CERTIFICATE
+ DEFAULT_SYSTEM_DEV_CERTIFICATE \
+ WITH_DEXPREOPT
#
# Stash values of the variables in _product_stash_var_list.
diff --git a/core/product_config.mk b/core/product_config.mk
index 7a27426..290dec4 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -164,11 +164,13 @@
# Default to building dalvikvm on hosts that support it...
ifeq ($(HOST_OS),linux)
+ifneq ($(HOST_ARCH),x86_64)
# ... or if the if the option is already set
ifeq ($(WITH_HOST_DALVIK),)
WITH_HOST_DALVIK := true
endif
endif
+endif
# ---------------------------------------------------------------
# Include the product definitions.
@@ -267,7 +269,7 @@
PRODUCT_RUNTIMES := $(product_runtimes)
product_runtimes :=
-PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PROPERTY_OVERRIDES += persist.sys.dalvik.vm.lib=$(DALVIK_VM_LIB)
+PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PROPERTY_OVERRIDES += persist.sys.dalvik.vm.lib.2=$(DALVIK_VM_LIB)
ifeq ($(words $(PRODUCT_RUNTIMES)),1)
# If we only have one runtime, we can strip classes.dex by default during dex_preopt
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 9a75a7b..71a3bb2 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,15 +18,22 @@
$(warning $(LOCAL_MODULE): LOCAL_UNSTRIPPED_PATH for shared libraries is unsupported in multiarch builds)
endif
endif
+endif # my_module_multilib == both
-ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
-# Build for TARGET_ARCH
+
LOCAL_2ND_ARCH_VAR_PREFIX :=
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+
+ifeq ($(my_module_arch_supported),true)
include $(BUILD_SYSTEM)/shared_library_internal.mk
endif
ifdef TARGET_2ND_ARCH
-ifneq ($(LOCAL_NO_2ND_ARCH),true)
+
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+
+ifeq ($(my_module_arch_supported),true)
# Build for TARGET_2ND_ARCH
OVERRIDE_BUILT_MODULE_PATH :=
LOCAL_BUILT_MODULE :=
@@ -27,9 +43,17 @@
LOCAL_INSTALLED_MODULE_STEM :=
LOCAL_INTERMEDIATE_TARGETS :=
-LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/shared_library_internal.mk
+
+endif
+
LOCAL_2ND_ARCH_VAR_PREFIX :=
-endif # LOCAL_NO_2ND_ARCH
endif # TARGET_2ND_ARCH
+
+my_module_arch_supported :=
+
+###########################################################
+## Copy headers to the install tree
+###########################################################
+include $(BUILD_COPY_HEADERS)
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 1ded4a1..abef11f 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
@@ -25,7 +25,7 @@
skip_build_from_source :=
ifdef LOCAL_PREBUILT_MODULE_FILE
ifeq (,$(call if-build-from-source,$(LOCAL_MODULE),$(LOCAL_PATH)))
-include $(BUILD_PREBUILT)
+include $(BUILD_SYSTEM)/prebuilt_internal.mk
skip_build_from_source := true
endif
endif
@@ -40,13 +40,9 @@
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
-ifeq ($(LOCAL_CLANG),true)
-my_target_global_ldflags := $(CLANG_TARGET_GLOBAL_LDFLAGS)
-else
-my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
-endif
my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
+my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O)
my_target_crtend_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTEND_SO_O)
ifdef LOCAL_SDK_VERSION
@@ -54,16 +50,17 @@
# so we don't have race condition when the system libraries (such as libc, libstdc++) are also built in the tree.
my_target_global_ld_dirs := \
$(addprefix -L, $(patsubst %/,%,$(dir $(my_ndk_stl_shared_lib_fullpath))) \
- $(my_ndk_version_root)/usr/lib) \
+ $(my_ndk_sysroot_lib)) \
$(my_target_global_ld_dirs)
my_target_global_ldflags := $(my_ndk_stl_shared_lib) $(my_target_global_ldflags)
-my_target_crtbegin_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtbegin_so.o)
-my_target_crtend_so_o := $(wildcard $(my_ndk_version_root)/usr/lib/crtend_so.o)
+my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o)
+my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o)
endif
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
+$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
$(linked_module): PRIVATE_TARGET_CRTEND_SO_O := $(my_target_crtend_so_o)
diff --git a/core/shared_test_lib.mk b/core/shared_test_lib.mk
new file mode 100644
index 0000000..fbfdc9c
--- /dev/null
+++ b/core/shared_test_lib.mk
@@ -0,0 +1,8 @@
+#############################################
+## A thin wrapper around BUILD_SHARED_LIBRARY
+## Common flags for native tests are added.
+#############################################
+
+include $(BUILD_SYSTEM)/target_test_internal.mk
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/core/static_library.mk b/core/static_library.mk
index 747db81..854cbfc 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -1,11 +1,24 @@
-ifneq ($(TARGET_IS_64_BIT)|$(LOCAL_32BIT_ONLY),true|true)
-# Build for TARGET_ARCH
+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
+
+ifeq ($(my_module_arch_supported),true)
include $(BUILD_SYSTEM)/static_library_internal.mk
endif
ifdef TARGET_2ND_ARCH
-ifneq ($(LOCAL_NO_2ND_ARCH),true)
+
+LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
+include $(BUILD_SYSTEM)/module_arch_supported.mk
+
+ifeq ($(my_module_arch_supported),true)
# Build for TARGET_2ND_ARCH
OVERRIDE_BUILT_MODULE_PATH :=
LOCAL_BUILT_MODULE :=
@@ -15,9 +28,17 @@
LOCAL_INSTALLED_MODULE_STEM :=
LOCAL_INTERMEDIATE_TARGETS :=
-LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/static_library_internal.mk
+
+endif
+
LOCAL_2ND_ARCH_VAR_PREFIX :=
-endif # LOCAL_NO_2ND_ARCH
endif # TARGET_2ND_ARCH
+
+my_module_arch_supported :=
+
+###########################################################
+## Copy headers to the install tree
+###########################################################
+include $(BUILD_COPY_HEADERS)
diff --git a/core/static_library_internal.mk b/core/static_library_internal.mk
index 2d3468c..cabe823 100644
--- a/core/static_library_internal.mk
+++ b/core/static_library_internal.mk
@@ -28,7 +28,6 @@
$(all_objects) : PRIVATE_TARGET_GLOBAL_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/core/static_test_lib.mk b/core/static_test_lib.mk
new file mode 100644
index 0000000..9d0bcc8
--- /dev/null
+++ b/core/static_test_lib.mk
@@ -0,0 +1,8 @@
+#############################################
+## A thin wrapper around BUILD_STATIC_LIBRARY
+## Common flags for native tests are added.
+#############################################
+
+include $(BUILD_SYSTEM)/target_test_internal.mk
+
+include $(BUILD_STATIC_LIBRARY)
diff --git a/core/target_test_internal.mk b/core/target_test_internal.mk
new file mode 100644
index 0000000..49ea518
--- /dev/null
+++ b/core/target_test_internal.mk
@@ -0,0 +1,24 @@
+#######################################################
+## Shared definitions for all target test compilations.
+#######################################################
+
+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_libc++ libgtest_main_libc++
+else
+LOCAL_STATIC_LIBRARIES += libgtest libgtest_main
+
+ifndef LOCAL_SDK_VERSION
+LOCAL_C_INCLUDES += bionic \
+ bionic/libstdc++/include \
+ external/stlport/stlport
+LOCAL_SHARED_LIBRARIES += libstlport
+LOCAL_STATIC_LIBRARIES += libstdc++
+endif
+endif
+
+ifndef LOCAL_MODULE_PATH
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE)
+endif
diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk
index ed8c125..f991a9e 100644
--- a/core/tasks/cts.mk
+++ b/core/tasks/cts.mk
@@ -28,6 +28,8 @@
VMTESTSTF_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,vm-tests-tf,HOST)
VMTESTSTF_JAR := $(VMTESTSTF_INTERMEDIATES)/android.core.vm-tests-tf.jar
+# The list of test packages that core-tests (libcore/Android.mk)
+# is split into.
CTS_CORE_CASE_LIST := \
android.core.tests.libcore.package.dalvik \
android.core.tests.libcore.package.com \
@@ -36,8 +38,26 @@
android.core.tests.libcore.package.tests \
android.core.tests.libcore.package.org \
android.core.tests.libcore.package.libcore \
+ android.core.tests.libcore.package.jsr166 \
+ android.core.tests.libcore.package.harmony_annotation \
+ android.core.tests.libcore.package.harmony_java_io \
+ android.core.tests.libcore.package.harmony_java_lang \
+ android.core.tests.libcore.package.harmony_java_math \
+ android.core.tests.libcore.package.harmony_java_net \
+ android.core.tests.libcore.package.harmony_java_nio \
+ android.core.tests.libcore.package.harmony_java_text \
+ android.core.tests.libcore.package.harmony_java_util \
+ android.core.tests.libcore.package.harmony_javax_security \
android.core.tests.runner
+# The list of test packages that apache-harmony-tests (external/apache-harmony/Android.mk)
+# is split into.
+CTS_CORE_CASE_LIST += \
+ android.core.tests.libcore.package.harmony_beans \
+ android.core.tests.libcore.package.harmony_logging \
+ android.core.tests.libcore.package.harmony_prefs \
+ android.core.tests.libcore.package.harmony_sql
+
# Depend on the full package paths rather than the phony targets to avoid
# rebuilding the packages every time.
CTS_CORE_CASES := $(foreach pkg,$(CTS_CORE_CASE_LIST),$(call intermediates-dir-for,APPS,$(pkg))/package.apk)
@@ -85,12 +105,14 @@
BOUNCYCASTLE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,bouncycastle,,COMMON)
APACHEXML_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,apache-xml,,COMMON)
OKHTTP_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,okhttp,,COMMON)
+APACHEHARMONY_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,apache-harmony-tests,,COMMON)
SQLITEJDBC_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,sqlite-jdbc,,COMMON)
JUNIT_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-junit,,COMMON)
CORETESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core-tests,,COMMON)
+JSR166TESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,jsr166-tests,,COMMON)
CONSCRYPTTESTS_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,conscrypt-tests,,COMMON)
-GEN_CLASSPATH := $(CORE_INTERMEDIATES)/classes.jar:$(CONSCRYPT_INTERMEDIATES)/classes.jar:$(BOUNCYCASTLE_INTERMEDIATES)/classes.jar:$(APACHEXML_INTERMEDIATES)/classes.jar:$(OKHTTP_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(SQLITEJDBC_INTERMEDIATES)/javalib.jar:$(CORETESTS_INTERMEDIATES)/javalib.jar:$(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar
+GEN_CLASSPATH := $(CORE_INTERMEDIATES)/classes.jar:$(CONSCRYPT_INTERMEDIATES)/classes.jar:$(BOUNCYCASTLE_INTERMEDIATES)/classes.jar:$(APACHEXML_INTERMEDIATES)/classes.jar:$(APACHEHARMONY_INTERMEDIATES)/classes.jar:$(OKHTTP_INTERMEDIATES)/classes.jar:$(JUNIT_INTERMEDIATES)/classes.jar:$(SQLITEJDBC_INTERMEDIATES)/javalib.jar:$(CORETESTS_INTERMEDIATES)/javalib.jar:$(JSR166TESTS_INTERMEDIATES)/javalib.jar:$(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar
CTS_CORE_XMLS := \
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.dalvik.xml \
@@ -99,7 +121,21 @@
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.sun.xml \
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.tests.xml \
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.org.xml \
- $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.libcore.xml
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.libcore.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.jsr166.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_annotation.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_io.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_lang.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_math.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_net.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_nio.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_text.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_util.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_javax_security.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_beans.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_logging.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_prefs.xml \
+ $(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_sql.xml \
$(CTS_CORE_XMLS): PRIVATE_CLASSPATH:=$(GEN_CLASSPATH)
# Why does this depend on javalib.jar instead of classes.jar? Because
@@ -107,7 +143,7 @@
# build system requires that dependencies use javalib.jar. If
# javalib.jar is up-to-date, then classes.jar is as well. Depending
# on classes.jar will build the files incorrectly.
-CTS_CORE_XMLS_DEPS := $(CTS_CORE_CASES) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(HOST_OUT_JAVA_LIBRARIES)/junit.jar $(CORE_INTERMEDIATES)/javalib.jar $(BOUNCYCASTLE_INTERMEDIATES)/javalib.jar $(APACHEXML_INTERMEDIATES)/javalib.jar $(OKHTTP_INTERMEDIATES)/javalib.jar $(SQLITEJDBC_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(CORETESTS_INTERMEDIATES)/javalib.jar $(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar | $(ACP)
+CTS_CORE_XMLS_DEPS := $(CTS_CORE_CASES) $(HOST_OUT_JAVA_LIBRARIES)/descGen.jar $(HOST_OUT_JAVA_LIBRARIES)/junit.jar $(CORE_INTERMEDIATES)/javalib.jar $(BOUNCYCASTLE_INTERMEDIATES)/javalib.jar $(APACHEXML_INTERMEDIATES)/javalib.jar $(APACHEHARMONY_INTERMEDIATES)/javalib.jar $(OKHTTP_INTERMEDIATES)/javalib.jar $(SQLITEJDBC_INTERMEDIATES)/javalib.jar $(JUNIT_INTERMEDIATES)/javalib.jar $(CORETESTS_INTERMEDIATES)/javalib.jar $(JSR166TESTS_INTERMEDIATES)/javalib.jar $(CONSCRYPTTESTS_INTERMEDIATES)/javalib.jar build/core/tasks/cts.mk | $(ACP)
$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.dalvik.xml: $(CTS_CORE_XMLS_DEPS)
$(hide) mkdir -p $(CTS_TESTCASES_OUT)
@@ -158,6 +194,105 @@
$(CORETESTS_INTERMEDIATES)/javalib.jar,libcore,\
libcore/expectations)
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.jsr166.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.jsr166,\
+ cts/tests/core/libcore/jsr166/AndroidManifest.xml,\
+ $(JSR166TESTS_INTERMEDIATES)/javalib.jar,jsr166,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_annotation.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_annotation,\
+ cts/tests/core/libcore/harmony_annotation/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.annotation.tests,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_io.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_io,\
+ cts/tests/core/libcore/harmony_java_io/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.java.io,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_lang.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_lang,\
+ cts/tests/core/libcore/harmony_java_lang/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.java.lang,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_math.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_math,\
+ cts/tests/core/libcore/harmony_java_math/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.java.math,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_net.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_net,\
+ cts/tests/core/libcore/harmony_java_net/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.java.net,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_nio.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_nio,\
+ cts/tests/core/libcore/harmony_java_nio/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.java.nio,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_text.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_text,\
+ cts/tests/core/libcore/harmony_java_text/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.java.text,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_util.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_java_util,\
+ cts/tests/core/libcore/harmony_java_util/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.java.util,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_javax_security.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_javax_security,\
+ cts/tests/core/libcore/harmony_javax_security/AndroidManifest.xml,\
+ $(CORETESTS_INTERMEDIATES)/javalib.jar,org.apache.harmony.tests.javax.security,\
+ libcore/expectations)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_beans.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_beans,\
+ cts/tests/core/libcore/harmony_beans/AndroidManifest.xml,\
+ $(APACHEHARMONY_INTERMEDIATES)/javalib.jar,com.android.org.apache.harmony.beans,\
+ libcore/expectations external/apache-harmony/Android.mk)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_logging.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_logging,\
+ cts/tests/core/libcore/harmony_logging/AndroidManifest.xml,\
+ $(APACHEHARMONY_INTERMEDIATES)/javalib.jar,com.android.org.apache.harmony.logging,\
+ libcore/expectations external/apache-harmony/Android.mk)
+
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_prefs.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_prefs,\
+ cts/tests/core/libcore/harmony_prefs/AndroidManifest.xml,\
+ $(APACHEHARMONY_INTERMEDIATES)/javalib.jar,com.android.org.apache.harmony.prefs,\
+ libcore/expectations external/apache-harmony/Android.mk)
+
+$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_sql.xml: $(CTS_CORE_XMLS_DEPS)
+ $(hide) mkdir -p $(CTS_TESTCASES_OUT)
+ $(call generate-core-test-description,$(CTS_TESTCASES_OUT)/android.core.tests.libcore.package.harmony_sql,\
+ cts/tests/core/libcore/harmony_sql/AndroidManifest.xml,\
+ $(APACHEHARMONY_INTERMEDIATES)/javalib.jar,com.android.org.apache.harmony.sql,\
+ libcore/expectations external/apache-harmony/Android.mk)
+
# ----- Generate the test descriptions for the vm-tests-tf -----
#
CORE_VM_TEST_TF_DESC := $(CTS_TESTCASES_OUT)/android.core.vm-tests-tf.xml
diff --git a/core/tasks/tools/package-modules.mk b/core/tasks/tools/package-modules.mk
new file mode 100644
index 0000000..19e756a
--- /dev/null
+++ b/core/tasks/tools/package-modules.mk
@@ -0,0 +1,52 @@
+# Package up modules to a zip file.
+# It preserves the install path of the modules' installed files.
+#
+# Input variables:
+# my_modules: a list of module names
+# my_package_name: the name of the output zip file.
+# Output variables:
+# my_package_zip: the path to the output zip file.
+#
+#
+
+my_staging_dir := $(call intermediates-dir-for,PACKAGING,$(my_package_name))
+my_built_modules :=
+my_copy_pairs :=
+my_pickup_files :=
+
+# Search for modules' built files and installed files;
+# Calculate the dest files in the output zip file.
+# If for 1 module name we found multiple installed files,
+# we use suffix matching to find the corresponding built file.
+$(foreach m,$(my_modules),\
+ $(if $(ALL_MODULES.$(m).INSTALLED),,\
+ $(warning Unknown installed file for module '$(m)'))\
+ $(eval my_pickup_files += $(ALL_MODULES.$(m).PICKUP_FILES))\
+ $(foreach i,$(filter $(TARGET_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),\
+ $(eval my_suffix := $(suffix $(i))) \
+ $(if $(my_suffix),\
+ $(eval my_patt := $(TARGET_OUT_ROOT)/%$(my_suffix)),\
+ $(eval my_patt := $(TARGET_OUT_ROOT)/%$(notdir $(i))))\
+ $(eval b := $(filter $(my_patt),$(ALL_MODULES.$(m).BUILT)))\
+ $(if $(filter 1,$(words $(b))),\
+ $(eval my_built_modules += $(b))\
+ $(eval my_copy_dest := $(patsubst data/%,DATA/%,\
+ $(patsubst system/%,SYSTEM/%,\
+ $(patsubst $(PRODUCT_OUT)/%,%,$(i)))))\
+ $(eval my_copy_pairs += $(b):$(my_staging_dir)/$(my_copy_dest)),\
+ $(warning Unexpected module built file '$(b)' for module '$(m)'))\
+ ))
+
+my_package_zip := $(my_staging_dir)/$(my_package_name).zip
+$(my_package_zip): PRIVATE_COPY_PAIRS := $(my_copy_pairs)
+$(my_package_zip): PRIVATE_PICKUP_FILES := $(my_pickup_files)
+$(my_package_zip) : $(my_built_modules)
+ @echo "Package $@"
+ @rm -rf $(dir $@) && mkdir -p $(dir $@)
+ $(hide) $(foreach p, $(PRIVATE_COPY_PAIRS), \
+ $(eval pair := $(subst :,$(space),$(p)))\
+ mkdir -p $(dir $(word 2,$(pair))); \
+ cp -rf $(word 1,$(pair)) $(word 2,$(pair));)
+ $(hide) $(foreach f, $(PRIVATE_PICKUP_FILES), \
+ cp -rf $(f) $(dir $@);)
+ $(hide) cd $(dir $@) && zip -rq $(notdir $@) *
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index 80b05b3..99d3d9e 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -25,6 +25,7 @@
htc \
imgtec \
invensense \
+ intel \
lge \
nvidia \
nxp \
@@ -72,11 +73,12 @@
$(foreach m, $(_vendor_check_modules), \
$(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\
- $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\
- $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \
- "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)"))\
- $(if $(ALL_MODULES.$(m).INSTALLED),\
- $(eval _vendor_module_owner_info += $(patsubst $(PRODUCT_OUT)/%,%,$(ALL_MODULES.$(m).INSTALLED)):$(ALL_MODULES.$(m).OWNER)))))
+ $(if $(filter-out FAKE, $(ALL_MODULES.$(m).CLASS)),\
+ $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\
+ $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \
+ "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)"))\
+ $(if $(ALL_MODULES.$(m).INSTALLED),\
+ $(eval _vendor_module_owner_info += $(patsubst $(PRODUCT_OUT)/%,%,$(ALL_MODULES.$(m).INSTALLED)):$(ALL_MODULES.$(m).OWNER))))))
endif
diff --git a/envsetup.sh b/envsetup.sh
index 0223999..b91d518 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -7,6 +7,7 @@
- m: Makes from the top of the tree.
- mm: Builds all of the modules in the current directory, but not their dependencies.
- mmm: Builds all of the modules in the supplied directories, but not their dependencies.
+ To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma: Builds all of the modules in the current directory, and their dependencies.
- mmma: Builds all of the modules in the supplied directories, and their dependencies.
- cgrep: Greps on all local C/C++ files.
@@ -115,16 +116,17 @@
fi
# and in with the new
- CODE_REVIEWS=
prebuiltdir=$(getprebuilt)
gccprebuiltdir=$(get_abs_build_var ANDROID_GCC_PREBUILTS)
# 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.
- export ANDROID_EABI_TOOLCHAIN=
+ export ANDROID_TOOLCHAIN=
+ export ANDROID_TOOLCHAIN_2ND_ARCH=
local ARCH=$(get_build_var TARGET_ARCH)
case $ARCH in
x86) toolchaindir=x86/x86_64-linux-android-$targetgccversion/bin
@@ -133,39 +135,63 @@
;;
arm) toolchaindir=arm/arm-linux-androideabi-$targetgccversion/bin
;;
- arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin
+ arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin;
+ toolchaindir2=arm/arm-linux-androideabi-$targetgccversion2/bin
;;
mips) toolchaindir=mips/mipsel-linux-android-$targetgccversion/bin
;;
+ mips64) toolchaindir=mips/mips64el-linux-android-$targetgccversion/bin
+ ;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;
esac
if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
- export ANDROID_EABI_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
+ export ANDROID_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
fi
- unset ARM_EABI_TOOLCHAIN ARM_EABI_TOOLCHAIN_PATH
+ if [ -d "$gccprebuiltdir/$toolchaindir2" ]; then
+ export ANDROID_TOOLCHAIN_2ND_ARCH=$gccprebuiltdir/$toolchaindir2
+ fi
+
+ unset ANDROID_KERNEL_TOOLCHAIN_PATH
case $ARCH in
arm)
+ # Legacy toolchain configuration used for ARM kernel compilation
toolchaindir=arm/arm-eabi-$targetgccversion/bin
if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
export ARM_EABI_TOOLCHAIN="$gccprebuiltdir/$toolchaindir"
- ARM_EABI_TOOLCHAIN_PATH=":$gccprebuiltdir/$toolchaindir"
+ ANDROID_KERNEL_TOOLCHAIN_PATH="$ARM_EABI_TOOLCHAIN":
fi
;;
- mips) toolchaindir=mips/mips-eabi-4.4.3/bin
- ;;
*)
# No need to set ARM_EABI_TOOLCHAIN for other ARCHs
;;
esac
- export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
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$ARM_EABI_TOOLCHAIN_PATH$CODE_REVIEWS:$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/<system>/ exists, prepend it to our PATH
+ # to ensure that the corresponding 'emulator' binaries are used.
+ case $(uname -s) in
+ Darwin)
+ ANDROID_EMULATOR_PREBUILTS=$T/prebuilts/android-emulator/darwin-x86_64
+ ;;
+ Linux)
+ ANDROID_EMULATOR_PREBUILTS=$T/prebuilts/android-emulator/linux-x86_64
+ ;;
+ *)
+ ANDROID_EMULATOR_PREBUILTS=
+ ;;
+ esac
+ if [ -n "$ANDROID_EMULATOR_PREBUILTS" -a -d "$ANDROID_EMULATOR_PREBUILTS" ]; then
+ ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS$ANDROID_EMULATOR_PREBUILTS:
+ export ANDROID_EMULATOR_PREBUILTS
+ fi
+
export PATH=$ANDROID_BUILD_PATHS$PATH
unset ANDROID_JAVA_TOOLCHAIN
@@ -183,10 +209,6 @@
unset ANDROID_HOST_OUT
export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT)
- # needed for processing samples collected by perf counters
- unset OPROFILE_EVENTS_DIR
- export OPROFILE_EVENTS_DIR=$T/external/oprofile/events
-
# needed for building linux on MacOS
# TODO: fix the path
#export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include
@@ -434,10 +456,11 @@
# add the default one here
add_lunch_combo aosp_arm-eng
-add_lunch_combo aosp_x86-eng
-add_lunch_combo aosp_mips-eng
-add_lunch_combo aosp_x86_64-eng
add_lunch_combo aosp_arm64-eng
+add_lunch_combo aosp_mips-eng
+add_lunch_combo aosp_mips64-eng
+add_lunch_combo aosp_x86-eng
+add_lunch_combo aosp_x86_64-eng
add_lunch_combo vbox_x86-eng
function print_lunch_menu()
@@ -600,7 +623,7 @@
T=
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
\cd ..
- T=`PWD= /bin/pwd`
+ T=`PWD= /bin/pwd -P`
done
\cd $HERE
if [ -f "$T/$TOPFILE" ]; then
@@ -617,8 +640,8 @@
test "$WITH_STATIC_ANALYZER" = "0" && unset WITH_STATIC_ANALYZER
if [ -n "$WITH_STATIC_ANALYZER" ]; then
echo "\
-$T/prebuilts/clang/linux-x86/host/3.3/tools/scan-build/scan-build \
---use-analyzer $T/prebuilts/clang/linux-x86/host/3.3/bin/analyzer \
+$T/prebuilts/misc/linux-x86/analyzer/tools/scan-build/scan-build \
+--use-analyzer $T/prebuilts/misc/linux-x86/analyzer/bin/analyzer \
--status-bugs \
--top=$T"
fi
@@ -917,22 +940,56 @@
function gdbwrapper()
{
- $ANDROID_TOOLCHAIN/$GDB -x "$@"
+ local GDB_CMD="$1"
+ shift 1
+ $GDB_CMD -x "$@"
}
+# process the symbolic link of /proc/$PID/exe and use the host file tool to
+# determine whether it is a 32-bit or 64-bit executable. It returns "" or "64"
+# which can be conveniently used as suffix.
+function is64bit()
+{
+ local PID="$1"
+ if [ "$PID" ] ; then
+ local EXE=`adb shell ls -l /proc/$PID/exe \
+ | tr -d '\r' \
+ | cut -d'>' -f2 \
+ | tr -d ' ' \
+ | cut -d'/' -f4`
+
+ local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED)
+ local IS64BIT=`file $OUT_EXE_SYMBOLS/$EXE | grep "64-bit"`
+ if [ "$IS64BIT" != "" ]; then
+ echo "64"
+ else
+ echo ""
+ fi
+ else
+ echo ""
+ fi
+}
+
+# gdbclient now determines whether the user wants to debug a 32-bit or 64-bit
+# executable, set up the approriate gdbserver, then invokes the proper host
+# gdb.
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)
local GDB
case "$ARCH" in
- x86) GDB=x86_64-linux-android-gdb;;
arm) GDB=arm-linux-androideabi-gdb;;
+ arm64) GDB=arm-linux-androideabi-gdb; GDB64=aarch64-linux-android-gdb;;
mips) GDB=mipsel-linux-android-gdb;;
+ mips64) GDB=mipsel-linux-android-gdb;;
+ x86) GDB=x86_64-linux-android-gdb;;
+ x86_64) GDB=x86_64-linux-android-gdb;;
*) echo "Unknown arch $ARCH"; return 1;;
esac
@@ -971,7 +1028,8 @@
fi
fi
adb forward "tcp$PORT" "tcp$PORT"
- adb shell gdbserver $PORT --attach $PID &
+ local USE64BIT="$(is64bit $PID)"
+ adb shell gdbserver$USE64BIT $PORT --attach $PID &
sleep 2
else
echo ""
@@ -982,13 +1040,26 @@
echo ""
fi
+ 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" ""
- gdbwrapper "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
+ local WHICH_GDB=
+ # 64-bit exe found
+ if [ "$USE64BIT" != "" ] ; then
+ WHICH_GDB=$ANDROID_TOOLCHAIN/$GDB64
+ # 32-bit exe / 32-bit platform
+ elif [ "$(get_build_var TARGET_2ND_ARCH)" = "" ]; then
+ WHICH_GDB=$ANDROID_TOOLCHAIN/$GDB
+ # 32-bit exe / 64-bit platform
+ else
+ WHICH_GDB=$ANDROID_TOOLCHAIN_2ND_ARCH/$GDB
+ fi
+ gdbwrapper $WHICH_GDB "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
else
echo "Unable to determine build system output dir."
fi
@@ -1335,7 +1406,8 @@
# JavaVM.framework/Versions/1.7/ folder.
function set_java_home() {
# Clear the existing JAVA_HOME value if we set it ourselves, so that
- # we can reset it later, depending on the value of EXPERIMENTAL_USE_JAVA7.
+ # we can reset it later, depending on the version of java the build
+ # system needs.
#
# If we don't do this, the JAVA_HOME value set by the first call to
# build/envsetup.sh will persist forever.
@@ -1344,7 +1416,7 @@
fi
if [ ! "$JAVA_HOME" ]; then
- if [ ! "$EXPERIMENTAL_USE_JAVA7" ]; then
+ if [ -n "$LEGACY_USE_JAVA6" ]; then
case `uname -s` in
Darwin)
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
@@ -1356,7 +1428,7 @@
else
case `uname -s` in
Darwin)
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
+ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
;;
*)
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
diff --git a/libs/host/Android.mk b/libs/host/Android.mk
index 74afa55..c67afbb 100644
--- a/libs/host/Android.mk
+++ b/libs/host/Android.mk
@@ -2,7 +2,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- CopyFile.c
+ CopyFile.c
ifeq ($(HOST_OS),cygwin)
LOCAL_CFLAGS += -DWIN32_EXE
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index e0ad23a..6d58b1c 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -69,7 +69,7 @@
TARGET_USERIMAGES_USE_EXT4 := true
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
@@ -77,6 +77,17 @@
BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
BOARD_SEPOLICY_UNION += \
+ adbd.te \
+ app.te \
bootanim.te \
+ device.te \
domain.te \
- surfaceflinger.te
+ file.te \
+ file_contexts \
+ mediaserver.te \
+ qemud.te \
+ rild.te \
+ shell.te \
+ surfaceflinger.te \
+ system_server.te \
+ zygote.te
diff --git a/target/board/generic/sepolicy/adbd.te b/target/board/generic/sepolicy/adbd.te
new file mode 100644
index 0000000..f65cfb3
--- /dev/null
+++ b/target/board/generic/sepolicy/adbd.te
@@ -0,0 +1 @@
+allow adbd qemu_device:chr_file rw_file_perms;
diff --git a/target/board/generic/sepolicy/app.te b/target/board/generic/sepolicy/app.te
new file mode 100644
index 0000000..fd33453
--- /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 d6506e1..a5a84f9 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/device.te b/target/board/generic/sepolicy/device.te
new file mode 100644
index 0000000..e4af13c
--- /dev/null
+++ b/target/board/generic/sepolicy/device.te
@@ -0,0 +1 @@
+type qemu_device, dev_type;
diff --git a/target/board/generic/sepolicy/file.te b/target/board/generic/sepolicy/file.te
new file mode 100644
index 0000000..6fad80a
--- /dev/null
+++ b/target/board/generic/sepolicy/file.te
@@ -0,0 +1 @@
+type qemud_socket, file_type;
diff --git a/target/board/generic/sepolicy/file_contexts b/target/board/generic/sepolicy/file_contexts
new file mode 100644
index 0000000..f204cde
--- /dev/null
+++ b/target/board/generic/sepolicy/file_contexts
@@ -0,0 +1,4 @@
+/dev/qemu_.* u:object_r:qemu_device:s0
+/dev/socket/qemud u:object_r:qemud_socket:s0
+/system/bin/qemud u:object_r:qemud_exec:s0
+/sys/qemu_trace(/.*)? -- u:object_r:sysfs_writable:s0
diff --git a/target/board/generic/sepolicy/mediaserver.te b/target/board/generic/sepolicy/mediaserver.te
new file mode 100644
index 0000000..90b8cf8
--- /dev/null
+++ b/target/board/generic/sepolicy/mediaserver.te
@@ -0,0 +1 @@
+allow mediaserver qemu_device:chr_file rw_file_perms;
diff --git a/target/board/generic/sepolicy/qemud.te b/target/board/generic/sepolicy/qemud.te
new file mode 100644
index 0000000..4ff02ec
--- /dev/null
+++ b/target/board/generic/sepolicy/qemud.te
@@ -0,0 +1,6 @@
+# qemu support daemon
+type qemud, domain;
+type qemud_exec, exec_type, file_type;
+
+init_daemon_domain(qemud)
+unconfined_domain(qemud)
diff --git a/target/board/generic/sepolicy/rild.te b/target/board/generic/sepolicy/rild.te
new file mode 100644
index 0000000..5de171a
--- /dev/null
+++ b/target/board/generic/sepolicy/rild.te
@@ -0,0 +1,2 @@
+allow rild qemu_device:chr_file rw_file_perms;
+unix_socket_connect(rild, qemud, qemud)
diff --git a/target/board/generic/sepolicy/shell.te b/target/board/generic/sepolicy/shell.te
new file mode 100644
index 0000000..b246d7e
--- /dev/null
+++ b/target/board/generic/sepolicy/shell.te
@@ -0,0 +1 @@
+allow shell serial_device:chr_file rw_file_perms;
diff --git a/target/board/generic/sepolicy/surfaceflinger.te b/target/board/generic/sepolicy/surfaceflinger.te
index 4c35469..6712789 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/system_server.te b/target/board/generic/sepolicy/system_server.te
new file mode 100644
index 0000000..ef4ce4a
--- /dev/null
+++ b/target/board/generic/sepolicy/system_server.te
@@ -0,0 +1,2 @@
+unix_socket_connect(system_server, qemud, qemud)
+allow system_server 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 0000000..a5da574
--- /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_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 03284d7..c383f87 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -21,6 +21,14 @@
TARGET_CPU_VARIANT := generic
TARGET_CPU_ABI := arm64-v8a
+TARGET_2ND_ARCH := arm
+TARGET_2ND_ARCH_VARIANT := armv7-a-neon
+TARGET_2ND_CPU_VARIANT := generic
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+
+TARGET_USES_64_BIT_BINDER := true
+
# no hardware camera
USE_CAMERA_STUB := true
@@ -40,14 +48,10 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
-# FIXME
-# Temporarily disable linking against compiler_rt until there is an arm64
-# version
-WITHOUT_LIBCOMPILER_RT := true
diff --git a/target/board/generic_mips/BoardConfig.mk b/target/board/generic_mips/BoardConfig.mk
index e6f43af..17e241d 100644
--- a/target/board/generic_mips/BoardConfig.mk
+++ b/target/board/generic_mips/BoardConfig.mk
@@ -50,9 +50,24 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
+
+BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy
+BOARD_SEPOLICY_UNION += \
+ adbd.te \
+ bootanim.te \
+ device.te \
+ domain.te \
+ file.te \
+ file_contexts \
+ mediaserver.te \
+ qemud.te \
+ rild.te \
+ shell.te \
+ surfaceflinger.te \
+ system_server.te
diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk
new file mode 100644
index 0000000..7452978
--- /dev/null
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -0,0 +1,65 @@
+#
+# Copyright (C) 2013 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.
+#
+# BoardConfig.mk
+#
+# Product-specific compile-time definitions.
+#
+
+# The generic product target doesn't have any hardware-specific pieces.
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
+
+TARGET_ARCH := mips64
+ifeq (,$(TARGET_ARCH_VARIANT))
+TARGET_ARCH_VARIANT := mips64r2
+endif
+TARGET_CPU_ABI := mips64
+
+TARGET_2ND_ARCH := mips
+ifeq (,$(TARGET_2ND_ARCH_VARIANT))
+TARGET_2ND_ARCH_VARIANT := mips32r2-fp
+endif
+TARGET_CPU_ABI := mips
+
+# The emulator (qemu) uses the Goldfish devices
+HAVE_HTC_AUDIO_DRIVER := true
+BOARD_USES_GENERIC_AUDIO := true
+
+# no hardware camera
+USE_CAMERA_STUB := true
+
+# 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)
+ ifeq ($(WITH_DEXPREOPT),)
+ WITH_DEXPREOPT := true
+ endif
+endif
+
+# Build OpenGLES emulation guest and host libraries
+BUILD_EMULATOR_OPENGL := true
+
+# Build and enable the OpenGL ES View renderer. When running on the emulator,
+# the GLES renderer disables itself if host GL acceleration isn't available.
+USE_OPENGL_RENDERER := true
+
+TARGET_USERIMAGES_USE_EXT4 := true
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
+BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_FLASH_BLOCK_SIZE := 512
+TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
diff --git a/target/board/generic_mips64/README.txt b/target/board/generic_mips64/README.txt
new file mode 100644
index 0000000..cd4e05b
--- /dev/null
+++ b/target/board/generic_mips64/README.txt
@@ -0,0 +1,8 @@
+The "generic_mips64" product defines a MIPS64 based non-hardware-specific
+target without a kernel or bootloader.
+
+It can be used to build the entire user-level system, and
+will work with the emulator.
+
+It is not a product "base class"; no other products inherit
+from it or use it in any way.
diff --git a/target/board/generic_mips64/device.mk b/target/board/generic_mips64/device.mk
new file mode 100644
index 0000000..58fe976
--- /dev/null
+++ b/target/board/generic_mips64/device.mk
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2009 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.
+#
+
+# This is a build configuration for the product aspects that
+# are specific to the emulator.
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ ro.ril.hsxpa=1 \
+ ro.ril.gprsclass=10 \
+ ro.adb.qemud=1
+
+PRODUCT_COPY_FILES := \
+ device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
+ device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+ device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
+ hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf
+
+PRODUCT_PACKAGES := \
+ audio.primary.goldfish \
+ power.goldfish \
+ libffi
diff --git a/target/board/generic_mips64/system.prop b/target/board/generic_mips64/system.prop
new file mode 100644
index 0000000..326e4b7
--- /dev/null
+++ b/target/board/generic_mips64/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic mips64 sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index 2381fea..5277cdc 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
@@ -35,8 +35,8 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
@@ -44,8 +44,19 @@
BOARD_SEPOLICY_DIRS += build/target/board/generic_x86/sepolicy
BOARD_SEPOLICY_UNION += \
+ app.te \
+ adbd.te \
+ bootanim.te \
+ device.te \
domain.te \
+ file.te \
+ file_contexts \
healthd.te \
installd.te \
+ mediaserver.te \
+ qemud.te \
+ rild.te \
+ shell.te \
+ surfaceflinger.te \
system_server.te \
zygote.te
diff --git a/target/board/generic_x86/sepolicy/adbd.te b/target/board/generic_x86/sepolicy/adbd.te
new file mode 100644
index 0000000..f65cfb3
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/adbd.te
@@ -0,0 +1 @@
+allow adbd qemu_device:chr_file rw_file_perms;
diff --git a/target/board/generic_x86/sepolicy/app.te b/target/board/generic_x86/sepolicy/app.te
new file mode 100644
index 0000000..fd33453
--- /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 0000000..762a573
--- /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/device.te b/target/board/generic_x86/sepolicy/device.te
new file mode 100644
index 0000000..e4af13c
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/device.te
@@ -0,0 +1 @@
+type qemu_device, dev_type;
diff --git a/target/board/generic_x86/sepolicy/domain.te b/target/board/generic_x86/sepolicy/domain.te
index 0bc8d87..c17950d 100644
--- a/target/board/generic_x86/sepolicy/domain.te
+++ b/target/board/generic_x86/sepolicy/domain.te
@@ -1 +1,3 @@
+# For /sys/qemu_trace files in the emulator.
+allow domain sysfs_writable:file rw_file_perms;
allow domain cpuctl_device:dir search;
diff --git a/target/board/generic_x86/sepolicy/file.te b/target/board/generic_x86/sepolicy/file.te
new file mode 100644
index 0000000..6fad80a
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/file.te
@@ -0,0 +1 @@
+type qemud_socket, file_type;
diff --git a/target/board/generic_x86/sepolicy/file_contexts b/target/board/generic_x86/sepolicy/file_contexts
new file mode 100644
index 0000000..f204cde
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/file_contexts
@@ -0,0 +1,4 @@
+/dev/qemu_.* u:object_r:qemu_device:s0
+/dev/socket/qemud u:object_r:qemud_socket:s0
+/system/bin/qemud u:object_r:qemud_exec:s0
+/sys/qemu_trace(/.*)? -- u:object_r:sysfs_writable:s0
diff --git a/target/board/generic_x86/sepolicy/mediaserver.te b/target/board/generic_x86/sepolicy/mediaserver.te
new file mode 100644
index 0000000..90b8cf8
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/mediaserver.te
@@ -0,0 +1 @@
+allow mediaserver qemu_device:chr_file rw_file_perms;
diff --git a/target/board/generic_x86/sepolicy/qemud.te b/target/board/generic_x86/sepolicy/qemud.te
new file mode 100644
index 0000000..4ff02ec
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/qemud.te
@@ -0,0 +1,6 @@
+# qemu support daemon
+type qemud, domain;
+type qemud_exec, exec_type, file_type;
+
+init_daemon_domain(qemud)
+unconfined_domain(qemud)
diff --git a/target/board/generic_x86/sepolicy/rild.te b/target/board/generic_x86/sepolicy/rild.te
new file mode 100644
index 0000000..5de171a
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/rild.te
@@ -0,0 +1,2 @@
+allow rild qemu_device:chr_file rw_file_perms;
+unix_socket_connect(rild, qemud, qemud)
diff --git a/target/board/generic_x86/sepolicy/shell.te b/target/board/generic_x86/sepolicy/shell.te
new file mode 100644
index 0000000..b246d7e
--- /dev/null
+++ b/target/board/generic_x86/sepolicy/shell.te
@@ -0,0 +1 @@
+allow shell serial_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 0000000..865405c
--- /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/system_server.te b/target/board/generic_x86/sepolicy/system_server.te
index 5d98a14..9bfe5fe 100644
--- a/target/board/generic_x86/sepolicy/system_server.te
+++ b/target/board/generic_x86/sepolicy/system_server.te
@@ -1 +1,3 @@
allow system_server self:process execmem;
+unix_socket_connect(system_server, qemud, qemud)
+allow system_server 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 93993a4..d34c4a1 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;
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index 8a2fd13..876caf3 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -11,6 +11,12 @@
TARGET_ARCH_VARIANT := x86_64
TARGET_PRELINK_MODULE := false
+TARGET_2ND_CPU_ABI := x86
+TARGET_2ND_ARCH := x86
+TARGET_2ND_ARCH_VARIANT := x86
+
+TARGET_USES_64_BIT_BINDER := true
+
# The IA emulator (qemu) uses the Goldfish devices
HAVE_HTC_AUDIO_DRIVER := true
BOARD_USES_GENERIC_AUDIO := true
@@ -24,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
# Build OpenGLES emulation host and guest libraries
@@ -35,8 +41,8 @@
USE_OPENGL_RENDERER := true
TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 576716800
-BOARD_USERDATAIMAGE_PARTITION_SIZE := 209715200
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 786432000
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
BOARD_CACHEIMAGE_PARTITION_SIZE := 69206016
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 512
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/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 65adb0c..fc407d3 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -41,7 +41,8 @@
$(LOCAL_DIR)/full_x86.mk \
$(LOCAL_DIR)/aosp_mips.mk \
$(LOCAL_DIR)/full_mips.mk \
- $(LOCAL_DIR)/aosp_arm64.mk
+ $(LOCAL_DIR)/aosp_arm64.mk \
+ $(LOCAL_DIR)/aosp_mips64.mk
else
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/core.mk \
@@ -55,6 +56,7 @@
$(LOCAL_DIR)/aosp_mips.mk \
$(LOCAL_DIR)/full_mips.mk \
$(LOCAL_DIR)/aosp_arm64.mk \
+ $(LOCAL_DIR)/aosp_mips64.mk \
$(LOCAL_DIR)/aosp_x86_64.mk \
$(LOCAL_DIR)/full_x86_64.mk \
$(LOCAL_DIR)/vbox_x86.mk \
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index 7f97a61..e119466 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -19,9 +19,12 @@
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
+PRODUCT_RUNTIMES := runtime_libart_default
+
include $(SRC_TARGET_DIR)/product/emulator.mk
PRODUCT_NAME := aosp_arm64
PRODUCT_DEVICE := generic_arm64
diff --git a/target/product/aosp_mips64.mk b/target/product/aosp_mips64.mk
new file mode 100644
index 0000000..3a6026c
--- /dev/null
+++ b/target/product/aosp_mips64.mk
@@ -0,0 +1,18 @@
+#
+# Copyright 2013 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.
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_mips64.mk)
+
+PRODUCT_NAME := aosp_mips64
diff --git a/target/product/base.mk b/target/product/base.mk
index 48deadc..4b8326d 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/core_64_bit.mk b/target/product/core_64_bit.mk
new file mode 100644
index 0000000..971b6bd
--- /dev/null
+++ b/target/product/core_64_bit.mk
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2014 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.
+#
+
+# Inherit from this product for devices that support 64-bit apps using:
+# $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+# The inheritance for this must come before the inheritance chain that leads
+# to core_minimal.mk
+
+# For now this will allow 64-bit apps, but still compile all apps with JNI
+# for 32-bit only.
+
+# Copy the 32-bit primary, 64-bit secondary zygote startup script
+PRODUCT_COPY_FILES += system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
+
+# Set the zygote property to select the 32-bit primary, 64-bit secondary script
+# This line must be parsed before the one in core_minimal.mk
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote32_64
+
+TARGET_SUPPORTS_32_BIT_APPS := true
+TARGET_SUPPORTS_64_BIT_APPS := true
diff --git a/target/product/core_base.mk b/target/product/core_base.mk
index 5487e66..e47532f 100644
--- a/target/product/core_base.mk
+++ b/target/product/core_base.mk
@@ -61,7 +61,6 @@
mdnsd \
mms-common \
requestsync \
- screenrecord \
telephony-common \
voip-common
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 8a30a38..26e868c 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -37,6 +37,7 @@
com.android.media.remotedisplay.xml \
drmserver \
framework-res \
+ idmap \
installd \
ip \
ip-up-vpn \
@@ -53,6 +54,7 @@
libkeystore \
libsqlite_jni \
libwilhelm \
+ logd \
make_ext4fs \
screencap \
sensorservice \
@@ -77,7 +79,11 @@
apache-xml \
webviewchromium
-PRODUCT_RUNTIMES := runtime_libdvm_default
-PRODUCT_RUNTIMES += runtime_libart
+PRODUCT_RUNTIMES := runtime_libart_default
+
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+ ro.zygote=zygote32
+PRODUCT_COPY_FILES += \
+ system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc
$(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index b0a5396..82e51dd 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -23,6 +23,7 @@
atrace \
bootanimation \
debuggerd \
+ debuggerd64 \
dumpstate \
dumpsys \
gralloc.default \
@@ -31,16 +32,13 @@
init \
init.environ.rc \
init.rc \
- input \
libEGL \
libETC1 \
libFFTEm \
- libGLES_android \
libGLESv1_CM \
libGLESv2 \
libbinder \
libc \
- libctest \
libcutils \
libdl \
libgui \
@@ -59,6 +57,7 @@
libui \
libutils \
linker \
+ linker64 \
lmkd \
logcat \
logwrapper \
@@ -68,7 +67,8 @@
servicemanager \
sh \
surfaceflinger \
- toolbox
+ toolbox \
+ libsigchain
# SELinux packages
PRODUCT_PACKAGES += \
@@ -76,7 +76,8 @@
file_contexts \
seapp_contexts \
property_contexts \
- mac_permissions.xml
+ mac_permissions.xml \
+ selinux_version
PRODUCT_COPY_FILES += \
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index 6812c22..62099df 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -20,21 +20,7 @@
# Host modules
PRODUCT_PACKAGES += \
- emulator \
- emulator-x86 \
- emulator-arm \
- emulator-mips \
- emulator64-x86 \
- emulator64-arm \
- emulator64-mips \
- libOpenglRender \
- libGLES_CM_translator \
- libGLES_V2_translator \
- libEGL_translator \
- lib64OpenglRender \
- lib64GLES_CM_translator \
- lib64GLES_V2_translator \
- lib64EGL_translator
+
# Device modules
PRODUCT_PACKAGES += \
@@ -43,6 +29,7 @@
libGLESv1_CM_emulation \
lib_renderControl_enc \
libEGL_emulation \
+ libGLES_android \
libGLESv2_enc \
libOpenglSystemCommon \
libGLESv2_emulation \
diff --git a/target/product/full_mips64.mk b/target/product/full_mips64.mk
new file mode 100644
index 0000000..408e81c
--- /dev/null
+++ b/target/product/full_mips64.mk
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2013 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.
+#
+
+# This is a build configuration for a full-featured build of the
+# Open-Source part of the tree. It's geared toward a US-centric
+# mips64 build quite specifically for the emulator, and might not be
+# entirely appropriate to inherit from for on-device configurations.
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_mips64/device.mk)
+
+PRODUCT_RUNTIMES := runtime_libart_default
+
+include $(SRC_TARGET_DIR)/product/emulator.mk
+
+# Overrides
+PRODUCT_NAME := full_mips64
+PRODUCT_DEVICE := generic_mips64
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on MIPS64 Emulator
diff --git a/target/product/full_x86_64.mk b/target/product/full_x86_64.mk
index 644f2a2..cd401a8 100755
--- a/target/product/full_x86_64.mk
+++ b/target/product/full_x86_64.mk
@@ -23,9 +23,16 @@
# that isn't a wifi connection. This will instruct init.rc to enable the
# network connection so that you can use it with ADB
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.zygote=zygote64_32
+PRODUCT_COPY_FILES += system/core/rootdir/init.zygote64_32.rc:root/init.zygote64_32.rc
+
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+PRODUCT_RUNTIMES := runtime_libart_default
+
include $(SRC_TARGET_DIR)/product/emulator.mk
ifdef NET_ETH0_STARTONBOOT
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 963d56a..12797f4 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -44,18 +44,14 @@
SystemUI \
TeleService \
CalendarProvider \
- bluetooth-health \
WallpaperCropper
PRODUCT_PACKAGES += \
- audio \
+ bcc \
clatd \
clatd.conf \
- dhcpcd.conf \
- network \
- pand \
pppd \
- sdptool
+ screenrecord
PRODUCT_PACKAGES += \
librs_jni \
@@ -82,6 +78,9 @@
ro.carrier=unknown
$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/dancing-script/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/carrois-gothic-sc/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
$(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
$(call inherit-product-if-exists, external/naver-fonts/fonts.mk)
$(call inherit-product-if-exists, external/sil-fonts/fonts.mk)
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 4005e57..5926f19 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -93,6 +93,12 @@
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/dancing-script/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/carrois-gothic-sc/fonts.mk)
+$(call inherit-product-if-exists, external/google-fonts/coming-soon/fonts.mk)
+$(call inherit-product-if-exists, external/noto-fonts/fonts.mk)
+$(call inherit-product-if-exists, external/naver-fonts/fonts.mk)
+$(call inherit-product-if-exists, external/sil-fonts/fonts.mk)
$(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
$(call inherit-product-if-exists, frameworks/webview/chromium/chromium.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
diff --git a/tools/acp/Android.mk b/tools/acp/Android.mk
index 5e0e2e4..33c5567 100644
--- a/tools/acp/Android.mk
+++ b/tools/acp/Android.mk
@@ -6,7 +6,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- acp.c
+ acp.c
ifeq ($(HOST_OS),cygwin)
LOCAL_CFLAGS += -DWIN32_EXE
@@ -23,4 +23,3 @@
LOCAL_ACP_UNAVAILABLE := true
include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index e3fe99c..46a73f8 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -20,10 +20,19 @@
echo "ro.product.name=$PRODUCT_NAME"
echo "ro.product.device=$TARGET_DEVICE"
echo "ro.product.board=$TARGET_BOOTLOADER_BOARD_NAME"
+
+# These values are deprecated, use "ro.product.cpu.abilist"
+# instead (see below).
+echo "# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,"
+echo "# use ro.product.cpu.abilist instead."
echo "ro.product.cpu.abi=$TARGET_CPU_ABI"
if [ -n "$TARGET_CPU_ABI2" ] ; then
echo "ro.product.cpu.abi2=$TARGET_CPU_ABI2"
fi
+echo "ro.product.cpu.abilist=$TARGET_CPU_ABI_LIST"
+echo "ro.product.cpu.abilist32=$TARGET_CPU_ABI_LIST_32_BIT"
+echo "ro.product.cpu.abilist64=$TARGET_CPU_ABI_LIST_64_BIT"
+
echo "ro.product.manufacturer=$PRODUCT_MANUFACTURER"
if [ -n "$PRODUCT_DEFAULT_LANGUAGE" ] ; then
echo "ro.product.locale.language=$PRODUCT_DEFAULT_LANGUAGE"
diff --git a/tools/droiddoc/templates-pdk/head_tag.cs b/tools/droiddoc/templates-pdk/head_tag.cs
index 0ecda7b..a61cadb 100644
--- a/tools/droiddoc/templates-pdk/head_tag.cs
+++ b/tools/droiddoc/templates-pdk/head_tag.cs
@@ -27,6 +27,17 @@
if:resources ?>
<script src="<?cs var:toroot ?>resources/resources-data.js" type="text/javascript"></script><?cs
/if ?>
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-10664927-1']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+</script>
<noscript>
<style type="text/css">
html,body{overflow:auto;}
@@ -37,4 +48,4 @@
#resize-packages-nav{border-bottom:3px solid #666;}
</style>
</noscript>
-</head>
\ No newline at end of file
+</head>
diff --git a/tools/droiddoc/templates-pdk/trailer.cs b/tools/droiddoc/templates-pdk/trailer.cs
index 155ba58..46c7bbc 100644
--- a/tools/droiddoc/templates-pdk/trailer.cs
+++ b/tools/droiddoc/templates-pdk/trailer.cs
@@ -1,11 +1,19 @@
</div> <!-- end body-content --> <?cs # normally opened by header.cs ?>
-
<script type="text/javascript">
init(); /* initialize android-developer-docs.js */
-var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
-<script type="text/javascript">
-var pageTracker = _gat._getTracker("UA-5831155-1");
-pageTracker._trackPageview();
-</script>
\ No newline at end of file
+<!--
+ Copyright 2013 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.
+-->
diff --git a/tools/droiddoc/templates-sac/designpage.cs b/tools/droiddoc/templates-sac/designpage.cs
index c714a74..c5f03ff 100644
--- a/tools/droiddoc/templates-sac/designpage.cs
+++ b/tools/droiddoc/templates-sac/designpage.cs
@@ -86,14 +86,5 @@
</div>
</div>
-
- <script type="text/javascript">
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
- </script>
- <script type="text/javascript">
- var pageTracker = _gat._getTracker("UA-5831155-1");
- pageTracker._trackPageview();
- </script>
</body>
</html>
diff --git a/tools/droiddoc/templates-sac/head_tag.cs b/tools/droiddoc/templates-sac/head_tag.cs
index 2d64e4f..9fca488 100644
--- a/tools/droiddoc/templates-sac/head_tag.cs
+++ b/tools/droiddoc/templates-sac/head_tag.cs
@@ -48,7 +48,7 @@
<script type="text/javascript">
var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-5831155-1']);
+ _gaq.push(['_setAccount', 'UA-45455297-1']);
_gaq.push(['_trackPageview']);
(function() {
@@ -57,4 +57,4 @@
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
-</head>
\ No newline at end of file
+</head>
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index 9d69736..5d1b350 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -16,12 +16,17 @@
import sys
+# See PROP_VALUE_MAX system_properties.h.
+# PROP_VALUE_MAX in system_properties.h includes the termination NUL,
+# so we decrease it by 1 here.
+PROP_VALUE_MAX = 91
+
# Put the modifications that you need to make into the /system/build.prop into this
# function. The prop object has get(name) and put(name,value) methods.
def mangle_build_prop(prop):
pass
-# Put the modifications that you need to make into the /system/build.prop into this
+# Put the modifications that you need to make into the /default.prop into this
# function. The prop object has get(name) and put(name,value) methods.
def mangle_default_prop(prop):
# If ro.debuggable is 1, then enable adb on USB by default
@@ -39,9 +44,47 @@
if not prop.get("persist.sys.usb.config"):
prop.put("persist.sys.usb.config", "none");
+def validate(prop):
+ """Validate the properties.
+
+ Returns:
+ True if nothing is wrong.
+ """
+ check_pass = True
+ buildprops = prop.to_dict()
+ dev_build = buildprops.get("ro.build.version.incremental",
+ "").startswith("eng")
+ for key, value in buildprops.iteritems():
+ # Check build properties' length.
+ if len(value) > PROP_VALUE_MAX:
+ # If dev build, show a warning message, otherwise fail the
+ # build with error message
+ if dev_build:
+ sys.stderr.write("warning: %s exceeds %d bytes: " %
+ (key, PROP_VALUE_MAX))
+ sys.stderr.write("%s (%d)\n" % (value, len(value)))
+ sys.stderr.write("warning: This will cause the %s " % key)
+ sys.stderr.write("property return as empty at runtime\n")
+ else:
+ check_pass = False
+ sys.stderr.write("error: %s cannot exceed %d bytes: " %
+ (key, PROP_VALUE_MAX))
+ sys.stderr.write("%s (%d)\n" % (value, len(value)))
+ return check_pass
+
class PropFile:
+
def __init__(self, lines):
- self.lines = [s[:-1] for s in lines]
+ self.lines = [s.strip() for s in lines]
+
+ def to_dict(self):
+ props = {}
+ for line in self.lines:
+ if not line or line.startswith("#"):
+ continue
+ key, value = line.split("=", 1)
+ props[key] = value
+ return props
def get(self, name):
key = name + "="
@@ -69,6 +112,7 @@
f.close()
properties = PropFile(lines)
+
if filename.endswith("/build.prop"):
mangle_build_prop(properties)
elif filename.endswith("/default.prop"):
@@ -77,6 +121,9 @@
sys.stderr.write("bad command line: " + str(argv) + "\n")
sys.exit(1)
+ if not validate(properties):
+ sys.exit(1)
+
f = open(filename, 'w+')
properties.write(f)
f.close()
diff --git a/tools/signapk/SignApk.java b/tools/signapk/SignApk.java
index b247072..e661e50 100644
--- a/tools/signapk/SignApk.java
+++ b/tools/signapk/SignApk.java
@@ -461,24 +461,75 @@
* 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<String, Attributes> entries = manifest.getEntries();
ArrayList<String> names = new ArrayList<String>(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 @@
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 @@
private static void usage() {
System.err.println("Usage: signapk [-w] " +
+ "[-a <alignment>] " +
"[-providerClass <className>] " +
"publickey.x509[.pem] privatekey.pk8 " +
"[publickey2.x509[.pem] privatekey2.pk8 ...] " +
@@ -794,6 +846,7 @@
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 @@
}
providerClass = args[++argstart];
++argstart;
+ } else if ("-a".equals(args[argstart])) {
+ alignment = Integer.parseInt(args[++argstart]);
+ ++argstart;
} else {
usage();
}
@@ -872,7 +928,7 @@
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();
}