first commit

This commit is contained in:
gaoyang3513
2025-09-22 22:53:38 +08:00
commit 0b0949a59e
193 changed files with 25289 additions and 0 deletions

2
build/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.pyc
*.swp

322
build/CleanSpec.mk Normal file
View File

@ -0,0 +1,322 @@
# Copyright (C) 2007 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.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libmediaplayerservice_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libmedia_jni_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libstagefright_omx_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/android-info.txt)
$(call add-clean-step, find $(PRODUCT_OUT) -name "*.apk" | xargs rm)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/*/LINKED)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(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/*)
$(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/lib/*.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/*.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/*.so)
$(call add-clean-step, rm -rf $(HOST_OUT_EXECUTABLES)/iself)
$(call add-clean-step, rm -rf $(HOST_OUT_EXECUTABLES)/lsd)
$(call add-clean-step, rm -rf $(HOST_OUT_EXECUTABLES)/apriori)
$(call add-clean-step, rm -rf $(HOST_OUT_EXECUTABLES)/isprelinked)
$(call add-clean-step, rm -rf $(HOST_OUT_EXECUTABLES)/soslim)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/*.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/*.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/symbols/system/lib/*.so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/YouTube*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libstagefright_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libstagefright_omx_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/librtp_jni_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/android-info.txt)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/JAVA_LIBRARIES/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/*)
$(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/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbcinfo_intermediates)
# ICS MR2!!!!!!!!!!!!
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbcinfo_intermediates)
# WAIT, I MEAN JELLY BEAN!!!!!!!!!!!!
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
# Changing where ro.carrier value is instantiated for system/build.prop
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
# Now we switched to build against Mac OS X SDK 10.6
$(call add-clean-step, rm -rf $(OUT_DIR)/host/darwin-x86/obj)
$(call add-clean-step, rm -f $(OUT_DIR)/versions_checked.mk)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/*.o)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/*.o)
# JB MR2!!!!!!! AND *NO*, THIS WILL NOT BE K-WHATEVER.
$(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/*)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
# Start of "K" 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/*)
# GCC 4.7
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/*.o)
# Wait, back to some JB 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/*)
# And on to KLP...
$(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/*)
# KLP now based off API 18.
$(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/*)
# Clean up around the /system/app -> /system/priv-app migration
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*)
# Clean up old location of generated Java files from aidl
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src)
# Clean up ApplicationsProvider which is being removed.
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/ApplicationsProvider_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/ApplicationsProvider.apk)
# Clean up Moto OMA DM client which isn't ready yet.
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.omadm.plugin.dev_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.omadm.plugin.diagmon_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.omadm.pluginhelper_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.omadm.plugin_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.omadm.service.api_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/DMService_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/SprintDM_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/DMService.apk)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/SprintDM.apk)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/omadm)
# GCC 4.8
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/EXECUTABLES)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/lib/*.o)
# KLP I mean KitKat now API 19.
$(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/*)
# 4.4.1
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
# 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/*)
# L 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/*)
# L 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)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
# Unset TARGET_PREFER_32_BIT_APPS for 64 bit targets.
$(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)
# 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)
# Switching to 32-bit-by-default host multilib build
$(call add-clean-step, rm -rf $(HOST_OUT_INTERMEDIATES))
# KKWT has become API 20
$(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/*)
# ims-common.jar added to BOOTCLASSPATH
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/ETC/init.environ.rc_intermediates)
# Change ro.zygote for core_64_bit.mk from zygote32_64 to zygote64_32
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
# Adding dalvik.vm.dex2oat-Xms, dalvik.vm.dex2oat-Xmx
# dalvik.vm.image-dex2oat-Xms, and dalvik.vm.image-dex2oat-Xmx
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system)
# Adding dalvik.vm.dex2oat-filter
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
# API 21?
$(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/*)
# API 21!
$(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/*)
# API 22!
$(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/*)
# 5.1!
$(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/*)
# 5.1.1!
$(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/*)
# Added new build props
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************

111
build/buildspec.mk.default Normal file
View File

@ -0,0 +1,111 @@
#
# Copyright (C) 2007 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 do-nothing template file. To use it, copy it to a file
# named "buildspec.mk" in the root directory, and uncomment or change
# the variables necessary for your desired configuration. The file
# "buildspec.mk" should never be checked in to source control.
######################################################################
# Choose a product to build for. Look in the products directory for ones
# that work.
ifndef TARGET_PRODUCT
#TARGET_PRODUCT:=generic
endif
# Choose a variant to build. If you don't pick one, the default is eng.
# User is what we ship. Userdebug is that, with a few flags turned on
# for debugging. Eng has lots of extra tools for development.
ifndef TARGET_BUILD_VARIANT
#TARGET_BUILD_VARIANT:=user
#TARGET_BUILD_VARIANT:=userdebug
#TARGET_BUILD_VARIANT:=eng
endif
# Choose additional targets to always install, even when building
# minimal targets like "make droid". This takes simple target names
# like "Browser" or "MyApp", the names used by LOCAL_MODULE or
# LOCAL_PACKAGE_NAME. Modules listed here will always be installed in
# /system, even if they'd usually go in /data.
ifndef CUSTOM_MODULES
#CUSTOM_MODULES:=
endif
# Set this to debug or release if you care. Otherwise, it defaults to release.
ifndef TARGET_BUILD_TYPE
#TARGET_BUILD_TYPE:=release
endif
# Uncomment this if you want the host tools built in debug mode. Otherwise
# it defaults to release.
ifndef HOST_BUILD_TYPE
#HOST_BUILD_TYPE:=debug
endif
# Turn on debugging for selected modules. If DEBUG_MODULE_<module-name> is set
# to a non-empty value, the appropriate HOST_/TARGET_CUSTOM_DEBUG_CFLAGS
# will be added to LOCAL_CFLAGS when building the module.
#DEBUG_MODULE_ModuleName:=true
# Specify an alternative tool chain prefix if needed.
#TARGET_TOOLS_PREFIX:=
# Specify the extra CFLAGS to use when building a module whose
# DEBUG_MODULE_ variable is set. Host and device flags are handled
# separately.
#HOST_CUSTOM_DEBUG_CFLAGS:=
#TARGET_CUSTOM_DEBUG_CFLAGS:=
# Choose additional locales, like "en_US" or "it_IT", to add to any
# built product. Any locales that appear in CUSTOM_LOCALES but not in
# the locale list for the selected product will be added to the end
# of PRODUCT_LOCALES.
ifndef CUSTOM_LOCALES
#CUSTOM_LOCALES:=
endif
# If you have a special place to put your ouput files, set this, otherwise
# it goes to <build-root>/out
#OUT_DIR:=/tmp/stuff
# If you want to always set certain system properties, add them to this list.
# E.g., "ADDITIONAL_BUILD_PROPERTIES += ro.prop1=5 prop2=value"
# This mechanism does not currently support values containing spaces.
#ADDITIONAL_BUILD_PROPERTIES +=
# If you want to reduce the system.img size by several meg, and are willing to
# lose access to CJK (and other) character sets, define NO_FALLBACK_FONT:=true
ifndef NO_FALLBACK_FONT
#NO_FALLBACK_FONT:=true
endif
# OVERRIDE_RUNTIMES allows you to locally override PRODUCT_RUNTIMES.
#
# To only build ART, use "runtime_libart_default"
# To use Dalvik but also include ART, use "runtime_libdvm_default runtime_libart"
# To use ART but also include Dalvik, use "runtime_libart_default runtime_libdvm"
ifndef OVERRIDE_RUNTIMES
#OVERRIDE_RUNTIMES:=runtime_libart_default
#OVERRIDE_RUNTIMES:=runtime_libdvm_default runtime_libart
#OVERRIDE_RUNTIMES:=runtime_libart_default runtime_libdvm
endif
# when the build system changes such that this file must be updated, this
# variable will be changed. After you have modified this file with the new
# changes (see buildspec.mk.default), update this to the new value from
# buildspec.mk.default.
BUILD_ENV_SEQUENCE_NUMBER := 10

1980
build/core/Makefile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
# Handle AndroidManifest.xmls
# Input: LOCAL_MANIFEST_FILE, LOCAL_FULL_MANIFEST_FILE, LOCAL_FULL_LIBS_MANIFEST_FILES
# Output: full_android_manifest
ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
LOCAL_MANIFEST_FILE := AndroidManifest.xml
endif
ifdef LOCAL_FULL_MANIFEST_FILE
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
else
full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
endif
my_full_libs_manifest_files := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
my_full_libs_manifest_deps := $(LOCAL_FULL_LIBS_MANIFEST_FILES)
# Set up dependency on aar libraries
ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES
my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar)
my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml)
LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),\
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res)
endif
# Set up rules to merge library manifest files
ifdef my_full_libs_manifest_files
main_android_manifest := $(full_android_manifest)
full_android_manifest := $(intermediates.COMMON)/AndroidManifest.xml
$(full_android_manifest): PRIVATE_LIBS_MANIFESTS := $(my_full_libs_manifest_files)
$(full_android_manifest) : $(main_android_manifest) $(my_full_libs_manifest_deps)
@echo "Merge android manifest files: $@ <-- $< $(PRIVATE_LIBS_MANIFESTS)"
@mkdir -p $(dir $@)
$(hide) $(ANDROID_MANIFEST_MERGER) --main $< --libs $(PRIVATE_LIBS_MANIFESTS) \
--out $@
endif

View File

@ -0,0 +1,17 @@
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "@hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************

View File

@ -0,0 +1,7 @@
******************************
You have tried to change the API from what has been previously released in
an SDK. Please fix the errors listed above.
******************************

690
build/core/base_rules.mk Normal file
View File

@ -0,0 +1,690 @@
#
# 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.
#
# Users can define base-rules-hook in their buildspec.mk to perform
# arbitrary operations as each module is included.
ifdef base-rules-hook
$(if $(base-rules-hook),)
endif
###########################################################
## Common instructions for a generic module.
###########################################################
LOCAL_MODULE := $(strip $(LOCAL_MODULE))
ifeq ($(LOCAL_MODULE),)
$(error $(LOCAL_PATH): LOCAL_MODULE is not defined)
endif
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
ifdef LOCAL_IS_HOST_MODULE
ifneq ($(LOCAL_IS_HOST_MODULE),true)
$(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
endif
my_prefix := HOST_
my_host := host-
else
my_prefix := TARGET_
my_host :=
endif
my_module_tags := $(LOCAL_MODULE_TAGS)
###########################################################
## Validate and define fallbacks for input LOCAL_* variables.
###########################################################
## Dump a .csv file of all modules and their tags
#ifneq ($(tag-list-first-time),false)
#$(shell rm -f tag-list.csv)
#tag-list-first-time := false
#endif
#$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(my_module_tags))) >> tag-list.csv)
LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
my_module_tags := $(sort $(my_module_tags))
ifeq (,$(my_module_tags))
my_module_tags := optional
endif
# User tags are not allowed anymore. Fail early because it will not be installed
# like it used to be.
ifneq ($(filter $(my_module_tags),user),)
$(warning *** Module name: $(LOCAL_MODULE))
$(warning *** Makefile location: $(LOCAL_MODULE_MAKEFILE))
$(warning * )
$(warning * Module is attempting to use the 'user' tag. This)
$(warning * used to cause the module to be installed automatically.)
$(warning * Now, the module must be listed in the PRODUCT_PACKAGES)
$(warning * section of a product makefile to have it installed.)
$(warning * )
$(error user tag detected on module.)
endif
# Only the tags mentioned in this test are expected to be set by module
# makefiles. Anything else is either a typo or a source of unexpected
# behaviors.
ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
$(warning unusual tags $(my_module_tags) on $(LOCAL_MODULE) at $(LOCAL_PATH))
endif
# 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*", "*_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* 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))
endif
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
$(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
partition_tag :=
else
ifeq (true,$(LOCAL_PROPRIETARY_MODULE))
partition_tag := _VENDOR
else ifeq (true,$(LOCAL_OEM_MODULE))
partition_tag := _OEM
else
# The definition of should-install-to-system will be different depending
# on which goal (e.g., sdk or just droid) is being built.
partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
endif
endif
install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
install_path_var := $(install_path_var)_PRIVILEGED
endif
my_module_path := $($(install_path_var))
ifeq ($(strip $(my_module_path)),)
$(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)")
endif
endif
ifneq ($(my_module_relative_path),)
my_module_path := $(my_module_path)/$(my_module_relative_path)
endif
endif # not LOCAL_UNINSTALLABLE_MODULE
ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
$(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
endif
my_register_name := $(LOCAL_MODULE)
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
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 \
$(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
ifdef $(module_id)
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
endif
$(module_id) := $(LOCAL_PATH)
intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
generated_sources_dir := $(call local-generated-sources-dir)
###########################################################
# Pick a name for the intermediate and final targets
###########################################################
include $(BUILD_SYSTEM)/configure_module_stem.mk
# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
# internal SHARED_LIBRARIES build files.
OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
ifdef OVERRIDE_BUILT_MODULE_PATH
ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
endif
built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
else
built_module_path := $(intermediates)
endif
LOCAL_BUILT_MODULE := $(built_module_path)/$(my_built_module_stem)
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
# Apk and its attachments reside in its own subdir.
ifeq ($(LOCAL_MODULE_CLASS),APPS)
# framework-res.apk doesn't like the additional layer.
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
my_module_path := $(my_module_path)/$(LOCAL_MODULE)
endif
endif
LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem)
endif
# Assemble the list of targets to create PRIVATE_ variables for.
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
###########################################################
## AIDL: Compile .aidl files to .java
###########################################################
aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES))
ifneq ($(strip $(aidl_sources)),)
aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources)))
aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources))
aidl_preprocess_import :=
LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION))
ifdef LOCAL_SDK_VERSION
ifneq ($(filter current system_current, $(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS)),)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS
aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl
else
aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl
endif # not current or system_current
else
# build against the platform.
LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
endif # LOCAL_SDK_VERSION
$(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES))
$(aidl_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.aidl $(LOCAL_ADDITIONAL_DEPENDENCIES) $(AIDL) $(aidl_preprocess_import)
$(transform-aidl-to-java)
-include $(aidl_java_sources:%.java=%.P)
else
aidl_java_sources :=
endif
###########################################################
## logtags: Add .logtags files to global list, emit java source
###########################################################
logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES))
ifneq ($(strip $(logtags_sources)),)
event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
# Emit a java source file with constants for the tags, if
# LOCAL_MODULE_CLASS is "APPS" or "JAVA_LIBRARIES".
ifneq ($(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES),)
logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources)))
logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources))
$(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
$(transform-logtags-to-java)
endif
else
logtags_java_sources :=
event_log_tags :=
endif
###########################################################
## .proto files: Compile proto files to .java
###########################################################
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
# Because names of the .java files compiled from .proto files are unknown until the
# .proto files are compiled, we use a timestamp file as depedency.
proto_java_sources_file_stamp :=
ifneq ($(proto_sources),)
proto_sources_fullpath := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(proto_sources))
# By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be
# automatically found by the java compiling function transform-java-to-classes.jar.
ifneq ($(LOCAL_INTERMEDIATE_SOURCE_DIR),)
proto_java_intemediate_dir := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/proto
else
# LOCAL_INTERMEDIATE_SOURCE_DIR may be not defined in non-java modules.
proto_java_intemediate_dir := $(intermediates)/proto
endif
proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp
proto_java_sources_dir := $(proto_java_intemediate_dir)/src
$(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP)
$(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath)
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir)
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out
else
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
else
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
endif
endif
$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
$(call transform-proto-to-java)
#TODO: protoc should output the dependencies introduced by imports.
LOCAL_INTERMEDIATE_TARGETS += $(proto_java_sources_file_stamp)
endif # proto_sources
###########################################################
## Java: Compile .java files to .class
###########################################################
#TODO: pull this into java.make once host and target are combined
java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \
$(filter %.java,$(LOCAL_GENERATED_SOURCES))
all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
## Java resources #########################################
# Look for resource files in any specified directories.
# Non-java and non-doc files will be picked up as resources
# and included in the output jar file.
java_resource_file_groups :=
LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS))
ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),)
# This makes a list of words like
# <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>:
# where each of the files is relative to the directory it's grouped with.
# Directories that don't contain any resource files will result in groups
# that end with a colon, and they are stripped out in the next step.
java_resource_file_groups += \
$(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \
$(subst $(space),:,$(strip \
$(TOP_DIR)$(LOCAL_PATH)/$(dir): \
$(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \
find . \
-type d -a -name ".svn" -prune -o \
-type f \
-a \! -name "*.java" \
-a \! -name "package.html" \
-a \! -name "overview.html" \
-a \! -name ".*.swp" \
-a \! -name ".DS_Store" \
-a \! -name "*~" \
-print \
)) \
)) \
)
java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups))
endif # LOCAL_JAVA_RESOURCE_DIRS
LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES))
ifneq ($(LOCAL_JAVA_RESOURCE_FILES),)
java_resource_file_groups += \
$(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \
$(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \
)
endif # LOCAL_JAVA_RESOURCE_FILES
ifdef java_resource_file_groups
# The full paths to all resources, used for dependencies.
java_resource_sources := \
$(foreach group,$(java_resource_file_groups), \
$(addprefix $(word 1,$(subst :,$(space),$(group)))/, \
$(wordlist 2,9999,$(subst :,$(space),$(group))) \
) \
)
# The arguments to jar that will include these files in a jar file.
# Quote the file name to handle special characters (such as #) correctly.
extra_jar_args := \
$(foreach group,$(java_resource_file_groups), \
$(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \
$(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \
) \
)
java_resource_file_groups :=
else
java_resource_sources :=
extra_jar_args :=
endif # java_resource_file_groups
## PRIVATE java vars ######################################
# LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files,
# but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR.
# You have to set up the dependency in some other way.
need_compile_java := $(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))
ifdef need_compile_java
full_static_java_libs := \
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
$(call intermediates-dir-for, \
JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE))
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES))
ifeq ($(my_prefix),TARGET_)
ifeq ($(LOCAL_SDK_VERSION),)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart)
else
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_system_stubs_current)
else
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION))
endif # current or system_current
endif # LOCAL_SDK_VERSION
endif # TARGET_
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs)
# full_java_libs: The list of files that should be used as the classpath.
# Using this list as a dependency list WILL NOT WORK.
# full_java_lib_deps: Should be specified as a prerequisite of this module
# to guarantee that the files in full_java_libs will
# be up-to-date.
ifdef LOCAL_IS_HOST_MODULE
ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-deps,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE))
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
else
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
full_java_lib_deps := $(full_shared_java_libs)
endif # USE_CORE_LIB_BOOTCLASSPATH
else # !LOCAL_IS_HOST_MODULE
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE))
endif # !LOCAL_IS_HOST_MODULE
full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH)
# This is set by packages that are linking to other packages that export
# shared libraries, allowing them to make use of the code in the linked apk.
apk_libraries := $(sort $(LOCAL_APK_LIBRARIES) $(LOCAL_RES_LIBRARIES))
ifneq ($(apk_libraries),)
link_apk_libraries := \
$(foreach lib,$(apk_libraries), \
$(call intermediates-dir-for, \
APPS,$(lib),,COMMON)/classes.jar)
# link against the jar with full original names (before proguard processing).
full_shared_java_libs += $(link_apk_libraries)
full_java_libs += $(link_apk_libraries)
full_java_lib_deps += $(link_apk_libraries)
endif
# This is set by packages that contain instrumentation, allowing them to
# link against the package they are instrumenting. Currently only one such
# package is allowed.
LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR))
ifdef LOCAL_INSTRUMENTATION_FOR
ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1)
$(error \
$(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined)
endif
link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \
APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON)
# link against the jar with full original names (before proguard processing).
link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar
full_java_libs += $(link_instr_classes_jar)
full_java_lib_deps += $(link_instr_classes_jar)
endif
endif # need_compile_java
# We may want to add jar manifest or jar resource files even if there is no java code at all.
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
jar_manifest_file :=
ifneq ($(strip $(LOCAL_JAR_MANIFEST)),)
jar_manifest_file := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(jar_manifest_file)
else
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST :=
endif
###########################################################
## make clean- targets
###########################################################
cleantarget := clean-$(my_register_name)
$(cleantarget) : PRIVATE_MODULE := $(my_register_name)
$(cleantarget) : PRIVATE_CLEAN_FILES := \
$(LOCAL_BUILT_MODULE) \
$(LOCAL_INSTALLED_MODULE) \
$(intermediates)
$(cleantarget)::
@echo "Clean: $(PRIVATE_MODULE)"
$(hide) rm -rf $(PRIVATE_CLEAN_FILES)
###########################################################
## Common definitions for module.
###########################################################
# aapt doesn't accept multiple --extra-packages flags.
# We have to collapse them into a single --extra-packages flag here.
LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS))
ifdef LOCAL_AAPT_FLAGS
ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),)
aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS))
aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags)))
aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages)))
LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \
--extra-packages $(subst $(space),:,$(aapt_flags_extra_packages))
aapt_flags_extra_packages :=
aapt_flags :=
endif
endif
# Propagate local configuration options to this target.
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR:= $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
# Tell the module and all of its sub-modules who it is.
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name)
# Provide a short-hand for building this module.
# We name both BUILT and INSTALLED in case
# LOCAL_UNINSTALLABLE_MODULE is set.
.PHONY: $(my_register_name)
$(my_register_name): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
###########################################################
## Module installation rule
###########################################################
# Some hosts do not have ACP; override the LOCAL version if that's the case.
ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),)
LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE))
endif
ifndef LOCAL_UNINSTALLABLE_MODULE
# Define a copy rule to install the module.
# acp and libraries that it uses can't use acp for
# installation; hence, LOCAL_ACP_UNAVAILABLE.
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP)
@echo "Install: $@"
$(copy-file-to-new-target)
$(PRIVATE_POST_INSTALL_CMD)
else
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
@echo "Install: $@"
$(copy-file-to-target-with-cp)
endif
endif # !LOCAL_UNINSTALLABLE_MODULE
###########################################################
## CHECK_BUILD goals
###########################################################
ifdef java_alternative_checked_module
LOCAL_CHECKED_MODULE := $(java_alternative_checked_module)
endif
# If nobody has defined a more specific module for the
# checked modules, use LOCAL_BUILT_MODULE.
ifndef LOCAL_CHECKED_MODULE
LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE)
endif
# If they request that this module not be checked, then don't.
# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
# GOOD REASON WILL HAVE IT REMOVED.
ifdef LOCAL_DONT_CHECK_MODULE
LOCAL_CHECKED_MODULE :=
endif
# 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
###########################################################
ALL_MODULES += $(my_register_name)
# Don't use += on subvars, or else they'll end up being
# recursively expanded.
ALL_MODULES.$(my_register_name).CLASS := \
$(ALL_MODULES.$(my_register_name).CLASS) $(LOCAL_MODULE_CLASS)
ALL_MODULES.$(my_register_name).PATH := \
$(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH)
ALL_MODULES.$(my_register_name).TAGS := \
$(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags)
ALL_MODULES.$(my_register_name).CHECKED := \
$(ALL_MODULES.$(my_register_name).CHECKED) $(LOCAL_CHECKED_MODULE)
ALL_MODULES.$(my_register_name).BUILT := \
$(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
ALL_MODULES.$(my_register_name).INSTALLED := \
$(strip $(ALL_MODULES.$(my_register_name).INSTALLED) $(LOCAL_INSTALLED_MODULE))
ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
$(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) $(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE))
endif
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 := \
$(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 := \
$(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR)
ALL_MODULES.$(my_register_name).MAKEFILE := \
$(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
ifdef LOCAL_MODULE_OWNER
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
ifdef aidl_sources
ALL_MODULES.$(my_register_name).AIDL_FILES := $(aidl_sources)
endif
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
###########################################################
## Take care of my_module_tags
###########################################################
# Keep track of all the tags we've seen.
ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
# Add this module to the tag list of each specified tag.
# Don't use "+=". If the variable hasn't been set with ":=",
# it will default to recursive expansion.
$(foreach tag,$(my_module_tags),\
$(eval ALL_MODULE_TAGS.$(tag) := \
$(ALL_MODULE_TAGS.$(tag)) \
$(LOCAL_INSTALLED_MODULE)))
# Add this module name to the tag list of each specified tag.
$(foreach tag,$(my_module_tags),\
$(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
###########################################################
## umbrella targets used to verify builds
###########################################################
j_or_n :=
ifneq (,$(filter EXECUTABLES SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)))
j_or_n := native
else
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
j_or_n := java
endif
endif
ifdef LOCAL_IS_HOST_MODULE
h_or_t := host
else
h_or_t := target
endif
ifdef j_or_n
$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(LOCAL_CHECKED_MODULE)
ifneq (,$(filter $(my_module_tags),tests))
$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(LOCAL_CHECKED_MODULE)
endif
endif
###########################################################
## NOTICE files
###########################################################
include $(BUILD_NOTICE_FILE)
#:vi noexpandtab

996
build/core/binary.mk Normal file
View File

@ -0,0 +1,996 @@
###########################################################
## Standard rules for building binary object files from
## asm/c/cpp/yacc/lex/etc source files.
##
## The list of object files is exported in $(all_objects).
###########################################################
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
my_ndk_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.)
endif
ifdef LOCAL_IS_HOST_MODULE
$(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_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
my_ndk_stl_include_path :=
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 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))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/system/include
# for "system" variant, the shared library exists in the system library and -lstdc++ is added by default.
else # LOCAL_NDK_STL_VARIANT is not system
ifneq (,$(filter stlport_%, $(LOCAL_NDK_STL_VARIANT)))
my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/stlport/stlport
ifeq (stlport_static,$(LOCAL_NDK_STL_VARIANT))
my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/stlport/libs/$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)CPU_ABI)/libstlport_static.a
else
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++/$($(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
##################################################
# Compute the dependency of the shared libraries
##################################################
# On the target, we compile with -nostdlib, so we must add in the
# default system shared libraries, unless they have requested not
# to by supplying a LOCAL_SYSTEM_SHARED_LIBRARIES value. One would
# supply that, for example, when building libc itself.
ifdef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
my_system_shared_libraries :=
else
my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
endif
else
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
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
# 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)
my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
my_whole_static_libraries := $(LOCAL_WHOLE_STATIC_LIBRARIES)
my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
my_cflags := $(LOCAL_CFLAGS)
my_cppflags := $(LOCAL_CPPFLAGS)
my_ldflags := $(LOCAL_LDFLAGS)
my_asflags := $(LOCAL_ASFLAGS)
my_cc := $(LOCAL_CC)
my_cxx := $(LOCAL_CXX)
my_c_includes := $(LOCAL_C_INCLUDES)
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
# all code is position independent, and then those warnings get promoted to
# errors.
ifeq ($(strip $(USE_MINGW)),)
ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
my_cflags += -fpie
else
my_cflags += -fPIC
endif
endif
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))
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
ifdef LOCAL_HAL_STATIC_LIBRARIES
$(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
$(eval b_lib := $(filter $(lib).%,$(BOARD_HAL_STATIC_LIBRARIES)))\
$(if $(b_lib), $(eval my_static_libraries += $(b_lib)),\
$(eval my_static_libraries += $(lib).default)))
b_lib :=
endif
ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
my_clang := true
# Frame pointer based unwinder in ASan requires ARM frame setup.
LOCAL_ARM_MODE := arm
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 $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_$(my_prefix)CLANG)),true)
my_clang :=
endif
# Add in libcompiler_rt for all regular device builds
ifeq (,$(LOCAL_SDK_VERSION)$(LOCAL_IS_HOST_MODULE)$(WITHOUT_LIBCOMPILER_RT))
my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
endif
my_compiler_dependencies :=
##################################################################
## Add FDO flags if FDO is turned on and supported
## Please note that we will do option filtering during FDO build.
## i.e. Os->O2, remove -fno-early-inline and -finline-limit.
##################################################################
ifeq ($(strip $(LOCAL_FDO_SUPPORT)), true)
ifeq ($(strip $(LOCAL_IS_HOST_MODULE)),)
my_cflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_CFLAGS)
my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LDFLAGS)
endif
endif
###########################################################
## Explicitly declare assembly-only __ASSEMBLY__ macro for
## assembly source
###########################################################
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 += \
$(my_register_name):$(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_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 ($(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_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
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)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
else # LOCAL_IS_HOST_MODULE
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 := $($(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)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_LDFLAGS := $(my_host_global_ldflags)
endif # LOCAL_IS_HOST_MODULE
###########################################################
## Define PRIVATE_ variables used by multiple module types
###########################################################
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
$(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
ifeq ($(strip $(WITH_SYNTAX_CHECK)),)
LOCAL_NO_SYNTAX_CHECK := true
endif
ifeq ($(strip $(WITH_STATIC_ANALYZER)),)
LOCAL_NO_STATIC_ANALYZER := true
endif
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
my_syntax_arch := host
else
my_syntax_arch := $(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
endif
ifeq ($(strip $(my_cc)),)
ifeq ($(strip $(my_clang)),true)
my_cc := $(CLANG)
else
my_cc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CC)
endif
endif
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-analyzer $(my_syntax_arch) "$(my_cc)"
else
ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
my_cc := $(SYNTAX_TOOLS_PREFIX)/ccc-syntax $(my_syntax_arch) "$(my_cc)"
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(my_cc)
ifeq ($(strip $(my_cxx)),)
ifeq ($(strip $(my_clang)),true)
my_cxx := $(CLANG_CXX)
else
my_cxx := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)CXX)
endif
endif
ifneq ($(LOCAL_NO_STATIC_ANALYZER),true)
my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-analyzer $(my_syntax_arch) "$(my_cxx)"
else
ifneq ($(LOCAL_NO_SYNTAX_CHECK),true)
my_cxx := $(SYNTAX_TOOLS_PREFIX)/cxx-syntax $(my_syntax_arch) "$(my_cxx)"
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang)
# TODO: support a mix of standard extensions so that this isn't necessary
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
ifeq ($(LOCAL_CPP_EXTENSION),)
LOCAL_CPP_EXTENSION := .cpp
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPP_EXTENSION := $(LOCAL_CPP_EXTENSION)
# Certain modules like libdl have to have symbols resolved at runtime and blow
# up if --no-undefined is passed to the linker.
ifeq ($(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS)),)
ifeq ($(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)),)
my_ldflags += $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)NO_UNDEFINED_LDFLAGS)
endif
endif
ifeq (true,$(LOCAL_GROUP_STATIC_LIBRARIES))
$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES := true
else
$(LOCAL_BUILT_MODULE): PRIVATE_GROUP_STATIC_LIBRARIES :=
endif
###########################################################
## Define arm-vs-thumb-mode flags.
###########################################################
LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE))
ifeq ($(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH),arm)
arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm)
normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb)
# Read the values from something like TARGET_arm_CFLAGS or
# TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't
# 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 $(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
arm_objects_mode :=
normal_objects_mode :=
arm_objects_cflags :=
normal_objects_cflags :=
endif
###########################################################
## Define per-module debugging flags. Users can turn on
## debugging for a particular module by setting DEBUG_MODULE_ModuleName
## to a non-empty value in their environment or buildspec.mk,
## and setting HOST_/TARGET_CUSTOM_DEBUG_CFLAGS to the
## debug flags that they want to use.
###########################################################
ifdef DEBUG_MODULE_$(strip $(LOCAL_MODULE))
debug_cflags := $($(my_prefix)CUSTOM_DEBUG_CFLAGS)
else
debug_cflags :=
endif
####################################################
## Compile RenderScript with reflected C++
####################################################
renderscript_sources := $(filter %.rs %.fs,$(my_src_files))
ifneq (,$(renderscript_sources))
renderscript_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(renderscript_sources))
RenderScript_file_stamp := $(intermediates)/RenderScriptCPP.stamp
renderscript_intermediate := $(intermediates)/renderscript
ifeq ($(LOCAL_RENDERSCRIPT_CC),)
LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
endif
# Turn on all warnings and warnings as errors for RS compiles.
# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error
renderscript_flags := -Wall -Werror
renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS)
# -m32 or -m64
renderscript_flags += -m$(my_32_64_bit_suffix)
renderscript_includes := \
$(TOPDIR)external/clang/lib/Headers \
$(TOPDIR)frameworks/rs/scriptc \
$(LOCAL_RENDERSCRIPT_INCLUDES)
ifneq ($(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE),)
renderscript_includes := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
endif
$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes)
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags)
$(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath)
$(RenderScript_file_stamp): PRIVATE_RS_OUTPUT_DIR := $(renderscript_intermediate)
$(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
$(transform-renderscripts-to-cpp-and-bc)
# include the dependency files (.d) generated by llvm-rs-cc.
renderscript_generated_dep_files := $(addprefix $(renderscript_intermediate)/, \
$(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
-include $(renderscript_generated_dep_files)
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
rs_generated_cpps := $(addprefix \
$(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
$(notdir $(renderscript_sources)))))
# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
$(rs_generated_cpps) : $(RenderScript_file_stamp)
@echo "Updated RS generated cpp file $@."
my_c_includes += $(renderscript_intermediate)
my_generated_sources += $(rs_generated_cpps)
endif
###########################################################
## Stuff source generated from one-off tools
###########################################################
$(my_generated_sources): PRIVATE_MODULE := $(my_register_name)
my_gen_sources_copy := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(filter $(generated_sources_dir)/%,$(my_generated_sources)))
$(my_gen_sources_copy): $(intermediates)/% : $(generated_sources_dir)/% | $(ACP)
@echo "Copy: $@"
$(copy-file-to-target)
my_generated_sources := $(patsubst $(generated_sources_dir)/%,$(intermediates)/%,$(my_generated_sources))
ALL_GENERATED_SOURCES += $(my_generated_sources)
###########################################################
## Compile the .proto files to .cc and then to .o
###########################################################
proto_sources := $(filter %.proto,$(my_src_files))
proto_generated_objects :=
proto_generated_headers :=
ifneq ($(proto_sources),)
proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
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_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)))
# Auto-export the generated proto source dir.
LOCAL_EXPORT_C_INCLUDE_DIRS += $(proto_generated_cc_sources_dir)
# 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)
# This is just a dummy rule to make sure gmake doesn't skip updating the dependents.
$(proto_generated_headers): $(proto_generated_cc_sources_dir)/%.pb.h: $(proto_generated_cc_sources_dir)/%.pb.cc
@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_obj_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(proto_generated_objects:%.o=%.P)
my_c_includes += external/protobuf/src $(proto_generated_cc_sources_dir)
my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),full)
my_static_libraries += libprotobuf-cpp-2.3.0-full
else
my_static_libraries += libprotobuf-cpp-2.3.0-lite
endif
endif # $(proto_sources) non-empty
###########################################################
## YACC: Compile .y and .yy files to .cpp and the to .o.
###########################################################
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 $(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)
$(transform-$(PRIVATE_HOST)cpp-to-o)
endif
###########################################################
## LEX: Compile .l and .ll files to .cpp and then to .o.
###########################################################
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 $(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: \
$(intermediates)/%$(LOCAL_CPP_EXTENSION) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
$(yacc_headers)
$(transform-$(PRIVATE_HOST)cpp-to-o)
endif
###########################################################
## C++: Compile .cpp files to .o.
###########################################################
# we also do this on host modules, even though
# it's not really arm, because there are files that are shared.
cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)))
cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files))
cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
$(cpp_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
$(cpp_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(cpp_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
cpp_objects := $(cpp_arm_objects) $(cpp_normal_objects)
ifneq ($(strip $(cpp_objects)),)
$(cpp_objects): $(intermediates)/%.o: \
$(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
$(yacc_cpps) $(proto_generated_headers) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(cpp_objects:%.o=%.P)
endif
###########################################################
## C++: Compile generated .cpp files to .o.
###########################################################
gen_cpp_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_generated_sources))
gen_cpp_objects := $(gen_cpp_sources:%$(LOCAL_CPP_EXTENSION)=%.o)
ifneq ($(strip $(gen_cpp_objects)),)
# Compile all generated files as thumb.
# TODO: support compiling certain generated files as arm.
$(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(gen_cpp_objects): $(intermediates)/%.o: \
$(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
$(proto_generated_headers) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)cpp-to-o)
-include $(gen_cpp_objects:%.o=%.P)
endif
###########################################################
## S: Compile generated .S and .s files to .o.
###########################################################
gen_S_sources := $(filter %.S,$(my_generated_sources))
gen_S_objects := $(gen_S_sources:%.S=%.o)
ifneq ($(strip $(gen_S_sources)),)
$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)s-to-o)
-include $(gen_S_objects:%.o=%.P)
endif
gen_s_sources := $(filter %.s,$(my_generated_sources))
gen_s_objects := $(gen_s_sources:%.s=%.o)
ifneq ($(strip $(gen_s_objects)),)
$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
-include $(gen_s_objects:%.o=%.P)
endif
gen_asm_objects := $(gen_S_objects) $(gen_s_objects)
###########################################################
## o: Include generated .o files in output.
###########################################################
gen_o_objects := $(filter %.o,$(my_generated_sources))
###########################################################
## C: Compile .c files to .o.
###########################################################
c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files)))
c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
c_normal_sources := $(filter %.c,$(my_src_files))
c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
$(c_arm_objects): PRIVATE_ARM_CFLAGS := $(arm_objects_cflags)
$(c_normal_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(c_normal_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
c_objects := $(c_arm_objects) $(c_normal_objects)
ifneq ($(strip $(c_objects)),)
$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)c-to-o)
-include $(c_objects:%.o=%.P)
endif
###########################################################
## C: Compile generated .c files to .o.
###########################################################
gen_c_sources := $(filter %.c,$(my_generated_sources))
gen_c_objects := $(gen_c_sources:%.c=%.o)
ifneq ($(strip $(gen_c_objects)),)
# Compile all generated files as thumb.
# TODO: support compiling certain generated files as arm.
$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)c-to-o)
-include $(gen_c_objects:%.o=%.P)
endif
###########################################################
## ObjC: Compile .m files to .o
###########################################################
objc_sources := $(filter %.m,$(my_src_files))
objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
ifneq ($(strip $(objc_objects)),)
$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)m-to-o)
-include $(objc_objects:%.o=%.P)
endif
###########################################################
## AS: Compile .S files to .o.
###########################################################
asm_sources_S := $(filter %.S,$(my_src_files))
asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
ifneq ($(strip $(asm_objects_S)),)
$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)s-to-o)
-include $(asm_objects_S:%.o=%.P)
endif
asm_sources_s := $(filter %.s,$(my_src_files))
asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
ifneq ($(strip $(asm_objects_s)),)
$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
$(LOCAL_ADDITIONAL_DEPENDENCIES) \
| $(my_compiler_dependencies)
$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
-include $(asm_objects_s:%.o=%.P)
endif
asm_objects := $(asm_objects_S) $(asm_objects_s)
# .asm for x86 needs to be compiled with yasm.
ifeq (x86,$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
asm_sources_asm := $(filter %.asm,$(my_src_files))
ifneq ($(strip $(asm_sources_asm)),)
asm_objects_asm := $(addprefix $(intermediates)/,$(asm_sources_asm:.asm=.o))
$(asm_objects_asm): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.asm \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-asm-to-o)
asm_objects += $(asm_objects_asm)
endif
endif
####################################################
## Import includes
####################################################
import_includes := $(intermediates)/import_includes
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) $(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: $@
$(hide) mkdir -p $(dir $@) && rm -f $@
ifdef import_includes_deps
$(hide) for f in $^; do \
cat $$f >> $@; \
done
else
$(hide) touch $@
endif
###########################################################
## Common object handling.
###########################################################
# some rules depend on asm_objects being first. If your code depends on
# being first, it's reasonable to require it to be assembly
normal_objects := \
$(asm_objects) \
$(cpp_objects) \
$(gen_cpp_objects) \
$(gen_asm_objects) \
$(c_objects) \
$(gen_c_objects) \
$(objc_objects) \
$(yacc_objects) \
$(lex_objects) \
$(proto_generated_objects) \
$(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
all_objects := $(normal_objects) $(gen_o_objects)
my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir)
ifndef LOCAL_SDK_VERSION
my_c_includes += $(JNI_H_INCLUDE)
endif
# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;
# use normal_objects here to avoid creating circular dependencies. This assumes
# that custom build rules which generate .o files don't consume other generated
# sources as input (or if they do they take care of that dependency themselves).
$(normal_objects) : | $(my_generated_sources)
$(all_objects) : | $(import_includes)
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
###########################################################
# Standard library handling.
###########################################################
###########################################################
# The list of libraries that this module will link against are in
# these variables. Each is a list of bare module names like "libc libm".
#
# LOCAL_SHARED_LIBRARIES
# LOCAL_STATIC_LIBRARIES
# LOCAL_WHOLE_STATIC_LIBRARIES
#
# We need to convert the bare names into the dependencies that
# we'll use for LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE.
# LOCAL_BUILT_MODULE should depend on the BUILT versions of the
# libraries, so that simply building this module doesn't force
# an install of a library. Similarly, LOCAL_INSTALLED_MODULE
# should depend on the INSTALLED versions of the libraries so
# that they get installed when this module does.
###########################################################
# NOTE:
# WHOLE_STATIC_LIBRARIES are libraries that are pulled into the
# module without leaving anything out, which is useful for turning
# a collection of .a files into a .so file. Linking against a
# normal STATIC_LIBRARY will only pull in code/symbols that are
# referenced by the module. (see gcc/ld's --whole-archive option)
###########################################################
# Get the list of BUILT libraries, which are under
# various intermediates directories.
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
a_suffix := $($(my_prefix)STATIC_LIB_SUFFIX)
ifdef LOCAL_SDK_VERSION
built_shared_libraries := \
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(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_sysroot_lib)/, \
$(addsuffix $(so_suffix), $(my_system_shared_libraries)))
built_shared_libraries += $(my_system_shared_libraries_fullpath)
else
built_shared_libraries := \
$(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
$(addsuffix $(so_suffix), \
$(installed_shared_library_module_names)))
endif
built_static_libraries := \
$(foreach lib,$(my_static_libraries), \
$(call intermediates-dir-for, \
STATIC_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/$(lib)$(a_suffix))
ifdef LOCAL_SDK_VERSION
built_static_libraries += $(my_ndk_stl_static_lib)
endif
built_whole_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))
# We don't care about installed static libraries, since the
# libraries have already been linked into the module at that point.
# We do, however, care about the NOTICE files for any static
# libraries that we use. (see notice_files.mk)
installed_static_library_notice_file_targets := \
$(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
# Default is -fno-rtti.
ifeq ($(strip $(LOCAL_RTTI_FLAG)),)
LOCAL_RTTI_FLAG := -fno-rtti
endif
###########################################################
# Rule-specific variable definitions
###########################################################
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
ifeq ($(LOCAL_FDO_SUPPORT), true)
build_with_fdo := false
ifeq ($(BUILD_FDO_INSTRUMENT), true)
build_with_fdo := true
endif
ifeq ($(BUILD_FDO_OPTIMIZE), true)
build_with_fdo := true
endif
ifeq ($(build_with_fdo), true)
my_cflags := $(patsubst -Os,-O2,$(my_cflags))
fdo_incompatible_flags=-fno-early-inlining -finline-limit=%
my_cflags := $(filter-out $(fdo_incompatible_flags),$(my_cflags))
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_YACCFLAGS := $(LOCAL_YACCFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASFLAGS := $(my_asflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CONLYFLAGS := $(LOCAL_CONLYFLAGS)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CFLAGS := $(my_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(my_cppflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
$(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
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_SHARED_LIBRARIES := $(built_shared_libraries)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_STATIC_LIBRARIES := $(built_static_libraries)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(built_whole_libraries)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ALL_OBJECTS := $(all_objects)
###########################################################
# Define library dependencies.
###########################################################
# all_libraries is used for the dependencies on LOCAL_BUILT_MODULE.
all_libraries := \
$(built_shared_libraries) \
$(built_static_libraries) \
$(built_whole_libraries)
# Also depend on the notice files for any static libraries that
# are linked into this module. This will force them to be installed
# when this module is.
$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
###########################################################
# Export includes
###########################################################
export_includes := $(intermediates)/export_includes
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
# Make sure .pb.h are already generated before any dependent source files get compiled.
$(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers)
@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
# Make sure export_includes gets generated when you are running mm/mmm
$(LOCAL_BUILT_MODULE) : | $(export_includes)

View File

@ -0,0 +1,962 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
A lot of people read this document template. Please keep it clean:
- keep the document xhtml-compliant, as many people use validating editors
- check your edits for typos, spelling errors, and questionable grammar
- prefer css styles to formatting tags like <font>, <tt>, etc.
- keep it human-readable and human-editable in a plain text editor:
- strive to keep lines wrapped at 80 columns, unless a link prevents it
- use plenty of whitespace
- try to pretty-format (wrt nesting and indenting) any hairy html
- check your inline javascript for errors using the javascript console
Your readers will be very appreciative.
-->
<head>
<title>Android Build System</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../android.css" type="text/css" rel="stylesheet" />
<!-- commenting out so the xhtml validator doesn't whine about < and &&;
the browser should still find the script tag. -->
<script language="JavaScript1.2" type="text/javascript">
<!--
function highlight(name) {
if (document.getElementsByTagName) {
tags = [ 'span', 'div', 'tr', 'td' ];
for (i in tags) {
elements = document.getElementsByTagName(tags[i]);
if (elements) {
for (j = 0; j < elements.length; j++) {
elementName = elements[j].getAttribute("class");
if (elementName == name) {
elements[j].style.backgroundColor = "#C0F0C0";
} else if (elementName && elementName.indexOf("rev") == 0) {
elements[j].style.backgroundColor = "#FFFFFF";
}
}
}
}
}
}
//-->
</script>
<!-- this style sheet is for the style of the toc -->
<link href="toc.css" type="text/css" rel="stylesheet" />
<style type="text/css">
.warning {
border: 1px solid red;
padding: 8px;
color: red;
}
pre.prettyprint {
margin-top: 0;
}
li {
margin-top: 8px;
}
</style>
</head>
<body onload="prettyPrint()">
<h1><a name="My_Project_" />Android Build System</h1>
<!-- Status is one of: Draft, Current, Needs Update, Obsolete -->
<p style="text-align:center">
<strong>Status:</strong> <em>Draft </em> &nbsp;
<small>(as of May 18, 2006)</small>
</p>
<p><b>Contents</b></p>
<!-- this div expands out to a list of contents based on the H2 and H3 headings.
Believe it! -->
<div id="nav" class="nav-2-levels"></div>
<h2>Objective</h2>
<p>The primary goals of reworking the build system are (1) to make dependencies
work more reliably, so that when files need to rebuilt, they are, and (2) to
improve performance of the build system so that unnecessary modules are not
rebuilt, and so doing a top-level build when little or nothing needs to be done
for a build takes as little time as possible.</p>
<h2>Principles and Use Cases and Policy</h2>
<p>Given the above objective, these are the overall principles and use cases
that we will support. This is not an exhaustive list.</p>
<h3>Multiple Targets</h3>
<p>It needs to be possible to build the Android platform for multiple targets.
This means:</p>
<ul>
<li>The build system will support building tools for the host platform,
both ones that are used in the build process itself, and developer tools
like the simulator.</li>
<li>The build system will need to be able to build tools on Linux
(definitely Goobuntu and maybe Grhat), MacOS, and to some degree on
Windows.</li>
<li>The build system will need to be able to build the OS on Linux, and in
the short-term, MacOS. Note that this is a conscious decision to stop
building the OS on Windows. We are going to rely on the emulator there
and not attempt to use the simulator. This is a requirement change now
that the emulator story is looking brighter.</li>
</ul>
<h3>Non-Recursive Make</h3>
<p>To achieve the objectives, the build system will be rewritten to use make
non-recursively. For more background on this, read <a href="http://aegis.sourceforge.net/auug97.pdf">Recursive Make Considered Harmful</a>. For those that don't
want PDF, here is the
<a href="http://72.14.203.104/search?q=cache:HwuX7YF2uBIJ:aegis.sourceforge.net/auug97.pdf&hl=en&gl=us&ct=clnk&cd=2&client=firefox">Google translated version</a>.
<h3>Rapid Compile-Test Cycles</h3>
<p>When developing a component, for example a C++ shared library, it must be
possible to easily rebuild just that component, and not have to wait more than a
couple seconds for dependency checks, and not have to wait for unneeded
components to be built.</p>
<h3>Both Environment and Config File Based Settings</h3>
<p>To set the target, and other options, some people on the team like to have a
configuration file in a directory so they do not have an environment setup
script to run, and others want an environment setup script to run so they can
run builds in different terminals on the same tree, or switch back and forth
in one terminal. We will support both.</p>
<h3>Object File Directory / make clean</h3>
<p>Object files and other intermediate files will be generated into a directory
that is separate from the source tree. The goal is to have make clean be
"rm -rf <obj>" in the tree root directory. The primary goals of
this are to simplify searching the source tree, and to make "make clean" more
reliable.</p>
<h3>SDK</h3>
<p>The SDK will be a tarball that will allow non-OS-developers to write apps.
The apps will actually be built by first building the SDK, and then building
the apps against that SDK. This will hopefully (1) make writing apps easier
for us, because we won't have to rebuild the OS as much, and we can use the
standard java-app development tools, and (2) allow us to dog-food the SDK, to
help ensure its quality. Cedric has suggested (and I agree) that apps built
from the SDK should be built with ant. Stay tuned for more details as we
figure out exactly how this will work.</p>
<h3>Dependecies</h3>
<p>Dependencies should all be automatic. Unless there is a custom tool involved
(e.g. the webkit has several), the dependencies for shared and static libraries,
.c, .cpp, .h, .java, java libraries, etc., should all work without intervention
in the Android.mk file.</p>
<h3>Hiding command lines</h3>
<p>The default of the build system will be to hide the command lines being
executed for make steps. It will be possible to override this by specifying
the showcommands pseudo-target, and possibly by setting an environment
variable.</p>
<h3>Wildcard source files</h3>
<p>Wildcarding source file will be discouraged. It may be useful in some
scenarios. The default <code>$(wildcard *)</code> will not work due to the
current directory being set to the root of the build tree.<p>
<h3>Multiple targets in one directory</h3>
<p>It will be possible to generate more than one target from a given
subdirectory. For example, libutils generates a shared library for the target
and a static library for the host.</p>
<h3>Makefile fragments for modules</h3>
<p><b>Android.mk</b> is the standard name for the makefile fragments that
control the building of a given module. Only the top directory should
have a file named "Makefile".</p>
<h3>Use shared libraries</h3>
<p>Currently, the simulator is not built to use shared libraries. This should
be fixed, and now is a good time to do it. This implies getting shared
libraries to work on Mac OS.</p>
<h2>Nice to Have</h2>
<p>These things would be nice to have, and this is a good place to record them,
however these are not promises.</p>
<h3>Simultaneous Builds</h3>
<p>The hope is to be able to do two builds for different combos in the same
tree at the same time, but this is a stretch goal, not a requirement.
Doing two builds in the same tree, not at the same time must work. (update:
it's looking like we'll get the two builds at the same time working)</p>
<h3>Deleting headers (or other dependecies)</h3>
<p>Problems can arise if you delete a header file that is referenced in
".d" files. The easy way to deal with this is "make clean". There
should be a better way to handle it. (from fadden)</p>
<p>One way of solving this is introducing a dependency on the directory. The
problem is that this can create extra dependecies and slow down the build.
It's a tradeoff.</p>
<h3>Multiple builds</h3>
<p>General way to perform builds across the set of known platforms. This
would make it easy to perform multiple platform builds when testing a
change, and allow a wide-scale "make clean". Right now the buildspec.mk
or environment variables need to be updated before each build. (from fadden)</p>
<h3>Aftermarket Locales and Carrier</h3>
<p>We will eventually need to add support for creating locales and carrier
customizations to the SDK, but that will not be addressed right now.</p>
<h2><a id="usage"/>Usage</h2>
<p>You've read (or scrolled past) all of the motivations for this build system,
and you want to know how to use it. This is the place.</p>
<h3>Your first build</h3>
<p>The <a href="../building.html">Building</a> document describes how do do
builds.</p>
<h3>build/envsetup.sh functions</h3>
If you source the file build/envsetup.sh into your bash environment,
<code>. build/envsetup.sh</code>you'll get a few helpful shell functions:
<ul>
<li><b>printconfig</b> - Prints the current configuration as set by the
lunch and choosecombo commands.</li>
<li><b>m</b> - Runs <code>make</code> from the top of the tree. This is
useful because you can run make from within subdirectories. If you have the
<code>TOP</code> environment variable set, it uses that. If you don't, it looks
up the tree from the current directory, trying to find the top of the tree.</li>
<li><b>croot</b> - <code>cd</code> to the top of the tree.</li>
<li><b>sgrep</b> - grep for the regex you provide in all .c, .cpp, .h, .java,
and .xml files below the current directory.</li>
</ul>
<h3>Build flavors/types</h3>
<p>
When building for a particular product, it's often useful to have minor
variations on what is ultimately the final release build. These are the
currently-defined "flavors" or "types" (we need to settle on a real name
for these).
</p>
<table border=1>
<tr>
<td>
<code>eng<code>
</td>
<td>
This is the default flavor. A plain "<code>make</code>" is the
same as "<code>make eng</code>". <code>droid</code> is an alias
for <code>eng</code>.
<ul>
<li>Installs modules tagged with: <code>eng</code>, <code>debug</code>,
<code>user</code>, and/or <code>development</code>.
<li>Installs non-APK modules that have no tags specified.
<li>Installs APKs according to the product definition files, in
addition to tagged APKs.
<li><code>ro.secure=0</code>
<li><code>ro.debuggable=1</code>
<li><code>ro.kernel.android.checkjni=1</code>
<li><code>adb</code> is enabled by default.
</td>
</tr>
<tr>
<td>
<code>user<code>
</td>
<td>
"<code>make user</code>"
<p>
This is the flavor intended to be the final release bits.
<ul>
<li>Installs modules tagged with <code>user</code>.
<li>Installs non-APK modules that have no tags specified.
<li>Installs APKs according to the product definition files; tags
are ignored for APK modules.
<li><code>ro.secure=1</code>
<li><code>ro.debuggable=0</code>
<li><code>adb</code> is disabled by default.
</td>
</tr>
<tr>
<td>
<code>userdebug<code>
</td>
<td>
"<code>make userdebug</code>"
<p>
The same as <code>user</code>, except:
<ul>
<li>Also installs modules tagged with <code>debug</code>.
<li><code>ro.debuggable=1</code>
<li><code>adb</code> is enabled by default.
</td>
</tr>
</table>
<p>
If you build one flavor and then want to build another, you should run
"<code>make installclean</code>" between the two makes to guarantee that
you don't pick up files installed by the previous flavor. "<code>make
clean</code>" will also suffice, but it takes a lot longer.
</p>
<h3>More pseudotargets</h3>
<p>Sometimes you want to just build one thing. The following pseudotargets are
there for your convenience:</p>
<ul>
<li><b>droid</b> - <code>make droid</code> is the normal build. This target
is here because the default target has to have a name.</li>
<li><b>all</b> - <code>make all</code> builds everything <code>make
droid</code> does, plus everything whose <code>LOCAL_MODULE_TAGS</code> do not
include the "droid" tag. The build server runs this to make sure
that everything that is in the tree and has an Android.mk builds.</li>
<li><b>clean-$(LOCAL_MODULE)</b> and <b>clean-$(LOCAL_PACKAGE_NAME)</b> -
Let you selectively clean one target. For example, you can type
<code>make clean-libutils</code> and it will delete libutils.so and all of the
intermediate files, or you can type <code>make clean-Home</code> and it will
clean just the Home app.</li>
<li><b>clean</b> - <code>make clean</code> deletes all of the output and
intermediate files for this configuration. This is the same as <code>rm -rf
out/&lt;configuration&gt;/</code></li>
<li><b>clobber</b> - <code>make clobber</code> deletes all of the output
and intermediate files for all configurations. This is the same as
<code>rm -rf out/</code>.</li>
<li><b>dataclean</b> - <code>make dataclean</code> deletes contents of the data
directory inside the current combo directory. This is especially useful on the
simulator and emulator, where the persistent data remains present between
builds.</li>
<li><b>showcommands</b> - <code>showcommands</code> is a modifier target
which causes the build system to show the actual command lines for the build
steps, instead of the brief descriptions. Most people don't like seeing the
actual commands, because they're quite long and hard to read, but if you need
to for debugging purposes, you can add <code>showcommands</code> to the list
of targets you build. For example <code>make showcommands</code> will build
the default android configuration, and <code>make runtime showcommands</code>
will build just the runtime, and targets that it depends on, while displaying
the full command lines. Please note that there are a couple places where the
commands aren't shown here. These are considered bugs, and should be fixed,
but they're often hard to track down. Please let
<a href="mailto:android-build-team">android-build-team</a> know if you find
any.</li>
<li><b>LOCAL_MODULE</b> - Anything you specify as a <code>LOCAL_MODULE</code>
in an Android.mk is made into a pseudotarget. For example, <code>make
runtime</code> might be shorthand for <code>make
out/linux-x86-debug/system/bin/runtime</code> (which would work), and
<code>make libkjs</code> might be shorthand for <code>make
out/linux-x86-debug/system/lib/libkjs.so</code> (which would also work).</li>
<li><b>targets</b> - <code>make targets</code> will print a list of all of
the LOCAL_MODULE names you can make.</li>
</ul>
<h3><a name="templates"/>How to add another component to the build - Android.mk templates</h3>
<p>You have a new library, a new app, or a new executable. For each of the
common types of modules, there is a corresponding file in the templates
directory. It will usually be enough to copy one of these, and fill in your
own values. Some of the more esoteric values are not included in the
templates, but are instead just documented here, as is the documentation
on using custom tools to generate files.</p>
<p>Mostly, you can just look for the TODO comments in the templates and do
what it says. Please remember to delete the TODO comments when you're done
to keep the files clean. The templates have minimal documentation in them,
because they're going to be copied, and when that gets stale, the copies just
won't get updated. So read on...</p>
<h4>Apps</h4>
<p>Use the <code>templates/apps</code> file.</p>
<p>This template is pretty self-explanitory. See the variables below for more
details.</p>
<h4>Java Libraries</h4>
<p>Use the <code>templates/java_library</code> file.</p>
<p>The interesting thing here is the value of LOCAL_MODULE, which becomes
the name of the jar file. (Actually right now, we're not making jar files yet,
just directories of .class files, but the directory is named according to
what you put in LOCAL_MODULE). This name will be what goes in the
LOCAL_JAVA_LIBRARIES variable in modules that depend on your java library.</p>
<h4>C/C++ Executables</h4>
<p>Use the <code>templates/executable</code> file, or the
<code>templates/executable_host</code> file.</p>
<p>This template has a couple extra options that you usually don't need.
Please delete the ones you don't need, and remove the TODO comments. It makes
the rest of them easier to read, and you can always refer back to the templates
if you need them again later.</p>
<p>By default, on the target these are built into /system/bin, and on the
host, they're built into <combo>/host/bin. These can be overridden by setting
<code>LOCAL_MODULE_PATH</code> or <code>LOCAL_MODULE_RELATIVE_PATH</code>. See
<a href="#moving-targets">Putting targets elsewhere</a>
for more.</p>
<h4>Shared Libraries</h4>
<p>Use the <code>templates/shared_library</code> file, or the
<code>templates/shared_library_host</code> file.</p>
<p>Remember that on the target, we use shared libraries, and on the host,
we use static libraries, since executable size isn't as big an issue, and it
simplifies distribution in the SDK.</p>
<h4>Static Libraries</h4>
<p>Use the <code>templates/static_library</code> file, or the
<code>templates/static_library_host</code> file.</p>
<p>Remember that on the target, we use shared libraries, and on the host,
we use static libraries, since executable size isn't as big an issue, and it
simplifies distribution in the SDK.</p>
<h4><a name="custom-tools"/>Using Custom Tools</h4>
<p>If you have a tool that generates source files for you, it's possible
to have the build system get the dependencies correct for it. Here are
a couple of examples. <code>$@</code> is the make built-in variable for
"the current target." The <font color=red>red</font> parts are the parts you'll
need to change.</p>
<p>You need to put this after you have declared <code>LOCAL_PATH</code> and
<code>LOCAL_MODULE</code>, because the <code>$(local-generated-sources-dir)</code>
and <code>$(local-host-generated-sources-dir)</code> macros use these variables
to determine where to put the files.
<h5>Example 1</h5>
<p>Here, there is one generated file, called
chartables.c, which doesn't depend on anything. And is built by the tool
built to $(HOST_OUT_EXECUTABLES)/dftables. Note on the second to last line
that a dependency is created on the tool.</p>
<pre>
intermediates:= $(local-generated-sources-dir)
GEN := $(intermediates)/<font color=red>chartables.c</font>
$(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>$(HOST_OUT_EXECUTABLES)/dftables $@</font>
$(GEN): <font color=red>$(HOST_OUT_EXECUTABLES)/dftables</font>
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
</pre>
<h5>Example 2</h5>
<p>Here as a hypothetical example, we use use cat as if it were to transform
a file. Pretend that it does something useful. Note how we use a
target-specific variable called PRIVATE_INPUT_FILE to store the name of the
input file.</p>
<pre>
intermediates:= $(local-generated-sources-dir)
GEN := $(intermediates)/<font color=red>file.c</font>
$(GEN): PRIVATE_INPUT_FILE := $(LOCAL_PATH)/<font color=red>input.file</font>
$(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>cat $(PRIVATE_INPUT_FILE) &gt; $@</font>
$(GEN): <font color=red>$(LOCAL_PATH)/file.c</font>
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
</pre>
<h5>Example 3</h5>
<p>If you have several files that are all similar in
name, and use the same tool, you can combine them. (here the *.lut.h files are
the generated ones, and the *.cpp files are the input files)</p>
<pre>
intermediates:= $(local-generated-sources-dir)
GEN := $(addprefix $(intermediates)<font color=red>/kjs/, \
array_object.lut.h \
bool_object.lut.h \</font>
)
$(GEN): PRIVATE_CUSTOM_TOOL = <font color=red>perl libs/WebKitLib/WebKit/JavaScriptCore/kjs/create_hash_table $< -i > $@</font>
$(GEN): $(intermediates)/<font color=red>%.lut.h</font> : $(LOCAL_PATH)/<font color=red>%.cpp</font>
$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)
</pre>
<h3><a name="platform-specific"/>Platform specific conditionals</h3>
<p>Sometimes you need to set flags specifically for different platforms. Here
is a list of which values the different build-system defined variables will be
set to and some examples.</p>
<p>For a device build, <code>TARGET_OS</code> is <code>linux</code> (we're using
linux!), and <code>TARGET_ARCH</code> is <code>arm</code>.</p>
<p>For a simulator build, <code>TARGET_OS</code> and <code>TARGET_ARCH</code>
are set to the same as <code>HOST_OS</code> and <code>HOST_ARCH</code> are
on your platform. <code>TARGET_PRODUCT</code> is the name of the target
hardware/product you are building for. The value <code>sim</code> is used
for the simulator. We haven't thought through the full extent of customization
that will happen here, but likely there will be additional UI configurations
specified here as well.</p>
<table cellspacing=25>
<tr>
<td valign=top align=center>
<b>HOST_OS</b><br/>
linux<br/>
darwin<br/>
(cygwin)
</td>
<td valign=top align=center>
<b>HOST_ARCH</b><br/>
x86
</td>
<td valign=top align=center>
<b>HOST_BUILD_TYPE</b><br/>
release<br/>
debug
</td>
</tr>
<tr>
<td valign=top align=center>
<b>TARGET_OS</b><br/>
linux<br/>
darwin<br/>
(cygwin)
</td>
<td valign=top align=center>
<b>TARGET_ARCH</b><br/>
arm<br/>
x86
</td>
<td valign=top align=center>
<b>TARGET_BUILD_TYPE</b><br/>
release<br/>
debug
</td>
<td valign=top align=center>
<b>TARGET_PRODUCT</b><br/>
sim<br/>
dream<br/>
sooner
</td>
</tr>
</table>
<h4>Some Examples</h4>
<pre>ifeq ($(TARGET_BUILD_TYPE),release)
LOCAL_CFLAGS += -DNDEBUG=1
endif
# from libutils
ifeq ($(TARGET_OS),linux)
# Use the futex based mutex and condition variable
# implementation from android-arm because it's shared mem safe
LOCAL_SRC_FILES += futex_synchro.c
LOCAL_LDLIBS += -lrt -ldl
endif
</pre>
<h3><a name="moving-modules"/>Putting modules elsewhere</h3>
<p>If you have modules that normally go somewhere, and you need to have them
build somewhere else, read this.</p>
<p>If you have modules that need to go in a subdirectory of their normal
location, for example HAL modules that need to go in /system/lib/hw or
/vendor/lib/hw, set LOCAL_MODULE_RELATIVE_PATH in your Android.mk, for
example:</p>
<pre>
LOCAL_MODULE_RELATIVE_PATH := hw
</pre>
<p>If you have modules that need to go in an entirely different location, for
example the root filesystem instead of in /system, add these lines to your
Android.mk:</p>
<pre>
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT_SBIN)
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_SBIN_UNSTRIPPED)
</pre>
<p>For executables and libraries, you need to specify a
<code>LOCAL_UNSTRIPPED_PATH</code> location if you specified a
<code>LOCAL_MODULE_PATH</code>, because on target builds, we keep
the unstripped executables so GDB can find the symbols.
<code>LOCAL_UNSTRIPPED_PATH</code> is not necessary if you only specified
<code>LOCAL_MODULE_RELATIVE_PATH</code>.</p>
<p>Look in <code>config/envsetup.make</code> for all of the variables defining
places to build things.</p>
<p>FYI: If you're installing an executable to /sbin, you probably also want to
set <code>LOCAL_FORCE_STATIC_EXCUTABLE := true</code> in your Android.mk, which
will force the linker to only accept static libraries.</p>
<h3>Android.mk variables</h3>
<p>These are the variables that you'll commonly see in Android.mk files, listed
alphabetically.</p>
<p>But first, a note on variable naming:
<ul>
<li><b>LOCAL_</b> - These variables are set per-module. They are cleared
by the <code>include $(CLEAR_VARS)</code> line, so you can rely on them
being empty after including that file. Most of the variables you'll use
in most modules are LOCAL_ variables.</li>
<li><b>PRIVATE_</b> - These variables are make-target-specific variables. That
means they're only usable within the commands for that module. It also
means that they're unlikely to change behind your back from modules that
are included after yours. This
<a href="http://www.gnu.org/software/make/manual/make.html#Target_002dspecific">link to the make documentation</a>
describes more about target-specific variables. Please note that there
are a couple of these laying around the tree that aren't prefixed with
PRIVATE_. It is safe, and they will be fixed as they are discovered.
Sorry for the confusion.</li>
<li><b>INTERNAL_</b> - These variables are critical to functioning of
the build system, so you shouldn't create variables named like this, and
you probably shouldn't be messing with these variables in your makefiles.
</li>
<li><b>HOST_</b> and <b>TARGET_</b> - These contain the directories
and definitions that are specific to either the host or the target builds.
Do not set variables that start with HOST_ or TARGET_ in your makefiles.
</li>
<li><b>BUILD_</b> and <b>CLEAR_VARS</b> - These contain the names of
well-defined template makefiles to include. Some examples are CLEAR_VARS
and BUILD_HOST_PACKAGE.</li>
<li>Any other name is fair-game for you to use in your Android.mk. However,
remember that this is a non-recursive build system, so it is possible that
your variable will be changed by another Android.mk included later, and be
different when the commands for your rule / module are executed.</li>
</ul>
</p>
<h4>LOCAL_ASSET_FILES</h4>
<p>In Android.mk files that <code>include $(BUILD_PACKAGE)</code> set this
to the set of files you want built into your app. Usually:</p>
<p><code>LOCAL_ASSET_FILES += $(call find-subdir-assets)</code></p>
<p>This will probably change when we switch to ant for the apps' build
system.</p>
<h4>LOCAL_CC</h4>
<p>If you want to use a different C compiler for this module, set LOCAL_CC
to the path to the compiler. If LOCAL_CC is blank, the appropriate default
compiler is used.</p>
<h4>LOCAL_CXX</h4>
<p>If you want to use a different C++ compiler for this module, set LOCAL_CXX
to the path to the compiler. If LOCAL_CXX is blank, the appropriate default
compiler is used.</p>
<h4>LOCAL_CFLAGS</h4>
<p>If you have additional flags to pass into the C or C++ compiler, add
them here. For example:</p>
<p><code>LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1</code></p>
<h4>LOCAL_CPPFLAGS</h4>
<p>If you have additional flags to pass into <i>only</i> the C++ compiler, add
them here. For example:</p>
<p><code>LOCAL_CPPFLAGS += -ffriend-injection</code></p>
<code>LOCAL_CPPFLAGS</code> is guaranteed to be after <code>LOCAL_CFLAGS</code>
on the compile line, so you can use it to override flags listed in
<code>LOCAL_CFLAGS</code>.
<h4>LOCAL_CPP_EXTENSION</h4>
<p>If your C++ files end in something other than "<code>.cpp</code>",
you can specify the custom extension here. For example:</p>
<p><code>LOCAL_CPP_EXTENSION := .cc</code></p>
Note that all C++ files for a given module must have the same
extension; it is not currently possible to mix different extensions.
<h4>LOCAL_NO_DEFAULT_COMPILER_FLAGS</h4>
<p>Normally, the compile line for C and C++ files includes global include
paths and global cflags. If <code>LOCAL_NO_DEFAULT_COMPILER_FLAGS</code>
is non-empty, none of the default includes or flags will be used when compiling
C and C++ files in this module.
<code>LOCAL_C_INCLUDES</code>, <code>LOCAL_CFLAGS</code>, and
<code>LOCAL_CPPFLAGS</code> will still be used in this case, as will
any <code>DEBUG_CFLAGS</code> that are defined for the module.
<h4>LOCAL_COPY_HEADERS</h4>
<p class=warning>This will be going away.</p>
<p>The set of files to copy to the install include tree. You must also
supply <code>LOCAL_COPY_HEADERS_TO</code>.</p>
<p>This is going away because copying headers messes up the error messages, and
may lead to people editing those headers instead of the correct ones. It also
makes it easier to do bad layering in the system, which we want to avoid. We
also aren't doing a C/C++ SDK, so there is no ultimate requirement to copy any
headers.</p>
<h4>LOCAL_COPY_HEADERS_TO</h4>
<p class=warning>This will be going away.</p>
<p>The directory within "include" to copy the headers listed in
<code>LOCAL_COPY_HEADERS</code> to.</p>
<p>This is going away because copying headers messes up the error messages, and
may lead to people editing those headers instead of the correct ones. It also
makes it easier to do bad layering in the system, which we want to avoid. We
also aren't doing a C/C++ SDK, so there is no ultimate requirement to copy any
headers.</p>
<h4>LOCAL_C_INCLUDES</h4>
<p>Additional directories to instruct the C/C++ compilers to look for header
files in. These paths are rooted at the top of the tree. Use
<code>LOCAL_PATH</code> if you have subdirectories of your own that you
want in the include paths. For example:</p>
<p><code>
LOCAL_C_INCLUDES += extlibs/zlib-1.2.3<br/>
LOCAL_C_INCLUDES += $(LOCAL_PATH)/src
</code></p>
<p>You should not add subdirectories of include to
<code>LOCAL_C_INCLUDES</code>, instead you should reference those files
in the <code>#include</code> statement with their subdirectories. For
example:</p>
<p><code>#include &lt;utils/KeyedVector.h&gt;</code><br/>
not <code><s>#include &lt;KeyedVector.h&gt;</s></code></p>
<p>There are some components that are doing this wrong, and should be cleaned
up.</p>
<h4>LOCAL_MODULE_TAGS</h4>
<p>Set <code>LOCAL_MODULE_TAGS</code> to any number of whitespace-separated
tags. If the tag list is empty or contains <code>droid</code>, the module
will get installed as part of a <code>make droid</code>. Otherwise, it will
only get installed by running <code>make &lt;your-module&gt;</code>
or with the <code>make all</code> pseudotarget.</p>
<h4>LOCAL_REQUIRED_MODULES</h4>
<p>Set <code>LOCAL_REQUIRED_MODULES</code> to any number of whitespace-separated
module names, like "libblah" or "Email". If this module is installed, all
of the modules that it requires will be installed as well. This can be
used to, e.g., ensure that necessary shared libraries or providers are
installed when a given app is installed.
<h4>LOCAL_FORCE_STATIC_EXECUTABLE</h4>
<p>If your executable should be linked statically, set
<code>LOCAL_FORCE_STATIC_EXECUTABLE:=true</code>. There is a very short
list of libraries that we have in static form (currently only libc). This is
really only used for executables in /sbin on the root filesystem.</p>
<h4>LOCAL_GENERATED_SOURCES</h4>
<p>Files that you add to <code>LOCAL_GENERATED_SOURCES</code> will be
automatically generated and then linked in when your module is built.
See the <a href="#custom-tools">Custom Tools</a> template makefile for an
example.</p>
<h4>LOCAL_JAVACFLAGS</h4>
<p>If you have additional flags to pass into the javac compiler, add
them here. For example:</p>
<p><code>LOCAL_JAVACFLAGS += -Xlint:deprecation</code></p>
<h4>LOCAL_JAVA_LIBRARIES</h4>
<p>When linking Java apps and libraries, <code>LOCAL_JAVA_LIBRARIES</code>
specifies which sets of java classes to include. Currently there are
two of these: <code>core</code> and <code>framework</code>.
In most cases, it will look like this:</p>
<p><code>LOCAL_JAVA_LIBRARIES := core framework</code></p>
<p>Note that setting <code>LOCAL_JAVA_LIBRARIES</code> is not necessary
(and is not allowed) when building an APK with
"<code>include $(BUILD_PACKAGE)</code>". The appropriate libraries
will be included automatically.</p>
<h4>LOCAL_LDFLAGS</h4>
<p>You can pass additional flags to the linker by setting
<code>LOCAL_LDFLAGS</code>. Keep in mind that the order of parameters is
very important to ld, so test whatever you do on all platforms.</p>
<h4>LOCAL_LDLIBS</h4>
<p><code>LOCAL_LDLIBS</code> allows you to specify additional libraries
that are not part of the build for your executable or library. Specify
the libraries you want in -lxxx format; they're passed directly to the
link line. However, keep in mind that there will be no dependency generated
for these libraries. It's most useful in simulator builds where you want
to use a library preinstalled on the host. The linker (ld) is a particularly
fussy beast, so it's sometimes necessary to pass other flags here if you're
doing something sneaky. Some examples:</p>
<p><code>LOCAL_LDLIBS += -lcurses -lpthread<br/>
LOCAL_LDLIBS += -Wl,-z,origin
</code></p>
<h4>LOCAL_NO_MANIFEST</h4>
<p>If your package doesn't have a manifest (AndroidManifest.xml), then
set <code>LOCAL_NO_MANIFEST:=true</code>. The common resources package
does this.</p>
<h4>LOCAL_PACKAGE_NAME</h4>
<p><code>LOCAL_PACKAGE_NAME</code> is the name of an app. For example,
Dialer, Contacts, etc. This will probably change or go away when we switch
to an ant-based build system for the apps.</p>
<h4>LOCAL_PATH</h4>
<p>The directory your Android.mk file is in. You can set it by putting the
following as the first line in your Android.mk:</p>
<p><code>LOCAL_PATH := $(my-dir)</code></p>
<p>The <code>my-dir</code> macro uses the
<code><a href="http://www.gnu.org/software/make/manual/make.html#MAKEFILE_005fLIST-Variable">MAKEFILE_LIST</a></code>
variable, so you must call it before you include any other makefiles. Also,
consider that any subdirectories you inlcude might reset LOCAL_PATH, so do your
own stuff before you include them. This also means that if you try to write
several <code>include</code> lines that reference <code>LOCAL_PATH</code>,
it won't work, because those included makefiles might reset LOCAL_PATH.
<h4>LOCAL_POST_PROCESS_COMMAND</h4>
<p>For host executables, you can specify a command to run on the module
after it's been linked. You might have to go through some contortions
to get variables right because of early or late variable evaluation:</p>
<p><code>module := $(HOST_OUT_EXECUTABLES)/$(LOCAL_MODULE)<br/>
LOCAL_POST_PROCESS_COMMAND := /Developer/Tools/Rez -d __DARWIN__ -t APPL\<br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-d __WXMAC__ -o $(module) Carbon.r
</code></p>
<h4>LOCAL_PREBUILT_EXECUTABLES</h4>
<p>When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to
executables that you want copied. They're located automatically into the
right bin directory.</p>
<h4>LOCAL_PREBUILT_LIBS</h4>
<p>When including $(BUILD_PREBUILT) or $(BUILD_HOST_PREBUILT), set these to
libraries that you want copied. They're located automatically into the
right lib directory.</p>
<h4>LOCAL_SHARED_LIBRARIES</h4>
<p>These are the libraries you directly link against. You don't need to
pass transitively included libraries. Specify the name without the suffix:</p>
<p><code>LOCAL_SHARED_LIBRARIES := \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libutils \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libui \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libaudio \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libexpat \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libsgl
</code></p>
<h4>LOCAL_SRC_FILES</h4>
<p>The build system looks at <code>LOCAL_SRC_FILES</code> to know what source
files to compile -- .cpp .c .y .l .java. For lex and yacc files, it knows
how to correctly do the intermediate .h and .c/.cpp files automatically. If
the files are in a subdirectory of the one containing the Android.mk, prefix
them with the directory name:</p>
<p><code>LOCAL_SRC_FILES := \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;file1.cpp \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;dir/file2.cpp
</code></p>
<h4>LOCAL_STATIC_LIBRARIES</h4>
<p>These are the static libraries that you want to include in your module.
Mostly, we use shared libraries, but there are a couple of places, like
executables in sbin and host executables where we use static libraries instead.
<p><code>LOCAL_STATIC_LIBRARIES := \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libutils \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libtinyxml
</code></p>
<h4>LOCAL_MODULE</h4>
<p><code>LOCAL_MODULE</code> is the name of what's supposed to be generated
from your Android.mk. For exmample, for libkjs, the <code>LOCAL_MODULE</code>
is "libkjs" (the build system adds the appropriate suffix -- .so .dylib .dll).
For app modules, use <code>LOCAL_PACKAGE_NAME</code> instead of
<code>LOCAL_MODULE</code>. We're planning on switching to ant for the apps,
so this might become moot.</p>
<h4>LOCAL_MODULE_PATH</h4>
<p>Instructs the build system to put the module somewhere other than what's
normal for its type. If you override this, make sure you also set
<code>LOCAL_UNSTRIPPED_PATH</code> if it's an executable or a shared library
so the unstripped binary has somewhere to go. An error will occur if you forget
to.</p>
<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p>
<h4>LOCAL_MODULE_RELATIVE_PATH</h4>
<p>Instructs the build system to put the module in a subdirectory under the
directory that is normal for its type. If you set this you do not need to
set <code>LOCAL_UNSTRIPPED_PATH</code>, the unstripped binaries will also use
the relative path.</p>
<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p>
<h4>LOCAL_UNSTRIPPED_PATH</h4>
<p>Instructs the build system to put the unstripped version of the module
somewhere other than what's normal for its type. Usually, you override this
because you overrode <code>LOCAL_MODULE_PATH</code> for an executable or a
shared library. If you overrode <code>LOCAL_MODULE_PATH</code>, but not
<code>LOCAL_UNSTRIPPED_PATH</code>, an error will occur.</p>
<p>See <a href="#moving-modules">Putting modules elsewhere</a> for more.</p>
<h4>LOCAL_WHOLE_STATIC_LIBRARIES</h4>
<p>These are the static libraries that you want to include in your module without allowing
the linker to remove dead code from them. This is mostly useful if you want to add a static library
to a shared library and have the static library's content exposed from the shared library.
<p><code>LOCAL_WHOLE_STATIC_LIBRARIES := \<br/>
&nbsp;&nbsp;&nbsp;&nbsp;libsqlite3_android<br/>
</code></p>
<h4>LOCAL_YACCFLAGS</h4>
<p>Any flags to pass to invocations of yacc for your module. A known limitation
here is that the flags will be the same for all invocations of YACC for your
module. This can be fixed. If you ever need it to be, just ask.</p>
<p><code>LOCAL_YACCFLAGS := -p kjsyy</code></p>
<h2>Implementation Details</h2>
<p>You should never have to touch anything in the config directory unless
you're adding a new platform, new tools, or adding new features to the
build system. In general, please consult with the build system owner(s)
(<a href="mailto:android-build-team">android-build-team</a>) before you go
mucking around in here. That said, here are some notes on what's going on
under the hood.</p>
<h3>Environment Setup / buildspec.mk Versioning</h3>
<p>In order to make easier for people when the build system changes, when
it is necessary to make changes to buildspec.mk or to rerun the environment
setup scripts, they contain a version number in the variable
BUILD_ENV_SEQUENCE_NUMBER. If this variable does not match what the build
system expects, it fails printing an error message explaining what happened.
If you make a change that requires an update, you need to update two places
so this message will be printed.
<ul>
<li>In config/envsetup.make, increment the
CORRECT_BUILD_ENV_SEQUENCE_NUMBER definition.</li>
<li>In buildspec.mk.default, update the BUILD_ENV_SEQUENCE_DUMBER
definition to match the one in config/envsetup.make</li>
</ul>
The scripts automatically get the value from the build system, so they will
trigger the warning as well.
</p>
<h3>Additional makefile variables</h3>
<p>You probably shouldn't use these variables. Please consult
<a href="mailto:android-build-team">android-build-team</a> before using them.
These are mostly there for workarounds for other issues, or things that aren't
completely done right.</p>
<h4>LOCAL_ADDITIONAL_DEPENDENCIES</h4>
<p>If your module needs to depend on anything else that
isn't actually built in to it, you can add those make targets to
<code>LOCAL_ADDITIONAL_DEPENDENCIES</code>. Usually this is a workaround
for some other dependency that isn't created automatically.</p>
<h4>LOCAL_BUILT_MODULE</h4>
<p>When a module is built, the module is created in an intermediate
directory then copied to its final location. LOCAL_BUILT_MODULE is
the full path to the intermediate file. See LOCAL_INSTALLED_MODULE
for the path to the final installed location of the module.</p>
<h4>LOCAL_HOST</h4>
<p>Set by the host_xxx.make includes to tell base_rules.make and the other
includes that we're building for the host. Kenneth did this as part of
openbinder, and I would like to clean it up so the rules, includes and
definitions aren't duplicated for host and target.</p>
<h4>LOCAL_INSTALLED_MODULE</h4>
<p>The fully qualified path name of the final location of the module.
See LOCAL_BUILT_MODULE for the location of the intermediate file that
the make rules should actually be constructing.</p>
<h4>LOCAL_REPLACE_VARS</h4>
<p>Used in some stuff remaining from the openbinder for building scripts
with particular values set,</p>
<h4>LOCAL_SCRIPTS</h4>
<p>Used in some stuff remaining from the openbinder build system that we
might find handy some day.</p>
<h4>LOCAL_MODULE_CLASS</h4>
<p>Which kind of module this is. This variable is used to construct other
variable names used to locate the modules. See base_rules.make and
envsetup.make.</p>
<h4>LOCAL_MODULE_NAME</h4>
<p>Set to the leaf name of the LOCAL_BUILT_MODULE. I'm not sure,
but it looks like it's just used in the WHO_AM_I variable to identify
in the pretty printing what's being built.</p>
<h4>LOCAL_MODULE_SUFFIX</h4>
<p>The suffix that will be appended to <code>LOCAL_MODULE</code> to form
<code>LOCAL_MODULE_NAME</code>. For example, .so, .a, .dylib.</p>
<h4>LOCAL_STRIP_MODULE</h4>
<p>Calculated in base_rules.make to determine if this module should actually
be stripped or not, based on whether <code>LOCAL_STRIPPABLE_MODULE</code>
is set, and whether the combo is configured to ever strip modules. With
Iliyan's stripping tool, this might change.</p>
<h4>LOCAL_STRIPPABLE_MODULE</h4>
<p>Set by the include makefiles if that type of module is strippable.
Executables and shared libraries are.</p>
<h4>LOCAL_SYSTEM_SHARED_LIBRARIES</h4>
<p>Used while building the base libraries: libc, libm, libdl. Usually
it should be set to "none," as it is in $(CLEAR_VARS). When building
these libraries, it's set to the ones they link against. For example,
libc, libstdc++ and libdl don't link against anything, and libm links against
libc. Normally, when the value is none, these libraries are automatically
linked in to executables and libraries, so you don't need to specify them
manually.</p>
</body>
</html>

21
build/core/build_id.mk Normal file
View File

@ -0,0 +1,21 @@
#
# 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.
#
# BUILD_ID is usually used to specify the branch name
# (like "MAIN") or a branch name and a release candidate
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.
export BUILD_ID=LMY49F

113
build/core/checktree Executable file
View File

@ -0,0 +1,113 @@
#!/usr/bin/python -E
import sys, os, re
excludes = [r'.*?/\.obj.*?',
r'.*?~',
r'.*?\/.DS_Store',
r'.*?\/.gdb_history',
r'.*?\/buildspec.mk',
r'.*?/\..*?\.swp',
r'.*?/out/.*?',
r'.*?/install/.*?']
excludes_compiled = map(re.compile, excludes)
def filter_excludes(str):
for e in excludes_compiled:
if e.match(str):
return False
return True
def split_perforce_parts(s):
spaces = ((s.count(" ") + 1) / 3) * 2
pos = 0
while spaces > 0:
pos = s.find(" ", pos) + 1
spaces = spaces - 1
return s[pos:]
def quotate(s):
return '"' + s + '"'
class PerforceError(Exception):
def __init__(self,value):
self.value = value
def __str__(self):
return repr(self.value)
def run(command, regex, filt):
def matchit(s):
m = regex_compiled.match(s)
if m:
return m.group(1)
else:
return ""
def filterit(s):
if filt_compiled.match(s):
return True
else:
return False
fd = os.popen(command);
lines = fd.readlines()
status = fd.close()
if status:
raise PerforceError("error calling " + command)
regex_compiled = re.compile(regex)
filt_compiled = re.compile(filt)
if len(lines) >= 1:
lines = filter(filterit, lines)
if len(lines) >= 1:
return map(matchit, lines)
return None
try:
if len(sys.argv) == 1:
do_exclude = True
elif len(sys.argv) == 2 and sys.argv[1] == "-a":
do_exclude = False
else:
print "usage: checktree [-a]"
print " -a don't filter common crud in the tree"
sys.exit(1)
have = run("p4 have ...", r'[^#]+#[0-9]+ - (.*)', r'.*')
cwd = os.getcwd()
files = run("find . -not -type d", r'.(.*)', r'.*')
files = map(lambda s: cwd+s, files)
added_depot_path = run("p4 opened ...", r'([^#]+)#.*', r'.*?#[0-9]+ - add .*');
added = []
if added_depot_path:
added_depot_path = map(quotate, added_depot_path)
where = "p4 where " + " ".join(added_depot_path)
added = run(where, r'(.*)', r'.*')
added = map(split_perforce_parts, added)
extras = []
# Python 2.3 -- still default on Mac OS X -- does not have set()
# Make dict's here to support the "in" operations below
have = dict().fromkeys(have, 1)
added = dict().fromkeys(added, 1)
for file in files:
if not file in have:
if not file in added:
extras.append(file)
if do_exclude:
extras = filter(filter_excludes, extras)
for s in extras:
print s.replace(" ", "\\ ")
except PerforceError, e:
sys.exit(2)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -0,0 +1,57 @@
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
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := armv7-none-linux-gnueabi

View File

@ -0,0 +1,57 @@
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
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := armv7-none-linux-gnueabi

View File

@ -0,0 +1,55 @@
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
RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := aarch64-linux-android

View File

@ -0,0 +1,55 @@
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)/mips64el-linux-android/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 := armv7-none-linux-gnueabi
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := mipsel-linux-android

View File

@ -0,0 +1,55 @@
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 := aarch64-linux-android
RS_TRIPLE_CFLAGS :=
RS_COMPAT_TRIPLE := mips64el-linux-android

View File

@ -0,0 +1,57 @@
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 := armv7-none-linux-gnueabi
$(clang_2nd_arch_prefix)RS_TRIPLE_CFLAGS := -D__i386__
RS_COMPAT_TRIPLE := i686-linux-android

View File

@ -0,0 +1,55 @@
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 := aarch64-linux-android
RS_TRIPLE_CFLAGS := -D__x86_64__
RS_COMPAT_TRIPLE := x86_64-linux-android

32
build/core/clang/arm.mk Normal file
View File

@ -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

24
build/core/clang/arm64.mk Normal file
View File

@ -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

108
build/core/clang/config.mk Normal file
View File

@ -0,0 +1,108 @@
## Clang configurations.
# WITHOUT_CLANG covers both HOST and TARGET
ifeq ($(WITHOUT_CLANG),true)
WITHOUT_TARGET_CLANG := true
WITHOUT_HOST_CLANG := 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 := $(BUILD_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
LLVM_TBLGEN := $(BUILD_OUT_EXECUTABLES)/llvm-tblgen$(BUILD_EXECUTABLE_SUFFIX)
# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars.
ifdef CC_WRAPPER
ifneq ($(CC_WRAPPER),$(firstword $(CLANG)))
CLANG := $(CC_WRAPPER) $(CLANG)
endif
endif
ifdef CXX_WRAPPER
ifneq ($(CXX_WRAPPER),$(firstword $(CLANG_CXX)))
CLANG_CXX := $(CXX_WRAPPER) $(CLANG_CXX)
endif
endif
# 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
# Help catch common 32/64-bit errors.
CLANG_CONFIG_EXTRA_CFLAGS += \
-Werror=int-conversion
# Workaround for ccache with clang.
# See http://petereisentraut.blogspot.com/2011/05/ccache-and-clang.html.
CLANG_CONFIG_EXTRA_CFLAGS += \
-Wno-unused-command-line-argument
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_RUNTIME_LIBRARY := libclang_rt.asan_$(TARGET_ARCH)_android
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address -fno-omit-frame-pointer
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl $(ADDRESS_SANITIZER_RUNTIME_LIBRARY)
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

20
build/core/clang/mips.mk Normal file
View File

@ -0,0 +1,20 @@
# 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) \
-fno-strict-volatile-bitfields \
-fgcse-after-reload \
-frerun-cse-after-loop \
-frename-registers \
-msynci \
-mno-fused-madd
# We don't have any mips flags to substitute yet.
define subst-clang-incompatible-mips-flags
$(1)
endef

View File

@ -0,0 +1,20 @@
# Clang flags for mips64 arch, target or host.
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) \
-fno-strict-volatile-bitfields \
-fgcse-after-reload \
-frerun-cse-after-loop \
-frename-registers \
-msynci \
-mno-fused-madd
# We don't have any mips64 flags to substitute yet.
define subst-clang-incompatible-mips64-flags
$(1)
endef

19
build/core/clang/x86.mk Normal file
View File

@ -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

View File

@ -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

250
build/core/cleanbuild.mk Normal file
View File

@ -0,0 +1,250 @@
# Copyright (C) 2007 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.
#
# Don't bother with the cleanspecs if you are running mm/mmm
ifeq ($(ONE_SHOT_MAKEFILE)$(dont_bother),)
INTERNAL_CLEAN_STEPS :=
# Builds up a list of clean steps. Creates a unique
# id for each step by taking makefile path, INTERNAL_CLEAN_BUILD_VERSION
# and appending an increasing number of '@' characters.
#
# $(1): shell command to run
# $(2): indicate to not use makefile path as part of step id if not empty.
# $(2) should only be used in build/core/cleanspec.mk: just for compatibility.
define _add-clean-step
$(if $(strip $(INTERNAL_CLEAN_BUILD_VERSION)),, \
$(error INTERNAL_CLEAN_BUILD_VERSION not set))
$(eval _acs_makefile_prefix := $(lastword $(MAKEFILE_LIST)))
$(eval _acs_makefile_prefix := $(subst /,_,$(_acs_makefile_prefix)))
$(eval _acs_makefile_prefix := $(subst .,-,$(_acs_makefile_prefix)))
$(eval _acs_makefile_prefix := $(_acs_makefile_prefix)_acs)
$(if $($(_acs_makefile_prefix)),,\
$(eval $(_acs_makefile_prefix) := $(INTERNAL_CLEAN_BUILD_VERSION)))
$(eval $(_acs_makefile_prefix) := $($(_acs_makefile_prefix))@)
$(if $(strip $(2)),$(eval _acs_id := $($(_acs_makefile_prefix))),\
$(eval _acs_id := $(_acs_makefile_prefix)$($(_acs_makefile_prefix))))
$(eval INTERNAL_CLEAN_STEPS += $(_acs_id))
$(eval INTERNAL_CLEAN_STEP.$(_acs_id) := $(1))
$(eval _acs_id :=)
$(eval _acs_makefile_prefix :=)
endef
define add-clean-step
$(eval # for build/core/cleanspec.mk, dont use makefile path as part of step id) \
$(if $(filter %/cleanspec.mk,$(lastword $(MAKEFILE_LIST))),\
$(eval $(call _add-clean-step,$(1),true)),\
$(eval $(call _add-clean-step,$(1))))
endef
# Defines INTERNAL_CLEAN_BUILD_VERSION and the individual clean steps.
# cleanspec.mk is outside of the core directory so that more people
# can have permission to touch it.
include $(BUILD_SYSTEM)/cleanspec.mk
INTERNAL_CLEAN_BUILD_VERSION := $(strip $(INTERNAL_CLEAN_BUILD_VERSION))
# If the clean_steps.mk file is missing (usually after a clean build)
# then we won't do anything.
CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)
CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)
# Read the current state from the file, if present.
# Will set CURRENT_CLEAN_BUILD_VERSION and CURRENT_CLEAN_STEPS.
#
clean_steps_file := $(PRODUCT_OUT)/clean_steps.mk
-include $(clean_steps_file)
ifneq ($(CURRENT_CLEAN_BUILD_VERSION),$(INTERNAL_CLEAN_BUILD_VERSION))
# The major clean version is out-of-date. Do a full clean, and
# don't even bother with the clean steps.
$(info *** A clean build is required because of a recent change.)
$(shell rm -rf $(OUT_DIR))
$(info *** Done with the cleaning, now starting the real build.)
else
# The major clean version is correct. Find the list of clean steps
# that we need to execute to get up-to-date.
steps := \
$(filter-out $(CURRENT_CLEAN_STEPS),$(INTERNAL_CLEAN_STEPS))
$(foreach step,$(steps), \
$(info Clean step: $(INTERNAL_CLEAN_STEP.$(step))) \
$(shell $(INTERNAL_CLEAN_STEP.$(step))) \
)
# Rewrite the clean step for the second arch.
ifdef TARGET_2ND_ARCH
# $(1): the clean step cmd
# $(2): the prefix to search for
# $(3): the prefix to replace with
define -cs-rewrite-cleanstep
$(if $(filter $(2)/%,$(1)),\
$(eval _crs_new_cmd := $(patsubst $(2)/%,$(3)/%,$(1)))\
$(info Clean step: $(_crs_new_cmd))\
$(shell $(_crs_new_cmd)))
endef
$(foreach step,$(steps), \
$(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$(TARGET_OUT_INTERMEDIATES),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES))\
$(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$(TARGET_OUT_SHARED_LIBRARIES),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES))\
$(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$(TARGET_OUT_VENDOR_SHARED_LIBRARIES),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES))\
$(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES),$(TARGET_OUT_INTERMEDIATES))\
$(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES),$(TARGET_OUT_SHARED_LIBRARIES))\
$(call -cs-rewrite-cleanstep,$(INTERNAL_CLEAN_STEP.$(step)),$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES),$(TARGET_OUT_VENDOR_SHARED_LIBRARIES))\
)
endif
_crs_new_cmd :=
steps :=
endif
CURRENT_CLEAN_BUILD_VERSION :=
CURRENT_CLEAN_STEPS :=
# Write the new state to the file.
#
$(shell \
mkdir -p $(dir $(clean_steps_file)) && \
echo "CURRENT_CLEAN_BUILD_VERSION := $(INTERNAL_CLEAN_BUILD_VERSION)" > \
$(clean_steps_file) ;\
echo "CURRENT_CLEAN_STEPS := $(INTERNAL_CLEAN_STEPS)" >> \
$(clean_steps_file) \
)
clean_steps_file :=
INTERNAL_CLEAN_STEPS :=
INTERNAL_CLEAN_BUILD_VERSION :=
endif # if not ONE_SHOT_MAKEFILE dont_bother
# Since products and build variants (unfortunately) share the same
# PRODUCT_OUT staging directory, things can get out of sync if different
# build configurations are built in the same tree. The following logic
# will notice when the configuration has changed and remove the files
# necessary to keep things consistent.
previous_build_config_file := $(PRODUCT_OUT)/previous_build_config.mk
# A change in the list of aapt configs warrants an installclean, too.
aapt_config_list := $(strip $(PRODUCT_AAPT_CONFIG) $(PRODUCT_AAPT_PREF_CONFIG))
current_build_config := \
$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)-{$(aapt_config_list)}
aapt_config_list :=
force_installclean := false
# Read the current state from the file, if present.
# Will set PREVIOUS_BUILD_CONFIG.
#
PREVIOUS_BUILD_CONFIG :=
-include $(previous_build_config_file)
PREVIOUS_BUILD_CONFIG := $(strip $(PREVIOUS_BUILD_CONFIG))
ifdef PREVIOUS_BUILD_CONFIG
ifneq "$(current_build_config)" "$(PREVIOUS_BUILD_CONFIG)"
$(info *** Build configuration changed: "$(PREVIOUS_BUILD_CONFIG)" -> "$(current_build_config)")
ifneq ($(DISABLE_AUTO_INSTALLCLEAN),true)
force_installclean := true
else
$(info DISABLE_AUTO_INSTALLCLEAN is set; skipping auto-clean. Your tree may be in an inconsistent state.)
endif
endif
endif # else, this is the first build, so no need to clean.
PREVIOUS_BUILD_CONFIG :=
# Write the new state to the file.
#
$(shell \
mkdir -p $(dir $(previous_build_config_file)) && \
echo "PREVIOUS_BUILD_CONFIG := $(current_build_config)" > \
$(previous_build_config_file) \
)
previous_build_config_file :=
current_build_config :=
#
# installclean logic
#
# The files/dirs to delete during an installclean. This includes the
# non-common APPS directory, which may contain the wrong resources.
#
# Deletes all of the files that change between different build types,
# like "make user" vs. "make sdk". This lets you work with different
# build types without having to do a full clean each time. E.g.:
#
# $ make -j8 all
# $ make installclean
# $ make -j8 user
# $ make installclean
# $ make -j8 sdk
#
installclean_files := \
$(HOST_OUT)/obj/NOTICE_FILES \
$(HOST_OUT)/sdk \
$(PRODUCT_OUT)/*.img \
$(PRODUCT_OUT)/*.ini \
$(PRODUCT_OUT)/*.txt \
$(PRODUCT_OUT)/*.xlb \
$(PRODUCT_OUT)/*.zip \
$(PRODUCT_OUT)/kernel \
$(PRODUCT_OUT)/data \
$(PRODUCT_OUT)/skin \
$(PRODUCT_OUT)/obj/APPS \
$(PRODUCT_OUT)/obj/NOTICE_FILES \
$(PRODUCT_OUT)/obj/PACKAGING \
$(PRODUCT_OUT)/recovery \
$(PRODUCT_OUT)/root \
$(PRODUCT_OUT)/system \
$(PRODUCT_OUT)/vendor \
$(PRODUCT_OUT)/oem \
$(PRODUCT_OUT)/userfastboot \
$(PRODUCT_OUT)/dex_bootjars \
$(PRODUCT_OUT)/obj/JAVA_LIBRARIES \
$(PRODUCT_OUT)/obj/FAKE \
$(PRODUCT_OUT)/obj/EXECUTABLES/adbd_intermediates \
$(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libfs_mgr_intermediates \
$(PRODUCT_OUT)/obj/EXECUTABLES/init_intermediates \
$(PRODUCT_OUT)/obj/ETC/mac_permissions.xml_intermediates \
$(PRODUCT_OUT)/obj/ETC/sepolicy_intermediates \
$(PRODUCT_OUT)/obj/ETC/init.environ.rc_intermediates
# The files/dirs to delete during a dataclean, which removes any files
# in the staging and emulator data partitions.
dataclean_files := \
$(PRODUCT_OUT)/data/* \
$(PRODUCT_OUT)/data-qemu/* \
$(PRODUCT_OUT)/userdata-qemu.img
# make sure *_OUT is set so that we won't result in deleting random parts
# of the filesystem.
ifneq (2,$(words $(HOST_OUT) $(PRODUCT_OUT)))
$(error both HOST_OUT and PRODUCT_OUT should be set at this point.)
endif
# Define the rules for commandline invocation.
.PHONY: dataclean
dataclean: FILES := $(dataclean_files)
dataclean:
$(hide) rm -rf $(FILES)
@echo "Deleted emulator userdata images."
.PHONY: installclean
installclean: FILES := $(installclean_files)
installclean: dataclean
$(hide) rm -rf $(FILES)
@echo "Deleted images and staging directories."
ifeq "$(force_installclean)" "true"
$(info *** Forcing "make installclean"...)
$(info *** rm -rf $(dataclean_files) $(installclean_files))
$(shell rm -rf $(dataclean_files) $(installclean_files))
$(info *** Done with the cleaning, now starting the real build.)
endif
force_installclean :=

69
build/core/cleanspec.mk Normal file
View File

@ -0,0 +1,69 @@
# Copyright (C) 2007 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.
#
# Just bump this if you want to force a clean build.
# **********************************************************************
# WHEN DOING SO
# 1. DELETE ANY "add-clean-step" ENTRIES THAT HAVE PILED UP IN THIS FILE.
# 2. REMOVE ALL FILES NAMED CleanSpec.mk.
# 3. BUMP THE VERSION.
# IDEALLY, THOSE STEPS SHOULD BE DONE ATOMICALLY.
# **********************************************************************
#
INTERNAL_CLEAN_BUILD_VERSION := 6
#
# ***********************************************************************
# Do not touch INTERNAL_CLEAN_BUILD_VERSION if you've added a clean step!
# ***********************************************************************
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
subdir_cleanspecs := \
$(shell build/tools/findleaves.py --prune=$(OUT_DIR) --prune=.repo --prune=.git . CleanSpec.mk)
include $(subdir_cleanspecs)
subdir_cleanspecs :=

258
build/core/clear_vars.mk Normal file
View File

@ -0,0 +1,258 @@
###########################################################
## Clear out values of all variables used by rule templates.
###########################################################
LOCAL_MODULE:=
LOCAL_MODULE_PATH:=
LOCAL_MODULE_RELATIVE_PATH :=
LOCAL_MODULE_STEM:=
LOCAL_DONT_CHECK_MODULE:=
LOCAL_CHECKED_MODULE:=
LOCAL_BUILT_MODULE:=
LOCAL_BUILT_MODULE_STEM:=
OVERRIDE_BUILT_MODULE_PATH:=
LOCAL_INSTALLED_MODULE:=
LOCAL_INSTALLED_MODULE_STEM:=
LOCAL_PICKUP_FILES:=
LOCAL_UNINSTALLABLE_MODULE:=
LOCAL_INTERMEDIATE_TARGETS:=
LOCAL_UNSTRIPPED_PATH:=
LOCAL_MODULE_CLASS:=
LOCAL_MODULE_SUFFIX:=
LOCAL_PACKAGE_NAME:=
LOCAL_OVERRIDES_PACKAGES:=
LOCAL_EXPORT_PACKAGE_RESOURCES:=
LOCAL_MANIFEST_PACKAGE_NAME:=
LOCAL_PACKAGE_SPLITS:=
LOCAL_REQUIRED_MODULES:=
LOCAL_ACP_UNAVAILABLE:=
LOCAL_MODULE_TAGS:=
LOCAL_SRC_FILES:=
LOCAL_PREBUILT_OBJ_FILES:=
LOCAL_STATIC_JAVA_LIBRARIES:=
LOCAL_STATIC_JAVA_AAR_LIBRARIES:=
LOCAL_STATIC_LIBRARIES:=
# Group static libraries with "-Wl,--start-group" and "-Wl,--end-group" when linking.
LOCAL_GROUP_STATIC_LIBRARIES:=
LOCAL_WHOLE_STATIC_LIBRARIES:=
LOCAL_SHARED_LIBRARIES:=
LOCAL_IS_HOST_MODULE:=
LOCAL_CC:=
LOCAL_CXX:=
LOCAL_CPP_EXTENSION:=
LOCAL_NO_DEFAULT_COMPILER_FLAGS:=
LOCAL_FDO_SUPPORT:=
LOCAL_ARM_MODE:=
LOCAL_YACCFLAGS:=
LOCAL_ASFLAGS:=
LOCAL_CFLAGS:=
LOCAL_CPPFLAGS:=
LOCAL_CONLYFLAGS:=
LOCAL_RTTI_FLAG:=
LOCAL_C_INCLUDES:=
LOCAL_EXPORT_C_INCLUDE_DIRS:=
LOCAL_LDFLAGS:=
LOCAL_LDLIBS:=
LOCAL_AAPT_FLAGS:=
LOCAL_AAPT_INCLUDE_ALL_RESOURCES:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
LOCAL_PREBUILT_LIBS:=
LOCAL_PREBUILT_EXECUTABLES:=
LOCAL_PREBUILT_JAVA_LIBRARIES:=
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=
LOCAL_PREBUILT_STRIP_COMMENTS:=
LOCAL_INTERMEDIATE_SOURCES:=
LOCAL_INTERMEDIATE_SOURCE_DIR:=
LOCAL_JAVACFLAGS:=
LOCAL_JAVA_LIBRARIES:=
LOCAL_JAVA_LAYERS_FILE:=
LOCAL_NO_STANDARD_LIBRARIES:=
LOCAL_CLASSPATH:=
LOCAL_DROIDDOC_USE_STANDARD_DOCLET:=
LOCAL_DROIDDOC_SOURCE_PATH:=
LOCAL_DROIDDOC_TEMPLATE_DIR:=
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=
LOCAL_DROIDDOC_ASSET_DIR:=
LOCAL_DROIDDOC_CUSTOM_ASSET_DIR:=
LOCAL_DROIDDOC_OPTIONS:=
LOCAL_DROIDDOC_HTML_DIR:=
LOCAL_ADDITIONAL_HTML_DIR:=
LOCAL_ASSET_DIR:=
LOCAL_RESOURCE_DIR:=
LOCAL_JAVA_RESOURCE_DIRS:=
LOCAL_JAVA_RESOURCE_FILES:=
LOCAL_GENERATED_SOURCES:=
LOCAL_COPY_HEADERS_TO:=
LOCAL_COPY_HEADERS:=
LOCAL_FORCE_STATIC_EXECUTABLE:=
LOCAL_ADDITIONAL_DEPENDENCIES:=
LOCAL_COMPRESS_MODULE_SYMBOLS:=
LOCAL_STRIP_MODULE:=
LOCAL_JNI_SHARED_LIBRARIES:=
LOCAL_JNI_SHARED_LIBRARIES_ABI:=
LOCAL_PREBUILT_JNI_LIBS:=
LOCAL_JAR_MANIFEST:=
LOCAL_INSTRUMENTATION_FOR:=
LOCAL_APK_LIBRARIES:=
LOCAL_RES_LIBRARIES:=
LOCAL_MANIFEST_INSTRUMENTATION_FOR:=
LOCAL_AIDL_INCLUDES:=
LOCAL_JARJAR_RULES:=
LOCAL_ADDITIONAL_JAVA_DIR:=
LOCAL_ALLOW_UNDEFINED_SYMBOLS:=
LOCAL_DX_FLAGS:=
LOCAL_CERTIFICATE:=
LOCAL_SDK_VERSION:=
LOCAL_SDK_RES_VERSION:=
LOCAL_NDK_STL_VARIANT:=
LOCAL_EMMA_INSTRUMENT:=
LOCAL_PROGUARD_ENABLED:= # '',full,custom,nosystem,disabled,obfuscation,optimization
LOCAL_PROGUARD_FLAGS:=
LOCAL_PROGUARD_FLAG_FILES:=
LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
LOCAL_EMMA_COVERAGE_FILTER:=
LOCAL_WARNINGS_ENABLE:=
LOCAL_FULL_MANIFEST_FILE:=
LOCAL_MANIFEST_FILE:=
LOCAL_FULL_LIBS_MANIFEST_FILES:=
LOCAL_RENDERSCRIPT_INCLUDES:=
LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE:=
LOCAL_RENDERSCRIPT_CC:=
LOCAL_RENDERSCRIPT_COMPATIBILITY:=
LOCAL_RENDERSCRIPT_FLAGS:=
LOCAL_RENDERSCRIPT_SKIP_INSTALL:=
LOCAL_RENDERSCRIPT_TARGET_API:=
LOCAL_DEX_PREOPT:= # '',true,false,nostripping
LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
LOCAL_DEX_PREOPT_FLAGS:=
LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full
LOCAL_PROTOC_FLAGS:=
LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
LOCAL_NO_CRT:=
LOCAL_PROPRIETARY_MODULE:=
LOCAL_OEM_MODULE:=
LOCAL_PRIVILEGED_MODULE:=
LOCAL_MODULE_OWNER:=
LOCAL_CTS_TEST_PACKAGE:=
LOCAL_CTS_TEST_RUNNER:=
LOCAL_CLANG:=
LOCAL_ADDRESS_SANITIZER:=
LOCAL_JAR_EXCLUDE_FILES:=
LOCAL_JAR_PACKAGES:=
LOCAL_JAR_EXCLUDE_PACKAGES:=
LOCAL_LINT_FLAGS:=
LOCAL_SOURCE_FILES_ALL_GENERATED:= # '',true
# Don't delete the META_INF dir when merging static Java libraries.
LOCAL_DONT_DELETE_JAR_META_INF:=
LOCAL_ADDITIONAL_CERTIFICATES:=
LOCAL_PREBUILT_MODULE_FILE:=
LOCAL_POST_INSTALL_CMD:=
LOCAL_DIST_BUNDLED_BINARIES:=
LOCAL_HAL_STATIC_LIBRARIES:=
LOCAL_ADD_ENCED_PLATFORM_KEYS_TO_APK:=
LOCAL_PUBLIC_KEY_TO_ENC_RANDOM_PROTECTION_KEY:=
LOCAL_RMTYPEDEFS:=
LOCAL_NO_SYNTAX_CHECK:=
LOCAL_NO_STATIC_ANALYZER:=
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_DPI_VARIANTS:=
LOCAL_DPI_FILE_STEM:=
# 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):=
LOCAL_PREBUILT_JNI_LIBS_$(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):=
LOCAL_PREBUILT_JNI_LIBS_$(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.
# Leave the current makefile to make sure we don't break anything
# that expects to be able to find the name of the current makefile.
MAKEFILE_LIST := $(lastword $(MAKEFILE_LIST))

View File

@ -0,0 +1,120 @@
#
# 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.
# Included by combo/select.mk
$(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
$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -static
endif # BUILD_HOST_static
# 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
include $(BUILD_COMBOS)/mac_version.mk
$(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 $($(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++
ifneq ($(filter 10.8 10.9, $(mac_sdk_version)),)
# Mac SDK 10.8+ no longer has stdarg.h, etc
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
$(combo_2nd_arch_prefix)HOST_CC := gcc
$(combo_2nd_arch_prefix)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
$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_ROOT)
$(combo_2nd_arch_prefix)HOST_AR := $(AR)
$(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)
$(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)),)
$(combo_2nd_arch_prefix)HOST_RUN_RANLIB_AFTER_COPYING := false
else
$(combo_2nd_arch_prefix)HOST_RUN_RANLIB_AFTER_COPYING := true
PRE_LION_DYNAMIC_LINKER_OPTIONS := -Wl,-dynamic
endif
$(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 \
$($(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)) \
$(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(PRIVATE_LDLIBS) \
-o $@ \
-install_name @rpath/$(notdir $@) \
-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/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)) \
-o $@ \
$(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)
endef
# $(1): The file to check
define get-file-size
stat -f "%z" $(1)
endef

View File

@ -0,0 +1,78 @@
#
# 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_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++
ifneq ($(filter 10.8 10.9, $(mac_sdk_version)),)
# 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

View File

@ -0,0 +1,62 @@
#
# 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.
# 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 -march=prescott
$(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

View File

@ -0,0 +1,53 @@
#
# 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
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

View File

@ -0,0 +1,86 @@
#
# 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 Linux on x86.
# 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
# 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 :=
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -DUSE_MINGW -DWIN32_LEAN_AND_MEAN
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -Wno-unused-parameter
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += --sysroot=prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32
$(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -m32
$(combo_2nd_arch_prefix)HOST_GLOBAL_LDFLAGS += -m32
TOOLS_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-
$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/include
$(combo_2nd_arch_prefix)HOST_C_INCLUDES += prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/lib/gcc/x86_64-w64-mingw32/4.8.3/include
$(combo_2nd_arch_prefix)HOST_GLOBAL_LD_DIRS += -Lprebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/x86_64-w64-mingw32/lib32
endif # USE_MINGW
endif # Linux
# 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
$(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
$(combo_2nd_arch_prefix)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)),)
$(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
# $(1): The file to check
# TODO: find out what format cygwin's stat(1) uses
define get-file-size
999999999
endef

View File

@ -0,0 +1,66 @@
#
# 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
# 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

View File

@ -0,0 +1,266 @@
#
# 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 Linux on ARM.
# Included by combo/select.mk
# You can set TARGET_ARCH_VARIANT to use an arch version other
# than ARMv5TE. 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_$(combo_2nd_arch_prefix)ARCH_VARIANT)),)
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 := 9.0
else
$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
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 ARM architecture version: $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
endif
include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
include $(BUILD_SYSTEM)/combo/fdo.mk
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),)
$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/arm-linux-androideabi-
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)
$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
$(combo_2nd_arch_prefix)TARGET_arm_CFLAGS := -O2 \
-fomit-frame-pointer \
-fstrict-aliasing \
-funswitch-loops
# Modules can choose to compile some source as thumb.
$(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS := -mthumb \
-Os \
-fomit-frame-pointer \
-fno-strict-aliasing
# Set FORCE_ARM_DEBUGGING to "true" in your buildspec.mk
# or in your environment to force a full arm build, even for
# files that are normally built as thumb; this can make
# gdb debugging easier. Don't forget to do a clean build.
#
# NOTE: if you try to build a -O0 build with thumb, several
# of the libraries (libpv, libwebcore, libkjs) need to be built
# with -mlong-calls. When built at -O0, those libraries are
# too big for a thumb "BL <label>" to go from one end to the other.
ifeq ($(FORCE_ARM_DEBUGGING),true)
$(combo_2nd_arch_prefix)TARGET_arm_CFLAGS += -fno-omit-frame-pointer -fno-strict-aliasing
$(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer
endif
android_config_h := $(call select-android-config-h,linux-arm)
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
-msoft-float \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
-fstack-protector \
-Wa,--noexecstack \
-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))
# The "-Wunused-but-set-variable" option often breaks projects that enable
# "-Wall -Werror" due to a commom idiom "ALOGV(mesg)" where ALOGV is turned
# into no-op in some builds while mesg is defined earlier. So we explicitly
# disable "-Wunused-but-set-variable" here.
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 += -fno-builtin-sin \
-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.
#
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-psabi
$(combo_2nd_arch_prefix)TARGET_GLOBAL_LDFLAGS += \
-Wl,-z,noexecstack \
-Wl,-z,relro \
-Wl,-z,now \
-Wl,--warn-shared-textrel \
-Wl,--fatal-warnings \
-Wl,--icf=safe \
$(arch_variant_ldflags)
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -mthumb-interwork
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS += -fvisibility-inlines-hidden
# More flags/options can be added here
$(combo_2nd_arch_prefix)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++
## on some hosts, the target cross-compiler is not available so do not run this command
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.
$(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)
endif
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
KERNEL_HEADERS_ARCH := $(libc_root)/kernel/uapi/asm-$(TARGET_$(combo_2nd_arch_prefix)ARCH)
KERNEL_HEADERS := $(KERNEL_HEADERS_COMMON) $(KERNEL_HEADERS_ARCH)
$(combo_2nd_arch_prefix)TARGET_C_INCLUDES := \
$(libc_root)/arch-arm/include \
$(libc_root)/include \
$(libstdc++_root)/include \
$(KERNEL_HEADERS) \
$(libm_root)/include \
$(libm_root)/include/arm \
$(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
$(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
$(combo_2nd_arch_prefix)TARGET_STRIP_MODULE:=true
$(combo_2nd_arch_prefix)TARGET_DEFAULT_SYSTEM_SHARED_LIBRARIES := libc libstdc++ libm
$(combo_2nd_arch_prefix)TARGET_CUSTOM_LD_COMMAND := true
define $(combo_2nd_arch_prefix)transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
$(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \
$(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)) \
$(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 $(combo_2nd_arch_prefix)transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-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)) \
$(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 $(combo_2nd_arch_prefix)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_LIBATOMIC) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTEND_O))
endef

View File

@ -0,0 +1,7 @@
# At the moment, use the same settings than the one
# for armv5te, since TARGET_ARCH_VARIANT := armv5te-vfp
# will only be used to select an optimized VFP-capable assembly
# interpreter loop for Dalvik.
#
include $(BUILD_COMBOS)/arch/arm/armv5te.mk

View File

@ -0,0 +1,15 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv5TE architecture and higher
#
# Note: Hard coding the 'tune' value here is probably not ideal,
# and a better solution should be found in the future.
#
arch_variant_cflags := \
-march=armv5te \
-mtune=xscale \
-D__ARM_ARCH_5__ \
-D__ARM_ARCH_5T__ \
-D__ARM_ARCH_5E__ \
-D__ARM_ARCH_5TE__

View File

@ -0,0 +1,28 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher with NEON
#
ARCH_ARM_HAVE_ARMV7A := true
ARCH_ARM_HAVE_VFP := true
ARCH_ARM_HAVE_VFP_D32 := true
ARCH_ARM_HAVE_NEON := true
ifneq (,$(filter cortex-a15 krait denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
arch_variant_cflags := -mcpu=cortex-a15
else
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a8)
arch_variant_cflags := -mcpu=cortex-a8
else
ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a7)
arch_variant_cflags := -mcpu=cortex-a7
else
arch_variant_cflags := -march=armv7-a
endif
endif
endif
arch_variant_cflags += \
-mfloat-abi=softfp \
-mfpu=neon
arch_variant_ldflags := \
-Wl,--fix-cortex-a8

View File

@ -0,0 +1,16 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher
#
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.
#
arch_variant_cflags := \
-march=armv7-a \
-mfloat-abi=softfp \
-mfpu=vfpv3-d16
arch_variant_ldflags := \
-Wl,--fix-cortex-a8

View File

@ -0,0 +1,10 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv5TE architecture and higher
#
# Note: Hard coding the 'tune' value here is probably not ideal,
# and a better solution should be found in the future.
#
arch_variant_cflags := \
-march=armv8

View File

@ -0,0 +1 @@
arch_variant_cflags :=

View File

@ -0,0 +1,12 @@
# Configuration for Android on MIPS.
# Generating binaries for MIPS32/hard-float/little-endian
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
-mips32 \
-mfp32 \
-modd-spreg \
arch_variant_ldflags := \
-Wl,-melf32ltsmip

View File

@ -0,0 +1,15 @@
# Configuration for Android on Ingenic xb4780/Xburst MIPS CPU.
# Generating binaries for MIPS32R2/hard-float/little-endian without
# support for the Madd family of instructions.
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
-mips32r2 \
-mfp32 \
-modd-spreg \
-mno-fused-madd \
-Wa,-mmxu
arch_variant_ldflags := \
-Wl,-melf32ltsmip

View File

@ -0,0 +1,13 @@
# Configuration for Android on MIPS.
# Generating binaries for MIPS32R2/hard-float/little-endian
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
-mips32r2 \
-mfp32 \
-modd-spreg \
-msynci
arch_variant_ldflags := \
-Wl,-melf32ltsmip

View File

@ -0,0 +1,16 @@
# Configuration for Android on MIPS.
# Generating binaries for MIPS32R2/hard-float/little-endian/dsp
ARCH_MIPS_HAS_DSP :=true
ARCH_MIPS_DSP_REV :=1
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
-mips32r2 \
-mfp32 \
-modd-spreg \
-mdsp \
-msynci
arch_variant_ldflags := \
-Wl,-melf32ltsmip

View File

@ -0,0 +1,16 @@
# Configuration for Android on MIPS.
# Generating binaries for MIPS32R2/hard-float/little-endian/dsp
ARCH_MIPS_HAS_DSP :=true
ARCH_MIPS_DSP_REV :=2
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
-mips32r2 \
-mfp32 \
-modd-spreg \
-mdspr2 \
-msynci
arch_variant_ldflags := \
-Wl,-melf32ltsmip

View File

@ -0,0 +1,12 @@
# Configuration for Android on MIPS.
# Generating binaries for MIPS32R6/hard-float/little-endian
ARCH_MIPS_REV6 := true
arch_variant_cflags := \
-mips32r6 \
-mfp64 \
-mno-odd-spreg \
-msynci
arch_variant_ldflags := \
-Wl,-melf32ltsmip

View File

@ -0,0 +1,10 @@
# Configuration for Android on mips64r2.
# This target is for temporary use only, until mips64r6 is supported by Android's qemu.
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
-mips64r2 \
-msynci

View File

@ -0,0 +1,7 @@
# Configuration for Android on mips64r6.
ARCH_MIPS_REV6 := true
arch_variant_cflags := \
-mips64r6 \
-msynci

View File

@ -0,0 +1,19 @@
# Configuration for Linux on x86.
# Generating binaries for Haswell processors.
#
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_AVX := true
ARCH_X86_HAVE_AVX2 := true
ARCH_X86_HAVE_POPCNT := true
ARCH_X86_HAVE_MOVBE := true
# CFLAGS for this arch
arch_variant_cflags := \
-march=core-avx2 \
-mstackrealign \
-mfpmath=sse \

View File

@ -0,0 +1,16 @@
# Configuration for Linux on x86.
# Generating binaries for Ivy Bridge processors.
#
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_AVX := true
# CFLAGS for this arch
arch_variant_cflags := \
-march=core-avx-i \
-mstackrealign \
-mfpmath=sse \

View File

@ -0,0 +1,14 @@
# Configuration for Linux on x86.
# Generating binaries for SandyBridge processors.
#
ARCH_X86_HAVE_SSSE3 := true
ARCH_X86_HAVE_SSE4_1 := true
ARCH_X86_HAVE_SSE4_2 := true
ARCH_X86_HAVE_AVX := true
# CFLAGS for this arch
arch_variant_cflags := \
-march=corei7-avx \
-mstackrealign \
-mfpmath=sse \

View File

@ -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 \

View File

@ -0,0 +1,16 @@
# This file contains feature macro definitions specific to the
# 'x86-atom' arch variant. This is an extension of the 'x86' base variant
# that adds Atom-specific features.
#
# See build/core/combo/arch/x86/x86.mk for differences.
#
ARCH_X86_HAVE_SSSE3 := true
ARCH_X86_HAVE_MOVBE := true
ARCH_X86_HAVE_POPCNT := false # popcnt is not supported by current Atom CPUs
# CFLAGS for this arch
arch_variant_cflags := \
-march=atom \
-mstackrealign \
-mfpmath=sse \

View File

@ -0,0 +1,23 @@
# This file contains feature macro definitions specific to the
# base 'x86' platform ABI.
#
# It is also used to build full_x86-eng / sdk_x86-eng platform images that
# are run in the emulator under KVM emulation (i.e. running directly on
# the host development machine's CPU).
# These features are optional and shall not be included in the base platform
# Otherwise, sdk_x86-eng system images might fail to run on some
# developer machines.
ARCH_X86_HAVE_SSSE3 := false
ARCH_X86_HAVE_MOVBE := false
ARCH_X86_HAVE_POPCNT := false
# XXX: This flag is probably redundant, because it should be set by default
# by our toolchain binaries. However, there have been reports that this may
# not always work as intended, so keep it unless we have the time to check
# everything properly.
arch_variant_cflags := \
-march=i686 \

View File

@ -0,0 +1,16 @@
# Configuration for Linux on x86_64.
# Generating binaries for Haswell processors.
#
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_AVX := true
ARCH_X86_HAVE_AVX2 := true
ARCH_X86_HAVE_POPCNT := true
ARCH_X86_HAVE_MOVBE := true
# CFLAGS for this arch
arch_variant_cflags := \
-march=core-avx2

View File

@ -0,0 +1,13 @@
# Configuration for Linux on x86_64.
# Generating binaries for Ivy Bridge processors.
#
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_AVX := true
# CFLAGS for this arch
arch_variant_cflags := \
-march=core-avx-i

View File

@ -0,0 +1,11 @@
# Configuration for Linux on x86_64.
# Generating binaries for SandyBridge processors.
#
ARCH_X86_HAVE_SSSE3 := true
ARCH_X86_HAVE_SSE4_1 := true
ARCH_X86_HAVE_SSE4_2 := true
ARCH_X86_HAVE_AVX := true
# CFLAGS for this arch
arch_variant_cflags := \
-march=corei7-avx

View File

@ -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 \

View File

@ -0,0 +1,13 @@
# This file contains feature macro definitions specific to the
# 'x86_64-atom' arch variant. This is an extension of the 'x86_64' base variant
# that adds Atom-specific features.
#
# See build/core/combo/arch/x86_64/x86_64.mk for differences.
#
ARCH_X86_HAVE_SSSE3 := true
ARCH_X86_HAVE_MOVBE := true
ARCH_X86_HAVE_POPCNT := false # popcnt is not supported by current Atom CPUs
# CFLAGS for this arch
arch_variant_cflags := \
-march=atom

View File

@ -0,0 +1,15 @@
# This file contains feature macro definitions specific to the
# base 'x86_64' platform ABI.
#
# It is also used to build full_x86_64-eng / sdk_x86_64-eng platform images
# that are run in the emulator under KVM emulation (i.e. running directly on
# the host development machine's CPU).
ARCH_X86_HAVE_SSSE3 := true
ARCH_X86_HAVE_MOVBE := false # Only supported on Atom.
ARCH_X86_HAVE_POPCNT := true
# CFLAGS for this arch
arch_variant_cflags := \
-march=x86-64

39
build/core/combo/fdo.mk Normal file
View File

@ -0,0 +1,39 @@
#
# 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.
#
# Setup FDO related flags.
$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:=
ifeq ($(strip $(BUILD_FDO_INSTRUMENT)), true)
# Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
# The profile will be generated on /sdcard/fdo_profile on the device.
$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/sdcard/fdo_profile -DANDROID_FDO
$(combo_2nd_arch_prefix)TARGET_FDO_LDFLAGS := -lgcov -lgcc
else
ifeq ($(strip $(BUILD_FDO_OPTIMIZE)), true)
# Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),)
$(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := vendor/google_data/fdo_profile
endif
ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)/$(PRODUCT_OUT))),)
$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO -fprofile-correction -Wcoverage-mismatch -Wno-error
else
$(warning Profile directory $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)/$(PRODUCT_OUT) does not exist. Turn off FDO.)
endif
endif
endif

View File

@ -0,0 +1,298 @@
/*
* Copyright (C) 2005 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 -- "Darwin". Used for X86 Mac OS X.
*/
#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 the futex syscall?
*/
/* #define HAVE_FUTEX */
/*
* Process creation model. Choose one:
*
* HAVE_FORKEXEC - use fork() and exec()
* HAVE_WIN32_PROC - use CreateProcess()
*/
#define HAVE_FORKEXEC
/*
* 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_MACOSX_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
/*
* 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
/*
* 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 1
/*
* 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 */
/*
* 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.
*/
#if (defined(__ppc__) || defined(__ppc64__))
# define HAVE_BIG_ENDIAN
#elif (defined(__i386__) || defined(__x86_64__))
# define HAVE_LITTLE_ENDIAN
#endif
/*
* We need to choose between 32-bit and 64-bit off_t. All of our code should
* agree on the same size. For desktop systems, use 64-bit values,
* because some of our libraries (e.g. wxWidgets) expect to be built that way.
*/
#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 */
/*
* Add any extra platform-specific defines here.
*/
#define _THREAD_SAFE
/*
* Define if we have <malloc.h> header
*/
/* #define HAVE_MALLOC_H */
/*
* 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 we have madvise() in <sys/mman.h>
*/
#define HAVE_MADVISE 1
/*
* Define if we include <sys/mount.h> for statfs()
*/
#define INCLUDE_SYS_MOUNT_FOR_STATFS 1
/*
* What CPU architecture does this platform use?
*/
#if (defined(__ppc__) || defined(__ppc64__))
# define ARCH_PPC
#elif (defined(__i386__) || defined(__x86_64__))
# define ARCH_X86
#endif
/*
* sprintf() format string for shared library naming.
*/
#define OS_SHARED_LIB_FORMAT_STR "lib%s.dylib"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE char *
/*
* The default path separator for the platform
*/
#define OS_PATH_SEPARATOR '/'
/*
* Is the filesystem case sensitive?
*
* For tools apps, we'll treat is as not 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 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
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
*/
#define HAVE_BSD_QSORT_R 1
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
*/
#define HAVE_GNU_QSORT_R 0
#endif /*_ANDROID_CONFIG_H*/

