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.
2017-10-17 16:30:14 +08:00
i f n d e f K A T I
$( warning Directly using config .mk from make is no longer supported .)
2017-11-04 06:52:50 +08: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 16:30:14 +08:00
$( error done )
e n d i f
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
i f d e f A N D R O I D _ B U I L D _ S H E L L
SHELL := $( ANDROID_BUILD_SHELL)
e l s e
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
e n d i f
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.
d e f i n e n e w l i n e
2015-09-23 05:37:53 +08:00
e n d e f
# The pound character "#"
d e f i n e p o u n d
#
2014-10-04 02:36:27 +08:00
e n d e f
# Unfortunately you can't simply define backslash as \ or \\.
backslash := \a
backslash := $( patsubst %a,%,$( backslash) )
2012-09-28 04:26:25 +08:00
2018-03-29 05:33:10 +08:00
# Prevent accidentally changing these variables
.KATI_READONLY := SHELL empty space comma newline pound backslash
2016-11-10 08:35:34 +08: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 :
2018-03-29 05:33:10 +08:00
# Mark variables that should be coming as environment variables from soong_ui
# as readonly
.KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE
2017-10-31 04:41:53 +08:00
# Mark variables deprecated/obsolete
2017-11-09 08:39:18 +08:00
CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
2017-12-28 08:57:34 +08:00
$( KATI_obsolete_var PATH ,Do not use PATH directly . See $ ( CHANGES_URL ) #PATH )
2017-11-29 14:32:05 +08: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-12-28 08:57:34 +08:00
$( KATI_obsolete_var ANDROID_PRODUCT_OUT ,Use PRODUCT_OUT instead . See $ ( CHANGES_URL ) #ANDROID_PRODUCT_OUT )
2017-11-29 14:32:05 +08: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 )
2018-01-04 07:15:38 +08:00
$( KATI_obsolete_var ANDROID_BUILD_TOP ,Use '.' instead . See $ ( CHANGES_URL ) #ANDROID_BUILD_TOP )
2017-11-29 14:32:05 +08:00
$( KATI_obsolete_var \
2017-11-09 08:39:18 +08:00
ANDROID_TOOLCHAIN \
ANDROID_TOOLCHAIN_2ND_ARCH \
ANDROID_DEV_SCRIPTS \
ANDROID_EMULATOR_PREBUILTS \
ANDROID_PRE_BUILD_PATHS \
,See $( CHANGES_URL) #other_envsetup_variables)
2017-12-13 10:01:09 +08:00
$( KATI_obsolete_var PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE ,Set FCM Version in device manifest instead . See $ ( CHANGES_URL ) #PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE )
2018-01-12 03:54:48 +08:00
$( KATI_obsolete_var USE_CLANG_PLATFORM_BUILD ,Clang is the only supported Android compiler . See $ ( CHANGES_URL ) #USE_CLANG_PLATFORM_BUILD )
2017-11-09 08:39:18 +08:00
2018-02-27 18:15:32 +08:00
# This is marked as obsolete in envsetup.mk after reading the BoardConfig.mk
$( KATI_deprecate_export It is a global setting . See $ ( CHANGES_URL ) #export_keyword )
2017-11-09 08:39:18 +08:00
CHANGES_URL :=
2017-10-31 04:41:53 +08:00
2016-11-10 08:35:34 +08:00
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY : FORCE
FORCE :
ORIGINAL_MAKECMDGOALS := $( MAKECMDGOALS)
2017-11-28 07:01:02 +08:00
dist_goal := $( strip $( filter dist,$( MAKECMDGOALS) ) )
MAKECMDGOALS := $( strip $( filter-out dist,$( MAKECMDGOALS) ) )
2017-07-25 15:57:38 +08:00
UNAME := $( shell uname -sm)
2009-03-04 11:28:42 +08:00
SRC_TARGET_DIR := $( TOPDIR) build/target
# Some specific paths to tools
2017-12-07 06:38:40 +08:00
SRC_DROIDDOC_DIR := $( TOPDIR) build/make/tools/droiddoc
2009-03-04 11:28:42 +08:00
2018-05-02 15:15:41 +08:00
# Mark some inputs as readonly
i f d e f T A R G E T _ D E V I C E _ D I R
.KATI_READONLY := TARGET_DEVICE_DIR
e n d i f
2017-06-01 03:48:55 +08:00
# Set up efficient math functions which are used in make.
# Here since this file is included by envsetup as well as during build.
i n c l u d e $( BUILD_SYSTEM ) / m a t h . m k
2009-03-04 11:28:42 +08:00
# Various mappings to avoid hard-coding paths all over the place
i n c l u d e $( BUILD_SYSTEM ) / p a t h m a p . m k
2018-02-16 00:26:31 +08:00
# Allow projects to define their own globally-available variables
i n c l u d e $( BUILD_SYSTEM ) / p r o j e c t _ d e f i n i t i o n s . m k
2009-03-04 11:28:42 +08:00
# ###############################################################
# 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 07:48:11 +08:00
BUILD_HEADER_LIBRARY := $( BUILD_SYSTEM) /header_library.mk
2016-08-02 08:41:49 +08:00
BUILD_AUX_STATIC_LIBRARY := $( BUILD_SYSTEM) /aux_static_library.mk
BUILD_AUX_EXECUTABLE := $( BUILD_SYSTEM) /aux_executable.mk
2009-03-04 11:28:42 +08: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 15:25:16 +08:00
BUILD_PHONY_PACKAGE := $( BUILD_SYSTEM) /phony_package.mk
2016-10-03 16:56:16 +08:00
BUILD_RRO_PACKAGE := $( BUILD_SYSTEM) /build_rro_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
2017-12-07 07:57:31 +08:00
BUILD_HOST_TEST_CONFIG := $( BUILD_SYSTEM) /host_test_config.mk
BUILD_TARGET_TEST_CONFIG := $( BUILD_SYSTEM) /target_test_config.mk
INSTRUMENTATION_TEST_CONFIG_TEMPLATE := $( BUILD_SYSTEM) /instrumentation_test_config_template.xml
2018-04-19 01:51:58 +08:00
NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE := $( BUILD_SYSTEM) /native_benchmark_test_config_template.xml
2017-12-07 07:57:31 +08:00
NATIVE_TEST_CONFIG_TEMPLATE := $( BUILD_SYSTEM) /native_test_config_template.xml
EMPTY_TEST_CONFIG := $( BUILD_SYSTEM) /empty_test_config.xml
# Tool to generate TradeFed test config file automatically.
AUTOGEN_TEST_CONFIG_SCRIPT := build/make/tools/auto_gen_test_config.py
2009-03-04 11:28:42 +08:00
# ###############################################################
# Parse out any modifier targets.
# ###############################################################
2017-05-26 13:10:08 +08:00
hide := @
2009-03-04 11:28:42 +08:00
2015-10-29 05:33:40 +08:00
################################################################
# Tools needed in product configuration makefiles.
################################################################
2017-12-07 06:38:40 +08:00
NORMALIZE_PATH := build/make/tools/normalize_path.py
2015-10-29 05:33:40 +08:00
# $(1): the paths to be normalized
d e f i n e n o r m a l i z e - p a t h s
$( if $ ( 1) ,$ ( shell $ ( NORMALIZE_PATH ) $ ( 1) ) )
e n d e f
2009-03-04 11:28:42 +08:00
# ###############################################################
# Set common values
# ###############################################################
2018-03-13 15:04:48 +08:00
# Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive.
SOONG_CONFIG_NAMESPACES :=
2009-03-04 11:28:42 +08:00
# 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
i f d e f T M P D I R
JAVA_TMPDIR_ARG := -Djava.io.tmpdir= $( TMPDIR)
e l s e
JAVA_TMPDIR_ARG :=
e n d i f
2018-04-05 12:37:42 +08:00
# ###############################################################
# Broken build defaults
# ###############################################################
2018-06-22 00:46:01 +08:00
BUILD_BROKEN_ANDROIDMK_EXPORTS :=
BUILD_BROKEN_DUP_COPY_HEADERS :=
BUILD_BROKEN_DUP_RULES :=
BUILD_BROKEN_PHONY_TARGETS :=
2018-04-05 12:37:42 +08:00
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
i f n d e f A N D R O I D _ B U I L D S P E C
ANDROID_BUILDSPEC := $( TOPDIR) buildspec.mk
e n d i f
- i n c l u d e $( 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.
i n c l u d e $( BUILD_SYSTEM ) / e n v s e t u p . m k
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
2016-10-05 07:21:49 +08:00
FIND_LEAVES_EXCLUDES := $( addprefix --prune= , $( SCAN_EXCLUDE_DIRS) .repo .git)
2015-06-10 01:35:45 +08:00
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
d e f i n e v a l i d a t e - k e r n e l - h e a d e r s
$( if $ ( firstword $ ( foreach hdr_dir ,$ ( 1) ,\
$( filter-out kernel-headers,$( notdir $( hdr_dir) ) ) ) ) ,\
$( error Kernel header dirs must be end in kernel-headers: $( 1) ) )
e n d e f
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) )
i f e q ( $( TARGET_CPU_ABI ) , )
$( error No TARGET_CPU_ABI defined by board config: $( board_config_mk) )
e n d i f
2009-11-07 07:12:00 +08:00
TARGET_CPU_ABI2 := $( strip $( TARGET_CPU_ABI2) )
2009-06-24 03:25:06 +08:00
2016-10-06 07:57:27 +08:00
BOARD_KERNEL_BASE := $( strip $( BOARD_KERNEL_BASE) )
BOARD_KERNEL_PAGESIZE := $( strip $( BOARD_KERNEL_PAGESIZE) )
2015-10-09 13:36:04 +08:00
# Commands to generate .toc file common to ELF .so files.
d e f i n e _ g e n _ t o c _ c o m m a n d _ f o r _ e l f
2015-11-05 11:51:08 +08:00
$( hide ) ( $( $ ( PRIVATE_ 2ND_ARCH_VAR_PREFIX ) $ ( PRIVATE_PREFIX ) READELF ) - d $( 1) | g r e p S O N A M E | | e c h o "No SONAME for $1" ) > $( 2)
2016-01-06 14:13:25 +08:00
$( hide ) $( $ ( PRIVATE_ 2ND_ARCH_VAR_PREFIX ) $ ( PRIVATE_PREFIX ) READELF ) - - d y n - s y m s $( 1) | a w k '{$$2=""; $$3=""; print}' > > $( 2)
2015-10-09 13:36:04 +08:00
e n d e f
# Commands to generate .toc file from Darwin dynamic library.
d e f i n e _ g e n _ t o c _ c o m m a n d _ f o r _ m a c h o
2018-06-04 07:20:08 +08:00
$( hide ) $( HOST_OTOOL ) - l $( 1) | g r e p L C _ I D _ D Y L I B - A 5 > $( 2)
$( hide ) $( HOST_NM ) - g P $( 1) | c u t - f 1 - 2 - d " " | ( g r e p - v U $$ > > $( 2) | | t r u e )
2015-10-09 13:36:04 +08:00
e n d e f
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
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
2014-04-18 01:03:35 +08:00
# Load the 2nd host arch if it's needed.
i f d e f H O S T _ 2 N D _ A R C H
combo_target := HOST_
combo_2nd_arch_prefix := $( HOST_2ND_ARCH_VAR_PREFIX)
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
e n d i f
2015-08-15 03:59:50 +08:00
# Load the windows cross compiler under Linux
i f d e f H O S T _ C R O S S _ O S
combo_target := HOST_CROSS_
combo_2nd_arch_prefix :=
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
2016-02-06 08:20:19 +08:00
i f d e f H O S T _ C R O S S _ 2 N D _ A R C H
combo_target := HOST_CROSS_
combo_2nd_arch_prefix := $( HOST_CROSS_2ND_ARCH_VAR_PREFIX)
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
e n d i f
2015-08-15 03:59:50 +08:00
e n d i f
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
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
2013-12-28 03:09:36 +08:00
# Load the 2nd target arch if it's needed.
i f d e f T A R G E T _ 2 N D _ A R C H
combo_target := TARGET_
combo_2nd_arch_prefix := $( TARGET_2ND_ARCH_VAR_PREFIX)
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
e n d i f
2017-10-12 16:35:14 +08:00
i f e q ( $( CALLED_FROM_SETUP ) , t r u e )
2015-07-21 09:40:18 +08:00
i n c l u d e $( BUILD_SYSTEM ) / c c a c h e . m k
2015-08-17 16:38:24 +08:00
i n c l u d e $( BUILD_SYSTEM ) / g o m a . m k
2016-09-01 04:32:39 +08:00
e n d i f
2016-09-01 00:35:32 +08:00
2014-05-01 09:09:13 +08:00
i f d e f T A R G E T _ P R E F E R _ 3 2 _ B I T
TARGET_PREFER_32_BIT_APPS := true
TARGET_PREFER_32_BIT_EXECUTABLES := true
e n d i f
2018-06-28 20:31:02 +08:00
i f e q ( , $( filter true ,$ ( TARGET_SUPPORTS_ 32_BIT_APPS ) $ ( TARGET_SUPPORTS_ 64_BIT_APPS ) ) )
2014-05-01 09:18:02 +08:00
TARGET_SUPPORTS_32_BIT_APPS := true
2014-04-07 18:01:54 +08:00
e n d i f
2018-06-28 20:31:02 +08:00
# Sanity check to warn about likely cryptic errors later in the build.
i f e q ( $( TARGET_IS_ 64_BIT ) , t r u e )
ifeq ( ,$( filter true false,$( TARGET_SUPPORTS_64_BIT_APPS) ) )
$( warning Building a 32-bit-app-only product on a 64-bit device. \
If this is intentional, set TARGET_SUPPORTS_64_BIT_APPS := false )
endif
e n d i f
2014-04-07 18:01:54 +08:00
# "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
i f e q ( , $( 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
e n d i f
i f e q ( , $( 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
e n d i f
# "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.
i f e q ( , $( 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
e n d i f
# 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
i f d e f T A R G E T _ 2 N D _ A R C H
2ND_TARGET_GCC_VERSION := 4.9
e n d i f
2016-09-27 08:37:19 +08:00
# Normalize WITH_STATIC_ANALYZER
2013-09-10 17:37:14 +08:00
i f e q ( $( strip $ ( WITH_STATIC_ANALYZER ) ) , 0 )
WITH_STATIC_ANALYZER :=
e n d i f
2016-04-01 07:30:23 +08:00
# Unset WITH_TIDY_ONLY if global WITH_TIDY_ONLY is not true nor 1.
i f e q ( , $( filter 1 true ,$ ( WITH_TIDY_ONLY ) ) )
WITH_TIDY_ONLY :=
e n d i f
2009-03-04 11:28:42 +08:00
# Pick a Java compiler.
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / j a v a c . m k
# ---------------------------------------------------------------
# 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.
i f e q ( , $( strip $ ( CALLED_FROM_SETUP ) ) )
i f n e q ( , $( strip $ ( BUILD_ENV_SEQUENCE_NUMBER ) ) )
i f n e q ( $( 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 ..)
e n d i f
e n d i f
e n d i f
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:
2018-03-07 06:07:21 +08:00
# 1) PDK_FUSION_PLATFORM_ZIP / PDK_FUSION_PLATFORM_DIR is passed in from the environment
2016-01-27 07:59:50 +08:00
# or
2018-03-07 06:07:21 +08:00
# 2) the platform.zip / pdk.mk exists in the default location
2016-01-27 07:59:50 +08:00
# 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
2018-03-07 06:07:21 +08:00
# if PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR is specified, do not override.
i f e q ( , $( strip $ ( PDK_FUSION_PLATFORM_ZIP ) $ ( PDK_FUSION_PLATFORM_DIR ) ) )
# 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.
# Others are set up with vendor/pdk/TARGET_DEVICE/TARGET_DEVICE-userdebug
_pdk_fusion_search_paths := \
vendor/pdk/$( TARGET_DEVICE) /$( TARGET_DEVICE) -$( TARGET_BUILD_VARIANT) /platform \
vendor/pdk/$( TARGET_DEVICE) /$( TARGET_PRODUCT) -$( TARGET_BUILD_VARIANT) /platform \
vendor/pdk/$( TARGET_DEVICE) /$( patsubst aosp_%,full_%,$( TARGET_PRODUCT) ) -$( TARGET_BUILD_VARIANT) /platform \
vendor/pdk/$( TARGET_PRODUCT) /$( TARGET_PRODUCT) -$( TARGET_BUILD_VARIANT) /platform \
vendor/pdk/$( TARGET_PRODUCT) /$( patsubst aosp_%,full_%,$( TARGET_PRODUCT) ) -$( TARGET_BUILD_VARIANT) /platform
_pdk_fusion_default_platform_zip := $( strip $( foreach p,$( _pdk_fusion_search_paths) ,$( wildcard $( p) /platform.zip) ) )
ifneq ( ,$( _pdk_fusion_default_platform_zip) )
PDK_FUSION_PLATFORM_ZIP := $( word 1, $( _pdk_fusion_default_platform_zip) )
_pdk_fusion_default_platform_zip :=
else
_pdk_fusion_default_platform_mk := $( strip $( foreach p,$( _pdk_fusion_search_paths) ,$( wildcard $( p) /pdk.mk) ) )
ifneq ( ,$( _pdk_fusion_default_platform_mk) )
PDK_FUSION_PLATFORM_DIR := $( dir $( word 1,$( _pdk_fusion_default_platform_mk) ) )
_pdk_fusion_default_platform_mk :=
endif
endif # _pdk_fusion_default_platform_zip
_pdk_fusion_search_paths :=
e n d i f # !PDK_FUSION_PLATFORM_ZIP && !PDK_FUSION_PLATFORM_DIR
i f n e q ( , $( PDK_FUSION_PLATFORM_ZIP ) )
ifneq ( ,$( PDK_FUSION_PLATFORM_DIR) )
$( error Only one of PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR may be specified)
endif
e n d i f
2016-01-27 07:59:50 +08:00
i f n e q ( , $( filter pdk fusion , $ ( MAKECMDGOALS ) ) )
TARGET_BUILD_PDK := true
i f n e q ( , $( filter fusion , $ ( MAKECMDGOALS ) ) )
2018-03-07 06:07:21 +08:00
i f e q ( , $( strip $ ( PDK_FUSION_PLATFORM_ZIP ) $ ( PDK_FUSION_PLATFORM_DIR ) ) )
$( error Specify PDK_FUSION_PLATFORM_ZIP or PDK_FUSION_PLATFORM_DIR to do a PDK fusion.)
2016-01-27 07:59:50 +08:00
e n d i f
e n d i f # fusion
e n d i f # pdk or fusion
i f d e f P D K _ F U S I O N _ P L A T F O R M _ Z I P
TARGET_BUILD_PDK := true
i f e q ( , $( wildcard $ ( PDK_FUSION_PLATFORM_ZIP ) ) )
2018-03-07 06:07:21 +08:00
ifneq ( ,$( wildcard $( dir $( PDK_FUSION_PLATFORM_ZIP) ) /pdk.mk) )
PDK_FUSION_PLATFORM_DIR := $( dir $( PDK_FUSION_PLATFORM_ZIP) )
PDK_FUSION_PLATFORM_ZIP :=
else
$( error Cannot find file $( PDK_FUSION_PLATFORM_ZIP) .)
endif
e n d i f
e n d i f
i f d e f P D K _ F U S I O N _ P L A T F O R M _ D I R
TARGET_BUILD_PDK := true
i f e q ( , $( wildcard $ ( PDK_FUSION_PLATFORM_DIR ) /pdk .mk ) )
$( error Cannot find file $( PDK_FUSION_PLATFORM_DIR) /pdk.mk.)
2016-01-27 07:59:50 +08:00
e n d i f
e n d i f
2016-03-12 02:32:01 +08:00
BUILD_PLATFORM_ZIP := $( filter platform platform-java,$( MAKECMDGOALS) )
2017-06-03 06:25:20 +08:00
# ---------------------------------------------------------------
# Whether we can expect a full build graph
ALLOW_MISSING_DEPENDENCIES := $( filter true,$( ALLOW_MISSING_DEPENDENCIES) )
i f n e q ( $( TARGET_BUILD_APPS ) , )
ALLOW_MISSING_DEPENDENCIES := true
e n d i f
i f e q ( $( TARGET_BUILD_PDK ) , t r u e )
ALLOW_MISSING_DEPENDENCIES := true
e n d i f
i f n e q ( $( filter true ,$ ( SOONG_ALLOW_MISSING_DEPENDENCIES ) ) , )
ALLOW_MISSING_DEPENDENCIES := true
e n d i f
i f n e q ( $( ONE_SHOT_MAKEFILE ) , )
ALLOW_MISSING_DEPENDENCIES := true
e n d i f
.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES
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
2017-09-23 06:03:38 +08: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
2018-05-26 07:13:52 +08:00
prebuilt_build_tools_bin_noasan := $( prebuilt_build_tools) /$( HOST_PREBUILT_TAG) /bin
2017-09-23 06:03:38 +08:00
i f e q ( $( filter address ,$ ( SANITIZE_HOST ) ) , )
2018-05-26 07:13:52 +08:00
prebuilt_build_tools_bin := $( prebuilt_build_tools_bin_noasan)
2017-09-23 06:03:38 +08:00
e l s e
prebuilt_build_tools_bin := $( prebuilt_build_tools) /$( HOST_PREBUILT_TAG) /asan/bin
e n d i f
2017-07-07 04:42:00 +08:00
USE_PREBUILT_SDK_TOOLS_IN_PLACE := true
2017-05-12 08:44:59 +08:00
2017-11-02 08:49:52 +08:00
# Work around for b/68406220
# This should match the soong version.
2018-06-07 05:46:25 +08:00
USE_D8 := true
2018-06-20 01:23:50 +08:00
.KATI_READONLY := USE_D8
2017-11-02 08:49:52 +08:00
2017-11-29 22:58:04 +08:00
# Default R8 behavior when USE_R8 is not specified.
i f n d e f U S E _ R 8
2018-03-13 23:58:45 +08:00
USE_R8 := true
2017-11-29 22:58:04 +08:00
e n d i f
2018-06-20 01:23:50 +08:00
.KATI_READONLY := USE_R8
2017-11-29 22:58:04 +08:00
2017-07-07 04:42:00 +08:00
#
# Tools that are prebuilts for TARGET_BUILD_APPS
#
i f e q ( , $( TARGET_BUILD_APPS ) $( filter true ,$ ( TARGET_BUILD_PDK ) ) )
AIDL := $( HOST_OUT_EXECUTABLES) /aidl
AAPT := $( HOST_OUT_EXECUTABLES) /aapt
AAPT2 := $( HOST_OUT_EXECUTABLES) /aapt2
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 13:22:59 +08:00
2017-07-07 04:42:00 +08:00
e l s e # TARGET_BUILD_APPS || TARGET_BUILD_PDK
2017-11-18 10:39:55 +08:00
AIDL := $( prebuilt_build_tools_bin) /aidl
2017-07-07 04:42:00 +08:00
AAPT := $( prebuilt_sdk_tools_bin) /aapt
AAPT2 := $( prebuilt_sdk_tools_bin) /aapt2
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 10:39:55 +08:00
ZIPALIGN := $( prebuilt_build_tools_bin) /zipalign
2017-07-07 04:42:00 +08:00
e n d i f # TARGET_BUILD_APPS || TARGET_BUILD_PDK
2015-12-03 08:33:04 +08:00
2017-07-07 04:42:00 +08:00
i f e q ( , $( 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
e l s e
LLVM_RS_CC := $( prebuilt_sdk_tools_bin) /llvm-rs-cc
BCC_COMPAT := $( prebuilt_sdk_tools_bin) /bcc_compat
e n d i f # TARGET_BUILD_PDK
2016-08-07 11:15:06 +08:00
2017-07-07 04:42:00 +08:00
prebuilt_sdk_tools :=
prebuilt_sdk_tools_bin :=
2017-04-18 05:59:43 +08:00
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
2017-07-07 04:42:00 +08:00
DEPMOD := $( HOST_OUT_EXECUTABLES) /depmod
FILESLIST := $( SOONG_HOST_OUT_EXECUTABLES) /fileslist
2018-06-14 05:51:05 +08:00
HOST_INIT_VERIFIER := $( HOST_OUT_EXECUTABLES) /host_init_verifier
2016-04-20 06:32:22 +08:00
MAKEPARALLEL := $( prebuilt_build_tools_bin) /makeparallel
2017-07-07 04:42:00 +08:00
SOONG_JAVAC_WRAPPER := $( SOONG_HOST_OUT_EXECUTABLES) /soong_javac_wrapper
SOONG_ZIP := $( SOONG_HOST_OUT_EXECUTABLES) /soong_zip
2017-09-14 04:13:53 +08:00
MERGE_ZIPS := $( SOONG_HOST_OUT_EXECUTABLES) /merge_zips
2018-02-27 10:26:44 +08:00
XMLLINT := $( SOONG_HOST_OUT_EXECUTABLES) /xmllint
2018-03-10 13:26:17 +08:00
XZ := $( prebuilt_build_tools) /$( HOST_PREBUILT_TAG) /bin/xz
2017-07-07 04:42:00 +08:00
ZIP2ZIP := $( SOONG_HOST_OUT_EXECUTABLES) /zip2zip
2016-06-07 05:44:00 +08:00
ZIPTIME := $( prebuilt_build_tools_bin) /ziptime
2016-03-09 03:12:40 +08:00
2009-03-04 11:28:42 +08:00
# ---------------------------------------------------------------
# Generic tools.
2018-05-26 07:13:52 +08:00
LEX := $( prebuilt_build_tools_bin_noasan) /flex
2013-04-06 09:02:16 +08:00
# The default PKGDATADIR built in the prebuilt bison is a relative path
2018-01-09 09:28:17 +08:00
# prebuilts/build-tools/common/bison.
2013-04-06 09:02:16 +08:00
# To run bison from elsewhere you need to set up enviromental variable
# BISON_PKGDATADIR.
2018-01-09 09:28:17 +08:00
BISON_PKGDATADIR := $( PWD) /prebuilts/build-tools/common/bison
2018-05-26 07:13:52 +08:00
BISON := $( prebuilt_build_tools_bin_noasan) /bison
2013-04-06 09:02:16 +08:00
YACC := $( BISON) -d
2018-01-09 09:28:17 +08:00
BISON_DATA := $( wildcard $( BISON_PKGDATADIR) /* $( BISON_PKGDATADIR) /*/*)
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-09-24 16:40:52 +08:00
i f e q ( $( HOST_OS ) , l i n u x )
BREAKPAD_DUMP_SYMS := $( HOST_OUT_EXECUTABLES) /dump_syms
e l s e
# For non-supported hosts, do not generate breakpad symbols.
BREAKPAD_GENERATE_SYMBOLS := false
e n d i f
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)
2016-02-20 03:06:58 +08:00
VTSC := $( HOST_OUT_EXECUTABLES) /vtsc$( HOST_EXECUTABLE_SUFFIX)
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)
2017-11-10 06:53:42 +08:00
BROTLI := $( HOST_OUT_EXECUTABLES) /brotli$( HOST_EXECUTABLE_SUFFIX)
2012-11-26 08:53:44 +08:00
i f e q ( , $( 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
e l s e
MKBOOTIMG := $( BOARD_CUSTOM_MKBOOTIMG)
e n d i f
2016-04-09 03:08:03 +08:00
i f e q ( , $( strip $ ( BOARD_CUSTOM_BPTTOOL ) ) )
BPTTOOL := $( HOST_OUT_EXECUTABLES) /bpttool$( HOST_EXECUTABLE_SUFFIX)
e l s e
BPTTOOL := $( BOARD_CUSTOM_BPTTOOL)
e n d i f
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-16 01:43:54 +08:00
i f e q ( , $( strip $ ( BOARD_CUSTOM_AVBTOOL ) ) )
AVBTOOL := $( HOST_OUT_EXECUTABLES) /avbtool$( HOST_EXECUTABLE_SUFFIX)
2016-01-30 05:59:17 +08:00
e l s e
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-16 01:43:54 +08:00
AVBTOOL := $( BOARD_CUSTOM_AVBTOOL)
2016-01-30 05:59:17 +08:00
e n d i f
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)
2016-11-19 09:06:29 +08:00
MAKE_EXT4FS := $( HOST_OUT_EXECUTABLES) /mke2fs$( HOST_EXECUTABLE_SUFFIX)
MKEXTUSERIMG := $( HOST_OUT_EXECUTABLES) /mkuserimg_mke2fs.sh
2017-03-11 08:53:45 +08:00
MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf
2016-11-19 09:06:29 +08:00
BLK_ALLOC_TO_BASE_FS := $( HOST_OUT_EXECUTABLES) /blk_alloc_to_base_fs$( HOST_EXECUTABLE_SUFFIX)
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)
2017-12-07 06:38:40 +08:00
MKTARBALL := build/make/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-04-20 00:55:39 +08:00
DATA_BINDING_COMPILER := $( HOST_OUT_JAVA_LIBRARIES) /databinding-compiler.jar
2017-12-07 06:38:40 +08:00
FAT16COPY := build/make/tools/fat16copy.py
CHECK_LINK_TYPE := build/make/tools/check_link_type.py
2015-02-02 19:18:20 +08:00
2009-08-31 04:39:24 +08:00
PROGUARD := external/proguard/bin/proguard.sh
2017-12-07 06:38:40 +08:00
JAVATAGS := build/make/tools/java-event-log-tags.py
MERGETAGS := build/make/tools/merge-event-log-tags.py
BUILD_IMAGE_SRCS := $( wildcard build/make/tools/releasetools/*.py)
2014-04-29 07:27:32 +08:00
APPEND2SIMG := $( HOST_OUT_EXECUTABLES) /append2simg
VERITY_SIGNER := $( HOST_OUT_EXECUTABLES) /verity_signer
2018-03-16 14:21:28 +08:00
BUILD_VERITY_METADATA := $( HOST_OUT_EXECUTABLES) /build_verity_metadata.py
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
2017-02-18 06:11:13 +08:00
FUTILITY := $( HOST_OUT_EXECUTABLES) /futility-host
2015-03-04 00:54:11 +08:00
VBOOT_SIGNER := prebuilts/misc/scripts/vboot_signer/vboot_signer.sh
2015-05-20 14:30:57 +08:00
FEC := $( HOST_OUT_EXECUTABLES) /fec
2017-04-20 06:54:22 +08:00
BRILLO_UPDATE_PAYLOAD := $( HOST_OUT_EXECUTABLES) /brillo_update_payload
2009-03-04 11:28:42 +08:00
2015-12-09 17:06:20 +08:00
DEXDUMP := $( HOST_OUT_EXECUTABLES) /dexdump2$( BUILD_EXECUTABLE_SUFFIX)
2017-03-01 03:17:32 +08:00
PROFMAN := $( HOST_OUT_EXECUTABLES) /profman
2018-01-29 22:43:14 +08:00
HIDDENAPI := $( HOST_OUT_EXECUTABLES) /hiddenapi
2015-11-09 15:47:42 +08:00
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
2014-02-06 10:24:45 +08:00
# Tool to merge AndroidManifest.xmls
2017-09-09 04:29:54 +08:00
ANDROID_MANIFEST_MERGER_CLASSPATH := \
2018-05-03 22:52:09 +08:00
prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/26.1.0/manifest-merger-26.1.0.jar \
prebuilts/gradle-plugin/com/android/tools/common/26.1.0/common-26.1.0.jar \
2018-05-24 07:30:51 +08:00
prebuilts/gradle-plugin/com/android/tools/sdk-common/26.1.0/sdk-common-26.1.0.jar \
prebuilts/gradle-plugin/com/android/tools/sdklib/26.1.0/sdklib-26.1.0.jar \
2018-05-03 22:52:09 +08:00
prebuilts/gradle-plugin/org/jetbrains/kotlin/kotlin-runtime/1.0.5/kotlin-runtime-1.0.5.jar \
prebuilts/gradle-plugin/org/jetbrains/kotlin/kotlin-stdlib/1.1.3/kotlin-stdlib-1.1.3.jar \
2017-09-09 04:29:54 +08:00
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 10:24:45 +08:00
2009-03-04 11:28:42 +08:00
COLUMN := column
2017-11-17 22:06:51 +08:00
USE_OPENJDK9 := true
2018-06-21 07:11:19 +08:00
i f e q ( $( EXPERIMENTAL_USE_OPENJDK 9) , )
2017-11-16 04:55:03 +08:00
TARGET_OPENJDK9 :=
e l s e i f e q ( $( EXPERIMENTAL_USE_OPENJDK 9) , 1 . 8 )
TARGET_OPENJDK9 :=
e l s e i f e q ( $( EXPERIMENTAL_USE_OPENJDK 9) , t r u e )
TARGET_OPENJDK9 := true
e n d i f
Pass OpenJDK 8's bootclasspath for host tools targeting <= 1.8.
Host (as opposed to hostdex) tools compile and run against OpenJDK's
core libraries. Before this CL, the core libraries of the default
toolchain were always used, even when targeting an earlier language
version.
This meant that code that uses APIs from a later version of OpenJDK
than corresponded to LOCAL_JAVA_LANGUAGE_VERSION would compile, but
would fail to run under that earlier version of OpenJDK. It also
meant that calls to existing APIs might be reinterpreted; for
example, the return type of java.nio.ByteBuffer.clear() changed from
Buffer in OpenJDK 8 to ByteBuffer in OpenJDK 9. At compile time, this
was noted via the warning:
bootstrap class path not set in conjunction with -source 1.8
After this CL, when targeting a language version <= 1.8 (which is
always the case when building with OpenJDK 8), some of OpenJDK 8's
core library/tools jars are now passed on the bootclasspath. The
decision to include the bootclasspath argument when building with
OpenJDK 8 was somewhat arbitrary, but has the advantage that we
discover any issues before we switch to OpenJDK 9.
Even when compiling with OpenJDK 9, use of OpenJDK 9 APIs will now
fail at compile time rather than at runtime; calls to existing APIs
will now be interpreted in OpenJDK 8 rather than 9 fashion. For
example, this means that dx and host-side CTS tests built with
OpenJDK 9 javac -target 1.8 will be runnable under OpenJDK 8.
Bug: 70521453
Bug: 70862583
Test: Checked that the bootclasspath argument was passed
in the javac invocation targeting 1.8 during:
make showcommands compatibility-common-util-hostsidelib
Test: make checkbuild
Change-Id: I9b6081edfdd2c3e9a450ae8a39c4e32c3d2cda92
2017-12-21 02:36:56 +08:00
# Path to tools.jar
HOST_JDK_TOOLS_JAR := $( ANDROID_JAVA8_HOME) /lib/tools.jar
2009-03-04 11:28:42 +08:00
# It's called md5 on Mac OS and md5sum on Linux
i f e q ( $( HOST_OS ) , d a r w i n )
MD5SUM := md5 -q
e l s e
MD5SUM := md5sum
e n d i f
2017-05-18 06:26:00 +08:00
APICHECK_CLASSPATH_ENTRIES := \
2018-05-12 21:11:27 +08:00
$( HOST_OUT_JAVA_LIBRARIES) /apicheck$( COMMON_JAVA_PACKAGE_SUFFIX) \
2017-05-18 06:26:00 +08:00
$( HOST_JDK_TOOLS_JAR) \
)
APICHECK_CLASSPATH := $( subst $( space) ,:,$( strip $( APICHECK_CLASSPATH_ENTRIES) ) )
2011-04-09 08:32:52 +08:00
APICHECK_COMMAND := $( APICHECK) -JXmx1024m -J" classpath $( APICHECK_CLASSPATH) "
2018-01-16 13:14:59 +08:00
# Boolean variable determining if the whitelist for compatible properties is enabled
PRODUCT_COMPATIBLE_PROPERTY := false
i f n e q ( $( PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE ) , )
PRODUCT_COMPATIBLE_PROPERTY := $( PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE)
e l s e i f e q ( $( PRODUCT_SHIPPING_API_LEVEL ) , )
#$(warning no product shipping level defined)
e l s e i f n e q ( $( call math_lt ,27,$ ( PRODUCT_SHIPPING_API_LEVEL ) ) , )
PRODUCT_COMPATIBLE_PROPERTY := true
e n d i f
.KATI_READONLY := \
PRODUCT_COMPATIBLE_PROPERTY
2017-05-19 06:26:59 +08:00
# Boolean variable determining if Treble is fully enabled
PRODUCT_FULL_TREBLE := false
i f n e q ( $( PRODUCT_FULL_TREBLE_OVERRIDE ) , )
PRODUCT_FULL_TREBLE := $( PRODUCT_FULL_TREBLE_OVERRIDE)
e l s e i f e q ( $( PRODUCT_SHIPPING_API_LEVEL ) , )
#$(warning no product shipping level defined)
e l s e i f n e q ( $( call math_gt_or_eq ,$ ( PRODUCT_SHIPPING_API_LEVEL ) ,26) , )
PRODUCT_FULL_TREBLE := true
e n d i f
2017-12-16 06:49:55 +08:00
# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior and remove
# references to it here and below.
i f d e f P R O D U C T _ N O T I C E _ S P L I T _ O V E R R I D E
$( error PRODUCT_NOTICE_SPLIT_OVERRIDE cannot be set.)
e n d i f
2017-11-10 02:15:31 +08:00
requirements := \
PRODUCT_TREBLE_LINKER_NAMESPACES \
PRODUCT_SEPOLICY_SPLIT \
PRODUCT_ENFORCE_VINTF_MANIFEST \
2017-12-16 06:49:55 +08:00
PRODUCT_NOTICE_SPLIT
2017-11-10 02:15:31 +08:00
# 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-12-07 01:21:02 +08:00
# If the requirement is false for any reason, then it's not PRODUCT_FULL_TREBLE
$( foreach req ,$ ( requirements ) ,$ ( eval \
PRODUCT_FULL_TREBLE := $( if $( filter false,$( $( req) ) ) ,false,$( PRODUCT_FULL_TREBLE) ) ) )
2017-11-10 02:15:31 +08:00
2017-11-18 02:47:30 +08:00
PRODUCT_FULL_TREBLE_OVERRIDE ?=
$( foreach req ,$ ( requirements ) ,$ ( eval $ ( req ) _OVERRIDE ?=) )
2017-11-10 02:15:31 +08:00
.KATI_READONLY := \
2017-11-18 02:47:30 +08:00
PRODUCT_FULL_TREBLE_OVERRIDE \
$( foreach req,$( requirements) ,$( req) _OVERRIDE) \
2017-11-10 02:15:31 +08:00
$( requirements) \
2017-11-18 02:47:30 +08:00
PRODUCT_FULL_TREBLE \
2017-11-10 02:15:31 +08:00
requirements :=
2018-02-08 06:19:55 +08:00
# BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED can be true only if early-mount of
# partitions is supported. But the early-mount must be supported for full
# treble products, and so BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED should be set
# by default for full treble products.
i f e q ( $( PRODUCT_FULL_TREBLE ) , t r u e )
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED ?= true
e n d i f
2017-12-12 14:47:14 +08:00
# If PRODUCT_USE_VNDK is true and BOARD_VNDK_VERSION is not defined yet,
# BOARD_VNDK_VERSION will be set to "current" as default.
# PRODUCT_USE_VNDK will be true in Android-P or later launching devices.
PRODUCT_USE_VNDK := false
i f n e q ( $( PRODUCT_USE_VNDK_OVERRIDE ) , )
PRODUCT_USE_VNDK := $( PRODUCT_USE_VNDK_OVERRIDE)
e l s e i f e q ( $( PRODUCT_SHIPPING_API_LEVEL ) , )
# No shipping level defined
e l s e i f e q ( $( call math_gt_or_eq ,27,$ ( PRODUCT_SHIPPING_API_LEVEL ) ) , )
PRODUCT_USE_VNDK := $( PRODUCT_FULL_TREBLE)
e n d i f
i f e q ( $( PRODUCT_USE_VNDK ) , t r u e )
ifndef BOARD_VNDK_VERSION
BOARD_VNDK_VERSION := current
endif
e n d i f
$( KATI_obsolete_var PRODUCT_USE_VNDK_OVERRIDE ,Use PRODUCT_USE_VNDK instead )
.KATI_READONLY := \
PRODUCT_USE_VNDK
2017-09-30 06:32:22 +08:00
i f d e f P R O D U C T _ S H I P P I N G _ A P I _ L E V E L
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
2018-01-22 14:25:14 +08:00
ifneq ( $( call numbers_less_than,$( PRODUCT_SHIPPING_API_LEVEL) ,$( BOARD_SYSTEMSDK_VERSIONS) ) ,)
$( error BOARD_SYSTEMSDK_VERSIONS ( $( BOARD_SYSTEMSDK_VERSIONS) ) must all be greater than or equal to PRODUCT_SHIPPING_API_LEVEL ( $( PRODUCT_SHIPPING_API_LEVEL) ) )
endif
2018-01-22 16:01:15 +08:00
ifneq ( $( call math_gt_or_eq,$( PRODUCT_SHIPPING_API_LEVEL) ,28) ,)
ifneq ( $( TARGET_IS_64_BIT) , true )
ifneq ( $( TARGET_USES_64_BIT_BINDER) , true )
$( error When PRODUCT_SHIPPING_API_LEVEL >= 28, TARGET_USES_64_BIT_BINDER must be true )
endif
endif
2018-03-26 22:10:57 +08:00
ifeq ( $( PRODUCT_FULL_TREBLE) ,true)
ifneq ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE) , true )
$( error When PRODUCT_SHIPPING_API_LEVEL >= 28, BOARD_BUILD_SYSTEM_ROOT_IMAGE must be true )
endif
endif
2018-01-22 16:01:15 +08:00
endif
2017-09-30 06:32:22 +08:00
e n d i f
2011-10-05 01:50:08 +08:00
# The default key if not set as LOCAL_CERTIFICATE
i f d e f P R O D U C T _ D E F A U L T _ D E V _ C E R T I F I C A T E
DEFAULT_SYSTEM_DEV_CERTIFICATE := $( PRODUCT_DEFAULT_DEV_CERTIFICATE)
e l s e
DEFAULT_SYSTEM_DEV_CERTIFICATE := build/target/product/security/testkey
e n d i f
2017-11-04 06:49:25 +08:00
BUILD_NUMBER_FROM_FILE := $$ ( cat $( OUT_DIR) /build_number.txt)
2018-02-15 05:30:53 +08:00
BUILD_DATETIME_FROM_FILE := $$ ( cat $( BUILD_DATETIME_FILE) )
2017-11-04 06:49:25 +08:00
2018-02-06 07:51:34 +08:00
# SEPolicy versions
# PLATFORM_SEPOLICY_VERSION is a number of the form "NN.m" with "NN" mapping to
# PLATFORM_SDK_VERSION and "m" as a minor number which allows for SELinux
# changes independent of PLATFORM_SDK_VERSION. This value will be set to
# 10000.0 to represent tip-of-tree development that is inherently unstable and
# thus designed not to work with any shipping vendor policy. This is similar in
# spirit to how DEFAULT_APP_TARGET_SDK is set.
# The minor version ('m' component) must be updated every time a platform release
# is made which breaks compatibility with the previous platform sepolicy version,
# not just on every increase in PLATFORM_SDK_VERSION. The minor version should
# be reset to 0 on every bump of the PLATFORM_SDK_VERSION.
sepolicy_major_vers := 27
sepolicy_minor_vers := 0
i f n e q ( $( sepolicy_major_vers ) , $( PLATFORM_SDK_VERSION ) )
$( error sepolicy_major_version does not match PLATFORM_SDK_VERSION , please update .)
e n d i f
2018-03-28 04:49:19 +08:00
TOT_SEPOLICY_VERSION := 10000.0
2018-02-06 07:51:34 +08:00
i f n e q ( R E L , $( PLATFORM_VERSION_CODENAME ) )
2018-03-28 04:49:19 +08:00
PLATFORM_SEPOLICY_VERSION := $( TOT_SEPOLICY_VERSION)
e l s e
PLATFORM_SEPOLICY_VERSION := $( join $( addsuffix .,$( sepolicy_major_vers) ) , $( sepolicy_minor_vers) )
2018-02-06 07:51:34 +08:00
e n d i f
sepolicy_major_vers :=
sepolicy_minor_vers :=
2018-02-06 07:52:46 +08:00
# A list of SEPolicy versions, besides PLATFORM_SEPOLICY_VERSION, that the framework supports.
PLATFORM_SEPOLICY_COMPAT_VERSIONS := \
26.0 \
27.0
2018-03-28 04:49:19 +08:00
.KATI_READONLY := \
PLATFORM_SEPOLICY_COMPAT_VERSIONS \
PLATFORM_SEPOLICY_VERSION \
TOT_SEPOLICY_VERSION \
2018-05-19 08:46:04 +08:00
i f n d e f U S E _ L O G I C A L _ P A R T I T I O N S
USE_LOGICAL_PARTITIONS := $( PRODUCT_USE_LOGICAL_PARTITIONS)
e n d i f
.KATI_READONLY := USE_LOGICAL_PARTITIONS
i f e q ( $( USE_LOGICAL_PARTITIONS ) , t r u e )
2018-06-01 04:07:13 +08:00
BOARD_KERNEL_CMDLINE += androidboot.logical_partitions= 1
2018-06-19 07:32:35 +08:00
i f n e q ( $( BOARD_SYSTEMIMAGE_PARTITION_SIZE ) , )
i f n e q ( $( BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE ) , )
$( error Should not define BOARD_SYSTEMIMAGE_PARTITION_SIZE and \
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE together)
e n d i f
2018-05-19 08:46:04 +08:00
e n d i f
2018-06-20 07:23:16 +08:00
i f n e q ( $( BOARD_VENDORIMAGE_PARTITION_SIZE ) , )
i f n e q ( $( BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE ) , )
$( error Should not define BOARD_VENDORIMAGE_PARTITION_SIZE and \
BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE together)
e n d i f
2018-05-19 08:46:04 +08:00
e n d i f
2018-06-19 07:32:35 +08:00
e n d i f # USE_LOGICAL_PARTITIONS
2009-03-04 11:28:42 +08:00
# ###############################################################
# Set up final options.
# ###############################################################
2015-12-17 05:10:35 +08: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.
i f e q ( $( HOST_OS ) , l i n u x )
RELATIVE_PWD := PWD = /proc/self/cwd
e l s e
RELATIVE_PWD :=
e n d i f
2016-07-21 03:22:57 +08:00
TARGET_PROJECT_INCLUDES :=
2016-11-19 06:05:39 +08:00
TARGET_PROJECT_SYSTEM_INCLUDES := \
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
i f d e f T A R G E T _ 2 N D _ A R C H
2014-02-22 08:17:05 +08:00
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $( TARGET_PROJECT_INCLUDES)
2016-07-21 03:22:57 +08:00
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $( TARGET_PROJECT_SYSTEM_INCLUDES)
2013-12-28 03:09:36 +08:00
e n d i f
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
i f d e f T A R G E T _ 2 N D _ A R C H
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
e n d i f
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.
i f d e f T A R G E T _ B U I L D _ A P P S
SUPPORT_LIBRARY_ROOT := $( HISTORICAL_SDK_VERSIONS_ROOT) /current/support
e l s e
SUPPORT_LIBRARY_ROOT := frameworks/support
e n d i f
2018-04-27 21:11:17 +08:00
get-sdk-version = $( if $( findstring _,$( 1) ) ,$( subst core_,,$( subst system_,,$( subst test_,,$( 1) ) ) ) ,$( 1) )
get-sdk-api = $( if $( findstring _,$( 1) ) ,$( patsubst %_$( call get-sdk-version,$( 1) ) ,%,$( 1) ) ,public)
get-prebuilt-sdk-dir = $( HISTORICAL_SDK_VERSIONS_ROOT) /$( call get-sdk-version,$( 1) ) /$( call get-sdk-api,$( 1) )
2018-04-10 23:16:33 +08:00
# Resolve LOCAL_SDK_VERSION to prebuilt module name, e.g.:
2018-04-10 23:18:44 +08:00
# 23 -> sdk_public_23_android
# system_current -> sdk_system_current_android
2018-04-10 23:16:33 +08:00
# $(1): An sdk version (LOCAL_SDK_VERSION)
2018-04-12 23:17:55 +08:00
# $(2): optional library name (default: android)
2018-04-10 23:16:33 +08:00
d e f i n e r e s o l v e - p r e b u i l t - s d k - m o d u l e
2018-04-10 23:18:44 +08:00
$( if $ ( findstring _ ,$ ( 1) ) ,\
2018-04-12 23:17:55 +08:00
sdk_$( 1) _$( or $( 2) ,android) ,\
sdk_public_$( 1) _$( or $( 2) ,android) )
2018-04-10 23:18:44 +08:00
e n d e f
2018-04-27 21:11:17 +08:00
# Resolve LOCAL_SDK_VERSION to prebuilt android.jar
# $(1): LOCAL_SDK_VERSION
resolve-prebuilt-sdk-jar-path = $( call get-prebuilt-sdk-dir,$( 1) ) /android.jar
2018-04-10 23:18:44 +08:00
# Resolve LOCAL_SDK_VERSION to prebuilt framework.aidl
# $(1): An sdk version (LOCAL_SDK_VERSION)
2018-04-27 21:11:17 +08:00
resolve-prebuilt-sdk-aidl-path = $( call get-prebuilt-sdk-dir,$( call get-sdk-version,$( 1) ) ) /framework.aidl
2018-04-10 23:16:33 +08:00
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
d e f i n e n u m e r i c a l l y _ s o r t
$( shell function sgrax ( ) { \
while [ -n " $$ 1 " ] ; do echo $$ 1 ; shift ; done \
} ; \
( sgrax $( 1) | sort -g ) )
e n d e f
2018-04-10 23:18:44 +08:00
# This produces a list like "current/core current/public current/system 4/public"
TARGET_AVAILABLE_SDK_VERSIONS := $( wildcard $( HISTORICAL_SDK_VERSIONS_ROOT) /*/*/android.jar)
TARGET_AVAILABLE_SDK_VERSIONS := $( patsubst $( HISTORICAL_SDK_VERSIONS_ROOT) /%/android.jar,%,$( TARGET_AVAILABLE_SDK_VERSIONS) )
# Strips and reorganizes the "public", "core" and "system" subdirs.
TARGET_AVAILABLE_SDK_VERSIONS := $( subst /public,,$( TARGET_AVAILABLE_SDK_VERSIONS) )
TARGET_AVAILABLE_SDK_VERSIONS := $( patsubst %/core,core_%,$( TARGET_AVAILABLE_SDK_VERSIONS) )
TARGET_AVAILABLE_SDK_VERSIONS := $( patsubst %/system,system_%,$( TARGET_AVAILABLE_SDK_VERSIONS) )
# No prebuilt for test_current.
TARGET_AVAILABLE_SDK_VERSIONS += test_current
TARGET_AVAIALBLE_SDK_VERSIONS := $( call numerically_sort,$( TARGET_AVAILABLE_SDK_VERSIONS) )
2009-03-04 11:28:42 +08:00
2017-10-13 04:34:40 +08: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) )
2018-01-23 03:47:44 +08:00
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/hiddenapi-light-greylist.txt
2018-01-26 19:07:18 +08:00
INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/hiddenapi-dark-greylist.txt
INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/hiddenapi-blacklist.txt
2018-01-23 03:47:44 +08:00
2018-03-24 12:57:02 +08:00
# Missing optional uses-libraries so that the platform doesn't create build rules that depend on
# them. See setup_one_odex.mk.
INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := com.google.android.ble com.google.android.wearable
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
i f d e f T A R G E T _ 2 N D _ A R C H
TARGET_2ND_PREBUILT_TAG := android-$( TARGET_2ND_ARCH)
e n d i f
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-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
2017-10-31 08:31:44 +08:00
# Add BUILD_NUMBER to apps default version name if it's unbundled build.
i f d e f T A R G E T _ B U I L D _ A P P S
TARGET_BUILD_WITH_APPS_VERSION_NAME := true
e n d i f
i f d e f T A R G E T _ B U I L D _ W I T H _ A P P S _ V E R S I O N _ N A M E
APPS_DEFAULT_VERSION_NAME := $( PLATFORM_VERSION) -$( BUILD_NUMBER_FROM_FILE)
e l s e
APPS_DEFAULT_VERSION_NAME := $( PLATFORM_VERSION)
e n d i f
2017-11-07 02:47:24 +08:00
# ANDROID_WARNING_ALLOWED_PROJECTS is generated by build/soong.
2016-10-12 06:38:39 +08:00
d e f i n e f i n d _ w a r n i n g _ a l l o w e d _ p r o j e c t s
$( filter $( ANDROID_WARNING_ALLOWED_PROJECTS) ,$( 1) /)
e n d e f
2016-11-10 08:35:34 +08:00
# These goals don't need to collect and include Android.mks/CleanSpec.mks
# in the source tree.
2017-05-19 04:42:40 +08:00
dont_bother_goals := out \
2016-11-10 08:35:34 +08:00
snod systemimage-nodeps \
stnod systemtarball-nodeps \
userdataimage-nodeps userdatatarball-nodeps \
cacheimage-nodeps \
bptimage-nodeps \
2017-03-08 04:10:09 +08:00
vnod vendorimage-nodeps \
2017-11-27 16:04:47 +08:00
pnod productimage-nodeps \
2016-11-10 08:35:34 +08:00
systemotherimage-nodeps \
ramdisk-nodeps \
bootimage-nodeps \
recoveryimage-nodeps \
vbmetaimage-nodeps \
product-graph dump-products
2017-10-12 16:35:14 +08:00
i f e q ( $( CALLED_FROM_SETUP ) , t r u e )
2016-11-10 09:22:15 +08:00
i n c l u d e $( BUILD_SYSTEM ) / n i n j a _ c o n f i g . m k
i n c l u d e $( BUILD_SYSTEM ) / s o o n g _ c o n f i g . m k
e n d i f
2013-04-06 09:02:16 +08:00
i n c l u d e $( BUILD_SYSTEM ) / d u m p v a r . m k