Merge "Add aosp_aarch64-eng to the default lunch menu."
diff --git a/core/Makefile b/core/Makefile
index a8a7d97..2bcf0cf 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -368,6 +368,22 @@
 # #################################################################
 # Targets for boot/OS images
 # #################################################################
+ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
+  INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
+  ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
+    INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
+  else
+    INSTALLED_2NDBOOTLOADER_TARGET :=
+  endif
+else
+  INSTALLED_BOOTLOADER_MODULE :=
+  INSTALLED_2NDBOOTLOADER_TARGET :=
+endif # TARGET_NO_BOOTLOADER
+ifneq ($(strip $(TARGET_NO_KERNEL)),true)
+  INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
+else
+  INSTALLED_KERNEL_TARGET :=
+endif
 
 # -----------------------------------------------------------------
 # the ramdisk
diff --git a/core/binary.mk b/core/binary.mk
index c677dea..55b529c 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -132,15 +132,6 @@
   endif
 endif
 
-####################################################
-## Add profiling flags if aprof is turned on
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
-  # -ffunction-sections and -fomit-frame-pointer are conflict with -pg
-  LOCAL_CFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
-  LOCAL_CPPFLAGS += -fno-omit-frame-pointer -fno-function-sections -pg
-endif
-
 ###########################################################
 ## Explicitly declare assembly-only __ASSEMBLY__ macro for
 ## assembly source
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 0648b35..7b3ab31 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -83,8 +83,6 @@
 LOCAL_COPY_HEADERS:=
 LOCAL_FORCE_STATIC_EXECUTABLE:=
 LOCAL_ADDITIONAL_DEPENDENCIES:=
-LOCAL_ENABLE_APROF:=
-LOCAL_ENABLE_APROF_JNI:=
 LOCAL_COMPRESS_MODULE_SYMBOLS:=
 LOCAL_STRIP_MODULE:=
 LOCAL_JNI_SHARED_LIBRARIES:=
diff --git a/core/config.mk b/core/config.mk
index 958a3fb..e5e46df 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -136,49 +136,6 @@
 # are specific to the user's build configuration.
 include $(BUILD_SYSTEM)/envsetup.mk
 
-# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
-# or under vendor/*/$(TARGET_DEVICE).  Search in both places, but
-# make sure only one exists.
-# Real boards should always be associated with an OEM vendor.
-board_config_mk := \
-	$(strip $(wildcard \
-		$(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
-		$(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
-		$(shell test -d vendor && find vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
-	))
-ifeq ($(board_config_mk),)
-  $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
-endif
-ifneq ($(words $(board_config_mk)),1)
-  $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
-endif
-include $(board_config_mk)
-ifeq ($(TARGET_ARCH),)
-  $(error TARGET_ARCH not defined by board config: $(board_config_mk))
-endif
-TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
-board_config_mk :=
-
-# Perhaps we should move this block to build/core/Makefile,
-# once we don't have TARGET_NO_KERNEL reference in AndroidBoard.mk/Android.mk.
-ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
-  INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
-  ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
-    INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
-  else
-    INSTALLED_2NDBOOTLOADER_TARGET :=
-  endif
-else
-  INSTALLED_BOOTLOADER_MODULE :=
-  INSTALLED_2NDBOOTLOADER_TARGET :=
-endif # TARGET_NO_BOOTLOADER
-ifneq ($(strip $(TARGET_NO_KERNEL)),true)
-  INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
-else
-  INSTALLED_KERNEL_TARGET :=
-endif
-
-
 # The build system exposes several variables for where to find the kernel
 # headers:
 #   TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 8ac437e..ab8426e 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -120,6 +120,29 @@
 $(error must be empty or one of: eng user userdebug)
 endif
 
+# Boards may be defined under $(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)
+# or under vendor/*/$(TARGET_DEVICE).  Search in both places, but
+# make sure only one exists.
+# Real boards should always be associated with an OEM vendor.
+board_config_mk := \
+	$(strip $(wildcard \
+		$(SRC_TARGET_DIR)/board/$(TARGET_DEVICE)/BoardConfig.mk \
+		$(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
+		$(shell test -d vendor && find vendor -maxdepth 4 -path '*/$(TARGET_DEVICE)/BoardConfig.mk') \
+	))
+ifeq ($(board_config_mk),)
+  $(error No config file found for TARGET_DEVICE $(TARGET_DEVICE))
+endif
+ifneq ($(words $(board_config_mk)),1)
+  $(error Multiple board config files for TARGET_DEVICE $(TARGET_DEVICE): $(board_config_mk))
+endif
+include $(board_config_mk)
+ifeq ($(TARGET_ARCH),)
+  $(error TARGET_ARCH not defined by board config: $(board_config_mk))
+endif
+TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
+board_config_mk :=
+
 # ---------------------------------------------------------------
 # Set up configuration for target machine.
 # The following must be set:
@@ -172,42 +195,48 @@
 
 OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
 
-BUILD_OUT_EXECUTABLES:= $(BUILD_OUT)/bin
+BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin
 
-HOST_OUT_EXECUTABLES:= $(HOST_OUT)/bin
-HOST_OUT_SHARED_LIBRARIES:= $(HOST_OUT)/lib
-HOST_OUT_JAVA_LIBRARIES:= $(HOST_OUT)/framework
+HOST_OUT_EXECUTABLES := $(HOST_OUT)/bin
+HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib
+HOST_OUT_JAVA_LIBRARIES := $(HOST_OUT)/framework
 HOST_OUT_SDK_ADDON := $(HOST_OUT)/sdk_addon
 
 HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj
-HOST_OUT_HEADERS:= $(HOST_OUT_INTERMEDIATES)/include
+HOST_OUT_HEADERS := $(HOST_OUT_INTERMEDIATES)/include
 HOST_OUT_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
-HOST_OUT_NOTICE_FILES:=$(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
+HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
 HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
 
 TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
-TARGET_OUT_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/include
+TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include
 TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
 TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
 
 TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
-TARGET_OUT_EXECUTABLES:= $(TARGET_OUT)/bin
-TARGET_OUT_OPTIONAL_EXECUTABLES:= $(TARGET_OUT)/xbin
-TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib
-TARGET_OUT_JAVA_LIBRARIES:= $(TARGET_OUT)/framework
-TARGET_OUT_APPS:= $(TARGET_OUT)/app
+TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
+TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin
+ifneq ($(filter %64,$(TARGET_ARCH)),)
+# /system/lib always contains 32-bit libraries,
+# and /system/lib64 (if present) always contains 64-bit libraries.
+TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib64
+else
+TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
+endif
+TARGET_OUT_JAVA_LIBRARIES := $(TARGET_OUT)/framework
+TARGET_OUT_APPS := $(TARGET_OUT)/app
 TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT)/priv-app
 TARGET_OUT_KEYLAYOUT := $(TARGET_OUT)/usr/keylayout
 TARGET_OUT_KEYCHARS := $(TARGET_OUT)/usr/keychars
 TARGET_OUT_ETC := $(TARGET_OUT)/etc
-TARGET_OUT_NOTICE_FILES:=$(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
+TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
 TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
 
 TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
-TARGET_OUT_DATA_EXECUTABLES:= $(TARGET_OUT_EXECUTABLES)
-TARGET_OUT_DATA_SHARED_LIBRARIES:= $(TARGET_OUT_SHARED_LIBRARIES)
-TARGET_OUT_DATA_JAVA_LIBRARIES:= $(TARGET_OUT_DATA)/framework
-TARGET_OUT_DATA_APPS:= $(TARGET_OUT_DATA)/app
+TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
+TARGET_OUT_DATA_SHARED_LIBRARIES := $(TARGET_OUT_SHARED_LIBRARIES)
+TARGET_OUT_DATA_JAVA_LIBRARIES := $(TARGET_OUT_DATA)/framework
+TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA)/app
 TARGET_OUT_DATA_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT)
 TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)
 TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)
@@ -217,11 +246,15 @@
 TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
 
 TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
-TARGET_OUT_VENDOR_EXECUTABLES:= $(TARGET_OUT_VENDOR)/bin
-TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES:= $(TARGET_OUT_VENDOR)/xbin
-TARGET_OUT_VENDOR_SHARED_LIBRARIES:= $(TARGET_OUT_VENDOR)/lib
-TARGET_OUT_VENDOR_JAVA_LIBRARIES:= $(TARGET_OUT_VENDOR)/framework
-TARGET_OUT_VENDOR_APPS:= $(TARGET_OUT_VENDOR)/app
+TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR)/bin
+TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES := $(TARGET_OUT_VENDOR)/xbin
+ifneq ($(filter %64,$(TARGET_ARCH)),)
+TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib64
+else
+TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib
+endif
+TARGET_OUT_VENDOR_JAVA_LIBRARIES := $(TARGET_OUT_VENDOR)/framework
+TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR)/app
 TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
 
 TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