View File

@ -0,0 +1,338 @@
/*
* Copyright (C) 2005 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-arm". Used for ARM 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
/*
* Process creation model. Choose one:
*
* HAVE_FORKEXEC - use fork() and exec()
* HAVE_WIN32_PROC - use CreateProcess()
*/
#define HAVE_FORKEXEC
/*
* 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 1 */
/*
* 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
/*
* We need to choose between 32-bit and 64-bit off_t. All of our code should
* agree on the same size. For desktop systems, use 64-bit values,
* because some of our libraries (e.g. wxWidgets) expect to be built that way.
*/
/* #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__
#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_ARM
/*
* 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"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE unsigned char *
/*
* 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
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
*/
#define HAVE_BSD_QSORT_R 0
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
*/
#define HAVE_GNU_QSORT_R 0
#endif /* _ANDROID_CONFIG_H */

View File

@ -0,0 +1,340 @@
/*
* 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-aarch64". Used for ARM aarch64 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
/*
* 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 1 */
/*
* 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__
#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_AARCH64
/*
* 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"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE unsigned char *
/*
* 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
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
*/
#define HAVE_BSD_QSORT_R 0
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
*/
#define HAVE_GNU_QSORT_R 0
#endif /* _ANDROID_CONFIG_H */

View File

@ -0,0 +1,350 @@
/*
* Copyright (C) 2010 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-mips". 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
/*
* Process creation model. Choose one:
*
* HAVE_FORKEXEC - use fork() and exec()
* HAVE_WIN32_PROC - use CreateProcess()
*/
#define HAVE_FORKEXEC
/*
* 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
#if defined(__MIPSEB__)
#define HAVE_BIG_ENDIAN
#endif
#if defined(__MIPSEL__)
#define HAVE_LITTLE_ENDIAN
#endif
/*
* We need to choose between 32-bit and 64-bit off_t. All of our code should
* agree on the same size. For desktop systems, use 64-bit values,
* because some of our libraries (e.g. wxWidgets) expect to be built that way.
*/
/* #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_MIPS 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"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE unsigned char *
/*
* 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 */

