2009-03-04 04:28:42 +01: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.
|
|
|
|
|
2017-10-17 10:30:14 +02:00
|
|
|
ifndef KATI
|
|
|
|
$(warning Directly using config.mk from make is no longer supported.)
|
2017-11-03 23:52:50 +01:00
|
|
|
$(warning )
|
|
|
|
$(warning If you are just attempting to build, you probably need to re-source envsetup.sh:)
|
|
|
|
$(warning )
|
|
|
|
$(warning $$ source build/envsetup.sh)
|
|
|
|
$(warning )
|
|
|
|
$(warning If you are attempting to emulate get_build_var, use one of the following:)
|
|
|
|
$(warning $$ build/soong/soong_ui.bash --dumpvar-mode)
|
|
|
|
$(warning $$ build/soong/soong_ui.bash --dumpvars-mode)
|
|
|
|
$(warning )
|
2017-10-17 10:30:14 +02:00
|
|
|
$(error done)
|
|
|
|
endif
|
|
|
|
|
2010-03-31 01:42:15 +02:00
|
|
|
# Only use ANDROID_BUILD_SHELL to wrap around bash.
|
|
|
|
# DO NOT use other shells such as zsh.
|
2010-03-30 21:55:13 +02:00
|
|
|
ifdef ANDROID_BUILD_SHELL
|
|
|
|
SHELL := $(ANDROID_BUILD_SHELL)
|
|
|
|
else
|
2009-03-04 04:28:42 +01: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-30 21:55:13 +02:00
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2012-09-27 22:26:25 +02:00
|
|
|
# Utility variables.
|
|
|
|
empty :=
|
|
|
|
space := $(empty) $(empty)
|
|
|
|
comma := ,
|
2014-10-03 20:36:27 +02:00
|
|
|
# Note that make will eat the newline just before endef.
|
|
|
|
define newline
|
|
|
|
|
|
|
|
|
2015-09-22 23:37:53 +02:00
|
|
|
endef
|
|
|
|
# The pound character "#"
|
|
|
|
define pound
|
|
|
|
#
|
2014-10-03 20:36:27 +02:00
|
|
|
endef
|
|
|
|
# Unfortunately you can't simply define backslash as \ or \\.
|
|
|
|
backslash := \a
|
|
|
|
backslash := $(patsubst %a,%,$(backslash))
|
2012-09-27 22:26:25 +02:00
|
|
|
|
2016-11-10 01:35:34 +01:00
|
|
|
# this turns off the suffix rules built into make
|
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
# this turns off the RCS / SCCS implicit rules of GNU Make
|
|
|
|
% : RCS/%,v
|
|
|
|
% : RCS/%
|
|
|
|
% : %,v
|
|
|
|
% : s.%
|
|
|
|
% : SCCS/s.%
|
|
|
|
|
|
|
|
# If a rule fails, delete $@.
|
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
|
2017-10-30 21:41:53 +01:00
|
|
|
# Mark variables deprecated/obsolete
|
2017-11-09 01:39:18 +01:00
|
|
|
CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
|
|
|
|
$(KATI_deprecated_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH)
|
2017-11-29 07:32:05 +01:00
|
|
|
$(KATI_obsolete_var PYTHONPATH,Do not use PYTHONPATH directly. See $(CHANGES_URL)#PYTHONPATH)
|
|
|
|
$(KATI_obsolete_var OUT,Use OUT_DIR instead. See $(CHANGES_URL)#OUT)
|
|
|
|
$(KATI_obsolete_var ANDROID_HOST_OUT,Use HOST_OUT instead. See $(CHANGES_URL)#ANDROID_HOST_OUT)
|
2017-11-09 01:39:18 +01:00
|
|
|
$(KATI_deprecated_var ANDROID_PRODUCT_OUT,Use PRODUCT_OUT instead. See $(CHANGES_URL)#ANDROID_PRODUCT_OUT)
|
2017-11-29 07:32:05 +01:00
|
|
|
$(KATI_obsolete_var ANDROID_HOST_OUT_TESTCASES,Use HOST_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_HOST_OUT_TESTCASES)
|
|
|
|
$(KATI_obsolete_var ANDROID_TARGET_OUT_TESTCASES,Use TARGET_OUT_TESTCASES instead. See $(CHANGES_URL)#ANDROID_TARGET_OUT_TESTCASES)
|
2017-11-09 01:39:18 +01:00
|
|
|
$(KATI_deprecated_var ANDROID_BUILD_TOP,Use '.' instead. See $(CHANGES_URL)#ANDROID_BUILD_TOP)
|
2017-11-29 07:32:05 +01:00
|
|
|
$(KATI_obsolete_var \
|
2017-11-09 01:39:18 +01:00
|
|
|
ANDROID_TOOLCHAIN \
|
|
|
|
ANDROID_TOOLCHAIN_2ND_ARCH \
|
|
|
|
ANDROID_DEV_SCRIPTS \
|
|
|
|
ANDROID_EMULATOR_PREBUILTS \
|
|
|
|
ANDROID_PRE_BUILD_PATHS \
|
|
|
|
,See $(CHANGES_URL)#other_envsetup_variables)
|
|
|
|
|
|
|
|
CHANGES_URL :=
|
2017-10-30 21:41:53 +01:00
|
|
|
|
2016-11-10 01:35:34 +01:00
|
|
|
# Used to force goals to build. Only use for conditionally defined goals.
|
|
|
|
.PHONY: FORCE
|
|
|
|
FORCE:
|
|
|
|
|
|
|
|
ORIGINAL_MAKECMDGOALS := $(MAKECMDGOALS)
|
|
|
|
|
2017-11-28 00:01:02 +01:00
|
|
|
dist_goal := $(strip $(filter dist,$(MAKECMDGOALS)))
|
|
|
|
MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS)))
|
|
|
|
|
2010-01-04 21:57:38 +01: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
|
|
|
|
|
2016-01-19 03:13:03 +01:00
|
|
|
ifneq ($(filter --color=always, $(GREP_OPTIONS)),)
|
2015-05-18 20:15:06 +02:00
|
|
|
$(warning The build system needs unmodified output of grep.)
|
2016-01-19 03:13:03 +01:00
|
|
|
$(error Please remove --color=always from your $$GREP_OPTIONS)
|
2015-05-18 20:15:06 +02:00
|
|
|
endif
|
|
|
|
|
2017-07-25 09:57:38 +02:00
|
|
|
UNAME := $(shell uname -sm)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
SRC_TARGET_DIR := $(TOPDIR)build/target
|
2012-12-05 00:07:34 +01:00
|
|
|
SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api
|
2014-06-27 02:54:28 +02:00
|
|
|
SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api
|
2015-11-06 16:20:51 +01:00
|
|
|
SRC_TEST_API_DIR := $(TOPDIR)prebuilts/sdk/test-api
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# Some specific paths to tools
|
|
|
|
SRC_DROIDDOC_DIR := $(TOPDIR)build/tools/droiddoc
|
|
|
|
|
2017-05-31 21:48:55 +02:00
|
|
|
# Set up efficient math functions which are used in make.
|
|
|
|
# Here since this file is included by envsetup as well as during build.
|
|
|
|
include $(BUILD_SYSTEM)/math.mk
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# 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
|
2017-02-16 00:48:11 +01:00
|
|
|
BUILD_HEADER_LIBRARY:= $(BUILD_SYSTEM)/header_library.mk
|
2016-08-02 02:41:49 +02:00
|
|
|
BUILD_AUX_STATIC_LIBRARY:= $(BUILD_SYSTEM)/aux_static_library.mk
|
|
|
|
BUILD_AUX_EXECUTABLE:= $(BUILD_SYSTEM)/aux_executable.mk
|
2009-03-04 04:28:42 +01:00
|
|
|
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 09:25:16 +02:00
|
|
|
BUILD_PHONY_PACKAGE:= $(BUILD_SYSTEM)/phony_package.mk
|
2016-10-03 10:56:16 +02:00
|
|
|
BUILD_RRO_PACKAGE:= $(BUILD_SYSTEM)/build_rro_package.mk
|
2009-03-04 04:28:42 +01: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-20 20:08:47 +02:00
|
|
|
BUILD_NATIVE_TEST := $(BUILD_SYSTEM)/native_test.mk
|
2013-11-15 23:37:23 +01:00
|
|
|
BUILD_NATIVE_BENCHMARK := $(BUILD_SYSTEM)/native_benchmark.mk
|
2010-07-20 20:08:47 +02:00
|
|
|
BUILD_HOST_NATIVE_TEST := $(BUILD_SYSTEM)/host_native_test.mk
|
2015-07-31 01:56:30 +02:00
|
|
|
BUILD_FUZZ_TEST := $(BUILD_SYSTEM)/fuzz_test.mk
|
|
|
|
BUILD_HOST_FUZZ_TEST := $(BUILD_SYSTEM)/host_fuzz_test.mk
|
2014-02-05 07:09:16 +01: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 01:22:33 +01:00
|
|
|
BUILD_NOTICE_FILE := $(BUILD_SYSTEM)/notice_files.mk
|
2013-10-28 14:20:52 +01: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
|
|
|
|
|
2017-11-13 22:38:17 +01:00
|
|
|
BUILD_HOST_TEST_CONFIG:= $(BUILD_SYSTEM)/host_test_config.mk
|
|
|
|
BUILD_TARGET_TEST_CONFIG:= $(BUILD_SYSTEM)/target_test_config.mk
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# ###############################################################
|
|
|
|
# Parse out any modifier targets.
|
|
|
|
# ###############################################################
|
|
|
|
|
2017-05-26 07:10:08 +02:00
|
|
|
hide := @
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2015-10-28 22:33:40 +01: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 04:28:42 +01: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 12:08:26 +01:00
|
|
|
ifdef TMPDIR
|
|
|
|
JAVA_TMPDIR_ARG := -Djava.io.tmpdir=$(TMPDIR)
|
|
|
|
else
|
|
|
|
JAVA_TMPDIR_ARG :=
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# ###############################################################
|
|
|
|
# Include sub-configuration files
|
|
|
|
# ###############################################################
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Try to include buildspec.mk, which will try to set stuff up.
|
2013-06-27 21:02:46 +02:00
|
|
|
# If this file doesn't exist, the environment variables will
|
2009-03-04 04:28:42 +01:00
|
|
|
# be used, and if that doesn't work, then the default is an
|
|
|
|
# arm build
|
2011-11-02 21:49:08 +01:00
|
|
|
ifndef ANDROID_BUILDSPEC
|
|
|
|
ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk
|
|
|
|
endif
|
|
|
|
-include $(ANDROID_BUILDSPEC)
|
2009-03-04 04:28:42 +01: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-09 19:35:45 +02:00
|
|
|
# Pruned directory options used when using findleaves.py
|
|
|
|
# See envsetup.mk for a description of SCAN_EXCLUDE_DIRS
|
2016-10-05 01:21:49 +02:00
|
|
|
FIND_LEAVES_EXCLUDES := $(addprefix --prune=, $(SCAN_EXCLUDE_DIRS) .repo .git)
|
2015-06-09 19:35:45 +02:00
|
|
|
|
2012-03-30 19:45:38 +02: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-22 19:18:15 +02: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-30 19:45:38 +02: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 07:50:17 +01:00
|
|
|
TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
|
|
|
|
|
2012-03-16 17:57:11 +01: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 07:50:17 +01: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-16 17:57:11 +01: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 07:50:17 +01:00
|
|
|
|
2009-06-23 21:25:06 +02: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 00:12:00 +01:00
|
|
|
TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
|
2009-06-23 21:25:06 +02:00
|
|
|
|
2016-10-06 01:57:27 +02:00
|
|
|
BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
|
|
|
|
BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
|
|
|
|
|
2015-10-09 07:36:04 +02:00
|
|
|
# Commands to generate .toc file common to ELF .so files.
|
|
|
|
define _gen_toc_command_for_elf
|
2015-11-05 04:51:08 +01:00
|
|
|
$(hide) ($($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) -d $(1) | grep SONAME || echo "No SONAME for $1") > $(2)
|
2016-01-06 07:13:25 +01:00
|
|
|
$(hide) $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) --dyn-syms $(1) | awk '{$$2=""; $$3=""; print}' >> $(2)
|
2015-10-09 07:36:04 +02: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)
|
2016-10-05 02:01:29 +02:00
|
|
|
$(hide) nm -gP $(1) | cut -f1-2 -d" " | (grep -v U$$ >> $(2) || true)
|
2015-10-09 07:36:04 +02:00
|
|
|
endef
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
combo_target := HOST_
|
2013-12-27 20:09:36 +01:00
|
|
|
combo_2nd_arch_prefix :=
|
2009-03-04 04:28:42 +01:00
|
|
|
include $(BUILD_SYSTEM)/combo/select.mk
|
|
|
|
|
2014-04-17 19:03:35 +02: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-14 21:59:50 +02: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 01:20:19 +01: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-14 21:59:50 +02:00
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01: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-27 20:09:36 +01:00
|
|
|
combo_2nd_arch_prefix :=
|
2009-03-04 04:28:42 +01:00
|
|
|
include $(BUILD_SYSTEM)/combo/select.mk
|
|
|
|
|
2013-12-27 20:09:36 +01: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
|
|
|
|
|
2017-10-12 10:35:14 +02:00
|
|
|
ifeq ($(CALLED_FROM_SETUP),true)
|
2015-07-21 03:40:18 +02:00
|
|
|
include $(BUILD_SYSTEM)/ccache.mk
|
2015-08-17 10:38:24 +02:00
|
|
|
include $(BUILD_SYSTEM)/goma.mk
|
2015-07-21 03:40:18 +02:00
|
|
|
|
2016-08-31 18:35:32 +02:00
|
|
|
export CC_WRAPPER
|
|
|
|
export CXX_WRAPPER
|
2017-06-05 11:08:36 +02:00
|
|
|
export JAVAC_WRAPPER
|
2016-08-31 22:32:39 +02:00
|
|
|
endif
|
2016-08-31 18:35:32 +02:00
|
|
|
|
2014-05-01 03:09:13 +02:00
|
|
|
ifdef TARGET_PREFER_32_BIT
|
|
|
|
TARGET_PREFER_32_BIT_APPS := true
|
|
|
|
TARGET_PREFER_32_BIT_EXECUTABLES := true
|
|
|
|
endif
|
|
|
|
|
2014-05-01 03:18:02 +02:00
|
|
|
ifeq (,$(TARGET_SUPPORTS_32_BIT_APPS)$(TARGET_SUPPORTS_64_BIT_APPS))
|
|
|
|
TARGET_SUPPORTS_32_BIT_APPS := true
|
2014-04-07 12:01:54 +02: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 01:51:42 +02:00
|
|
|
# be overriden in the board configuration.
|
2014-04-07 12:01:54 +02:00
|
|
|
ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
|
2014-05-01 03:18:02 +02:00
|
|
|
ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
|
2014-04-07 12:01:54 +02: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 03:18:02 +02: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 12:01:54 +02: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 07:07:31 +02:00
|
|
|
# GCC version selection
|
|
|
|
TARGET_GCC_VERSION := 4.9
|
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
2ND_TARGET_GCC_VERSION := 4.9
|
|
|
|
endif
|
|
|
|
|
2016-09-27 02:37:19 +02:00
|
|
|
# Normalize WITH_STATIC_ANALYZER
|
2013-09-10 11:37:14 +02:00
|
|
|
ifeq ($(strip $(WITH_STATIC_ANALYZER)),0)
|
|
|
|
WITH_STATIC_ANALYZER :=
|
|
|
|
endif
|
|
|
|
|
2016-02-02 20:30:39 +01:00
|
|
|
# define clang/llvm versions and base directory.
|
|
|
|
include $(BUILD_SYSTEM)/clang/versions.mk
|
|
|
|
|
2016-04-01 01:30:23 +02: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
|
|
|
|
|
2016-09-27 02:37:19 +02:00
|
|
|
# Disable WITH_STATIC_ANALYZER if tool can't be found
|
2016-02-02 20:30:39 +01:00
|
|
|
SYNTAX_TOOLS_PREFIX := \
|
|
|
|
$(LLVM_PREBUILTS_BASE)/$(BUILD_OS)-x86/$(LLVM_PREBUILTS_VERSION)/tools/scan-build/libexec
|
2013-09-10 11:37:14 +02: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 11:55:46 +02:00
|
|
|
|
2009-03-04 04:28:42 +01: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 00:59:50 +01: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-11 19:32:01 +01:00
|
|
|
BUILD_PLATFORM_ZIP := $(filter platform platform-java,$(MAKECMDGOALS))
|
|
|
|
|
2017-06-03 00:25:20 +02:00
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Whether we can expect a full build graph
|
|
|
|
ALLOW_MISSING_DEPENDENCIES := $(filter true,$(ALLOW_MISSING_DEPENDENCIES))
|
|
|
|
ifneq ($(TARGET_BUILD_APPS),)
|
|
|
|
ALLOW_MISSING_DEPENDENCIES := true
|
|
|
|
endif
|
|
|
|
ifeq ($(TARGET_BUILD_PDK),true)
|
|
|
|
ALLOW_MISSING_DEPENDENCIES := true
|
|
|
|
endif
|
|
|
|
ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),)
|
|
|
|
ALLOW_MISSING_DEPENDENCIES := true
|
|
|
|
endif
|
|
|
|
ifneq ($(ONE_SHOT_MAKEFILE),)
|
|
|
|
ALLOW_MISSING_DEPENDENCIES := true
|
|
|
|
endif
|
|
|
|
.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES
|
|
|
|
|
2016-03-08 20:12:40 +01:00
|
|
|
prebuilt_sdk_tools := prebuilts/sdk/tools
|
|
|
|
prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
|
2015-12-03 01:33:04 +01:00
|
|
|
|
2017-09-23 00:03:38 +02:00
|
|
|
# Always use prebuilts for ckati and makeparallel
|
|
|
|
prebuilt_build_tools := prebuilts/build-tools
|
|
|
|
prebuilt_build_tools_wrappers := prebuilts/build-tools/common/bin
|
|
|
|
prebuilt_build_tools_jars := prebuilts/build-tools/common/framework
|
|
|
|
ifeq ($(filter address,$(SANITIZE_HOST)),)
|
|
|
|
prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/bin
|
|
|
|
else
|
|
|
|
prebuilt_build_tools_bin := $(prebuilt_build_tools)/$(HOST_PREBUILT_TAG)/asan/bin
|
|
|
|
endif
|
|
|
|
|
2017-07-06 22:42:00 +02:00
|
|
|
USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
|
2017-05-12 02:44:59 +02:00
|
|
|
|
2017-11-02 01:49:52 +01:00
|
|
|
# Work around for b/68406220
|
|
|
|
# This should match the soong version.
|
|
|
|
ifndef USE_D8
|
|
|
|
USE_D8 := true
|
|
|
|
endif
|
|
|
|
|
2017-11-29 15:58:04 +01:00
|
|
|
# Default R8 behavior when USE_R8 is not specified.
|
|
|
|
ifndef USE_R8
|
2017-12-11 10:43:39 +01:00
|
|
|
USE_R8 := false
|
2017-11-29 15:58:04 +01:00
|
|
|
endif
|
|
|
|
|
2017-07-06 22:42:00 +02:00
|
|
|
#
|
|
|
|
# Tools that are prebuilts for TARGET_BUILD_APPS
|
|
|
|
#
|
|
|
|
ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
|
|
|
|
AIDL := $(HOST_OUT_EXECUTABLES)/aidl
|
|
|
|
AAPT := $(HOST_OUT_EXECUTABLES)/aapt
|
|
|
|
AAPT2 := $(HOST_OUT_EXECUTABLES)/aapt2
|
2017-09-23 00:03:38 +02:00
|
|
|
DESUGAR := $(HOST_OUT_JAVA_LIBRARIES)/desugar.jar
|
2017-07-06 22:42:00 +02:00
|
|
|
MAINDEXCLASSES := $(HOST_OUT_EXECUTABLES)/mainDexClasses
|
|
|
|
SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
|
|
|
|
SIGNAPK_JNI_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
|
|
|
|
ZIPALIGN := $(HOST_OUT_EXECUTABLES)/zipalign
|
2017-07-18 07:22:59 +02:00
|
|
|
|
2017-07-06 22:42:00 +02:00
|
|
|
else # TARGET_BUILD_APPS || TARGET_BUILD_PDK
|
2017-11-18 03:39:55 +01:00
|
|
|
AIDL := $(prebuilt_build_tools_bin)/aidl
|
2017-07-06 22:42:00 +02:00
|
|
|
AAPT := $(prebuilt_sdk_tools_bin)/aapt
|
|
|
|
AAPT2 := $(prebuilt_sdk_tools_bin)/aapt2
|
2017-09-23 00:03:38 +02:00
|
|
|
DESUGAR := $(prebuilt_build_tools_jars)/desugar.jar
|
2017-07-06 22:42:00 +02:00
|
|
|
MAINDEXCLASSES := $(prebuilt_sdk_tools)/mainDexClasses
|
|
|
|
SIGNAPK_JAR := $(prebuilt_sdk_tools)/lib/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
|
|
|
|
SIGNAPK_JNI_LIBRARY_PATH := $(prebuilt_sdk_tools)/$(HOST_OS)/lib64
|
2017-11-18 03:39:55 +01:00
|
|
|
ZIPALIGN := $(prebuilt_build_tools_bin)/zipalign
|
2017-07-06 22:42:00 +02:00
|
|
|
endif # TARGET_BUILD_APPS || TARGET_BUILD_PDK
|
2015-12-03 01:33:04 +01:00
|
|
|
|
2017-11-17 00:51:07 +01:00
|
|
|
R8_COMPAT_PROGUARD := $(HOST_OUT_EXECUTABLES)/r8-compat-proguard
|
2017-11-07 16:18:28 +01:00
|
|
|
|
2017-07-06 22:42:00 +02:00
|
|
|
ifeq (,$(TARGET_BUILD_APPS))
|
|
|
|
# Use RenderScript prebuilts for unbundled builds but not PDK builds
|
|
|
|
LLVM_RS_CC := $(HOST_OUT_EXECUTABLES)/llvm-rs-cc
|
|
|
|
BCC_COMPAT := $(HOST_OUT_EXECUTABLES)/bcc_compat
|
|
|
|
else
|
|
|
|
LLVM_RS_CC := $(prebuilt_sdk_tools_bin)/llvm-rs-cc
|
|
|
|
BCC_COMPAT := $(prebuilt_sdk_tools_bin)/bcc_compat
|
|
|
|
endif # TARGET_BUILD_PDK
|
2016-08-07 05:15:06 +02:00
|
|
|
|
2017-07-06 22:42:00 +02:00
|
|
|
prebuilt_sdk_tools :=
|
|
|
|
prebuilt_sdk_tools_bin :=
|
2017-04-17 23:59:43 +02:00
|
|
|
|
2016-06-06 23:44:00 +02:00
|
|
|
ACP := $(prebuilt_build_tools_bin)/acp
|
2016-04-20 00:32:22 +02:00
|
|
|
CKATI := $(prebuilt_build_tools_bin)/ckati
|
2017-07-06 22:42:00 +02:00
|
|
|
DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod
|
|
|
|
FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist
|
2016-04-20 00:32:22 +02:00
|
|
|
MAKEPARALLEL := $(prebuilt_build_tools_bin)/makeparallel
|
2017-07-06 22:42:00 +02:00
|
|
|
SOONG_JAVAC_WRAPPER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_wrapper
|
|
|
|
SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip
|
2017-09-13 22:13:53 +02:00
|
|
|
MERGE_ZIPS := $(SOONG_HOST_OUT_EXECUTABLES)/merge_zips
|
2017-07-06 22:42:00 +02:00
|
|
|
ZIP2ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/zip2zip
|
2016-06-06 23:44:00 +02:00
|
|
|
ZIPTIME := $(prebuilt_build_tools_bin)/ziptime
|
2016-03-08 20:12:40 +01:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Generic tools.
|
|
|
|
|
2014-05-16 18:37:23 +02:00
|
|
|
LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39
|
2013-04-06 03:02:16 +02: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-17 19:03:35 +02:00
|
|
|
BISON := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bison/bison
|
2013-04-06 03:02:16 +02:00
|
|
|
YACC := $(BISON) -d
|
2016-04-05 13:12:48 +02:00
|
|
|
BISON_DATA := $(wildcard external/bison/data/* external/bison/data/*/*)
|
2013-04-06 03:02:16 +02:00
|
|
|
|
2014-06-06 04:05:47 +02:00
|
|
|
YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
DOXYGEN:= doxygen
|
2015-09-24 10:40:52 +02: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-05 19:28:51 +01:00
|
|
|
PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
|
2016-04-05 10:34:51 +02: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)
|
2016-02-19 20:06:58 +01:00
|
|
|
VTSC := $(HOST_OUT_EXECUTABLES)/vtsc$(HOST_EXECUTABLE_SUFFIX)
|
2009-03-04 04:28:42 +01:00
|
|
|
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
|
2009-05-27 18:14:25 +02:00
|
|
|
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
|
2017-11-09 23:53:42 +01:00
|
|
|
BROTLI := $(HOST_OUT_EXECUTABLES)/brotli$(HOST_EXECUTABLE_SUFFIX)
|
2012-11-26 01:53:44 +01:00
|
|
|
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
|
2009-03-04 04:28:42 +01:00
|
|
|
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
|
2012-11-26 01:53:44 +01:00
|
|
|
else
|
|
|
|
MKBOOTIMG := $(BOARD_CUSTOM_MKBOOTIMG)
|
|
|
|
endif
|
2016-04-08 21:08:03 +02:00
|
|
|
ifeq (,$(strip $(BOARD_CUSTOM_BPTTOOL)))
|
|
|
|
BPTTOOL := $(HOST_OUT_EXECUTABLES)/bpttool$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
else
|
|
|
|
BPTTOOL := $(BOARD_CUSTOM_BPTTOOL)
|
|
|
|
endif
|
Update for new Android Verified Boot (AVB).
This updates the build system for the new Android Verified Boot
codebase. As this is based on Brillo Verified Boot, this change replaces
the existing BVB support.
Android Verified Boot is enabled by the BOARD_AVB_ENABLE variable
BOARD_AVB_ENABLE := true
This will make the build system create vbmeta.img which will contain a
hash descriptor for boot.img, a hashtree descriptor for system.img, a
kernel-cmdline descriptor for setting up dm-verity for system.img and
append a hash-tree to system.img.
Additionally, the descriptors are left in boot.img and system.img so a
third party can create their own vbmeta.img file linking - using the
option --chain_partition - to these images. If this is not needed
footers can be erased using the 'avbtool erase_footer' command. It's
also harmless to just leave them in the images.
By default, the algorithm SHA256_RSA4096 is used with a test key from
the AVB source directory. This can be overriden by the
BOARD_AVB_ALGORITHM and BOARD_AVB_KEY_PATH variables to use e.g. a
4096-bit RSA key and SHA-512:
BOARD_AVB_ALGORITHM := SHA512_RSA4096
BOARD_AVB_KEY_PATH := /path/to/rsa_key_4096bits.pem
To prevent rollback attacks, the rollback index should be increased on a
regular basis. The rollback index can be set with the
BOARD_AVB_ROLLBACK_INDEX variable:
BOARD_AVB_ROLLBACK_INDEX := 5
If this is not set, the rollback index defaults to 0.
The variable BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS can be used to specify
additional options passed to 'avbtool make_vbmeta_image'. Typical
options to be used here include '--prop', '--prop_from_file', and
'--chain_partition'.
The variable BOARD_AVBTOOL_BOOT_ADD_HASH_FOOTER_ARGS can be used to
specify additional options passed to 'avbtool add_hash_footer' for
boot.img. Typical options to be used here include '--hash_algorithm' and
'--salt'.
The variable BOARD_AVBTOOL_SYSTEM_ADD_HASHTREE_FOOTER_ARGS can be used
to specify additional options passed to 'avbtool add_hashtree_footer'
for systems.img. Typical options to be used here include
'--hash_algorithm', '--salt', and '--block_size'.
BUG=31264226
TEST=Manually tested on edison-eng by inspecting {boot, system,
vbmeta}.img in out/ directory as well as their counterparts in
the IMAGES/ directory of edision-target_files-eng.zeuthen.zip
Merged-In: Ic9a61cfc65c148b12996e57f04da5432eef6b982
Change-Id: I97042655bca15e7eac899f12c5bada2f6184d307
2016-09-15 19:43:54 +02:00
|
|
|
ifeq (,$(strip $(BOARD_CUSTOM_AVBTOOL)))
|
|
|
|
AVBTOOL := $(HOST_OUT_EXECUTABLES)/avbtool$(HOST_EXECUTABLE_SUFFIX)
|
2016-01-29 22:59:17 +01:00
|
|
|
else
|
Update for new Android Verified Boot (AVB).
This updates the build system for the new Android Verified Boot
codebase. As this is based on Brillo Verified Boot, this change replaces
the existing BVB support.
Android Verified Boot is enabled by the BOARD_AVB_ENABLE variable
BOARD_AVB_ENABLE := true
This will make the build system create vbmeta.img which will contain a
hash descriptor for boot.img, a hashtree descriptor for system.img, a
kernel-cmdline descriptor for setting up dm-verity for system.img and
append a hash-tree to system.img.
Additionally, the descriptors are left in boot.img and system.img so a
third party can create their own vbmeta.img file linking - using the
option --chain_partition - to these images. If this is not needed
footers can be erased using the 'avbtool erase_footer' command. It's
also harmless to just leave them in the images.
By default, the algorithm SHA256_RSA4096 is used with a test key from
the AVB source directory. This can be overriden by the
BOARD_AVB_ALGORITHM and BOARD_AVB_KEY_PATH variables to use e.g. a
4096-bit RSA key and SHA-512:
BOARD_AVB_ALGORITHM := SHA512_RSA4096
BOARD_AVB_KEY_PATH := /path/to/rsa_key_4096bits.pem
To prevent rollback attacks, the rollback index should be increased on a
regular basis. The rollback index can be set with the
BOARD_AVB_ROLLBACK_INDEX variable:
BOARD_AVB_ROLLBACK_INDEX := 5
If this is not set, the rollback index defaults to 0.
The variable BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS can be used to specify
additional options passed to 'avbtool make_vbmeta_image'. Typical
options to be used here include '--prop', '--prop_from_file', and
'--chain_partition'.
The variable BOARD_AVBTOOL_BOOT_ADD_HASH_FOOTER_ARGS can be used to
specify additional options passed to 'avbtool add_hash_footer' for
boot.img. Typical options to be used here include '--hash_algorithm' and
'--salt'.
The variable BOARD_AVBTOOL_SYSTEM_ADD_HASHTREE_FOOTER_ARGS can be used
to specify additional options passed to 'avbtool add_hashtree_footer'
for systems.img. Typical options to be used here include
'--hash_algorithm', '--salt', and '--block_size'.
BUG=31264226
TEST=Manually tested on edison-eng by inspecting {boot, system,
vbmeta}.img in out/ directory as well as their counterparts in
the IMAGES/ directory of edision-target_files-eng.zeuthen.zip
Merged-In: Ic9a61cfc65c148b12996e57f04da5432eef6b982
Change-Id: I97042655bca15e7eac899f12c5bada2f6184d307
2016-09-15 19:43:54 +02:00
|
|
|
AVBTOOL := $(BOARD_CUSTOM_AVBTOOL)
|
2016-01-29 22:59:17 +01:00
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
APICHECK := $(HOST_OUT_EXECUTABLES)/apicheck$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
|
2016-11-19 02:06:29 +01:00
|
|
|
MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh
|
2017-03-11 01:53:45 +01:00
|
|
|
MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf
|
2016-11-19 02:06:29 +01:00
|
|
|
BLK_ALLOC_TO_BASE_FS := $(HOST_OUT_EXECUTABLES)/blk_alloc_to_base_fs$(HOST_EXECUTABLE_SUFFIX)
|
2015-03-03 21:30:37 +01:00
|
|
|
MAKE_SQUASHFS := $(HOST_OUT_EXECUTABLES)/mksquashfs$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh
|
2014-06-16 23:17:40 +02:00
|
|
|
MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh
|
2012-11-27 03:10:23 +01:00
|
|
|
SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
|
2015-06-25 00:42:19 +02:00
|
|
|
IMG2SIMG := $(HOST_OUT_EXECUTABLES)/img2simg$(HOST_EXECUTABLE_SUFFIX)
|
2012-11-27 03:10:23 +01:00
|
|
|
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
|
2009-03-04 04:28:42 +01:00
|
|
|
MKTARBALL := build/tools/mktarball.sh
|
2010-05-07 11:23:59 +02:00
|
|
|
TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
|
2010-05-04 00:01:38 +02:00
|
|
|
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
|
2015-04-19 18:55:39 +02:00
|
|
|
DATA_BINDING_COMPILER := $(HOST_OUT_JAVA_LIBRARIES)/databinding-compiler.jar
|
2016-09-02 03:07:15 +02:00
|
|
|
FAT16COPY := build/tools/fat16copy.py
|
2016-09-15 06:38:29 +02:00
|
|
|
CHECK_LINK_TYPE := build/tools/check_link_type.py
|
2015-02-02 12:18:20 +01:00
|
|
|
|
2009-08-30 22:39:24 +02:00
|
|
|
PROGUARD := external/proguard/bin/proguard.sh
|
2009-11-30 23:28:59 +01:00
|
|
|
JAVATAGS := build/tools/java-event-log-tags.py
|
2016-03-28 20:29:21 +02:00
|
|
|
MERGETAGS := build/tools/merge-event-log-tags.py
|
2016-04-19 11:41:27 +02:00
|
|
|
BUILD_IMAGE_SRCS := $(wildcard build/tools/releasetools/*.py)
|
2014-04-29 01:27:32 +02:00
|
|
|
APPEND2SIMG := $(HOST_OUT_EXECUTABLES)/append2simg
|
|
|
|
VERITY_SIGNER := $(HOST_OUT_EXECUTABLES)/verity_signer
|
2014-04-17 03:49:56 +02:00
|
|
|
BUILD_VERITY_TREE := $(HOST_OUT_EXECUTABLES)/build_verity_tree
|
2014-07-09 05:07:41 +02:00
|
|
|
BOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/boot_signer
|
2017-02-17 23:11:13 +01:00
|
|
|
FUTILITY := $(HOST_OUT_EXECUTABLES)/futility-host
|
2015-03-03 17:54:11 +01:00
|
|
|
VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh
|
2015-05-20 08:30:57 +02:00
|
|
|
FEC := $(HOST_OUT_EXECUTABLES)/fec
|
2017-04-20 00:54:22 +02:00
|
|
|
BRILLO_UPDATE_PAYLOAD := $(HOST_OUT_EXECUTABLES)/brillo_update_payload
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2015-12-09 10:06:20 +01:00
|
|
|
DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump2$(BUILD_EXECUTABLE_SUFFIX)
|
2017-02-28 20:17:32 +01:00
|
|
|
PROFMAN := $(HOST_OUT_EXECUTABLES)/profman
|
2015-11-09 08:47:42 +01:00
|
|
|
|
2015-04-21 01:59:05 +02:00
|
|
|
# relocation packer
|
|
|
|
RELOCATION_PACKER := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/relocation_packer/relocation_packer
|
|
|
|
|
2014-05-20 10:04:16 +02:00
|
|
|
FINDBUGS_DIR := external/owasp/sanitizer/tools/findbugs/bin
|
|
|
|
FINDBUGS := $(FINDBUGS_DIR)/findbugs
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2014-02-06 03:24:45 +01:00
|
|
|
# Tool to merge AndroidManifest.xmls
|
2017-09-08 22:29:54 +02:00
|
|
|
ANDROID_MANIFEST_MERGER_CLASSPATH := \
|
|
|
|
prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/26.0.0-beta2/manifest-merger-26.0.0-beta2.jar \
|
|
|
|
prebuilts/gradle-plugin/com/android/tools/sdk-common/26.0.0-beta2/sdk-common-26.0.0-beta2.jar \
|
|
|
|
prebuilts/gradle-plugin/com/android/tools/common/26.0.0-beta2/common-26.0.0-beta2.jar \
|
|
|
|
prebuilts/misc/common/guava/guava-21.0.jar
|
|
|
|
ANDROID_MANIFEST_MERGER := $(JAVA) \
|
|
|
|
-classpath $(subst $(space),:,$(strip $(ANDROID_MANIFEST_MERGER_CLASSPATH))) \
|
|
|
|
com.android.manifmerger.Merger
|
2014-02-06 03:24:45 +01:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
COLUMN:= column
|
|
|
|
|
2017-11-15 21:55:03 +01:00
|
|
|
ifeq ($(EXPERIMENTAL_USE_OPENJDK9),)
|
Build with OpenJDK 9 -target 1.8 by default except for errorprone.
(This is cherry-picked from the first attempt to submit this CL
topic, which was reverted after 3 hours because of bug 70286093;
robolectric 3.{1.1,4.2} now stick with OpenJDK 8 to avoid that bug).
Before this CL topic, the build toolchain for .java source files
used OpenJDK 8, targeting 1.8 (v52 class files) by default.
This CL topic switches the default to OpenJDK 9, but still
targeting 1.8 (v52 class files) by default. If USE_ERROR_PRONE
is set to true, then the default remains OpenJDK 8.
Code in the Android platform should generally be unaffected,
but if host tools that are now compiled and run using
OpenJDK 9 are causing problems for your team, then let me
know.
To manually switch back to the old behavior for now (continue
using OpenJDK 8), run this command in your shell:
export EXPERIMENTAL_USE_OPENJDK9=false
Bug: 69449021
Test: Treehugger
Test: Running robolectric tests succeeds on internal-master
after cherry-picking this CL topic, using the command
line from http://b/70286093#comment1
(cherry picked from commit 5f36a62622840e121a5276acbdfa8d548744d4e5)
Change-Id: I4972c714ed80c35328895e88675b56bf0e195c01
2017-11-17 15:06:51 +01:00
|
|
|
ifeq ($(RUN_ERROR_PRONE),true)
|
2017-11-15 21:55:03 +01:00
|
|
|
USE_OPENJDK9 :=
|
Build with OpenJDK 9 -target 1.8 by default except for errorprone.
(This is cherry-picked from the first attempt to submit this CL
topic, which was reverted after 3 hours because of bug 70286093;
robolectric 3.{1.1,4.2} now stick with OpenJDK 8 to avoid that bug).
Before this CL topic, the build toolchain for .java source files
used OpenJDK 8, targeting 1.8 (v52 class files) by default.
This CL topic switches the default to OpenJDK 9, but still
targeting 1.8 (v52 class files) by default. If USE_ERROR_PRONE
is set to true, then the default remains OpenJDK 8.
Code in the Android platform should generally be unaffected,
but if host tools that are now compiled and run using
OpenJDK 9 are causing problems for your team, then let me
know.
To manually switch back to the old behavior for now (continue
using OpenJDK 8), run this command in your shell:
export EXPERIMENTAL_USE_OPENJDK9=false
Bug: 69449021
Test: Treehugger
Test: Running robolectric tests succeeds on internal-master
after cherry-picking this CL topic, using the command
line from http://b/70286093#comment1
(cherry picked from commit 5f36a62622840e121a5276acbdfa8d548744d4e5)
Change-Id: I4972c714ed80c35328895e88675b56bf0e195c01
2017-11-17 15:06:51 +01:00
|
|
|
else
|
|
|
|
USE_OPENJDK9 := true
|
|
|
|
endif
|
2017-11-15 21:55:03 +01:00
|
|
|
TARGET_OPENJDK9 :=
|
|
|
|
else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),false)
|
|
|
|
USE_OPENJDK9 :=
|
|
|
|
TARGET_OPENJDK9 :=
|
|
|
|
else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),1.8)
|
|
|
|
USE_OPENJDK9 := true
|
|
|
|
TARGET_OPENJDK9 :=
|
|
|
|
else ifeq ($(EXPERIMENTAL_USE_OPENJDK9),true)
|
|
|
|
USE_OPENJDK9 := true
|
|
|
|
TARGET_OPENJDK9 := true
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Path to tools.jar, or empty if USE_OPENJDK9 is unset
|
2017-05-18 00:26:00 +02:00
|
|
|
HOST_JDK_TOOLS_JAR :=
|
|
|
|
# TODO: Remove HOST_JDK_TOOLS_JAR and all references to it once OpenJDK 8
|
2017-11-15 21:55:03 +01:00
|
|
|
# toolchains are no longer supported (i.e. when USE_OPENJDK9 is enforced).
|
|
|
|
# http://b/38418220
|
|
|
|
ifndef USE_OPENJDK9
|
2017-07-01 01:01:45 +02:00
|
|
|
HOST_JDK_TOOLS_JAR := $(ANDROID_JAVA_TOOLCHAIN)/../lib/tools.jar
|
2017-11-17 14:02:12 +01:00
|
|
|
endif # ifndef USE_OPENJDK9
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# It's called md5 on Mac OS and md5sum on Linux
|
|
|
|
ifeq ($(HOST_OS),darwin)
|
|
|
|
MD5SUM:=md5 -q
|
|
|
|
else
|
|
|
|
MD5SUM:=md5sum
|
|
|
|
endif
|
|
|
|
|
2017-05-18 00:26:00 +02:00
|
|
|
APICHECK_CLASSPATH_ENTRIES := \
|
|
|
|
$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) \
|
|
|
|
$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
|
|
|
|
$(HOST_JDK_TOOLS_JAR) \
|
|
|
|
)
|
|
|
|
APICHECK_CLASSPATH := $(subst $(space),:,$(strip $(APICHECK_CLASSPATH_ENTRIES)))
|
|
|
|
|
2011-04-09 02:32:52 +02:00
|
|
|
APICHECK_COMMAND := $(APICHECK) -JXmx1024m -J"classpath $(APICHECK_CLASSPATH)"
|
|
|
|
|
2017-05-19 00:26:59 +02:00
|
|
|
# Boolean variable determining if Treble is fully enabled
|
|
|
|
PRODUCT_FULL_TREBLE := false
|
|
|
|
ifneq ($(PRODUCT_FULL_TREBLE_OVERRIDE),)
|
|
|
|
PRODUCT_FULL_TREBLE := $(PRODUCT_FULL_TREBLE_OVERRIDE)
|
|
|
|
else ifeq ($(PRODUCT_SHIPPING_API_LEVEL),)
|
|
|
|
#$(warning no product shipping level defined)
|
|
|
|
else ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),26),)
|
|
|
|
PRODUCT_FULL_TREBLE := true
|
|
|
|
endif
|
|
|
|
|
2017-11-09 19:15:31 +01:00
|
|
|
requirements := \
|
|
|
|
PRODUCT_TREBLE_LINKER_NAMESPACES \
|
|
|
|
PRODUCT_SEPOLICY_SPLIT \
|
|
|
|
PRODUCT_ENFORCE_VINTF_MANIFEST \
|
|
|
|
|
|
|
|
# If it is overriden, then the requirement override is taken, otherwise it's
|
|
|
|
# PRODUCT_FULL_TREBLE
|
|
|
|
$(foreach req,$(requirements),$(eval \
|
|
|
|
$(req) := $(if $($(req)_OVERRIDE),$($(req)_OVERRIDE),$(PRODUCT_FULL_TREBLE))))
|
|
|
|
|
2017-11-17 19:47:30 +01:00
|
|
|
PRODUCT_FULL_TREBLE_OVERRIDE ?=
|
|
|
|
$(foreach req,$(requirements),$(eval $(req)_OVERRIDE ?=))
|
|
|
|
|
2017-11-09 19:15:31 +01:00
|
|
|
.KATI_READONLY := \
|
2017-11-17 19:47:30 +01:00
|
|
|
PRODUCT_FULL_TREBLE_OVERRIDE \
|
|
|
|
$(foreach req,$(requirements),$(req)_OVERRIDE) \
|
2017-11-09 19:15:31 +01:00
|
|
|
$(requirements) \
|
2017-11-17 19:47:30 +01:00
|
|
|
PRODUCT_FULL_TREBLE \
|
2017-11-09 19:15:31 +01:00
|
|
|
|
|
|
|
requirements :=
|
|
|
|
|
2017-09-30 00:32:22 +02:00
|
|
|
ifdef PRODUCT_SHIPPING_API_LEVEL
|
|
|
|
ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),27),)
|
|
|
|
ifneq ($(TARGET_USES_MKE2FS),true)
|
|
|
|
$(error When PRODUCT_SHIPPING_API_LEVEL >= 27, TARGET_USES_MKE2FS must be true)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-10-04 19:50:08 +02: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
|
|
|
|
|
2017-04-14 09:00:46 +02:00
|
|
|
FRAMEWORK_MANIFEST_FILE := system/libhidl/manifest.xml
|
2017-05-27 00:36:14 +02:00
|
|
|
|
|
|
|
# Compatibility matrix versioning:
|
|
|
|
# MATRIX_LEVEL_OVERRIDE defined: MATRIX_LEVEL = MATRIX_LEVEL_OVERRIDE
|
|
|
|
# MATRIX_LEVEL_OVERRIDE undefined:
|
|
|
|
# FULL_TREBLE != true: MATRIX_LEVEL = legacy
|
|
|
|
# FULL_TREBLE == true:
|
|
|
|
# SHIPPING_API_LEVEL defined: MATRIX_LEVEL = SHIPPING_API_LEVEL
|
|
|
|
# SHIPPING_API_LEVEL undefined: MATRIX_LEVEL = PLATFORM_SDK_VERSION
|
|
|
|
# MATRIX_LEVEL == legacy => legacy.xml
|
|
|
|
# MATRIX_LEVEL <= 26 => 26.xml
|
|
|
|
# MATRIX_LEVEL == 27 => 27.xml # define when 27 releases
|
|
|
|
# MATRIX_LEVEL == 28 => 28.xml # define when 28 releases
|
|
|
|
# ...
|
|
|
|
# otherwise => current.xml
|
|
|
|
|
|
|
|
ifneq ($(PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE),)
|
|
|
|
PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE)
|
|
|
|
else ifneq ($(PRODUCT_FULL_TREBLE),true)
|
|
|
|
PRODUCT_COMPATIBILITY_MATRIX_LEVEL := legacy
|
|
|
|
else ifneq ($(PRODUCT_SHIPPING_API_LEVEL),)
|
|
|
|
PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PRODUCT_SHIPPING_API_LEVEL)
|
|
|
|
else
|
|
|
|
PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PLATFORM_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(strip $(PRODUCT_COMPATIBILITY_MATRIX_LEVEL)),legacy)
|
|
|
|
FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.legacy.xml
|
2017-08-29 23:41:16 +02:00
|
|
|
else ifeq ($(call math_gt_or_eq,$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL),26),)
|
|
|
|
# All PRODUCT_FULL_TREBLE devices with shipping API levels < 26 get the level 26 manifest
|
|
|
|
# as that is the first.
|
2017-05-27 00:36:14 +02:00
|
|
|
FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.26.xml
|
2017-08-29 23:41:16 +02:00
|
|
|
else ifeq ($(call math_gt_or_eq,$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL),28),)
|
|
|
|
# All shipping API levels with released compatibility matrices get the corresponding matrix.
|
|
|
|
FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
|
|
|
|
hardware/interfaces/compatibility_matrix.$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL).xml
|
2017-05-27 00:36:14 +02:00
|
|
|
else
|
|
|
|
FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.current.xml
|
|
|
|
endif
|
2017-04-04 22:01:18 +02:00
|
|
|
|
2017-11-03 23:49:25 +01:00
|
|
|
BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
|
|
|
|
BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# ###############################################################
|
|
|
|
# Set up final options.
|
|
|
|
# ###############################################################
|
|
|
|
|
2015-12-16 22:10:35 +01:00
|
|
|
# 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-07-20 21:22:57 +02:00
|
|
|
TARGET_PROJECT_INCLUDES :=
|
2016-11-18 23:05:39 +01:00
|
|
|
TARGET_PROJECT_SYSTEM_INCLUDES := \
|
2012-03-30 19:24:31 +02:00
|
|
|
$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
|
|
|
|
$(TARGET_PRODUCT_KERNEL_HEADERS)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2013-12-27 20:09:36 +01:00
|
|
|
ifdef TARGET_2ND_ARCH
|
2014-02-22 01:17:05 +01:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES)
|
2016-07-20 21:22:57 +02:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES)
|
2013-12-27 20:09:36 +01:00
|
|
|
endif
|
|
|
|
|
2014-04-19 00:23:40 +02:00
|
|
|
# Flags for DEX2OAT
|
2015-10-16 05:43:29 +02:00
|
|
|
first_non_empty_of_three = $(if $(1),$(1),$(if $(2),$(2),$(3)))
|
2014-04-19 00:23:40 +02:00
|
|
|
DEX2OAT_TARGET_ARCH := $(TARGET_ARCH)
|
2015-10-16 05:43:29 +02:00
|
|
|
DEX2OAT_TARGET_CPU_VARIANT := $(call first_non_empty_of_three,$(TARGET_CPU_VARIANT),$(TARGET_ARCH_VARIANT),default)
|
2014-03-20 20:13:10 +01:00
|
|
|
DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
|
2014-04-19 00:23:40 +02:00
|
|
|
|
|
|
|
ifdef TARGET_2ND_ARCH
|
2014-05-13 22:57:28 +02:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH := $(TARGET_2ND_ARCH)
|
2015-10-16 05:43:29 +02: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-13 22:57:28 +02:00
|
|
|
$(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default
|
2014-03-20 20:13:10 +01:00
|
|
|
endif
|
|
|
|
|
2016-12-15 00:54:01 +01:00
|
|
|
# These will come from Soong, drop the environment versions
|
|
|
|
unexport CLANG
|
|
|
|
unexport CLANG_CXX
|
|
|
|
unexport CCC_CC
|
|
|
|
unexport CCC_CXX
|
2012-01-12 16:09:06 +01:00
|
|
|
|
2009-03-04 04:28:42 +01: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-29 19:24:27 +01:00
|
|
|
HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk
|
2011-11-29 20:20:16 +01:00
|
|
|
HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk
|
2010-06-09 19:26:26 +02:00
|
|
|
|
2015-05-20 01:03:57 +02: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-09 19:26:26 +02: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 04:28:42 +01: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-09 19:26:26 +02: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 03:07:33 +02:00
|
|
|
TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
|
2010-06-09 19:26:26 +02:00
|
|
|
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
|
2014-07-21 22:44:06 +02:00
|
|
|
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))
|
|
|
|
|
2017-10-16 12:20:34 +02:00
|
|
|
TARGET_AVAILABLE_SDK_VERSIONS := $(addprefix system_,$(call numerically_sort,\
|
|
|
|
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android_system.jar,%, \
|
|
|
|
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android_system.jar)))) \
|
|
|
|
$(TARGET_AVAILABLE_SDK_VERSIONS)
|
|
|
|
|
2015-11-06 16:20:51 +01:00
|
|
|
# We don't have prebuilt test_current SDK yet.
|
|
|
|
TARGET_AVAILABLE_SDK_VERSIONS := test_current $(TARGET_AVAILABLE_SDK_VERSIONS)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
2017-10-12 22:34:40 +02:00
|
|
|
TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
|
|
|
|
TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,27,$(TARGET_AVAILABLE_SDK_VERSIONS))
|
|
|
|
|
2011-04-09 00:03:48 +02:00
|
|
|
INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.txt
|
2014-02-21 23:18:19 +01:00
|
|
|
INTERNAL_PLATFORM_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/removed.txt
|
2014-06-27 02:54:28 +02: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
|
2017-05-10 03:03:01 +02:00
|
|
|
INTERNAL_PLATFORM_SYSTEM_EXACT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-exact.txt
|
2015-11-06 16:20:51 +01:00
|
|
|
INTERNAL_PLATFORM_TEST_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-api.txt
|
|
|
|
INTERNAL_PLATFORM_TEST_REMOVED_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-removed.txt
|
2017-05-10 03:03:01 +02:00
|
|
|
INTERNAL_PLATFORM_TEST_EXACT_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/test-exact.txt
|
2010-03-09 02:16:57 +01:00
|
|
|
|
2010-10-14 23:31:48 +02: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 07:11:46 +02:00
|
|
|
TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
|
2014-05-22 21:01:23 +02:00
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
TARGET_2ND_PREBUILT_TAG := android-$(TARGET_2ND_ARCH)
|
|
|
|
endif
|
2010-10-14 23:31:48 +02:00
|
|
|
|
2013-03-05 20:07:15 +01:00
|
|
|
# Set up RS prebuilt variables for compatibility library
|
|
|
|
|
2014-10-01 00:08:03 +02:00
|
|
|
RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TARGET_ARCH).bc
|
2013-03-05 20:07:15 +01:00
|
|
|
RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
|
|
|
|
|
2015-01-08 03:18:41 +01: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-20 20:05:18 +01:00
|
|
|
RSCOMPAT_NO_USAGEIO_API_LEVELS := 8 9 10 11 12 13
|
2015-01-08 03:18:41 +01:00
|
|
|
|
2017-10-31 01:31:44 +01:00
|
|
|
# Add BUILD_NUMBER to apps default version name if it's unbundled build.
|
|
|
|
ifdef TARGET_BUILD_APPS
|
|
|
|
TARGET_BUILD_WITH_APPS_VERSION_NAME := true
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef TARGET_BUILD_WITH_APPS_VERSION_NAME
|
|
|
|
APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER_FROM_FILE)
|
|
|
|
else
|
|
|
|
APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)
|
|
|
|
endif
|
|
|
|
|
2017-11-06 19:47:24 +01:00
|
|
|
# ANDROID_WARNING_ALLOWED_PROJECTS is generated by build/soong.
|
2016-10-12 00:38:39 +02:00
|
|
|
define find_warning_allowed_projects
|
|
|
|
$(filter $(ANDROID_WARNING_ALLOWED_PROJECTS),$(1)/)
|
|
|
|
endef
|
|
|
|
|
2016-11-10 01:35:34 +01:00
|
|
|
# These goals don't need to collect and include Android.mks/CleanSpec.mks
|
|
|
|
# in the source tree.
|
2017-05-18 22:42:40 +02:00
|
|
|
dont_bother_goals := out \
|
2016-11-10 01:35:34 +01:00
|
|
|
snod systemimage-nodeps \
|
|
|
|
stnod systemtarball-nodeps \
|
|
|
|
userdataimage-nodeps userdatatarball-nodeps \
|
|
|
|
cacheimage-nodeps \
|
|
|
|
bptimage-nodeps \
|
2017-03-07 21:10:09 +01:00
|
|
|
vnod vendorimage-nodeps \
|
2016-11-10 01:35:34 +01:00
|
|
|
systemotherimage-nodeps \
|
|
|
|
ramdisk-nodeps \
|
|
|
|
bootimage-nodeps \
|
|
|
|
recoveryimage-nodeps \
|
|
|
|
vbmetaimage-nodeps \
|
|
|
|
product-graph dump-products
|
|
|
|
|
2017-10-12 10:35:14 +02:00
|
|
|
ifeq ($(CALLED_FROM_SETUP),true)
|
2016-11-10 02:22:15 +01:00
|
|
|
include $(BUILD_SYSTEM)/ninja_config.mk
|
|
|
|
include $(BUILD_SYSTEM)/soong_config.mk
|
|
|
|
endif
|
|
|
|
|
2013-04-06 03:02:16 +02:00
|
|
|
include $(BUILD_SYSTEM)/dumpvar.mk
|