diff --git a/core/executable.mk b/core/executable.mk
index d6b342e..f35ebcc 100644
--- a/core/executable.mk
+++ b/core/executable.mk
@@ -23,17 +23,6 @@
 endif
 
 ifndef skip_build_from_source
-####################################################
-## Add profiling libraries if aprof is turned
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
-  ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE), true)
-    LOCAL_STATIC_LIBRARIES += libaprof libaprof_static libc libcutils
-  else
-    LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime libc
-  endif
-  LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_aux
-endif
 
 include $(BUILD_SYSTEM)/dynamic_binary.mk
 
diff --git a/core/shared_library.mk b/core/shared_library.mk
index 5619274..bf83c0c 100644
--- a/core/shared_library.mk
+++ b/core/shared_library.mk
@@ -31,17 +31,6 @@
 endif
 
 ifndef skip_build_from_source
-####################################################
-## Add profiling libraries if aprof is turned
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF_JNI)),true)
-  LOCAL_ENABLE_APROF := true
-  LOCAL_WHOLE_STATIC_LIBRARIES += libaprof_jni
-endif
-
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
-  LOCAL_SHARED_LIBRARIES += libaprof libaprof_runtime
-endif
 
 # Put the built targets of all shared libraries in a common directory
 # to simplify the link line.
@@ -49,7 +38,6 @@
 
 include $(BUILD_SYSTEM)/dynamic_binary.mk
 
-
 # Define PRIVATE_ variables from global vars
 my_target_global_ld_dirs := $(TARGET_GLOBAL_LD_DIRS)
 ifeq ($(LOCAL_CLANG),true)
diff --git a/core/static_library.mk b/core/static_library.mk
index 976963e..525806b 100644
--- a/core/static_library.mk
+++ b/core/static_library.mk
@@ -18,13 +18,6 @@
 $(error $(LOCAL_PATH): Cannot set module stem for a library)
 endif
 
-####################################################
-## Add profiling libraries if aprof is turned
-####################################################
-ifeq ($(strip $(LOCAL_ENABLE_APROF)),true)
-  LOCAL_WHOLE_STATIC_LIBRARIES += libaprof
-endif
-
 include $(BUILD_SYSTEM)/binary.mk
 
 ifeq ($(LOCAL_RAW_STATIC_LIBRARY),true)