View File

@ -0,0 +1,347 @@
/*
* 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
/*
* 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"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE unsigned char *
/*
* 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 */

View File

@ -0,0 +1,322 @@
/*
* Copyright (C) 2005 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 -- "Linux". Used for desktop x86 Linux.
*/
#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 the futex syscall?
*/
#define HAVE_FUTEX
/*
* Process creation model. Choose one:
*
* HAVE_FORKEXEC - use fork() and exec()
* HAVE_WIN32_PROC - use CreateProcess()
*/
#define HAVE_FORKEXEC
/*
* 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_SYSV_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 1
/*
* 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
/*
* We need to choose between 32-bit and 64-bit off_t. All of our code should
* agree on the same size. For desktop systems, use 64-bit values,
* because some of our libraries (e.g. wxWidgets) expect to be built that way.
*/
#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 1
/*
* 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.
*/
/*
* Define if we have <malloc.h> header
*/
#define HAVE_MALLOC_H
/*
* Define if we have Linux-style non-filesystem Unix Domain Sockets
*/
/*
* What CPU architecture does this platform use?
*/
#define ARCH_X86
/*
* 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 */
/*
* Define if system provides a system property server (should be
* mutually exclusive with HAVE_LIBC_SYSTEM_PROPERTIES).
*/
#define HAVE_SYSTEM_PROPERTY_SERVER
/*
* sprintf() format string for shared library naming.
*/
#define OS_SHARED_LIB_FORMAT_STR "lib%s.so"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE unsigned char *
/*
* 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
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
*/
#define HAVE_BSD_QSORT_R 0
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
*/
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
#define HAVE_GNU_QSORT_R 1
#else
#define HAVE_GNU_QSORT_R 0
#endif
#endif /*_ANDROID_CONFIG_H*/

