2009-03-04 11:28:42 +08:00
|
|
|
# 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.
|
|
|
|
|
2010-03-31 07:42:15 +08:00
|
|
|
# Only use ANDROID_BUILD_SHELL to wrap around bash.
|
|
|
|
# DO NOT use other shells such as zsh.
|
2010-03-31 03:55:13 +08:00
|
|
|
ifdef ANDROID_BUILD_SHELL
|
|
|
|
SHELL := $(ANDROID_BUILD_SHELL)
|
|
|
|
else
|
2009-03-04 11:28:42 +08:00
|
|
|
# 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
|
2010-03-31 03:55:13 +08:00
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2012-09-28 04:26:25 +08:00
|
|
|
# Utility variables.
|
|
|
|
empty :=
|
|
|
|
space := $(empty) $(empty)
|
|
|
|
comma := ,
|
2014-10-04 02:36:27 +08:00
|
|
|
# Note that make will eat the newline just before endef.
|
|
|
|
define newline
|
|
|
|
|
|
|
|
|
2015-09-23 05:37:53 +08:00
|
|
|
endef
|
|
|
|
# The pound character "#"
|
|
|
|
define pound
|
|
|
|
#
|
2014-10-04 02:36:27 +08:00
|
|
|
endef
|
|
|
|
# Unfortunately you can't simply define backslash as \ or \\.
|
|
|
|
backslash := \a
|
|
|
|
backslash := $(patsubst %a,%,$(backslash))
|
2012-09-28 04:26:25 +08:00
|
|
|
|
2010-01-05 04:57:38 +08:00
|
|
|
# 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
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# Standard source directories.
|
|
|
|
# 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 \
|
2015-04-04 06:09:11 +08:00
|
|
|
$(TOPDIR)system/media/audio/include \
|
2009-03-04 11:28:42 +08:00
|
|
|
$(TOPDIR)hardware/libhardware/include \
|
|
|
|
$(TOPDIR)hardware/libhardware_legacy/include \
|
|
|
|
$(TOPDIR)hardware/ril/include \
|
2012-05-04 07:37:40 +08:00
|
|
|
$(TOPDIR)libnativehelper/include \
|
2012-03-06 08:04:31 +08:00
|
|
|
$(TOPDIR)frameworks/native/include \
|
|
|
|
$(TOPDIR)frameworks/native/opengl/include \
|
2012-03-24 09:46:42 +08:00
|
|
|
$(TOPDIR)frameworks/av/include \
|
2014-02-28 03:02:37 +08:00
|
|
|
$(TOPDIR)frameworks/base/include
|
2009-03-04 11:28:42 +08:00
|
|
|
SRC_TARGET_DIR := $(TOPDIR)build/target
|
2012-12-05 07:07:34 +08:00
|
|
|
SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
|
2014-06-27 08:54:28 +08:00
|
|
|
SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api
|
2009-03-04 11:28:42 +08:00
|
|
|
|
|
|
|
# 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_SHARED_LIBRARY:= $(BUILD_SYSTEM)/shared_library.mk
|
|
|
|
BUILD_EXECUTABLE:= $(BUILD_SYSTEM)/executable.mk
|
|
|
|
BUILD_HOST_EXECUTABLE:= $(BUILD_SYSTEM)/host_executable.mk
|
|
|
|
BUILD_PACKAGE:= $(BUILD_SYSTEM)/package.mk
|
2010-09-16 15:25:16 +08:00
|
|
|
BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk
|
2009-03-04 11:28:42 +08:00
|
|
|
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
|
2010-07-21 02:08:47 +08:00
|
|
|
BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
|
2013-11-16 06:37:23 +08:00
|
|
|
BUILD_NATIVE_BENCHMARK := $(BUILD_SYSTEM)/native_benchmark.mk
|
2010-07-21 02:08:47 +08:00
|
|
|
BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
|
2015-07-31 07:56:30 +08:00
|
|
|
BUILD_FUZZ_TEST := $(BUILD_SYSTEM)/fuzz_test.mk
|
|
|
|
BUILD_HOST_FUZZ_TEST := $(BUILD_SYSTEM)/host_fuzz_test.mk
|
2014-02-05 14:09:16 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-11-02 08:22:33 +08:00
|
|
|
BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
|
2013-10-28 21:20:52 +08:00
|
|
|
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
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
|
|
|
|
# ###############################################################
|
|
|
|
# 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))
|
2015-07-29 08:57:45 +08:00
|
|
|
hide := $(if $(SHOW_COMMANDS),,@)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2015-10-29 05:33:40 +08:00
|
|
|
################################################################
|
|
|
|
# Tools needed in product configuration makefiles.
|
|
|
|
################################################################
|
|
|
|
NORMALIZE_PATH := build/tools/normalize_path.py
|
|
|
|
|
|
|
|
# $(1): the paths to be normalized
|
|
|
|
define normalize-paths
|
|
|
|
$(if $(1),$(shell $(NORMALIZE_PATH) $(1)))
|
|
|
|
endef
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# ###############################################################
|
|
|
|
# Set common values
|
|
|
|
# ###############################################################
|
|
|
|
|
|
|
|
# Set the extensions used for various packages
|
|
|
|
COMMON_PACKAGE_SUFFIX := .zip
|
|
|
|
COMMON_JAVA_PACKAGE_SUFFIX := .jar
|
|
|
|
COMMON_ANDROID_PACKAGE_SUFFIX := .apk
|
|
|
|
|
2015-03-13 19:08:26 +08:00
|
|
|
ifdef TMPDIR
|
|
|
|
JAVA_TMPDIR_ARG := -Djava.io.tmpdir=$(TMPDIR)
|
|
|
|
else
|
|
|
|
JAVA_TMPDIR_ARG :=
|
|
|
|
endif
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# ###############################################################
|
|
|
|
# Include sub-configuration files
|
|
|
|
# ###############################################################
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Try to include buildspec.mk, which will try to set stuff up.
|
2013-06-28 03:02:46 +08:00
|
|
|
# If this file doesn't exist, the environment variables will
|
2009-03-04 11:28:42 +08:00
|
|
|
# be used, and if that doesn't work, then the default is an
|
|
|
|
# arm build
|
2011-11-03 04:49:08 +08:00
|
|
|
ifndef ANDROID_BUILDSPEC
|
|
|
|
ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk
|
|
|
|
endif
|
|
|
|
-include $(ANDROID_BUILDSPEC)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Define most of the global variables. These are the ones that
|
|
|
|
# are specific to the user's build configuration.
|
|
|
|
include $(BUILD_SYSTEM)/envsetup.mk
|
|
|
|
|
2015-06-10 01:35:45 +08:00
|
|
|
# Pruned directory options used when using findleaves.py
|
|
|
|
# See envsetup.mk for a description of SCAN_EXCLUDE_DIRS
|
|
|
|
FIND_LEAVES_EXCLUDES := $(addprefix --prune=, $(OUT_DIR) $(SCAN_EXCLUDE_DIRS) .repo .git)
|
|
|
|
|
2012-03-31 01:45:38 +08:00
|
|
|
# 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
|
2016-04-23 01:18:15 +08:00
|
|
|
# bionic/libc/kernel/tools/clean_header.py tool. Additionally, the original
|
|
|
|
# kernel headers must also be checked in, but in a different subdirectory. By
|
2012-03-31 01:45:38 +08:00
|
|
|
# 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
|
|
|
|
#
|
2012-03-15 14:50:17 +08:00
|
|
|
TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
|
|
|
|
|
2012-03-17 00:57:11 +08:00
|
|
|
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
|
2012-03-15 14:50:17 +08:00
|
|
|
# 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))
|
2012-03-17 00:57:11 +08:00
|
|
|
$(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))
|
2012-03-15 14:50:17 +08:00
|
|
|
|
2009-06-24 03:25:06 +08:00
|
|
|
# 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
|
2009-11-07 07:12:00 +08:00
|
|
|
TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
|
2009-06-24 03:25:06 +08:00
|
|
|
|
2015-10-09 13:36:04 +08:00
|
|
|
# Commands to generate .toc file common to ELF .so files.
|
|
|
|
define _gen_toc_command_for_elf
|
2015-11-05 11:51:08 +08:00
|
|
|
$(hide) ($($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) -d $(1) | grep SONAME || echo "No SONAME for $1") > $(2)
|
2016-01-06 14:13:25 +08:00
|
|
|
$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) --dyn-syms $(1) | awk '{$$2=""; $$3=""; print}' >> $(2)
|
2015-10-09 13:36:04 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Commands to generate .toc file from Darwin dynamic library.
|
|
|
|
define _gen_toc_command_for_macho
|
|
|
|
$(hide) otool -l $(1) | grep LC_ID_DYLIB -A 5 > $(2)
|
|
|
|
$(hide) nm -gP $(1) | cut -f1-2 -d" " | grep -v U$$ >> $(2)
|
|
|
|
endef
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
combo_target := HOST_
|
2013-12-28 03:09:36 +08:00
|
|
|
combo_2nd_arch_prefix :=
|
2009-03-04 11:28:42 +08:00
|
|
|
include $(BUILD_SYSTEM)/combo/select.mk
|
|
|
|
|
2014-04-18 01:03:35 +08:00
|
|
|
# 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
|
|
|
|
|
2015-08-15 03:59:50 +08:00
|
|
|
# Load the windows cross compiler under Linux
|
|
|
|
ifdef HOST_CROSS_OS
|
|
|
|
combo_target := HOST_CROSS_
|
|
|
|
combo_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/combo/select.mk
|
2016-02-06 08:20:19 +08:00
|
|
|
|
|
|
|
ifdef HOST_CROSS_2ND_ARCH
|
|
|
|
combo_target := HOST_CROSS_
|
|
|
|
combo_2nd_arch_prefix := $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/combo/select.mk
|
|
|
|
endif
|
2015-08-15 03:59:50 +08:00
|
|
|
endif
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# on windows, the tools have .exe at the end, and we depend on the
|
|
|
|
# host config stuff being done first
|
|
|
|
|
|
|
|
combo_target := TARGET_
|
2013-12-28 03:09:36 +08:00
|
|
|
combo_2nd_arch_prefix :=
|
2009-03-04 11:28:42 +08:00
|
|
|
include $(BUILD_SYSTEM)/combo/select.mk
|
|
|
|
|
2013-12-28 03:09:36 +08:00
|
|
|
# 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
|
|
|
|
|
2015-07-21 09:40:18 +08:00
|
|
|
include $(BUILD_SYSTEM)/ccache.mk
|
2015-08-17 16:38:24 +08:00
|
|
|
include $(BUILD_SYSTEM)/goma.mk
|
2015-07-21 09:40:18 +08:00
|
|
|
|
2014-05-01 09:09:13 +08:00
|
|
|
ifdef TARGET_PREFER_32_BIT
|
|
|
|
TARGET_PREFER_32_BIT_APPS := true
|
|
|
|
TARGET_PREFER_32_BIT_EXECUTABLES := true
|
|
|
|
endif
|
|
|
|
|
2014-05-01 09:18:02 +08:00
|
|
|
ifeq (,$(TARGET_SUPPORTS_32_BIT_APPS)$(TARGET_SUPPORTS_64_BIT_APPS))
|
|
|
|
TARGET_SUPPORTS_32_BIT_APPS := true
|
2014-04-07 18:01:54 +08:00
|
|
|
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
|
2014-06-17 07:51:42 +08:00
|
|
|
# be overriden in the board configuration.
|
2014-04-07 18:01:54 +08:00
|
|
|
ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
|
2014-05-01 09:18:02 +08:00
|
|
|
ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
|
2014-04-07 18:01:54 +08:00
|
|
|
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
|
2014-05-01 09:18:02 +08:00
|
|
|
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)
|
2014-04-07 18:01:54 +08:00
|
|
|
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)))
|
|
|
|
|
2016-05-17 13:07:31 +08:00
|
|
|
# GCC version selection
|
|
|
|
TARGET_GCC_VERSION := 4.9
|
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
2ND_TARGET_GCC_VERSION := 4.9
|
|
|
|
endif
|
|
|
|
|
2013-09-10 17:37:14 +08:00
|
|
|
# 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
|
|
|
|
|
2016-02-03 03:30:39 +08:00
|
|
|
# define clang/llvm versions and base directory.
|
|
|
|
include $(BUILD_SYSTEM)/clang/versions.mk
|
|
|
|
|
2016-04-01 07:30:23 +08:00
|
|
|
# Unset WITH_TIDY_ONLY if global WITH_TIDY_ONLY is not true nor 1.
|
|
|
|
ifeq (,$(filter 1 true,$(WITH_TIDY_ONLY)))
|
|
|
|
WITH_TIDY_ONLY :=
|
|
|
|
endif
|
|
|
|
|
|
|
|
PATH_TO_CLANG_TIDY := \
|
|
|
|
$(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/bin/clang-tidy
|
|
|
|
ifeq ($(wildcard $(PATH_TO_CLANG_TIDY)),)
|
|
|
|
ifneq (,$(filter 1 true,$(WITH_TIDY)))
|
|
|
|
$(warning *** Disable WITH_TIDY because $(PATH_TO_CLANG_TIDY) does not exist)
|
|
|
|
endif
|
|
|
|
PATH_TO_CLANG_TIDY :=
|
|
|
|
endif
|
|
|
|
|
2013-09-10 17:37:14 +08:00
|
|
|
# Disable WITH_STATIC_ANALYZER and WITH_SYNTAX_CHECK if tool can't be found
|
2016-02-03 03:30:39 +08:00
|
|
|
SYNTAX_TOOLS_PREFIX := \
|
|
|
|
$(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/tools/scan-build/libexec
|
2013-09-10 17:37:14 +08:00
|
|
|
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
|
2013-08-27 17:55:46 +08:00
|
|
|
|
2013-09-10 17:37:14 +08:00
|
|
|
# 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
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# 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
|
|
|
|
|
2016-01-27 07:59:50 +08:00
|
|
|
# Set up PDK so we can use TARGET_BUILD_PDK to select prebuilt tools below
|
|
|
|
.PHONY: pdk fusion
|
|
|
|
pdk fusion: $(DEFAULT_GOAL)
|
|
|
|
|
|
|
|
# What to build:
|
|
|
|
# pdk fusion if:
|
|
|
|
# 1) PDK_FUSION_PLATFORM_ZIP is passed in from the environment
|
|
|
|
# or
|
|
|
|
# 2) the platform.zip exists in the default location
|
|
|
|
# or
|
|
|
|
# 3) fusion is a command line build goal,
|
|
|
|
# PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal?
|
|
|
|
# otherwise pdk only if:
|
|
|
|
# 1) pdk is a command line build goal
|
|
|
|
# or
|
|
|
|
# 2) TARGET_BUILD_PDK is passed in from the environment
|
|
|
|
|
|
|
|
# if PDK_FUSION_PLATFORM_ZIP is specified, do not override.
|
|
|
|
ifndef PDK_FUSION_PLATFORM_ZIP
|
|
|
|
# Most PDK project paths should be using vendor/pdk/TARGET_DEVICE
|
|
|
|
# but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup
|
|
|
|
# with vendor/pdk/TARGET_PRODUCT.
|
|
|
|
_pdk_fusion_default_platform_zip = $(strip \
|
|
|
|
$(wildcard vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
|
|
|
|
$(wildcard vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
|
|
|
|
$(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \
|
|
|
|
$(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip))
|
|
|
|
ifneq (,$(_pdk_fusion_default_platform_zip))
|
|
|
|
PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip))
|
|
|
|
TARGET_BUILD_PDK := true
|
|
|
|
endif # _pdk_fusion_default_platform_zip
|
|
|
|
endif # !PDK_FUSION_PLATFORM_ZIP
|
|
|
|
|
|
|
|
ifneq (,$(filter pdk fusion, $(MAKECMDGOALS)))
|
|
|
|
TARGET_BUILD_PDK := true
|
|
|
|
ifneq (,$(filter fusion, $(MAKECMDGOALS)))
|
|
|
|
ifndef PDK_FUSION_PLATFORM_ZIP
|
|
|
|
$(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.)
|
|
|
|
endif
|
|
|
|
endif # fusion
|
|
|
|
endif # pdk or fusion
|
|
|
|
|
|
|
|
ifdef PDK_FUSION_PLATFORM_ZIP
|
|
|
|
TARGET_BUILD_PDK := true
|
|
|
|
ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP)))
|
|
|
|
$(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2016-03-12 02:32:01 +08:00
|
|
|
BUILD_PLATFORM_ZIP := $(filter platform platform-java,$(MAKECMDGOALS))
|
|
|
|
|
2015-12-03 08:33:04 +08:00
|
|
|
#
|
|
|
|
# Tools that are prebuilts for TARGET_BUILD_APPS
|
|
|
|
#
|
2016-03-09 03:12:40 +08:00
|
|
|
prebuilt_sdk_tools := prebuilts/sdk/tools
|
|
|
|
prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
|
2015-12-03 08:33:04 +08:00
|
|
|
|
|
|
|
AIDL := $(HOST_OUT_EXECUTABLES)/aidl
|
|
|
|
AAPT := $(HOST_OUT_EXECUTABLES)/aapt
|
|
|
|
ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign
|
|
|
|
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
|
2015-12-11 05:38:50 +08:00
|
|
|
SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
|
2015-12-03 08:33:04 +08:00
|
|
|
LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc
|
|
|
|
BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat
|
|
|
|
|
|
|
|
DX := $(HOST_OUT_EXECUTABLES)/dx
|
|
|
|
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
|
|
|
|
|
2016-03-09 03:12:40 +08:00
|
|
|
# Always use prebuilts for ckati and makeparallel
|
2016-04-20 06:32:22 +08:00
|
|
|
prebuilt_build_tools := prebuilts/build-tools
|
|
|
|
prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin
|
2016-06-07 05:44:00 +08:00
|
|
|
ACP := $(prebuilt_build_tools_bin)/acp
|
2016-04-20 06:32:22 +08:00
|
|
|
CKATI := $(prebuilt_build_tools_bin)/ckati
|
2016-06-07 05:44:00 +08:00
|
|
|
IJAR := $(prebuilt_build_tools_bin)/ijar
|
2016-04-20 06:32:22 +08:00
|
|
|
MAKEPARALLEL := $(prebuilt_build_tools_bin)/makeparallel
|
2016-06-07 05:44:00 +08:00
|
|
|
ZIPTIME := $(prebuilt_build_tools_bin)/ziptime
|
2016-03-09 03:12:40 +08:00
|
|
|
|
2016-01-21 08:08:49 +08:00
|
|
|
USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
|
|
|
|
|
2015-12-03 08:33:04 +08:00
|
|
|
# Override the definitions above for unbundled and PDK builds
|
|
|
|
ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
|
|
|
|
AIDL := $(prebuilt_sdk_tools_bin)/aidl
|
|
|
|
AAPT := $(prebuilt_sdk_tools_bin)/aapt
|
|
|
|
ZIPALIGN := $(prebuilt_sdk_tools_bin)/zipalign
|
|
|
|
SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
|
2015-12-11 05:38:50 +08:00
|
|
|
# Use 64-bit libraries unconditionally because 32-bit JVMs are no longer supported
|
|
|
|
SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
|
2015-12-03 08:33:04 +08:00
|
|
|
|
|
|
|
DX := $(prebuilt_sdk_tools)/dx
|
|
|
|
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
|
|
|
|
|
|
|
|
# Don't use prebuilts in PDK
|
|
|
|
ifneq ($(TARGET_BUILD_PDK),true)
|
|
|
|
LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc
|
|
|
|
BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat
|
|
|
|
endif # TARGET_BUILD_PDK
|
|
|
|
endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK
|
2016-03-09 03:12:40 +08:00
|
|
|
prebuilt_sdk_tools :=
|
|
|
|
prebuilt_sdk_tools_bin :=
|
2015-12-03 08:33:04 +08:00
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Generic tools.
|
2015-03-10 23:50:55 +08:00
|
|
|
JACK := $(HOST_OUT_EXECUTABLES)/jack
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2014-05-17 00:37:23 +08:00
|
|
|
LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39
|
2013-04-06 09:02:16 +08:00
|
|
|
# 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
|
2014-04-18 01:03:35 +08:00
|
|
|
BISON := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bison/bison
|
2013-04-06 09:02:16 +08:00
|
|
|
YACC := $(BISON) -d
|
2016-04-05 19:12:48 +08:00
|
|
|
BISON_DATA := $(wildcard external/bison/data/* external/bison/data/*/*)
|
2013-04-06 09:02:16 +08:00
|
|
|
|
2014-06-06 10:05:47 +08:00
|
|
|
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
DOXYGEN:= doxygen
|
2015-10-15 08:27:24 +08:00
|
|
|
AIDL_CPP := $(HOST_OUT_EXECUTABLES)/aidl-cpp$(HOST_EXECUTABLE_SUFFIX)
|
2015-09-24 16:40:52 +08:00
|
|
|
ifeq ($(HOST_OS),linux)
|
|
|
|
BREAKPAD_DUMP_SYMS := $(HOST_OUT_EXECUTABLES)/dump_syms
|
|
|
|
else
|
|
|
|
# For non-supported hosts, do not generate breakpad symbols.
|
|
|
|
BREAKPAD_GENERATE_SYMBOLS := false
|
|
|
|
endif
|
2010-11-06 02:28:51 +08:00
|
|
|
PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
|
2016-04-05 16:34:51 +08:00
|
|
|
NANOPB_SRCS := external/nanopb-c/generator/protoc-gen-nanopb \
|
|
|
|
$(wildcard external/nanopb-c/generator/*.py \
|
|
|
|
external/nanopb-c/generator/google/*.py \
|
|
|
|
external/nanopb-c/generator/proto/*.py)
|
2015-07-30 08:14:24 +08:00
|
|
|
DBUS_GENERATOR := $(HOST_OUT_EXECUTABLES)/dbus-binding-generator
|
2009-03-04 11:28:42 +08:00
|
|
|
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
|
2009-05-28 00:14:25 +08:00
|
|
|
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
|
2012-11-26 08:53:44 +08:00
|
|
|
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
|
2009-03-04 11:28:42 +08:00
|
|
|
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
|
2012-11-26 08:53:44 +08:00
|
|
|
else
|
|
|
|
MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
|
|
|
|
endif
|
2016-04-09 03:08:03 +08:00
|
|
|
ifeq (,$(strip $(BOARD_CUSTOM_BPTTOOL)))
|
|
|
|
BPTTOOL := $(HOST_OUT_EXECUTABLES)/bpttool$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
else
|
|
|
|
BPTTOOL := $(BOARD_CUSTOM_BPTTOOL)
|
|
|
|
endif
|
2016-01-30 05:59:17 +08:00
|
|
|
ifeq (,$(strip $(BOARD_CUSTOM_BVBTOOL)))
|
|
|
|
BVBTOOL := $(HOST_OUT_EXECUTABLES)/bvbtool$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
else
|
|
|
|
BVBTOOL := $(BOARD_CUSTOM_BVBTOOL)
|
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
|
2010-08-04 05:43:15 +08:00
|
|
|
MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX)
|
2010-11-18 07:40:38 +08:00
|
|
|
MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg.sh
|
2015-03-04 04:30:37 +08:00
|
|
|
MAKE_SQUASHFS := $(HOST_OUT_EXECUTABLES)/mksquashfs$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh
|
2014-06-17 05:17:40 +08:00
|
|
|
MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh
|
2012-11-27 10:10:23 +08:00
|
|
|
SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
|
2015-06-25 06:42:19 +08:00
|
|
|
IMG2SIMG := $(HOST_OUT_EXECUTABLES)/img2simg$(HOST_EXECUTABLE_SUFFIX)
|
2012-11-27 10:10:23 +08:00
|
|
|
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
|
2009-03-04 11:28:42 +08:00
|
|
|
MKTARBALL := build/tools/mktarball.sh
|
2010-05-07 17:23:59 +08:00
|
|
|
TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
|
2010-05-04 06:01:38 +08:00
|
|
|
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
|
2015-02-02 19:18:20 +08:00
|
|
|
|
2015-04-09 18:10:21 +08:00
|
|
|
ifneq ($(ANDROID_JACK_EXTRA_ARGS),)
|
2016-04-07 17:56:42 +08:00
|
|
|
JACK_DEFAULT_ARGS :=
|
2015-04-09 18:10:21 +08:00
|
|
|
DEFAULT_JACK_EXTRA_ARGS := $(ANDROID_JACK_EXTRA_ARGS)
|
|
|
|
else
|
2016-04-07 17:56:42 +08:00
|
|
|
JACK_DEFAULT_ARGS := $(BUILD_SYSTEM)/jack-default.args
|
|
|
|
DEFAULT_JACK_EXTRA_ARGS := @$(JACK_DEFAULT_ARGS)
|
2015-04-09 18:10:21 +08:00
|
|
|
endif
|
2015-03-13 19:08:26 +08:00
|
|
|
|
2009-08-31 04:39:24 +08:00
|
|
|
PROGUARD := external/proguard/bin/proguard.sh
|
2009-12-01 06:28:59 +08:00
|
|
|
JAVATAGS := build/tools/java-event-log-tags.py
|
2016-03-29 02:29:21 +08:00
|
|
|
MERGETAGS := build/tools/merge-event-log-tags.py
|
2016-04-19 17:41:27 +08:00
|
|
|
BUILD_IMAGE_SRCS := $(wildcard build/tools/releasetools/*.py)
|
2014-04-29 07:27:32 +08:00
|
|
|
APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg
|
|
|
|
VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer
|
2014-04-17 09:49:56 +08:00
|
|
|
BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree
|
2014-07-09 11:07:41 +08:00
|
|
|
BOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/boot_signer
|
2015-03-04 00:54:11 +08:00
|
|
|
FUTILITY := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/futility/futility
|
|
|
|
VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh
|
2015-05-20 14:30:57 +08:00
|
|
|
FEC := $(HOST_OUT_EXECUTABLES)/fec
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2015-12-09 17:06:20 +08:00
|
|
|
DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX)
|
2015-11-09 15:47:42 +08:00
|
|
|
|
2015-04-21 07:59:05 +08:00
|
|
|
# relocation packer
|
|
|
|
RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer
|
|
|
|
|
2014-05-20 16:04:16 +08:00
|
|
|
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
|
|
|
|
FINDBUGS := $(FINDBUGS_DIR)/findbugs
|
2009-03-04 11:28:42 +08:00
|
|
|
EMMA_JAR := external/emma/lib/emma$(COMMON_JAVA_PACKAGE_SUFFIX)
|
|
|
|
|
2014-02-06 10:24:45 +08:00
|
|
|
# Tool to merge AndroidManifest.xmls
|
|
|
|
ANDROID_MANIFEST_MERGER := java -classpath prebuilts/devtools/tools/lib/manifest-merger.jar com.android.manifmerger.Main merge
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
COLUMN:= column
|
|
|
|
|
2015-11-03 07:56:58 +08:00
|
|
|
# We may not have the right JAVA_HOME/PATH set up yet when this is run from envsetup.sh.
|
|
|
|
ifneq ($(CALLED_FROM_SETUP),true)
|
2013-12-05 23:20:41 +08:00
|
|
|
HOST_JDK_TOOLS_JAR:= $(shell $(BUILD_SYSTEM)/find-jdk-tools-jar.sh)
|
|
|
|
|
|
|
|
ifneq ($(HOST_JDK_TOOLS_JAR),)
|
2010-04-27 09:36:52 +08:00
|
|
|
ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
|
2015-10-24 05:33:51 +08:00
|
|
|
$(error Error: could not find jdk tools.jar at $(HOST_JDK_TOOLS_JAR), please check if your JDK was installed correctly)
|
2010-04-27 09:36:52 +08:00
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
endif
|
|
|
|
|
2011-05-25 06:46:15 +08:00
|
|
|
# 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
|
2015-11-03 07:56:58 +08:00
|
|
|
endif # CALLED_FROM_SETUP not true
|
2011-05-25 06:46:15 +08:00
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# It's called md5 on Mac OS and md5sum on Linux
|
|
|
|
ifeq ($(HOST_OS),darwin)
|
|
|
|
MD5SUM:=md5 -q
|
|
|
|
else
|
|
|
|
MD5SUM:=md5sum
|
|
|
|
endif
|
|
|
|
|
2011-04-09 08:32:52 +08:00
|
|
|
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)"
|
|
|
|
|
2011-10-05 01:50:08 +08:00
|
|
|
# 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
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# ###############################################################
|
|
|
|
# Set up final options.
|
|
|
|
# ###############################################################
|
|
|
|
|
2015-12-17 05:10:35 +08:00
|
|
|
GLOBAL_CFLAGS_NO_OVERRIDE := \
|
|
|
|
-Werror=int-to-pointer-cast \
|
|
|
|
-Werror=pointer-to-int-cast \
|
|
|
|
|
|
|
|
GLOBAL_CLANG_CFLAGS_NO_OVERRIDE := \
|
|
|
|
-Werror=address-of-temporary \
|
|
|
|
-Werror=null-dereference \
|
|
|
|
-Werror=return-type \
|
|
|
|
|
|
|
|
GLOBAL_CPPFLAGS_NO_OVERRIDE :=
|
|
|
|
|
|
|
|
# We run gcc/clang with PWD=/proc/self/cwd to remove the $TOP
|
|
|
|
# from the debug output. That way two builds in two different
|
|
|
|
# directories will create the same output.
|
|
|
|
# /proc doesn't exist on Darwin.
|
|
|
|
ifeq ($(HOST_OS),linux)
|
|
|
|
RELATIVE_PWD := PWD=/proc/self/cwd
|
|
|
|
else
|
|
|
|
RELATIVE_PWD :=
|
|
|
|
endif
|
|
|
|
|
2016-05-17 13:07:31 +08:00
|
|
|
HOST_GLOBAL_LD_DIRS := -L$(HOST_OUT_INTERMEDIATE_LIBRARIES)
|
|
|
|
TARGET_GLOBAL_LD_DIRS := -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2016-03-01 17:14:03 +08:00
|
|
|
HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(HOST_OUT_HEADERS)
|
2012-03-15 14:50:17 +08:00
|
|
|
TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
|
2012-03-31 01:24:31 +08:00
|
|
|
$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
|
|
|
|
$(TARGET_PRODUCT_KERNEL_HEADERS)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2013-12-28 03:09:36 +08:00
|
|
|
ifdef TARGET_2ND_ARCH
|
2016-05-17 13:07:31 +08:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS := -L$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES)
|
2014-02-22 08:17:05 +08:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
|
2013-12-28 03:09:36 +08:00
|
|
|
endif
|
|
|
|
|
2014-04-18 01:03:35 +08:00
|
|
|
ifdef HOST_2ND_ARCH
|
2016-05-17 13:07:31 +08:00
|
|
|
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS := -L$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES)
|
2014-04-18 01:03:35 +08:00
|
|
|
$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_INCLUDES := $(HOST_PROJECT_INCLUDES)
|
|
|
|
endif
|
|
|
|
|
2015-08-15 03:59:50 +08:00
|
|
|
ifdef HOST_CROSS_OS
|
2016-05-17 13:07:31 +08:00
|
|
|
HOST_CROSS_GLOBAL_LD_DIRS := -L$(HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES)
|
2016-03-01 17:14:03 +08:00
|
|
|
HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(HOST_CROSS_OUT_HEADERS)
|
2016-02-06 08:20:19 +08:00
|
|
|
|
|
|
|
ifdef HOST_CROSS_2ND_ARCH
|
2016-05-17 13:07:31 +08:00
|
|
|
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_LD_DIRS := -L$($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES)
|
2016-07-20 04:19:21 +08:00
|
|
|
$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(HOST_CROSS_PROJECT_INCLUDES)
|
2015-12-17 07:04:51 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2013-08-07 07:07:13 +08:00
|
|
|
# allow overriding default Java libraries on a per-target basis
|
|
|
|
ifeq ($(TARGET_DEFAULT_JAVA_LIBRARIES),)
|
2015-02-18 00:55:52 +08:00
|
|
|
TARGET_DEFAULT_JAVA_LIBRARIES := core-oj core-libart core-junit ext framework okhttp
|
2013-08-07 07:07:13 +08:00
|
|
|
endif
|
|
|
|
|
2014-04-19 06:23:40 +08:00
|
|
|
# Flags for DEX2OAT
|
2015-10-16 11:43:29 +08:00
|
|
|
first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3)))
|
2014-04-19 06:23:40 +08:00
|
|
|
DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
|
2015-10-16 11:43:29 +08:00
|
|
|
DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT),$(TARGET_ARCH_VARIANT),default)
|
2014-03-21 03:13:10 +08:00
|
|
|
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
|
2014-04-19 06:23:40 +08:00
|
|
|
|
|
|
|
ifdef TARGET_2ND_ARCH
|
2014-05-14 04:57:28 +08:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH)
|
2015-10-16 11:43:29 +08:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_2ND_CPU_VARIANT),$(TARGET_2ND_ARCH_VARIANT),default)
|
2014-05-14 04:57:28 +08:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
|
2014-03-21 03:13:10 +08:00
|
|
|
endif
|
|
|
|
|
2014-02-07 10:08:44 +08:00
|
|
|
# define clang/llvm tools and global flags
|
|
|
|
include $(BUILD_SYSTEM)/clang/config.mk
|
2012-01-12 23:09:06 +08:00
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# ###############################################################
|
|
|
|
# Collect a list of the SDK versions that we could compile against
|
|
|
|
# For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE)
|
|
|
|
# ###############################################################
|
|
|
|
|
2011-11-30 02:24:27 +08:00
|
|
|
HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk
|
2011-11-30 03:20:16 +08:00
|
|
|
HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk
|
2010-06-10 01:26:26 +08:00
|
|
|
|
2015-05-20 07:03:57 +08:00
|
|
|
# The path where app can reference the support library resources.
|
|
|
|
ifdef TARGET_BUILD_APPS
|
|
|
|
SUPPORT_LIBRARY_ROOT := $(HISTORICAL_SDK_VERSIONS_ROOT)/current/support
|
|
|
|
else
|
|
|
|
SUPPORT_LIBRARY_ROOT := frameworks/support
|
|
|
|
endif
|
|
|
|
|
2010-06-10 01:26:26 +08:00
|
|
|
# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N.
|
|
|
|
# The 'current' version is whatever this source tree is.
|
2009-03-04 11:28:42 +08:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2010-06-10 01:26:26 +08:00
|
|
|
# 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
|
|
|
|
|
2012-05-11 09:07:33 +08:00
|
|
|
TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
|
2010-06-10 01:26:26 +08:00
|
|
|
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
|
2014-07-22 04:44:06 +08:00
|
|
|
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
|
|
|
|
|
|
|
|
# We don't have prebuilt system_current SDK yet.
|
2014-09-05 03:18:51 +08:00
|
|
|
TARGET_AVAILABLE_SDK_VERSIONS := $(TARGET_AVAILABLE_SDK_VERSIONS)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2011-04-09 06:03:48 +08:00
|
|
|
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
|
2014-02-22 06:18:19 +08:00
|
|
|
INTERNAL_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed.txt
|
2014-06-27 08:54:28 +08:00
|
|
|
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
|
2010-03-09 09:16:57 +08:00
|
|
|
|
2010-10-15 05:31:48 +08:00
|
|
|
# This is the standard way to name a directory containing prebuilt target
|
|
|
|
# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
|
2011-07-12 13:11:46 +08:00
|
|
|
TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
|
2014-05-23 03:01:23 +08:00
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
TARGET_2ND_PREBUILT_TAG := android-$(TARGET_2ND_ARCH)
|
|
|
|
endif
|
2010-10-15 05:31:48 +08:00
|
|
|
|
2013-03-06 03:07:15 +08:00
|
|
|
# Set up RS prebuilt variables for compatibility library
|
|
|
|
|
2014-10-01 06:08:03 +08:00
|
|
|
RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc
|
2013-03-06 03:07:15 +08:00
|
|
|
RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
|
2015-07-29 08:43:51 +08:00
|
|
|
ifeq (true,$(TARGET_IS_64_BIT))
|
2016-03-31 04:29:42 +08:00
|
|
|
RS_PREBUILT_LIBPATH := -L prebuilts/ndk/current/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib64 \
|
|
|
|
-L prebuilts/ndk/current/platforms/android-21/arch-$(TARGET_ARCH)/usr/lib
|
2015-07-29 08:43:51 +08:00
|
|
|
else
|
2015-10-01 13:32:05 +08:00
|
|
|
RS_PREBUILT_LIBPATH := -L prebuilts/ndk/current/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
|
2015-07-29 08:43:51 +08:00
|
|
|
endif
|
2013-03-06 03:07:15 +08:00
|
|
|
|
2015-01-08 10:18:41 +08:00
|
|
|
# API Level lists for Renderscript Compat lib.
|
|
|
|
RSCOMPAT_32BIT_ONLY_API_LEVELS := 8 9 10 11 12 13 14 15 16 17 18 19 20
|
2014-11-21 03:05:18 +08:00
|
|
|
RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13
|
2015-01-08 10:18:41 +08:00
|
|
|
|
Rewrite LDLIBS and SHARED_LIBRARIES
LOCAL_LDLIBS was the only correct way to use NDK libraries, but few used
it correctly. It also often got confused with LOCAL_LDFLAGS, so move the
flags to the correct variable.
For binaries that weren't using the NDK (empty LOCAL_SDK_VERSION), it
was never valid to use LOCAL_LDLIBS, as dependencies would not be
properly set up, and could lead to random build failures. So convert any
-l linker flags to using LOCAL_SHARED_LIBRARIES automatically.
For binaries built using the NDK (LOCAL_SDK_VERSION set), they were
required to use LOCAL_LDLIBS for prebuilt NDK libraries, otherwise they
would get headers and dependencies to the platform versions. Any
non-prebuilt LOCAL_LDLIBS would miss dependencies. So move the NDK
prebuilt libraries to LDLIBS from SHARED_LIBRARIES, and move everything
else to SHARED_LIBRARIES.
So now, for device modules, LOCAL_SHARED_LIBRARIES should always be
used, and we'll do the right thing. LOCAL_LDLIBS should only be used for
host libraries from the system.
Change-Id: Ide34c7afdcfb6507a378d45a42471729e489a9e0
2016-06-08 07:55:57 +08:00
|
|
|
NDK_PREBUILT_SHARED_LIBRARIES := android c dl EGL GLESv1_CM GLESv2 GLESv3 jnigraphics log mediandk m OpenMAXAL OpenSLES stdc++ vulkan z
|
|
|
|
|
2016-02-06 10:24:17 +08:00
|
|
|
ifeq ($(JAVA_NOT_REQUIRED),true)
|
|
|
|
# Remove java and tools from our path so that we make sure nobody uses them.
|
|
|
|
unexport ANDROID_JAVA_HOME
|
|
|
|
unexport JAVA_HOME
|
|
|
|
export ANDROID_BUILD_PATHS:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(ANDROID_BUILD_PATHS)
|
|
|
|
export PATH:=$(abspath $(BUILD_SYSTEM)/no_java_path):$(PATH)
|
|
|
|
endif
|
|
|
|
|
2013-04-06 09:02:16 +08:00
|
|
|
include $(BUILD_SYSTEM)/dumpvar.mk
|