View File

@ -0,0 +1,327 @@
/*
* Copyright 2005 The Android Open Source Project
*
* Android config -- "target_linux-x86". Used for x86 linux target devices.
*/
#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
/*
* Process creation model. Choose one:
*
* HAVE_FORKEXEC - use fork() and exec()
* HAVE_WIN32_PROC - use CreateProcess()
*/
#define HAVE_FORKEXEC
/*
* 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 1
/*
* Memory-mapping model. Choose one:
*
* HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h
* HAVE_WIN32_FILEMAP - use Win32 filemaps
*/
#define HAVE_POSIX_FILEMAP 1
/*
* 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 have Microsoft C runtime (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 1
/*
* Define this if we have localtime_r().
*/
/* #define HAVE_LOCALTIME_R 1 */
/*
* 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
/*
* We need to choose between 32-bit and 64-bit off_t. All of our code should
* agree on the same size. For desktop systems, use 64-bit values,
* because some of our libraries (e.g. wxWidgets) expect to be built that way.
*/
#if __LP64__
#define _FILE_OFFSET_BITS 64
#endif
/* #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__
#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 we have Linux's dbus
*/
/* #define HAVE_DBUS 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_X86
/*
* sprintf() format string for shared library naming.
*/
#define OS_SHARED_LIB_FORMAT_STR "lib%s.so"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE unsigned char *
/*
* 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
/*
* Whether or not _Unwind_Context is defined as a struct.
*/
#define HAVE_UNWIND_CONTEXT_STRUCT
/*
* 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
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
*/
#define HAVE_BSD_QSORT_R 0
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
*/
#define HAVE_GNU_QSORT_R 0
#endif /* _ANDROID_CONFIG_H */

View File

@ -0,0 +1,355 @@
/*
* Copyright (C) 2005 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 -- "CYGWIN_NT-5.1".
*
* Cygwin has pthreads, but GDB seems to get confused if you use it to
* create threads. By "confused", I mean it freezes up the first time the
* debugged process creates a thread, even if you use CreateThread. The
* mere presence of pthreads linkage seems to cause problems.
*/
#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.
*/
/* MingW doesn't define __BEGIN_DECLS / __END_DECLS. */
#ifndef __BEGIN_DECLS
# ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# else
# define __BEGIN_DECLS
# endif
#endif
#ifndef __END_DECLS
# ifdef __cplusplus
# define __END_DECLS }
# else
# define __END_DECLS
# endif
#endif
/*
* Threading model. Choose one:
*
* HAVE_PTHREADS - use the pthreads library.
* HAVE_WIN32_THREADS - use Win32 thread primitives.
*/
#define HAVE_WIN32_THREADS
/*
* Do we have the futex syscall?
*/
/* #define HAVE_FUTEX */
/*
* Process creation model. Choose one:
*
* HAVE_FORKEXEC - use fork() and exec()
* HAVE_WIN32_PROC - use CreateProcess()
*/
#ifdef __CYGWIN__
# define HAVE_FORKEXEC
#else
# define HAVE_WIN32_PROC
#endif
/*
* 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_WIN32_IPC
/*
* Memory-mapping model. Choose one:
*
* HAVE_POSIX_FILEMAP - use the Posix sys/mmap.h
* HAVE_WIN32_FILEMAP - use Win32 filemaps
*/
#ifdef __CYGWIN__
#define HAVE_POSIX_FILEMAP
#else
#define HAVE_WIN32_FILEMAP
#endif
/*
* Define this if you have <termio.h>
*/
#ifdef __CYGWIN__
# define HAVE_TERMIO_H
#endif
/*
* Define this if you have <sys/sendfile.h>
*/
#ifdef __CYGWIN__
# define HAVE_SYS_SENDFILE_H 1
#endif
/*
* Define this if you build against MSVCRT.DLL
*/
#ifndef __CYGWIN__
# define HAVE_MS_C_RUNTIME
#endif
/*
* Define this if you have sys/uio.h
*/
#ifdef __CYGWIN__
#define HAVE_SYS_UIO_H
#endif
/*
* Define this if we have localtime_r().
*/
/* #define HAVE_LOCALTIME_R 1 */
/*
* 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.
*/
#ifndef __CYGWIN__
#define HAVE_WINSOCK
#endif
/*
* Define this if your platforms implements symbolic links
* in its filesystems
*/
/* #define HAVE_SYMLINKS */
/*
* Define this if have clock_gettime() and friends
*/
/* #define HAVE_POSIX_CLOCKS */
/*
* 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.
*/
#ifdef __CYGWIN__
#define HAVE_ENDIAN_H
#endif
#define HAVE_LITTLE_ENDIAN
/*
* We need to choose between 32-bit and 64-bit off_t. All of our code should
* agree on the same size. For desktop systems, use 64-bit values,
* because some of our libraries (e.g. wxWidgets) expect to be built that way.
*/
#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
/*
* 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 */
/*
* Define if system provides a system property server (should be
* mutually exclusive with HAVE_LIBC_SYSTEM_PROPERTIES).
*/
/* #define HAVE_SYSTEM_PROPERTY_SERVER */
/*
* Define if we have madvise() in <sys/mman.h>
*/
/*#define HAVE_MADVISE 1*/
/*
* Add any extra platform-specific defines here.
*/
#define WIN32 1 /* stock Cygwin doesn't define these */
#define _WIN32 1
#define _WIN32_WINNT 0x0500 /* admit to using >= Win2K */
#define HAVE_WINDOWS_PATHS /* needed by simulator */
/*
* What CPU architecture does this platform use?
*/
#define ARCH_X86
/*
* sprintf() format string for shared library naming.
*/
#define OS_SHARED_LIB_FORMAT_STR "lib%s.dll"
/*
* type for the third argument to mincore().
*/
#define MINCORE_POINTER_TYPE unsigned char *
/*
* 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.
* Cygwin has it, but not MinGW.
*/
#ifdef USE_MINGW
/* #define HAVE_SYS_SOCKET_H */
#else
#define HAVE_SYS_SOCKET_H 1
#endif
/*
* 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 <winsock2.h> exists.
* Only MinGW has it.
*/
#ifdef USE_MINGW
#define HAVE_WINSOCK2_H 1
#else
/* #define HAVE_WINSOCK2_H */
#endif
/*
* Various definitions missing in MinGW
*/
#ifdef USE_MINGW
#define S_IRGRP 0
#endif
/*
* Define if writev() exists.
*/
/* #define HAVE_WRITEV */
/*
* Define if <stdint.h> exists.
*/
/* #define HAVE_STDINT_H */
/*
* Define if <stdbool.h> exists.
*/
#define HAVE_STDBOOL_H
/*
* Define if <sched.h> exists.
*/
/* #define HAVE_SCHED_H */
/*
* 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 */
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a BSD style function prototype.
*/
#define HAVE_BSD_QSORT_R 0
/*
* Define to 1 if <stdlib.h> provides qsort_r() with a GNU style function prototype.
*/
#define HAVE_GNU_QSORT_R 0
#endif /*_ANDROID_CONFIG_H*/

51
build/core/combo/javac.mk Normal file
View File

@ -0,0 +1,51 @@
# Selects a Java compiler.
#
# Inputs:
# CUSTOM_JAVA_COMPILER -- "eclipse", "openjdk". or nothing for the system
# default
# ALTERNATE_JAVAC -- the alternate java compiler to use
#
# Outputs:
# COMMON_JAVAC -- Java compiler command with common arguments
#
ifneq ($(LEGACY_USE_JAVA6),)
common_jdk_flags := -target 1.5 -Xmaxerrs 9999999
else
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
ifeq ($(ALTERNATE_JAVAC),)
JAVACC := javac
else
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_jdk_flags)
else
COMMON_JAVAC := $(JAVACC) -J-Xmx1024M $(common_jdk_flags)
endif
# Eclipse.
ifeq ($(CUSTOM_JAVA_COMPILER), eclipse)
COMMON_JAVAC := java -Xmx256m -jar prebuilt/common/ecj/ecj.jar -5 \
-maxProblems 9999999 -nowarn
$(info CUSTOM_JAVA_COMPILER=eclipse)
endif
HOST_JAVAC ?= $(COMMON_JAVAC)
TARGET_JAVAC ?= $(COMMON_JAVAC)
#$(info HOST_JAVAC=$(HOST_JAVAC))
#$(info TARGET_JAVAC=$(TARGET_JAVAC))

119
build/core/combo/select.mk Normal file
View File

@ -0,0 +1,119 @@
#
# 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.
#
# Select a combo based on the compiler being used.
#
# Inputs:
# combo_target -- prefix for final variables (HOST_ or TARGET_)
# 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".
combo_os_arch := $($(combo_target)OS)-$($(combo_target)$(combo_2nd_arch_prefix)ARCH)
combo_var_prefix := $(combo_2nd_arch_prefix)$(combo_target)
# Set reasonable defaults for the various variables
$(combo_var_prefix)CC := $(CC)
$(combo_var_prefix)CXX := $(CXX)
$(combo_var_prefix)AR := $(AR)
$(combo_var_prefix)STRIP := $(STRIP)
$(combo_var_prefix)BINDER_MINI := 0
$(combo_var_prefix)HAVE_EXCEPTIONS := 0
$(combo_var_prefix)HAVE_UNIX_FILE_PATH := 1
$(combo_var_prefix)HAVE_WINDOWS_FILE_PATH := 0
$(combo_var_prefix)HAVE_RTTI := 1
$(combo_var_prefix)HAVE_CALL_STACKS := 1
$(combo_var_prefix)HAVE_64BIT_IO := 1
$(combo_var_prefix)HAVE_CLOCK_TIMERS := 1
$(combo_var_prefix)HAVE_PTHREAD_RWLOCK := 1
$(combo_var_prefix)HAVE_STRNLEN := 1
$(combo_var_prefix)HAVE_STRERROR_R_STRRET := 1
$(combo_var_prefix)HAVE_STRLCPY := 0
$(combo_var_prefix)HAVE_STRLCAT := 0
$(combo_var_prefix)HAVE_KERNEL_MODULES := 0
$(combo_var_prefix)GLOBAL_CFLAGS := -fno-exceptions -Wno-multichar
$(combo_var_prefix)RELEASE_CFLAGS := -O2 -g -fno-strict-aliasing
$(combo_var_prefix)GLOBAL_CPPFLAGS :=
$(combo_var_prefix)GLOBAL_LDFLAGS :=
$(combo_var_prefix)GLOBAL_ARFLAGS := crsPD
$(combo_var_prefix)GLOBAL_LD_DIRS :=
$(combo_var_prefix)EXECUTABLE_SUFFIX :=
$(combo_var_prefix)SHLIB_SUFFIX := .so
$(combo_var_prefix)JNILIB_SUFFIX := $($(combo_var_prefix)SHLIB_SUFFIX)
$(combo_var_prefix)STATIC_LIB_SUFFIX := .a
# Now include the combo for this specific target.
include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk
ifneq ($(USE_CCACHE),)
# The default check uses size and modification time, causing false misses
# since the mtime depends when the repo was checked out
export CCACHE_COMPILERCHECK := content
# See man page, optimizations to get more cache hits
# implies that __DATE__ and __TIME__ are not critical for functionality.
# Ignore include file modification time since it will depend on when
# the repo was checked out
export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro
# Turn all preprocessor absolute paths into relative paths.
# Fixes absolute paths in preprocessed source due to use of -g.
# We don't really use system headers much so the rootdir is
# fine; ensures these paths are relative for all Android trees
# on a workstation.
export CCACHE_BASEDIR := /
# Workaround for ccache with clang.
# See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
export CCACHE_CPP2 := true
CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
# 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-$(HOST_PREBUILT_ARCH)
endif
ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
# Check that the executable is here.
ccache := $(strip $(wildcard $(ccache)))
ifdef ccache
ifndef CC_WRAPPER
CC_WRAPPER := $(ccache)
endif
ifndef CXX_WRAPPER
CXX_WRAPPER := $(ccache)
endif
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

641
build/core/config.mk Normal file
View File

@ -0,0 +1,641 @@
# This is included by the top-level Makefile.
# It sets up standard variables based on the
# current configuration and platform, which
# are not specific to what is being built.
# Only use ANDROID_BUILD_SHELL to wrap around bash.
# DO NOT use other shells such as zsh.
ifdef ANDROID_BUILD_SHELL
SHELL := $(ANDROID_BUILD_SHELL)
else
# Use bash, not whatever shell somebody has installed as /bin/sh
# This is repeated from main.mk, since envsetup.sh runs this file
# directly.
SHELL := /bin/bash
endif
# Utility variables.
empty :=
space := $(empty) $(empty)
comma := ,
# Note that make will eat the newline just before endef.
define newline
endef
# Unfortunately you can't simply define backslash as \ or \\.
backslash := \a
backslash := $(patsubst %a,%,$(backslash))
# Tell python not to spam the source tree with .pyc files. This
# only has an effect on python 2.6 and above.
export PYTHONDONTWRITEBYTECODE := 1
# Standard source directories.
SRC_DOCS:= $(TOPDIR)docs
# TODO: Enforce some kind of layering; only add include paths
# when a module links against a particular library.
# TODO: See if we can remove most of these from the global list.
SRC_HEADERS := \
$(TOPDIR)system/core/include \
$(TOPDIR)hardware/libhardware/include \
$(TOPDIR)hardware/libhardware_legacy/include \
$(TOPDIR)hardware/ril/include \
$(TOPDIR)libnativehelper/include \
$(TOPDIR)frameworks/native/include \
$(TOPDIR)frameworks/native/opengl/include \
$(TOPDIR)frameworks/av/include \
$(TOPDIR)frameworks/base/include
SRC_HOST_HEADERS:=$(TOPDIR)tools/include
SRC_LIBRARIES:= $(TOPDIR)libs
SRC_SERVERS:= $(TOPDIR)servers
SRC_TARGET_DIR := $(TOPDIR)build/target
SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api
# Some specific paths to tools
SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc
# Various mappings to avoid hard-coding paths all over the place
include $(BUILD_SYSTEM)/pathmap.mk
# ###############################################################
# Build system internal files
# ###############################################################
BUILD_COMBOS:= $(BUILD_SYSTEM)/combo
CLEAR_VARS:= $(BUILD_SYSTEM)/clear_vars.mk
BUILD_HOST_STATIC_LIBRARY:= $(BUILD_SYSTEM)/host_static_library.mk
BUILD_HOST_SHARED_LIBRARY:= $(BUILD_SYSTEM)/host_shared_library.mk
BUILD_STATIC_LIBRARY:= $(BUILD_SYSTEM)/static_library.mk
BUILD_RAW_STATIC_LIBRARY := $(BUILD_SYSTEM)/raw_static_library.mk
BUILD_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk
BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk
BUILD_RAW_EXECUTABLE:= $(BUILD_SYSTEM)/raw_executable.mk
BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk
BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk
BUILD_HOST_PREBUILT:= $(BUILD_SYSTEM)/host_prebuilt.mk
BUILD_PREBUILT:= $(BUILD_SYSTEM)/prebuilt.mk
BUILD_MULTI_PREBUILT:= $(BUILD_SYSTEM)/multi_prebuilt.mk
BUILD_JAVA_LIBRARY:= $(BUILD_SYSTEM)/java_library.mk
BUILD_STATIC_JAVA_LIBRARY:= $(BUILD_SYSTEM)/static_java_library.mk
BUILD_HOST_JAVA_LIBRARY:= $(BUILD_SYSTEM)/host_java_library.mk
BUILD_DROIDDOC:= $(BUILD_SYSTEM)/droiddoc.mk
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
-include cts/build/config.mk
# ###############################################################
# Parse out any modifier targets.
# ###############################################################
# The 'showcommands' goal says to show the full command
# lines being executed, instead of a short message about
# the kind of operation being done.
SHOW_COMMANDS:= $(filter showcommands,$(MAKECMDGOALS))
# ###############################################################
# Set common values
# ###############################################################
# These can be changed to modify both host and device modules.
COMMON_GLOBAL_CFLAGS:= -DANDROID -fmessage-length=0 -W -Wall -Wno-unused -Winit-self -Wpointer-arith
COMMON_RELEASE_CFLAGS:= -DNDEBUG -UDEBUG
COMMON_GLOBAL_CPPFLAGS:= $(COMMON_GLOBAL_CFLAGS) -Wsign-promo
COMMON_RELEASE_CPPFLAGS:= $(COMMON_RELEASE_CFLAGS)
# Set the extensions used for various packages
COMMON_PACKAGE_SUFFIX := .zip
COMMON_JAVA_PACKAGE_SUFFIX := .jar
COMMON_ANDROID_PACKAGE_SUFFIX := .apk
# list of flags to turn specific warnings in to errors
TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point
# TODO: do symbol compression
TARGET_COMPRESS_MODULE_SYMBOLS := false
# ###############################################################
# Include sub-configuration files
# ###############################################################
# ---------------------------------------------------------------
# Try to include buildspec.mk, which will try to set stuff up.
# If this file doesn't exist, the environment variables will
# be used, and if that doesn't work, then the default is an
# arm build
ifndef ANDROID_BUILDSPEC
ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk
endif
-include $(ANDROID_BUILDSPEC)
# ---------------------------------------------------------------
# Define most of the global variables. These are the ones that
# are specific to the user's build configuration.
include $(BUILD_SYSTEM)/envsetup.mk
# The build system exposes several variables for where to find the kernel
# headers:
# TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
# device being built. It is set as $(TARGET_DEVICE_DIR)/kernel-headers,
# e.g. device/samsung/tuna/kernel-headers. This directory is not
# explicitly set by anyone, the build system always adds this subdir.
#
# TARGET_BOARD_KERNEL_HEADERS is specified by the BoardConfig.mk file
# to allow other directories to be included. This is useful if there's
# some common place where a few headers are being kept for a group
# of devices. For example, device/<vendor>/common/kernel-headers could
# contain some headers for several of <vendor>'s devices.
#
# TARGET_PRODUCT_KERNEL_HEADERS is generated by the product inheritance
# graph. This allows architecture products to provide headers for the
# devices using that architecture. For example,
# hardware/ti/omap4xxx/omap4.mk will specify
# PRODUCT_VENDOR_KERNEL_HEADERS variable that specify where the omap4
# specific headers are, e.g. hardware/ti/omap4xxx/kernel-headers.
# The build system then combines all the values specified by all the
# PRODUCT_VENDOR_KERNEL_HEADERS directives in the product inheritance
# tree and then exports a TARGET_PRODUCT_KERNEL_HEADERS variable.
#
# The layout of subdirs in any of the kernel-headers dir should mirror the
# layout of the kernel include/ directory. For example,
# device/samsung/tuna/kernel-headers/linux/,
# hardware/ti/omap4xxx/kernel-headers/media/,
# etc.
#
# NOTE: These directories MUST contain post-processed headers using the
# bionic/libc/kernel/clean_header.py tool. Additionally, the original kernel
# headers must also be checked in, but in a different subdirectory. By
# convention, the originals should be checked into original-kernel-headers
# directory of the same parent dir. For example,
# device/samsung/tuna/kernel-headers <----- post-processed
# device/samsung/tuna/original-kernel-headers <----- originals
#
TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
define validate-kernel-headers
$(if $(firstword $(foreach hdr_dir,$(1),\
$(filter-out kernel-headers,$(notdir $(hdr_dir))))),\
$(error Kernel header dirs must be end in kernel-headers: $(1)))
endef
# also allow the board config to provide additional directories since
# there could be device/oem/base_hw and device/oem/derived_hw
# that both are valid devices but derived_hw needs to use kernel headers
# from base_hw.
TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS)))
TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS))
$(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS))
# then add product-inherited includes, to allow for
# hardware/sivendor/chip/chip.mk to include their own headers
TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS)))
TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS))
$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS))
# Clean up/verify variables defined by the board config file.
TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
ifeq ($(TARGET_CPU_ABI),)
$(error No TARGET_CPU_ABI defined by board config: $(board_config_mk))
endif
TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
# $(1): os/arch
define select-android-config-h
build/core/combo/include/arch/$(1)/AndroidConfig.h
endef
combo_target := HOST_
combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
# Load the 2nd host arch if it's needed.
ifdef HOST_2ND_ARCH
combo_target := HOST_
combo_2nd_arch_prefix := $(HOST_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/combo/select.mk
endif
# on windows, the tools have .exe at the end, and we depend on the
# host config stuff being done first
combo_target := TARGET_
combo_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/combo/select.mk
# Load the 2nd target arch if it's needed.
ifdef TARGET_2ND_ARCH
combo_target := TARGET_
combo_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
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 board 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
TARGET_TOOLCHAIN_ROOT := $(patsubst %/, %, $(dir $(TARGET_TOOLS_PREFIX)))
TARGET_TOOLCHAIN_ROOT := $(patsubst %/, %, $(dir $(TARGET_TOOLCHAIN_ROOT)))
TARGET_TOOLCHAIN_ROOT := $(wildcard $(TARGET_TOOLCHAIN_ROOT))
endif
# Normalize WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK
ifeq ($(strip $(WITH_STATIC_ANALYZER)),0)
WITH_STATIC_ANALYZER :=
endif
ifeq ($(strip $(WITH_SYNTAX_CHECK)),0)
WITH_SYNTAX_CHECK :=
endif
# Disable WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK if tool can't be found
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)
WITH_STATIC_ANALYZER :=
endif
endif
ifneq ($(strip $(WITH_SYNTAX_CHECK)),)
ifeq ($(wildcard $(SYNTAX_TOOLS_PREFIX)/ccc-syntax),)
$(warning *** Disable WITH_SYNTAX_CHECK because $(SYNTAX_TOOLS_PREFIX)/ccc-syntax does not exist)
WITH_SYNTAX_CHECK :=
endif
endif
# WITH_STATIC_ANALYZER trumps WITH_SYNTAX_CHECK
ifneq ($(strip $(WITH_STATIC_ANALYZER)),)
ifneq ($(strip $(WITH_SYNTAX_CHECK)),)
$(warning *** Disable WITH_SYNTAX_CHECK in the presence of static analyzer WITH_STATIC_ANALYZER)
WITH_SYNTAX_CHECK :=
endif
endif
# Pick a Java compiler.
include $(BUILD_SYSTEM)/combo/javac.mk
# ---------------------------------------------------------------
# Check that the configuration is current. We check that
# BUILD_ENV_SEQUENCE_NUMBER is current against this value.
# Don't fail if we're called from envsetup, so they have a
# chance to update their environment.
ifeq (,$(strip $(CALLED_FROM_SETUP)))
ifneq (,$(strip $(BUILD_ENV_SEQUENCE_NUMBER)))
ifneq ($(BUILD_ENV_SEQUENCE_NUMBER),$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER))
$(warning BUILD_ENV_SEQUENCE_NUMBER is set incorrectly.)
$(info *** If you use envsetup/lunch/choosecombo:)
$(info *** - Re-execute envsetup (". envsetup.sh"))
$(info *** - Re-run lunch or choosecombo)
$(info *** If you use buildspec.mk:)
$(info *** - Look at buildspec.mk.default to see what has changed)
$(info *** - Update BUILD_ENV_SEQUENCE_NUMBER to "$(CORRECT_BUILD_ENV_SEQUENCE_NUMBER)")
$(error bailing..)
endif
endif
endif
# ---------------------------------------------------------------
# Generic tools.
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)-$(HOST_PREBUILT_ARCH)/bison/bison
YACC := $(BISON) -d
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
DOXYGEN:= doxygen
AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX)
AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX)
PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
else
MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
endif
MKYAFFS2 := $(HOST_OUT_EXECUTABLES)/mkyaffs2image$(HOST_EXECUTABLE_SUFFIX)
APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
MKEXT2IMG := $(HOST_OUT_EXECUTABLES)/genext2fs$(HOST_EXECUTABLE_SUFFIX)
MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX)
MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh
MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh
MKEXT2BOOTIMG := external/genext2fs/mkbootimg_ext2.sh
SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
MKTARBALL := build/tools/mktarball.sh
TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
PROGUARD := external/proguard/bin/proguard.sh
JAVATAGS := build/tools/java-event-log-tags.py
LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc$(HOST_EXECUTABLE_SUFFIX)
BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat$(HOST_EXECUTABLE_SUFFIX)
LINT := prebuilts/sdk/tools/lint
RMTYPEDEFS := $(HOST_OUT_EXECUTABLES)/rmtypedefs
APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg
VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer
BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree
BOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/boot_signer
# ACP is always for the build OS, not for the host OS
ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)
# dx is java behind a shell script; no .exe necessary.
DX := $(HOST_OUT_EXECUTABLES)/dx
ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign$(HOST_EXECUTABLE_SUFFIX)
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
FINDBUGS := $(FINDBUGS_DIR)/findbugs
EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX)
# Tool to merge AndroidManifest.xmls
ANDROID_MANIFEST_MERGER := java -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge
YACC_HEADER_SUFFIX:= .hpp
# Don't use column under Windows, cygwin or not
ifeq ($(HOST_OS),windows)
COLUMN:= cat
else
COLUMN:= column
endif
ifeq ($(HOST_OS),darwin)
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
# versions allegedly use a non-standard directory structure.
HOST_JDK_TOOLS_JAR :=
endif
else
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
endif
ifneq ($(HOST_JDK_TOOLS_JAR),)
ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
$(error Error: could not find jdk tools.jar, please check if your JDK was installed correctly)
endif
endif
# Is the host JDK 64-bit version?
HOST_JDK_IS_64BIT_VERSION :=
#ifneq ($(filter 64-Bit, $(shell java -version 2>&1)),)
#HOST_JDK_IS_64BIT_VERSION := true
#endif
# It's called md5 on Mac OS and md5sum on Linux
ifeq ($(HOST_OS),darwin)
MD5SUM:=md5 -q
else
MD5SUM:=md5sum
endif
APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR)
APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)
APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"
# The default key if not set as LOCAL_CERTIFICATE
ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
DEFAULT_SYSTEM_DEV_CERTIFICATE := $(PRODUCT_DEFAULT_DEV_CERTIFICATE)
else
DEFAULT_SYSTEM_DEV_CERTIFICATE := build/target/product/security/testkey
endif
# ###############################################################
# Set up final options.
# ###############################################################
HOST_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
HOST_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
HOST_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
HOST_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
TARGET_GLOBAL_CFLAGS += $(COMMON_GLOBAL_CFLAGS)
TARGET_RELEASE_CFLAGS += $(COMMON_RELEASE_CFLAGS)
TARGET_GLOBAL_CPPFLAGS += $(COMMON_GLOBAL_CPPFLAGS)
TARGET_RELEASE_CPPFLAGS += $(COMMON_RELEASE_CPPFLAGS)
HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES)
TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
$(TARGET_PRODUCT_KERNEL_HEADERS)
# Many host compilers don't support these flags, so we have to make
# sure to only specify them for the target compilers checked in to
# the source tree.
TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
HOST_GLOBAL_CFLAGS += $(HOST_RELEASE_CFLAGS)
HOST_GLOBAL_CPPFLAGS += $(HOST_RELEASE_CPPFLAGS)
TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS)
TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
ifdef TARGET_2ND_ARCH
$(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
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
TARGET_DEFAULT_JAVA_LIBRARIES := core-libart core-junit ext framework
endif
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
ifeq ($(ARCH_X86_HAVE_SSSE3),true)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := ssse3
endif
ifeq ($(ARCH_X86_HAVE_SSE4_2),true)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := sse4_2
endif
ifeq ($(ARCH_X86_HAVE_AVX),true)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := avx
endif
ifeq ($(ARCH_X86_HAVE_AVX2),true)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := avx2
endif
ifeq ($(ARCH_X86_HAVE_AES_NI),true)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)$(comma)aes_in
endif
ifeq ($(ARCH_X86_HAVE_POPCNT),true)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)$(comma)popcnt
endif
ifeq ($(ARCH_X86_HAVE_MOVBE),true)
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := $(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)$(comma)movbe
endif
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
# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE)
# ###############################################################
HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk
HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk
# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N.
# The 'current' version is whatever this source tree is.
#
# sgrax is the opposite of xargs. It takes the list of args and puts them
# on each line for sort to process.
# sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3.
# Numerically sort a list of numbers
# $(1): the list of numbers to be sorted
define numerically_sort
$(shell function sgrax() { \
while [ -n "$$1" ] ; do echo $$1 ; shift ; done \
} ; \
( sgrax $(1) | sort -g ) )
endef
TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
# We don't have prebuilt system_current SDK yet.
TARGET_AVAILABLE_SDK_VERSIONS := $(TARGET_AVAILABLE_SDK_VERSIONS)
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
INTERNAL_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed.txt
INTERNAL_PLATFORM_SYSTEM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-api.txt
INTERNAL_PLATFORM_SYSTEM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-removed.txt
# 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
RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc
RS_PREBUILT_LIBPATH := -L prebuilts/ndk/8/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
include $(BUILD_SYSTEM)/dumpvar.mk

View File

@ -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

View File

@ -0,0 +1,25 @@
###########################################################
## Copy headers to the install tree
###########################################################
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
my_prefix := HOST_
else
my_prefix := TARGET_
endif
# Create a rule to copy each header, and make the
# all_copied_headers phony target depend on each
# destination header. copy-one-header defines the
# actual rule.
#
$(foreach header,$(LOCAL_COPY_HEADERS), \
$(eval _chFrom := $(LOCAL_PATH)/$(header)) \
$(eval _chTo := \
$(if $(LOCAL_COPY_HEADERS_TO),\
$($(my_prefix)OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\
$($(my_prefix)OUT_HEADERS)/$(notdir $(header)))) \
$(eval $(call copy-one-header,$(_chFrom),$(_chTo))) \
$(eval all_copied_headers: $(_chTo)) \
)
_chFrom :=
_chTo :=

2274
build/core/definitions.mk Normal file

File diff suppressed because it is too large Load Diff

76
build/core/device.mk Normal file
View File

@ -0,0 +1,76 @@
#
# Copyright (C) 2007 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.
#
_device_var_list := \
DEVICE_NAME \
DEVICE_BOARD \
DEVICE_REGION
define dump-device
$(info ==== $(1) ====)\
$(foreach v,$(_device_var_list),\
$(info DEVICES.$(1).$(v) := $(DEVICES.$(1).$(v))))\
$(info --------)
endef
define dump-devices
$(foreach p,$(DEVICES),$(call dump-device,$(p)))
endef
#
# $(1): device to inherit
#
define inherit-device
$(foreach v,$(_device_var_list), \
$(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1))))
endef
#
# $(1): device makefile list
#
#TODO: check to make sure that devices have all the necessary vars defined
define import-devices
$(call import-nodes,DEVICES,$(1),$(_device_var_list))
endef
#
# $(1): short device name like "sooner"
#
define _resolve-short-device-name
$(eval dn := $(strip $(1)))
$(eval d := \
$(foreach d,$(DEVICES), \
$(if $(filter $(dn),$(DEVICES.$(d).DEVICE_NAME)), \
$(d) \
)) \
)
$(eval d := $(sort $(d)))
$(if $(filter 1,$(words $(d))), \
$(d), \
$(if $(filter 0,$(words $(d))), \
$(error No matches for device "$(dn)"), \
$(error Device "$(dn)" ambiguous: matches $(d)) \
) \
)
endef
#
# $(1): short device name like "sooner"
#
define resolve-short-device-name
$(strip $(call _resolve-short-device-name,$(1)))
endef

81
build/core/dex_preopt.mk Normal file
View File

@ -0,0 +1,81 @@
####################################
# dexpreopt support - typically used on user builds to run dexopt (for Dalvik) or dex2oat (for ART) ahead of time
#
####################################
ifneq ($(DALVIK_VM_LIB),)
# list of boot classpath jars for dexpreopt
DEXPREOPT_BOOT_JARS := $(subst $(space),:,$(PRODUCT_BOOT_JARS))
DEXPREOPT_BOOT_JARS_MODULES := $(PRODUCT_BOOT_JARS)
PRODUCT_BOOTCLASSPATH := $(subst $(space),:,$(foreach m,$(DEXPREOPT_BOOT_JARS_MODULES),/system/framework/$(m).jar))
PRODUCT_SYSTEM_SERVER_CLASSPATH := $(subst $(space),:,$(foreach m,$(PRODUCT_SYSTEM_SERVER_JARS),/system/framework/$(m).jar))
DEXPREOPT_BUILD_DIR := $(OUT_DIR)
DEXPREOPT_PRODUCT_DIR_FULL_PATH := $(PRODUCT_OUT)/dex_bootjars
DEXPREOPT_PRODUCT_DIR := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXPREOPT_PRODUCT_DIR_FULL_PATH))
DEXPREOPT_BOOT_JAR_DIR := system/framework
DEXPREOPT_BOOT_JAR_DIR_FULL_PATH := $(DEXPREOPT_PRODUCT_DIR_FULL_PATH)/$(DEXPREOPT_BOOT_JAR_DIR)
# $(1): the .jar or .apk to remove classes.dex
define dexpreopt-remove-classes.dex
$(hide) zip --quiet --delete $(1) classes.dex; \
dex_index=2; \
while zip --quiet --delete $(1) classes$${dex_index}.dex > /dev/null; do \
let dex_index=dex_index+1; \
done
endef
# Special rules for building stripped boot jars that override java_library.mk rules
# $(1): boot jar module name
define _dexpreopt-boot-jar-remove-classes.dex
_dbj_jar_no_dex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1)_nodex.jar
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
$$(_dbj_jar_no_dex) : $$(_dbj_src_jar) | $(ACP) $(AAPT)
$$(call copy-file-to-target)
ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
$$(call dexpreopt-remove-classes.dex,$$@)
endif
_dbj_jar_no_dex :=
_dbj_src_jar :=
endef
$(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-jar-remove-classes.dex,$(b))))
# Conditionally include Dalvik support.
ifeq ($(DALVIK_VM_LIB),libdvm.so)
include $(BUILD_SYSTEM)/dex_preopt_libdvm.mk
endif
# Unconditionally include ART support because its used run dex2oat on the host for tests.
include $(BUILD_SYSTEM)/dex_preopt_libart.mk
# Define dexpreopt-one-file based on current default runtime.
# $(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,$(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))
endef
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.

View File

@ -0,0 +1,107 @@
####################################
# dexpreopt support for ART
#
####################################
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
# By default, do not run rerun dex2oat if the tool changes.
# Comment out the | to force dex2oat to rerun on after all changes.
DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
DEX2OAT_DEPENDENCY += |
DEX2OAT_DEPENDENCY += $(DEX2OAT)
DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY)
DEX2OATD_DEPENDENCY += $(DEX2OATD)
# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
# Use the first compiled-classes file in PRODUCT_COPY_FILES.
COMPILED_CLASSES := $(call word-colon,1,$(firstword \
$(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES))))
# start of image reserved address space
LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
ifeq ($(strip $(TARGET_BOARD_PLATFORM)),sofia3gr)
LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
else
LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
endif
define get-product-default-property
$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
endef
DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xmx)
DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
ifeq ($(TARGET_ARCH),mips)
# MIPS specific overrides.
# For MIPS the ART image is loaded at a lower address. This causes issues
# with the image overlapping with memory on the host cross-compiling and
# building the image. We therefore limit the Xmx value. This isn't done
# via a property as we want the larger Xmx value if we're running on a
# MIPS device.
LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
DEX2OAT_XMX := 128m
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)
my_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
ifdef TARGET_2ND_ARCH
my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
my_2nd_arch_prefix :=
endif
########################################################################
# For a single jar or APK
# $(1): the input .jar or .apk file
# $(2): the output .odex file
define dex2oat-one-file
$(hide) rm -f $(2)
$(hide) mkdir -p $(dir $(2))
$(hide) $(DEX2OATD) \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
--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=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
--include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \
$(PRIVATE_DEX_PREOPT_FLAGS)
endef

View File

@ -0,0 +1,68 @@
# 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
# Compile boot.oat as position-independent code if WITH_DEXPREOPT_PIC=true
ifeq (true,$(WITH_DEXPREOPT_PIC))
PRODUCT_DEX_PREOPT_BOOT_FLAGS += --compile-pic
endif
# If we have a compiled-classes file, create a parameter.
COMPILED_CLASSES_FLAGS :=
ifneq ($(COMPILED_CLASSES),)
COMPILED_CLASSES_FLAGS := --compiled-classes=$(COMPILED_CLASSES)
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 -Xms$(DEX2OAT_IMAGE_XMS) --runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
--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 --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \
$(PRODUCT_DEX_PREOPT_BOOT_FLAGS) $(COMPILED_CLASSES_FLAGS)

View File

@ -0,0 +1,76 @@
####################################
# dexpreopt support for Dalvik
#
####################################
DEXOPT := $(HOST_OUT_EXECUTABLES)/dexopt$(HOST_EXECUTABLE_SUFFIX)
DEXPREOPT := dalvik/tools/dex-preopt
DEXPREOPT_DEXOPT := $(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(DEXOPT))
DEXPREOPT_BOOT_ODEXS := $(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),\
$(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(b).odex)
# If the target is a uniprocessor, then explicitly tell the preoptimizer
# that fact. (By default, it always optimizes for an SMP target.)
ifeq ($(TARGET_CPU_SMP),true)
DEXPREOPT_UNIPROCESSOR :=
else
DEXPREOPT_UNIPROCESSOR := --uniprocessor
endif
# By default, do not run rerun dexopt if the tool changes.
# Comment out the | to force dex2oat to rerun on after all changes.
DEXOPT_DEPENDENCY := |
DEXOPT_DEPENDENCY += $(DEXPREOPT) $(DEXOPT)
# $(1): the input .jar or .apk file
# $(2): the output .odex file
define dexopt-one-file
$(hide) rm -f $(2)
$(hide) mkdir -p $(dir $(2))
$(hide) $(DEXPREOPT) \
--dexopt=$(DEXPREOPT_DEXOPT) \
--build-dir=$(DEXPREOPT_BUILD_DIR) \
--product-dir=$(DEXPREOPT_PRODUCT_DIR) \
--boot-dir=$(DEXPREOPT_BOOT_JAR_DIR) \
--boot-jars=$(DEXPREOPT_BOOT_JARS) \
$(DEXPREOPT_UNIPROCESSOR) \
$(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(1)) \
$(patsubst $(DEXPREOPT_BUILD_DIR)/%,%,$(2))
endef
# Special rules for building odex files for boot jars that override java_library.mk rules
# $(1): boot jar module name
define _dexpreopt-boot-odex
_dbj_jar := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).jar
_dbj_odex := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(1).odex
_dbj_src_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(1),,COMMON)/javalib.jar
$$(_dbj_odex): PRIVATE_DBJ_JAR := $$(_dbj_jar)
$$(_dbj_odex) : $$(_dbj_src_jar) | $(ACP) $(DEXPREOPT) $(DEXOPT)
@echo "Dexpreopt Boot Jar: $$@"
$(hide) mkdir -p $$(dir $$(PRIVATE_DBJ_JAR)) && $(ACP) -fp $$< $$(PRIVATE_DBJ_JAR)
$$(call dexopt-one-file,$$(PRIVATE_DBJ_JAR),$$@)
_dbj_jar :=
_dbj_odex :=
_dbj_src_jar :=
endef
$(foreach b,$(DEXPREOPT_BOOT_JARS_MODULES),$(eval $(call _dexpreopt-boot-odex,$(b))))
# $(1): the rest list of boot jars
define _build-dexpreopt-boot-jar-dependency-pair
$(if $(filter 1,$(words $(1)))$(filter 0,$(words $(1))),,\
$(eval _bdbjdp_target := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(word 2,$(1)).odex) \
$(eval _bdbjdp_dep := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/$(word 1,$(1)).odex) \
$(eval $(call add-dependency,$(_bdbjdp_target),$(_bdbjdp_dep))) \
$(eval $(call _build-dexpreopt-boot-jar-dependency-pair,$(wordlist 2,999,$(1)))))
endef
define _build-dexpreopt-boot-jar-dependency
$(call _build-dexpreopt-boot-jar-dependency-pair,$(DEXPREOPT_BOOT_JARS_MODULES))
endef
$(eval $(call _build-dexpreopt-boot-jar-dependency))

View File

@ -0,0 +1,132 @@
# dexpreopt_odex_install.mk is used to define odex creation rules for JARs and APKs
# This file depends on variables set in base_rules.mk
# Output variables: LOCAL_DEX_PREOPT, built_odex, dexpreopt_boot_jar_module
# Setting LOCAL_DEX_PREOPT based on WITH_DEXPREOPT, LOCAL_DEX_PREOPT, etc
LOCAL_DEX_PREOPT := $(strip $(LOCAL_DEX_PREOPT))
ifneq (true,$(WITH_DEXPREOPT))
LOCAL_DEX_PREOPT :=
else # WITH_DEXPREOPT=true
ifeq (,$(TARGET_BUILD_APPS)) # TARGET_BUILD_APPS empty
ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
ifneq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Installed to system.img.
ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty
# If we have product-specific config for this module?
ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
LOCAL_DEX_PREOPT := false
else
LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
endif
else # LOCAL_APK_LIBRARIES not empty
LOCAL_DEX_PREOPT := nostripping
endif # LOCAL_APK_LIBRARIES not empty
endif # Installed to system.img.
endif # LOCAL_DEX_PREOPT undefined
endif # TARGET_BUILD_APPS empty
endif # WITH_DEXPREOPT=true
ifeq (false,$(LOCAL_DEX_PREOPT))
LOCAL_DEX_PREOPT :=
endif
ifdef LOCAL_UNINSTALLABLE_MODULE
LOCAL_DEX_PREOPT :=
endif
ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file))) # contains no java code
LOCAL_DEX_PREOPT :=
endif
# if module oat file requested in data, disable LOCAL_DEX_PREOPT, will default location to dalvik-cache
ifneq (,$(filter $(LOCAL_MODULE),$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA)))
LOCAL_DEX_PREOPT :=
endif
# if WITH_DEXPREOPT_BOOT_IMG_ONLY=true and module is not in boot class path skip
ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_ONLY))
ifeq ($(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)
LOCAL_DEX_PREOPT :=
endif
endif
built_odex :=
installed_odex :=
built_installed_odex :=
ifdef LOCAL_DEX_PREOPT
dexpreopt_boot_jar_module := $(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE))
ifdef dexpreopt_boot_jar_module
ifeq ($(DALVIK_VM_LIB),libdvm.so)
built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex
built_installed_odex := $(built_odex):$(installed_odex)
else # libdvm.so
# For libart, the boot jars' odex files are replaced by $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE).
# We use this installed_odex trick to get boot.art installed.
installed_odex := $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
# Append the odex for the 2nd arch if we have one.
installed_odex += $($(TARGET_2ND_ARCH_VAR_PREFIX)DEFAULT_DEX_PREOPT_INSTALLED_IMAGE)
endif # libdvm.so
else # boot jar
ifeq ($(DALVIK_VM_LIB),libdvm.so)
built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
installed_odex := $(basename $(LOCAL_INSTALLED_MODULE)).odex
built_installed_odex := $(built_odex):$(installed_odex)
$(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
my_2nd_arch_prefix :=
include $(BUILD_SYSTEM)/setup_one_odex.mk
# #################################################
# Odex for the 2nd arch
ifdef TARGET_2ND_ARCH
my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/setup_one_odex.mk
endif # TARGET_2ND_ARCH
# #################################################
else # must be APPS
# The preferred arch
my_2nd_arch_prefix := $(LOCAL_2ND_ARCH_VAR_PREFIX)
include $(BUILD_SYSTEM)/setup_one_odex.mk
ifdef TARGET_2ND_ARCH
ifeq ($(LOCAL_MULTILIB),both)
# The non-preferred arch
my_2nd_arch_prefix := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),,$(TARGET_2ND_ARCH_VAR_PREFIX))
include $(BUILD_SYSTEM)/setup_one_odex.mk
endif # LOCAL_MULTILIB is both
endif # TARGET_2ND_ARCH
endif # LOCAL_MODULE_CLASS
endif # libart
endif # boot jar
ifdef built_odex
ifndef LOCAL_DEX_PREOPT_FLAGS
LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
ifndef LOCAL_DEX_PREOPT_FLAGS
LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
endif
endif
# Compile apps with position-independent code if WITH_DEXPREOPT_PIC=true
ifeq (true,$(WITH_DEXPREOPT_PIC))
LOCAL_DEX_PREOPT_FLAGS += --compile-pic
endif
$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
# 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
# Add the installed_odex to the list of installed files for this module.
ALL_MODULES.$(my_register_name).INSTALLED += $(installed_odex)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(built_installed_odex)
# Make sure to install the .odex when you run "make <module_name>"
$(my_register_name): $(installed_odex)
endif # LOCAL_DEX_PREOPT

79
build/core/distdir.mk Normal file
View File

@ -0,0 +1,79 @@
#
# Copyright (C) 2007 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.
#
# When specifying "dist", the user has asked that we copy the important
# files from this build into DIST_DIR.
.PHONY: dist
dist: ;
dist_goal := $(strip $(filter dist,$(MAKECMDGOALS)))
MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS)))
ifeq (,$(strip $(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))))
# The commandline was something like "make dist" or "make dist showcommands".
# Add a dependency on a real target.
dist: $(DEFAULT_GOAL)
endif
ifdef dist_goal
# $(1): source file
# $(2): destination file
# $(3): goals that should copy the file
#
define copy-one-dist-file
$(3): $(2)
$(2): $(1)
@echo "Dist: $$@"
$$(copy-file-to-new-target-with-cp)
endef
# A global variable to remember all dist'ed src:dst pairs.
# So if a src:dst is already dist'ed by another goal,
# we should just establish the dependency and don't really call the
# copy-one-dist-file to avoid multiple rules for the same target.
_all_dist_src_dst_pairs :=
# Other parts of the system should use this function to associate
# certain files with certain goals. When those goals are built
# and "dist" is specified, the marked files will be copied to DIST_DIR.
#
# $(1): a list of goals (e.g. droid, sdk, pdk, ndk)
# $(2): the dist files to add to those goals. If the file contains ':',
# the text following the colon is the name that the file is copied
# to under the dist directory. Subdirs are ok, and will be created
# at copy time if necessary.
define dist-for-goals
$(foreach file,$(2), \
$(eval fw := $(subst :,$(space),$(file))) \
$(eval src := $(word 1,$(fw))) \
$(eval dst := $(word 2,$(fw))) \
$(eval dst := $(if $(dst),$(dst),$(notdir $(src)))) \
$(if $(filter $(_all_dist_src_dst_pairs),$(src):$(dst)),\
$(eval $(call add-dependency,$(1),$(DIST_DIR)/$(dst))),\
$(eval $(call copy-one-dist-file,\
$(src),$(DIST_DIR)/$(dst),$(1)))\
$(eval _all_dist_src_dst_pairs += $(src):$(dst))\
)\
)
endef
else # !dist_goal
# empty definition when not building dist
define dist-for-goals
endef
endif # !dist_goal

View File

@ -0,0 +1,70 @@
# Set up rules to build dpi-specific apk, with whatever else from the base apk.
# Input variable: my_dpi, and all other variables set up in package_internal.mk.
#
dpi_apk_name := $(LOCAL_MODULE)_$(my_dpi)
dpi_intermediate := $(call intermediates-dir-for,APPS,$(dpi_apk_name))
built_dpi_apk := $(dpi_intermediate)/package.apk
# Set up all the target-specific variables.
$(built_dpi_apk): PRIVATE_MODULE := $(dpi_apk_name)
$(built_dpi_apk): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) $(PRODUCT_AAPT_FLAGS) $($(LOCAL_PACKAGE_NAME)_aapt_flags_$(my_dpi))
# Clear PRIVATE_PRODUCT_AAPT_CONFIG to include everything by default.
$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_CONFIG :=
$(built_dpi_apk): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(my_dpi)
$(built_dpi_apk): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
$(built_dpi_apk): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
$(built_dpi_apk): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
$(built_dpi_apk): PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
ifneq (,$(filter-out current system_current, $(LOCAL_SDK_VERSION)))
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
else
$(built_dpi_apk): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
endif
$(built_dpi_apk): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
$(built_dpi_apk): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_INSTRUMENTATION_FOR)
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
$(built_dpi_apk): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abis)
$(built_dpi_apk): PRIVATE_DEX_FILE := $(built_dex)
# Note that PRIVATE_CLASS_INTERMEDIATES_DIR points to the base apk's intermediate dir.
$(built_dpi_apk): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes
$(built_dpi_apk): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
$(built_dpi_apk): PRIVATE_PRIVATE_KEY := $(private_key)
$(built_dpi_apk): PRIVATE_CERTIFICATE := $(certificate)
$(built_dpi_apk): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
# Set up dependenncies and the build recipe.
$(built_dpi_apk) : $(R_file_stamp)
$(built_dpi_apk) : $(all_library_res_package_export_deps)
$(built_dpi_apk) : $(built_dex)
$(built_dpi_apk) : $(private_key) $(certificate) $(SIGNAPK_JAR)
$(built_dpi_apk) : $(AAPT) | $(ZIPALIGN)
$(built_dpi_apk) : $(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)
$(align-package)
# Set up global variables to register this apk to the higher-level dependency graph.
ALL_MODULES += $(dpi_apk_name)
ALL_MODULES.$(dpi_apk_name).CLASS := APPS
ALL_MODULES.$(dpi_apk_name).BUILT := $(built_dpi_apk)
PACKAGES := $(PACKAGES) $(dpi_apk_name)
PACKAGES.$(dpi_apk_name).PRIVATE_KEY := $(private_key)
PACKAGES.$(dpi_apk_name).CERTIFICATE := $(certificate)
# Phony targets used by "apps_only".
.PHONY: $(dpi_apk_name)
$(dpi_apk_name) : $(built_dpi_apk)

242
build/core/droiddoc.mk Normal file
View File

@ -0,0 +1,242 @@
#
# 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.
#
##
##
## Common to both droiddoc and javadoc
##
##
LOCAL_IS_HOST_MODULE := $(call true-or-empty,$(LOCAL_IS_HOST_MODULE))
ifeq ($(LOCAL_IS_HOST_MODULE),true)
my_prefix := HOST_
else
my_prefix := TARGET_
endif
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
ifndef LOCAL_MODULE_CLASS
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined)
endif
full_src_files := $(patsubst %,$(LOCAL_PATH)/%,$(LOCAL_SRC_FILES))
out_dir := $(OUT_DOCS)/$(LOCAL_MODULE)
full_target := $(call doc-timestamp-for,$(LOCAL_MODULE))
ifeq ($(LOCAL_DROIDDOC_SOURCE_PATH),)
LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)
endif
ifeq ($(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR),)
LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := $(SRC_DROIDDOC_DIR)/$(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
endif
ifeq ($(LOCAL_DROIDDOC_ASSET_DIR),)
LOCAL_DROIDDOC_ASSET_DIR := assets
endif
ifeq ($(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR),)
LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets
endif
ifeq ($(LOCAL_IS_HOST_MODULE),true)
$(full_target): PRIVATE_BOOTCLASSPATH :=
full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
full_java_lib_deps := $(full_java_libs)
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 ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
LOCAL_JAVA_LIBRARIES := android_system_stubs_current $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, android_system_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-libart ext framework $(LOCAL_JAVA_LIBRARIES)
$(full_target): PRIVATE_BOOTCLASSPATH := $(call java-lib-files, core-libart)
endif # LOCAL_SDK_VERSION
LOCAL_JAVA_LIBRARIES := $(sort $(LOCAL_JAVA_LIBRARIES))
full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES)) $(LOCAL_CLASSPATH)
endif # !LOCAL_IS_HOST_MODULE
$(full_target): PRIVATE_CLASSPATH := $(subst $(space),:,$(full_java_libs))
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
$(full_target): PRIVATE_SOURCE_PATH := $(call normalize-path-list,$(LOCAL_DROIDDOC_SOURCE_PATH))
$(full_target): PRIVATE_JAVA_FILES := $(filter %.java,$(full_src_files))
$(full_target): PRIVATE_JAVA_FILES += $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES)))
$(full_target): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
$(full_target): PRIVATE_SRC_LIST_FILE := $(intermediates.COMMON)/droiddoc-src-list
ifneq ($(strip $(LOCAL_ADDITIONAL_JAVA_DIR)),)
$(full_target): PRIVATE_ADDITIONAL_JAVA_DIR := $(LOCAL_ADDITIONAL_JAVA_DIR)
endif
$(full_target): PRIVATE_OUT_DIR := $(out_dir)
$(full_target): PRIVATE_DROIDDOC_OPTIONS := $(LOCAL_DROIDDOC_OPTIONS)
# Lists the input files for the doc build into a text file
# suitable for the @ syntax of javadoc.
# $(1): the file to create
# $(2): files to include
# $(3): list of directories to search for java files in
define prepare-doc-source-list
$(hide) mkdir -p $(dir $(1))
$(call dump-words-to-file, $(2), $(1))
$(hide) for d in $(3) ; do find $$d -name '*.java' >> $(1) 2> /dev/null ; done ; true
endef
ifeq (a,b)
$(full_target): PRIVATE_PROFILING_OPTIONS := \
-J-agentlib:jprofilerti=port=8849 -J-Xbootclasspath/a:/Applications/jprofiler5/bin/agent.jar
endif
ifneq ($(strip $(LOCAL_DROIDDOC_USE_STANDARD_DOCLET)),true)
##
##
## droiddoc only
##
##
droiddoc_templates := \
$(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f)
droiddoc := \
$(HOST_JDK_TOOLS_JAR) \
$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER)
$(full_target): PRIVATE_CURRENT_TIME := -hdf page.now "$(shell date "+%d %b %Y %k:%M")"
$(full_target): PRIVATE_CUSTOM_TEMPLATE_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
$(full_target): PRIVATE_IN_CUSTOM_ASSET_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
$(full_target): PRIVATE_OUT_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_OUT_CUSTOM_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
html_dir_files :=
ifneq ($(strip $(LOCAL_DROIDDOC_HTML_DIR)),)
$(full_target): PRIVATE_DROIDDOC_HTML_DIR := -htmldir $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR)
html_dir_files := $(shell find $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR) -type f)
else
$(full_target): PRIVATE_DROIDDOC_HTML_DIR :=
endif
ifneq ($(strip $(LOCAL_ADDITIONAL_HTML_DIR)),)
$(full_target): PRIVATE_ADDITIONAL_HTML_DIR := -htmldir2 $(LOCAL_PATH)/$(LOCAL_ADDITIONAL_HTML_DIR)
else
$(full_target): PRIVATE_ADDITIONAL_HTML_DIR :=
endif
# TODO: not clear if this is used any more
$(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
$(full_target): $(full_src_files) $(droiddoc_templates) $(droiddoc) $(html_dir_files) $(full_java_lib_deps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
@echo Docs droiddoc: $(PRIVATE_OUT_DIR)
$(hide) mkdir -p $(dir $@)
$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
$(hide) ( \
javadoc \
-encoding UTF-8 \
\@$(PRIVATE_SRC_LIST_FILE) \
-J-Xmx1280m \
-XDignore.symbol.file \
$(PRIVATE_PROFILING_OPTIONS) \
-quiet \
-doclet com.google.doclava.Doclava \
-docletpath $(PRIVATE_DOCLETPATH) \
-templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
$(PRIVATE_DROIDDOC_HTML_DIR) \
$(PRIVATE_ADDITIONAL_HTML_DIR) \
$(addprefix -bootclasspath ,$(PRIVATE_BOOTCLASSPATH)) \
$(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
-sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
-d $(PRIVATE_OUT_DIR) \
$(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) \
$(PRIVATE_DROIDDOC_OPTIONS) \
&& touch -f $@ \
) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
else
##
##
## standard doclet only
##
##
$(full_target): $(full_src_files) $(full_java_lib_deps)
@echo Docs javadoc: $(PRIVATE_OUT_DIR)
@mkdir -p $(dir $@)
$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
$(hide) ( \
javadoc \
-encoding UTF-8 \
$(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 \
&& touch -f $@ \
) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
endif
##
##
## Common to both droiddoc and javadoc
##
##
ALL_DOCS += $(full_target)
.PHONY: $(LOCAL_MODULE)-docs
$(LOCAL_MODULE)-docs : $(full_target)
ifeq ($(strip $(LOCAL_UNINSTALLABLE_MODULE)),)
# Define a rule to create a zip of these docs.
out_zip := $(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip
$(out_zip): PRIVATE_DOCS_DIR := $(out_dir)
$(out_zip): $(full_target)
@echo Package docs: $@
@rm -f $@
@mkdir -p $(dir $@)
$(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rq $$F * )
$(LOCAL_MODULE)-docs.zip : $(out_zip)
$(call dist-for-goals,docs,$(out_zip))
endif

87
build/core/dumpvar.mk Normal file
View File

@ -0,0 +1,87 @@
# ---------------------------------------------------------------
# the setpath shell function in envsetup.sh uses this to figure out
# what to add to the path given the config we have chosen.
ifeq ($(CALLED_FROM_SETUP),true)
ifneq ($(filter /%,$(HOST_OUT_EXECUTABLES)),)
ABP:=$(HOST_OUT_EXECUTABLES)
else
ABP:=$(PWD)/$(HOST_OUT_EXECUTABLES)
endif
ANDROID_BUILD_PATHS := $(ABP)
ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
# The "dumpvar" stuff lets you say something like
#
# CALLED_FROM_SETUP=true \
# make -f config/envsetup.make dumpvar-TARGET_OUT
# or
# CALLED_FROM_SETUP=true \
# make -f config/envsetup.make dumpvar-abs-HOST_OUT_EXECUTABLES
#
# The plain (non-abs) version just dumps the value of the named variable.
# The "abs" version will treat the variable as a path, and dumps an
# absolute path to it.
#
dumpvar_goals := \
$(strip $(patsubst dumpvar-%,%,$(filter dumpvar-%,$(MAKECMDGOALS))))
ifdef dumpvar_goals
ifneq ($(words $(dumpvar_goals)),1)
$(error Only one "dumpvar-" goal allowed. Saw "$(MAKECMDGOALS)")
endif
# If the goal is of the form "dumpvar-abs-VARNAME", then
# treat VARNAME as a path and return the absolute path to it.
absolute_dumpvar := $(strip $(filter abs-%,$(dumpvar_goals)))
ifdef absolute_dumpvar
dumpvar_goals := $(patsubst abs-%,%,$(dumpvar_goals))
ifneq ($(filter /%,$($(dumpvar_goals))),)
DUMPVAR_VALUE := $($(dumpvar_goals))
else
DUMPVAR_VALUE := $(PWD)/$($(dumpvar_goals))
endif
dumpvar_target := dumpvar-abs-$(dumpvar_goals)
else
DUMPVAR_VALUE := $($(dumpvar_goals))
dumpvar_target := dumpvar-$(dumpvar_goals)
endif
.PHONY: $(dumpvar_target)
$(dumpvar_target):
@echo $(DUMPVAR_VALUE)
endif # dumpvar_goals
ifneq ($(dumpvar_goals),report_config)
PRINT_BUILD_CONFIG:=
endif
endif # CALLED_FROM_SETUP
ifneq ($(PRINT_BUILD_CONFIG),)
HOST_OS_EXTRA:=$(shell python -c "import platform; print(platform.platform())")
$(info ============================================)
$(info PLATFORM_VERSION_CODENAME=$(PLATFORM_VERSION_CODENAME))
$(info PLATFORM_VERSION=$(PLATFORM_VERSION))
$(info TARGET_PRODUCT=$(TARGET_PRODUCT))
$(info TARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT))
$(info TARGET_BUILD_TYPE=$(TARGET_BUILD_TYPE))
$(info TARGET_BUILD_APPS=$(TARGET_BUILD_APPS))
$(info TARGET_ARCH=$(TARGET_ARCH))
$(info TARGET_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))
$(info HOST_BUILD_TYPE=$(HOST_BUILD_TYPE))
$(info BUILD_ID=$(BUILD_ID))
$(info OUT_DIR=$(OUT_DIR))
$(info ============================================)
endif

View File

@ -0,0 +1,136 @@
###########################################################
## Standard rules for building any target-side binaries
## with dynamic linkage (dynamic libraries or executables
## that link with dynamic libraries)
##
## Files including this file must define a rule to build
## the target $(linked_module).
###########################################################
# This constraint means that we can hard-code any $(TARGET_*) variables.
ifdef LOCAL_IS_HOST_MODULE
$(error This file should not be used to build host binaries. Included by (or near) $(lastword $(filter-out config/%,$(MAKEFILE_LIST))))
endif
# The name of the target file, without any path prepended.
# 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
intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX))
# Define the target that is the unmodified output of the linker.
# 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 := $(intermediates)/LINKED/$(my_built_module_stem)
ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
# Because TARGET_SYMBOL_FILTER_FILE depends on ALL_ORIGINAL_DYNAMIC_BINARIES,
# the linked_module rules won't necessarily inherit the PRIVATE_
# variables from LOCAL_BUILT_MODULE. This tells binary.make to explicitly
# define the PRIVATE_ variables for linked_module as well as for
# LOCAL_BUILT_MODULE.
LOCAL_INTERMEDIATE_TARGETS := $(linked_module)
###################################
include $(BUILD_SYSTEM)/binary.mk
###################################
###########################################################
## Compress
###########################################################
compress_input := $(linked_module)
ifeq ($(strip $(LOCAL_COMPRESS_MODULE_SYMBOLS)),)
LOCAL_COMPRESS_MODULE_SYMBOLS := $(strip $(TARGET_COMPRESS_MODULE_SYMBOLS))
endif
ifeq ($(LOCAL_COMPRESS_MODULE_SYMBOLS),true)
$(error Symbol compression not yet supported.)
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
# make it depend on ALL_ORIGINAL_DYNAMIC_BINARIES.
$(compress_output): $(compress_input) $(TARGET_SYMBOL_FILTER_FILE) | $(ACP)
@echo "target Compress Symbols: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
else
# Skip this step.
compress_output := $(compress_input)
endif
###########################################################
## Store a copy with symbols for symbolic debugging
###########################################################
ifeq ($(LOCAL_UNSTRIPPED_PATH),)
my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
else
my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH)
endif
symbolic_input := $(compress_output)
symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem)
$(symbolic_output) : $(symbolic_input) | $(ACP)
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
###########################################################
## Strip
###########################################################
strip_input := $(symbolic_output)
strip_output := $(LOCAL_BUILT_MODULE)
my_strip_module := $(LOCAL_STRIP_MODULE)
ifeq ($(my_strip_module),)
my_strip_module := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP_MODULE)
endif
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)
# A product may be configured to strip everything in some build variants.
# We do the stripping as a post-install command so that LOCAL_BUILT_MODULE
# is still with the symbols and we don't need to clean it (and relink) when
# you switch build variant.
ifneq ($(filter $(STRIP_EVERYTHING_BUILD_VARIANTS),$(TARGET_BUILD_VARIANT)),)
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := \
$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP) --strip-all $(LOCAL_INSTALLED_MODULE)
endif
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.
#
# If the binary we're copying is acp or a prerequisite,
# use cp(1) instead.
ifneq ($(LOCAL_ACP_UNAVAILABLE),true)
$(strip_output): $(strip_input) | $(ACP)
@echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
else
$(strip_output): $(strip_input)
@echo "target Unstripped: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target-with-cp)
endif
endif
endif # my_strip_module
$(cleantarget): PRIVATE_CLEAN_FILES += \
$(linked_module) \
$(symbolic_output) \
$(compress_output)

404
build/core/envsetup.mk Normal file
View File

@ -0,0 +1,404 @@
# Variables we check:
# HOST_BUILD_TYPE = { release debug }
# TARGET_BUILD_TYPE = { release debug }
# and we output a bunch of variables, see the case statement at
# the bottom for the full list
# OUT_DIR is also set to "out" if it's not already set.
# this allows you to set it to somewhere else if you like
# Set up version information.
include $(BUILD_SYSTEM)/version_defaults.mk
# ---------------------------------------------------------------
# If you update the build system such that the environment setup
# or buildspec.mk need to be updated, increment this number, and
# people who haven't re-run those will have to do so before they
# can build. Make sure to also update the corresponding value in
# buildspec.mk.default and envsetup.sh.
CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 10
# ---------------------------------------------------------------
# The product defaults to generic on hardware
# NOTE: This will be overridden in product_config.mk if make
# was invoked with a PRODUCT-xxx-yyy goal.
ifeq ($(TARGET_PRODUCT),)
TARGET_PRODUCT := full
endif
# the variant -- the set of files that are included for a build
ifeq ($(strip $(TARGET_BUILD_VARIANT)),)
TARGET_BUILD_VARIANT := eng
endif
# ---------------------------------------------------------------
# Set up configuration for host machine. We don't do cross-
# compiles except for arm/mips, so the HOST is whatever we are
# running on
UNAME := $(shell uname -sm)
# HOST_OS
ifneq (,$(findstring Linux,$(UNAME)))
HOST_OS := linux
endif
ifneq (,$(findstring Darwin,$(UNAME)))
HOST_OS := darwin
endif
ifneq (,$(findstring Macintosh,$(UNAME)))
HOST_OS := darwin
endif
ifneq (,$(findstring CYGWIN,$(UNAME)))
HOST_OS := windows
endif
# BUILD_OS is the real host doing the build.
BUILD_OS := $(HOST_OS)
# Under Linux, if USE_MINGW is set, we change HOST_OS to Windows to build the
# Windows SDK. Only a subset of tools and SDK will manage to build properly.
ifeq ($(HOST_OS),linux)
ifneq ($(USE_MINGW),)
HOST_OS := windows
endif
endif
ifeq ($(HOST_OS),)
$(error Unable to determine HOST_OS from uname -sm: $(UNAME)!)
endif
# 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))
# Default to 32-bit-by-default multilib host build.
HOST_PREFER_32_BIT := true
endif
# HOST_ARCH
ifneq (,$(findstring x86_64,$(UNAME)))
HOST_ARCH := x86_64
HOST_2ND_ARCH := x86
HOST_IS_64_BIT := true
endif
ifeq ($(HOST_PREFER_32_BIT),true)
SDK_HOST_ARCH := x86
else
SDK_HOST_ARCH := $(HOST_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)!)
endif
# the host build defaults to release, and it must be release or debug
ifeq ($(HOST_BUILD_TYPE),)
HOST_BUILD_TYPE := release
endif
ifneq ($(HOST_BUILD_TYPE),release)
ifneq ($(HOST_BUILD_TYPE),debug)
$(error HOST_BUILD_TYPE must be either release or debug, not '$(HOST_BUILD_TYPE)')
endif
endif
# We don't want to move all the prebuilt host tools to a $(HOST_OS)-x86_64 dir.
HOST_PREBUILT_ARCH := x86
# This is the standard way to name a directory containing prebuilt host
# objects. E.g., prebuilt/$(HOST_PREBUILT_TAG)/cc
ifeq ($(HOST_OS),windows)
HOST_PREBUILT_TAG := windows
else
HOST_PREBUILT_TAG := $(HOST_OS)-$(HOST_PREBUILT_ARCH)
endif
# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT.
# Define them here so they can be used in product config files.
TARGET_COPY_OUT_SYSTEM := system
TARGET_COPY_OUT_DATA := data
TARGET_COPY_OUT_OEM := oem
TARGET_COPY_OUT_ROOT := root
TARGET_COPY_OUT_RECOVERY := recovery
###########################################
# Define TARGET_COPY_OUT_VENDOR to a placeholder, for at this point
# we don't know if the device wants to build a separate vendor.img
# or just build vendor stuff into system.img.
# A device can set up TARGET_COPY_OUT_VENDOR to "vendor" in its
# BoardConfig.mk.
# We'll substitute with the real value after loading BoardConfig.mk.
_vendor_path_placeholder := ||VENDOR-PATH-PH||
TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
###########################################
# Read the product specs so we can get TARGET_DEVICE and other
# variables that we need in order to locate the output files.
include $(BUILD_SYSTEM)/product_config.mk
build_variant := $(filter-out eng user userdebug,$(TARGET_BUILD_VARIANT))
ifneq ($(build_variant)-$(words $(TARGET_BUILD_VARIANT)),-1)
$(warning bad TARGET_BUILD_VARIANT: $(TARGET_BUILD_VARIANT))
$(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 :=
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR
ifeq ($(TARGET_COPY_OUT_VENDOR),$(_vendor_path_placeholder))
TARGET_COPY_OUT_VENDOR := system/vendor
else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),)
$(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.)
endif
PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES))
###########################################
# ---------------------------------------------------------------
# Set up configuration for target machine.
# The following must be set:
# TARGET_OS = { linux }
# TARGET_ARCH = { arm | x86 | mips }
TARGET_OS := linux
# TARGET_ARCH should be set by BoardConfig.mk and will be checked later
ifneq ($(filter %64,$(TARGET_ARCH)),)
TARGET_IS_64_BIT := true
endif
# the target build type defaults to release
ifneq ($(TARGET_BUILD_TYPE),debug)
TARGET_BUILD_TYPE := release
endif
# ---------------------------------------------------------------
# figure out the output directories
ifeq (,$(strip $(OUT_DIR)))
ifeq (,$(strip $(OUT_DIR_COMMON_BASE)))
OUT_DIR := $(TOPDIR)out
else
OUT_DIR := $(OUT_DIR_COMMON_BASE)/$(notdir $(PWD))
endif
endif
DEBUG_OUT_DIR := $(OUT_DIR)/debug
# Move the host or target under the debug/ directory
# if necessary.
TARGET_OUT_ROOT_release := $(OUT_DIR)/target
TARGET_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/target
TARGET_OUT_ROOT := $(TARGET_OUT_ROOT_$(TARGET_BUILD_TYPE))
HOST_OUT_ROOT_release := $(OUT_DIR)/host
HOST_OUT_ROOT_debug := $(DEBUG_OUT_DIR)/host
HOST_OUT_ROOT := $(HOST_OUT_ROOT_$(HOST_BUILD_TYPE))
# 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))
ifeq ($(strip $(ANDROID_HOST_OUT)), )
HOST_OUT_IS_ABS=$(shell if [ -d $(shell pwd)/$(HOST_OUT) ] ; then echo "false" ; else echo "true"; fi )
ifeq ($(strip $(HOST_OUT_IS_ABS)), false)
ANDROID_HOST_OUT := $(shell pwd)/$(HOST_OUT)
else
ANDROID_HOST_OUT := $(HOST_OUT)
endif
endif
BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)
TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common
HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common
PRODUCT_OUT := $(TARGET_PRODUCT_OUT_ROOT)/$(TARGET_DEVICE)
OUT_DOCS := $(TARGET_COMMON_OUT_ROOT)/docs
BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin
HOST_OUT_EXECUTABLES := $(HOST_OUT)/bin
HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib64
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_INTERMEDIATE_LIBRARIES := $(HOST_OUT_INTERMEDIATES)/lib
HOST_OUT_NOTICE_FILES := $(HOST_OUT_INTERMEDIATES)/NOTICE_FILES
HOST_OUT_COMMON_INTERMEDIATES := $(HOST_COMMON_OUT_ROOT)/obj
HOST_OUT_FAKE := $(HOST_OUT)/fake_packages
HOST_OUT_GEN := $(HOST_OUT)/gen
HOST_OUT_COMMON_GEN := $(HOST_COMMON_OUT_ROOT)/gen
# Out for HOST_2ND_ARCH
HOST_2ND_ARCH_VAR_PREFIX := 2ND_
HOST_2ND_ARCH_MODULE_SUFFIX := _32
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES := $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES)/lib
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_EXECUTABLES := $(HOST_OUT_EXECUTABLES)
# The default host library path.
# It always points to the path where we build libraries in the default bitness.
ifeq ($(HOST_PREFER_32_BIT),true)
HOST_LIBRARY_PATH := $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)
else
HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
endif
TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
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_GEN := $(PRODUCT_OUT)/gen
TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
TARGET_OUT_EXECUTABLES := $(TARGET_OUT)/bin
TARGET_OUT_OPTIONAL_EXECUTABLES := $(TARGET_OUT)/xbin
ifeq ($(TARGET_IS_64_BIT),true)
# /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_FAKE := $(PRODUCT_OUT)/fake_packages
# Out for TARGET_2ND_ARCH
TARGET_2ND_ARCH_VAR_PREFIX := $(HOST_2ND_ARCH_VAR_PREFIX)
TARGET_2ND_ARCH_MODULE_SUFFIX := $(HOST_2ND_ARCH_MODULE_SUFFIX)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj_$(TARGET_2ND_ARCH)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATES)/lib
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES := $(TARGET_OUT)/lib
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_EXECUTABLES := $(TARGET_OUT_EXECUTABLES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS := $(TARGET_OUT_APPS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_APPS_PRIVILEGED := $(TARGET_OUT_APPS_PRIVILEGED)
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_KEYLAYOUT := $(TARGET_OUT_KEYLAYOUT)
TARGET_OUT_DATA_KEYCHARS := $(TARGET_OUT_KEYCHARS)
TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC)
ifeq ($(TARGET_IS_64_BIT),true)
TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest64
else
TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
endif
TARGET_OUT_DATA_FAKE := $(TARGET_OUT_DATA)/fake_packages
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_DATA_EXECUTABLES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_APPS := $(TARGET_OUT_DATA_APPS)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
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
ifeq ($(TARGET_IS_64_BIT),true)
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_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR_APPS)
TARGET_OUT_OEM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_OEM)
TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM)/bin
ifneq ($(filter %64,$(TARGET_ARCH)),)
TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib64
else
TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
endif
# We don't expect Java libraries in the oem.img.
# TARGET_OUT_OEM_JAVA_LIBRARIES:= $(TARGET_OUT_OEM)/framework
TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM)/app
TARGET_OUT_OEM_ETC := $(TARGET_OUT_OEM)/etc
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_EXECUTABLES := $(TARGET_OUT_OEM_EXECUTABLES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_SHARED_LIBRARIES := $(TARGET_OUT_OEM)/lib
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_OEM_APPS := $(TARGET_OUT_OEM_APPS)
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols
TARGET_OUT_EXECUTABLES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/bin
TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/system/lib
TARGET_OUT_VENDOR_SHARED_LIBRARIES_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/$(TARGET_COPY_OUT_VENDOR)/lib
TARGET_ROOT_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
TARGET_ROOT_OUT_SBIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/sbin
TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin
TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT)
TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin
TARGET_ROOT_OUT_SBIN := $(TARGET_ROOT_OUT)/sbin
TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc
TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr
TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY)
TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root
TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader
TARGET_SYSLOADER_ROOT_OUT := $(TARGET_SYSLOADER_OUT)/root
TARGET_SYSLOADER_SYSTEM_OUT := $(TARGET_SYSLOADER_OUT)/root/system
TARGET_INSTALLER_OUT := $(PRODUCT_OUT)/installer
TARGET_INSTALLER_DATA_OUT := $(TARGET_INSTALLER_OUT)/data
TARGET_INSTALLER_ROOT_OUT := $(TARGET_INSTALLER_OUT)/root
TARGET_INSTALLER_SYSTEM_OUT := $(TARGET_INSTALLER_OUT)/root/system
TARGET_FACTORY_RAMDISK_OUT := $(PRODUCT_OUT)/factory_ramdisk
COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARIES
ifeq (,$(strip $(DIST_DIR)))
DIST_DIR := $(OUT_DIR)/dist
endif
ifeq ($(PRINT_BUILD_CONFIG),)
PRINT_BUILD_CONFIG := true
endif

73
build/core/executable.mk Normal file
View File

@ -0,0 +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_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
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 :=

View File

@ -0,0 +1,72 @@
###########################################################
## Standard rules for building an executable file.
##
## Additional inputs from base_rules.make:
## None.
###########################################################
ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
LOCAL_MODULE_CLASS := EXECUTABLES
endif
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
LOCAL_MODULE_SUFFIX := $(TARGET_EXECUTABLE_SUFFIX)
endif
$(call target-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)/dynamic_binary.mk
# Check for statically linked libc
ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
ifneq ($(filter $(my_static_libraries),libc),)
$(error $(LOCAL_PATH): $(LOCAL_MODULE) is statically linking libc to dynamic executable, please remove libc from static libs or set LOCAL_FORCE_STATIC_EXECUTABLE := true)
endif
endif
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
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)
ifdef LOCAL_SDK_VERSION
# Make sure the prebuilt NDK paths are put ahead of the TARGET_GLOBAL_LD_DIRS,
# 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_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_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_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)
$(transform-o-to-static-executable)
else
$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o)
$(transform-o-to-executable)
endif
endif # skip_build_from_source

View File

@ -0,0 +1,55 @@
# 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
# 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.
ifneq ($(LOCAL_IS_HOST_MODULE),true)
my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE))
ifeq ($(TARGET_IS_64_BIT),true)
ifeq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(TARGET_SUPPORTS_32_BIT_APPS),true|true)
# We support both 32 and 64 bit apps, so we will have to
# base our decision on whether the target prefers one or the
# other.
ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
else
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
endif
else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
# We support only 64 bit apps.
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
else
# We support only 32 bit apps.
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
endif
else
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
endif
else
my_symlink := $(addprefix $(HOST_OUT)/bin/, $(LOCAL_MODULE))
ifneq ($(HOST_PREFER_32_BIT),true)
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
else
$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
endif
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)
# Create the symlink when you run mm/mmm or "make <module_name>"
$(LOCAL_MODULE) : $(my_symlink)
my_symlink :=

View File

@ -0,0 +1,25 @@
NM=$1
shift
PREFIX=$1
shift
SUFFIX=$1
shift
while test "$1" != ""
do
$NM -g -fp $1 | while read -a line
do
type=${line[1]}
# if [[ "$type" != "V" && "$type" != "U" ]]; then
#if [[ "$type" != "W" && "$type" != "V" && "$type" != "U" ]]; then
echo "$PREFIX${line[0]}$SUFFIX # ${line[1]}"
#fi
done
shift
done

View File

@ -0,0 +1,14 @@
#!/bin/sh
if [ "x$ANDROID_JAVA_HOME" != x ] && [ -e "$ANDROID_JAVA_HOME/lib/tools.jar" ] ; then
echo $ANDROID_JAVA_HOME/lib/tools.jar
else
JAVAC=$(which javac)
if [ -z "$JAVAC" ] ; then
exit 1
fi
while [ -L "$JAVAC" ] ; do
LSLINE=$(ls -l "$JAVAC")
JAVAC=$(echo -n "$LSLINE" | sed -e "s/.* -> //")
done
echo $JAVAC | sed -e "s:\(.*\)/bin/javac.*:\\1/lib/tools.jar:"
fi

34
build/core/help.mk Normal file
View File

@ -0,0 +1,34 @@
#
# Copyright (C) 2010 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.
#
.PHONY: help
help:
@echo
@echo "Common make targets:"
@echo "----------------------------------------------------------------------------------"
@echo "droid Default target"
@echo "clean (aka clobber) equivalent to rm -rf out/"
@echo "snod Quickly rebuild the system image from built packages"
@echo "offline-sdk-docs Generate the HTML for the developer SDK docs"
@echo "doc-comment-check-docs Check HTML doc links & validity, without generating HTML"
@echo "libandroid_runtime All the JNI framework stuff"
@echo "framework All the java framework stuff"
@echo "services The system server (Java) and friends"
@echo "help You're reading it right now"
.PHONY: out
out:
@echo "I'm sure you're nice and all, but no thanks."

View File

@ -0,0 +1,107 @@
#
# 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.
#
#
# Rules for building a host dalvik java library. These libraries
# are meant to be used by a dalvik VM instance running on the host.
# They will be compiled against libcore and not the host JRE.
#
USE_CORE_LIB_BOOTCLASSPATH := true
#######################################
include $(BUILD_SYSTEM)/host_java_library_common.mk
#######################################
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
LOCAL_JAVA_LIBRARIES += core-libart-hostdex
endif
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
full_classes_jar := $(intermediates.COMMON)/classes.jar
built_dex := $(intermediates.COMMON)/classes.dex
LOCAL_INTERMEDIATE_TARGETS += \
$(full_classes_compiled_jar) \
$(full_classes_jarjar_jar) \
$(full_classes_jar) \
$(built_dex)
# See comment in java.mk
java_alternative_checked_module := $(full_classes_compiled_jar)
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
java_alternative_checked_module :=
# The layers file allows you to enforce a layering between java packages.
# Run build/tools/java-layers.py for more details.
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS :=
$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
$(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES)
$(transform-host-java-to-package)
# Run jarjar if necessary, otherwise just copy the file.
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
@echo JarJar: $@
$(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
else
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
endif
$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
@echo Copying: $@
$(hide) $(ACP) -fp $< $@
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
$(built_dex): $(full_classes_jar) $(DX)
$(transform-classes.jar-to-dex)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
$(add-dex-to-package)
$(add-carried-java-resources)
ifneq ($(extra_jar_args),)
$(add-java-resources-to-package)
endif
USE_CORE_LIB_BOOTCLASSPATH :=

View File

@ -0,0 +1,28 @@
#
# 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.
#
#
# Rules for building a host dalvik static java library.
# These libraries will be compiled against libcore and not the host
# JRE.
#
USE_CORE_LIB_BOOTCLASSPATH := true
LOCAL_JAVA_LIBRARIES += core-libart-hostdex
include $(BUILD_SYSTEM)/host_java_library.mk
USE_CORE_LIB_BOOTCLASSPATH :=

Some files were not shown because too many files have changed in this diff Show More