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
i f n d e f K A T I
$( 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 )
e n d i f
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
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 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
e n d i f
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.
d e f i n e n e w l i n e
2015-09-22 23:37:53 +02:00
e n d e f
# The pound character "#"
d e f i n e p o u n d
#
2014-10-03 20:36:27 +02:00
e n d e f
# Unfortunately you can't simply define backslash as \ or \\.
backslash := \a
backslash := $( patsubst %a,%,$( backslash) )
2012-09-27 22:26:25 +02:00
2018-03-28 23:33:10 +02:00
# Prevent accidentally changing these variables
.KATI_READONLY := SHELL empty space comma newline pound backslash
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 :
2018-03-28 23:33:10 +02: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-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
2017-12-28 01:57:34 +01:00
$( KATI_obsolete_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-12-28 01:57:34 +01:00
$( KATI_obsolete_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 )
2018-01-04 00:15:38 +01:00
$( KATI_obsolete_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)
2017-12-13 03:01:09 +01: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-11 20:54:48 +01: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 01:39:18 +01:00
2018-02-27 11:15:32 +01: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 01:39:18 +01:00
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) ) )
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
# Some specific paths to tools
2017-12-06 23:38:40 +01:00
SRC_DROIDDOC_DIR := $( TOPDIR) build/make/tools/droiddoc
2009-03-04 04:28:42 +01:00
2018-05-02 09:15:41 +02: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-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.
i n c l u d e $( BUILD_SYSTEM ) / m a t h . m k
2009-03-04 04:28:42 +01: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-15 17:26:31 +01: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 04:28:42 +01: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 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
2017-07-13 23:10:15 +02:00
BUILD_APIDIFF := $( BUILD_SYSTEM) /apidiff.mk
2009-03-04 04:28:42 +01:00
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-12-07 00:57:31 +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.
################################################################
2017-12-06 23:38:40 +01:00
NORMALIZE_PATH := build/make/tools/normalize_path.py
2015-10-28 22:33:40 +01: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 04:28:42 +01:00
# ###############################################################
# Set common values
# ###############################################################
2018-03-13 08:04:48 +01:00
# Initialize SOONG_CONFIG_NAMESPACES so that it isn't recursive.
SOONG_CONFIG_NAMESPACES :=
2009-03-04 04:28:42 +01: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 12:08:26 +01: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-02-22 17:35:12 +01:00
# Default to remove the org.apache.http.legacy from bootclasspath
i f e q ( $( REMOVE_OAHL_FROM_BCP ) , )
REMOVE_OAHL_FROM_BCP := true
e n d i f
2018-04-05 06:37:42 +02:00
# ###############################################################
# Broken build defaults
# ###############################################################
2018-06-21 18:46:01 +02:00
BUILD_BROKEN_ANDROIDMK_EXPORTS :=
BUILD_BROKEN_DUP_COPY_HEADERS :=
BUILD_BROKEN_DUP_RULES :=
BUILD_BROKEN_PHONY_TARGETS :=
2018-04-05 06:37:42 +02:00
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
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 04:28:42 +01: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-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
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 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) )
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 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.
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 04:51:08 +01: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 07:13:25 +01: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 07:36:04 +02: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 01:20:08 +02: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 07:36:04 +02:00
e n d e f
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
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
2014-04-17 19:03:35 +02: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-14 21:59:50 +02: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 01:20:19 +01: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-14 21:59:50 +02:00
e n d i f
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
i n c l u d e $( BUILD_SYSTEM ) / c o m b o / s e l e c t . m k
2013-12-27 20:09:36 +01: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 10:35:14 +02:00
i f e q ( $( CALLED_FROM_SETUP ) , t r u e )
2015-07-21 03:40:18 +02:00
i n c l u d e $( BUILD_SYSTEM ) / c c a c h e . m k
2015-08-17 10:38:24 +02:00
i n c l u d e $( BUILD_SYSTEM ) / g o m a . m k
2016-08-31 22:32:39 +02:00
e n d i f
2016-08-31 18:35:32 +02:00
2014-05-01 03:09:13 +02: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 14:31:02 +02:00
i f e q ( , $( filter true ,$ ( TARGET_SUPPORTS_ 32_BIT_APPS ) $ ( TARGET_SUPPORTS_ 64_BIT_APPS ) ) )
2014-05-01 03:18:02 +02:00
TARGET_SUPPORTS_32_BIT_APPS := true
2014-04-07 12:01:54 +02:00
e n d i f
2018-06-28 14:31:02 +02: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 12:01:54 +02: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 01:51:42 +02:00
# be overriden in the board configuration.
2014-04-07 12:01:54 +02:00
i f e q ( , $( 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
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 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
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 12:01:54 +02: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 07:07:31 +02: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 02:37:19 +02:00
# Normalize WITH_STATIC_ANALYZER
2013-09-10 11:37:14 +02:00
i f e q ( $( strip $ ( WITH_STATIC_ANALYZER ) ) , 0 )
WITH_STATIC_ANALYZER :=
e n d i f
2016-04-01 01:30:23 +02: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 04:28:42 +01: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 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:
2018-03-06 23:07:21 +01:00
# 1) PDK_FUSION_PLATFORM_ZIP / PDK_FUSION_PLATFORM_DIR is passed in from the environment
2016-01-27 00:59:50 +01:00
# or
2018-03-06 23:07:21 +01:00
# 2) the platform.zip / pdk.mk exists in the default location
2016-01-27 00:59:50 +01: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-06 23:07:21 +01: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 00:59:50 +01:00
i f n e q ( , $( filter pdk fusion , $ ( MAKECMDGOALS ) ) )
TARGET_BUILD_PDK := true
i f n e q ( , $( filter fusion , $ ( MAKECMDGOALS ) ) )
2018-03-06 23:07:21 +01: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 00:59:50 +01: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-06 23:07:21 +01: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 00:59:50 +01:00
e n d i f
e n d i f
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) )
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-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
2018-05-26 01:13:52 +02:00
prebuilt_build_tools_bin_noasan := $( prebuilt_build_tools) /$( HOST_PREBUILT_TAG) /bin
2017-09-23 00:03:38 +02:00
i f e q ( $( filter address ,$ ( SANITIZE_HOST ) ) , )
2018-05-26 01:13:52 +02:00
prebuilt_build_tools_bin := $( prebuilt_build_tools_bin_noasan)
2017-09-23 00:03:38 +02:00
e l s e
prebuilt_build_tools_bin := $( prebuilt_build_tools) /$( HOST_PREBUILT_TAG) /asan/bin
e n d i f
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.
2018-06-06 23:46:25 +02:00
USE_D8 := true
2018-06-19 19:23:50 +02:00
.KATI_READONLY := USE_D8
2017-11-02 01:49:52 +01:00
2017-07-06 22:42:00 +02: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 07:22:59 +02:00
2017-07-06 22:42:00 +02:00
e l s e # 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
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
e n d i f # TARGET_BUILD_APPS || TARGET_BUILD_PDK
2015-12-03 01:33:04 +01:00
2017-07-06 22:42:00 +02: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 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
2018-06-13 23:51:05 +02:00
HOST_INIT_VERIFIER := $( HOST_OUT_EXECUTABLES) /host_init_verifier
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
2018-02-27 03:26:44 +01:00
XMLLINT := $( SOONG_HOST_OUT_EXECUTABLES) /xmllint
2018-03-10 06:26:17 +01:00
XZ := $( prebuilt_build_tools) /$( HOST_PREBUILT_TAG) /bin/xz
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.
2018-05-26 01:13:52 +02:00
LEX := $( prebuilt_build_tools_bin_noasan) /flex
2013-04-06 03:02:16 +02:00
# The default PKGDATADIR built in the prebuilt bison is a relative path
2018-01-09 02:28:17 +01:00
# prebuilts/build-tools/common/bison.
2013-04-06 03:02:16 +02:00
# To run bison from elsewhere you need to set up enviromental variable
# BISON_PKGDATADIR.
2018-01-09 02:28:17 +01:00
BISON_PKGDATADIR := $( PWD) /prebuilts/build-tools/common/bison
2018-05-26 01:13:52 +02:00
BISON := $( prebuilt_build_tools_bin_noasan) /bison
2013-04-06 03:02:16 +02:00
YACC := $( BISON) -d
2018-01-09 02:28:17 +01:00
BISON_DATA := $( wildcard $( BISON_PKGDATADIR) /* $( BISON_PKGDATADIR) /*/*)
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
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-05 19:28:51 +01:00
PROTOC := $( HOST_OUT_EXECUTABLES) /aprotoc$( HOST_EXECUTABLE_SUFFIX)
2018-08-04 01:48:10 +02:00
NANOPB_SRCS := $( HOST_OUT_EXECUTABLES) /protoc-gen-nanopb
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
i f e q ( , $( 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
e l s e
MKBOOTIMG := $( BOARD_CUSTOM_MKBOOTIMG)
e n d i f
2016-04-08 21:08:03 +02: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-15 19:43:54 +02:00
i f e q ( , $( strip $ ( BOARD_CUSTOM_AVBTOOL ) ) )
AVBTOOL := $( HOST_OUT_EXECUTABLES) /avbtool$( HOST_EXECUTABLE_SUFFIX)
2016-01-29 22:59:17 +01: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-15 19:43:54 +02:00
AVBTOOL := $( BOARD_CUSTOM_AVBTOOL)
2016-01-29 22:59:17 +01:00
e n d i f
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)
2017-12-06 23:38:40 +01:00
MKTARBALL := build/make/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
2017-12-06 23:38:40 +01:00
FAT16COPY := build/make/tools/fat16copy.py
CHECK_LINK_TYPE := build/make/tools/check_link_type.py
2018-07-25 02:45:08 +02:00
UUIDGEN := build/make/tools/uuidgen.py
2015-02-02 12:18:20 +01:00
2009-08-30 22:39:24 +02:00
PROGUARD := external/proguard/bin/proguard.sh
2017-12-06 23:38:40 +01: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 01:27:32 +02:00
APPEND2SIMG := $( HOST_OUT_EXECUTABLES) /append2simg
VERITY_SIGNER := $( HOST_OUT_EXECUTABLES) /verity_signer
2018-03-16 07:21:28 +01:00
BUILD_VERITY_METADATA := $( HOST_OUT_EXECUTABLES) /build_verity_metadata.py
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
2018-01-29 15:43:14 +01:00
HIDDENAPI := $( HOST_OUT_EXECUTABLES) /hiddenapi
2018-07-11 16:14:00 +02:00
CLASS2GREYLIST := $( HOST_OUT_EXECUTABLES) /class2greylist
2015-11-09 08:47:42 +01:00
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
2018-01-31 23:34:07 +01:00
JETIFIER := prebuilts/sdk/tools/jetifier/jetifier-standalone/bin/jetifier-standalone
2009-03-04 04:28:42 +01:00
COLUMN := column
2017-11-17 15:06:51 +01:00
USE_OPENJDK9 := true
2018-06-21 01:11:19 +02:00
i f e q ( $( EXPERIMENTAL_USE_OPENJDK 9) , )
2017-11-15 21:55:03 +01: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-20 19:36:56 +01:00
# Path to tools.jar
HOST_JDK_TOOLS_JAR := $( ANDROID_JAVA8_HOME) /lib/tools.jar
2009-03-04 04:28:42 +01: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 00:26:00 +02:00
APICHECK_CLASSPATH_ENTRIES := \
2018-05-12 15:11:27 +02:00
$( HOST_OUT_JAVA_LIBRARIES) /apicheck$( COMMON_JAVA_PACKAGE_SUFFIX) \
2017-05-18 00:26:00 +02:00
$( 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) "
2018-01-16 06:14:59 +01: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 00:26:59 +02: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-15 23:49:55 +01: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-09 19:15:31 +01:00
requirements := \
PRODUCT_TREBLE_LINKER_NAMESPACES \
PRODUCT_SEPOLICY_SPLIT \
PRODUCT_ENFORCE_VINTF_MANIFEST \
2017-12-15 23:49:55 +01:00
PRODUCT_NOTICE_SPLIT
2017-11-09 19:15:31 +01: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-06 18:21:02 +01: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-09 19:15:31 +01:00
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 :=
2018-02-07 23:19:55 +01: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 07:47:14 +01: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
2018-04-23 03:39:54 +02:00
# Set BOARD_SYSTEMSDK_VERSIONS to the latest SystemSDK version starting from P-launching
# devices if unset.
i f n d e f B O A R D _ S Y S T E M S D K _ V E R S I O N S
ifdef PRODUCT_SHIPPING_API_LEVEL
ifneq ( $( call math_gt_or_eq,$( PRODUCT_SHIPPING_API_LEVEL) ,28) ,)
ifeq ( REL,$( PLATFORM_VERSION_CODENAME) )
BOARD_SYSTEMSDK_VERSIONS := $( PLATFORM_SDK_VERSION)
else
BOARD_SYSTEMSDK_VERSIONS := $( PLATFORM_VERSION_CODENAME)
endif
endif
endif
e n d i f
2017-09-30 00:32:22 +02: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
2018-01-22 07:25:14 +01: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 09:01:15 +01: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
endif
2018-08-13 18:13:24 +02:00
ifneq ( $( call math_gt_or_eq,$( PRODUCT_SHIPPING_API_LEVEL) ,29) ,)
ifneq ( $( BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE) ,)
$( error When PRODUCT_SHIPPING_API_LEVEL >= 29, BOARD_OTA_FRAMEWORK_VBMETA_VERSION_OVERRIDE cannot be set )
endif
endif
2017-09-30 00:32:22 +02:00
e n d i f
2011-10-04 19:50:08 +02: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-03 23:49:25 +01:00
BUILD_NUMBER_FROM_FILE := $$ ( cat $( OUT_DIR) /build_number.txt)
2018-02-14 22:30:53 +01:00
BUILD_DATETIME_FROM_FILE := $$ ( cat $( BUILD_DATETIME_FILE) )
2017-11-03 23:49:25 +01:00
2018-02-06 00:51:34 +01: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.
2018-04-12 00:00:05 +02:00
sepolicy_major_vers := 28
2018-02-06 00:51:34 +01:00
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-27 22:49:19 +02:00
TOT_SEPOLICY_VERSION := 10000.0
2018-02-06 00:51:34 +01:00
i f n e q ( R E L , $( PLATFORM_VERSION_CODENAME ) )
2018-03-27 22:49:19 +02: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 00:51:34 +01:00
e n d i f
sepolicy_major_vers :=
sepolicy_minor_vers :=
2018-02-06 00:52:46 +01:00
# A list of SEPolicy versions, besides PLATFORM_SEPOLICY_VERSION, that the framework supports.
PLATFORM_SEPOLICY_COMPAT_VERSIONS := \
26.0 \
2018-07-18 00:00:26 +02:00
27.0 \
28.0 \
2018-02-06 00:52:46 +01:00
2018-03-27 22:49:19 +02:00
.KATI_READONLY := \
PLATFORM_SEPOLICY_COMPAT_VERSIONS \
PLATFORM_SEPOLICY_VERSION \
TOT_SEPOLICY_VERSION \
2018-07-26 20:40:12 +02:00
# If true, kernel configuration requirements are present in OTA package (and will be enforced
# during OTA). Otherwise, kernel configuration requirements are enforced in VTS.
# Devices that checks the running kernel (instead of the kernel in OTA package) should not
# set this variable to prevent OTA failures.
i f n d e f P R O D U C T _ O T A _ E N F O R C E _ V I N T F _ K E R N E L _ R E Q U I R E M E N T S
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS :=
ifdef PRODUCT_SHIPPING_API_LEVEL
ifeq ( true,$( call math_gt_or_eq,$( PRODUCT_SHIPPING_API_LEVEL) ,29) )
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := true
endif
endif
e n d i f
.KATI_READONLY := PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
2018-07-31 22:30:38 +02:00
i f e q ( $( PRODUCT_USE_LOGICAL_PARTITIONS ) , t r u e )
2018-07-31 21:47:27 +02:00
requirements := \
PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
PRODUCT_BUILD_SUPER_PARTITION \
PRODUCT_USE_FASTBOOTD \
$( foreach req,$( requirements) ,$( if $( filter false,$( $( req) ) ) ,\
2018-07-31 22:30:38 +02:00
$( error PRODUCT_USE_LOGICAL_PARTITIONS requires $( req) to be true ) ) )
2018-07-31 21:47:27 +02:00
requirements :=
2018-05-31 22:07:13 +02:00
BOARD_KERNEL_CMDLINE += androidboot.logical_partitions= 1
2018-07-31 21:47:27 +02:00
e n d i f
i f e q ( $( PRODUCT_USE_DYNAMIC_PARTITION_SIZE ) , t r u e )
2018-06-19 01:32:35 +02: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 02:46:04 +02:00
e n d i f
2018-06-20 01:23:16 +02: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 02:46:04 +02:00
e n d i f
2017-11-14 16:42:30 +01:00
i f n e q ( $( BOARD_ODMIMAGE_PARTITION_SIZE ) , )
i f n e q ( $( BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE ) , )
$( error Should not define BOARD_ODMIMAGE_PARTITION_SIZE and \
BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE together)
e n d i f
e n d i f
2018-07-21 00:19:34 +02:00
i f n e q ( $( BOARD_PRODUCTIMAGE_PARTITION_SIZE ) , )
i f n e q ( $( BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE ) , )
$( error Should not define BOARD_PRODUCTIMAGE_PARTITION_SIZE and \
BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE together)
e n d i f
e n d i f
2018-07-21 00:33:47 +02:00
i f n e q ( $( BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE ) , )
i f n e q ( $( BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE ) , )
$( error Should not define BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE and \
BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE together)
e n d i f
e n d i f
2018-07-31 21:47:27 +02:00
e n d i f # PRODUCT_USE_DYNAMIC_PARTITION_SIZE
i f e q ( $( PRODUCT_BUILD_SUPER_PARTITION ) , t r u e )
2018-07-25 02:44:18 +02:00
i f d e f B O A R D _ S U P E R _ P A R T I T I O N _ P A R T I T I O N _ L I S T
# BOARD_SUPER_PARTITION_PARTITION_LIST: a list of the following tokens
2018-07-27 01:02:52 +02:00
valid_super_partition_list := system vendor product product_services
2018-07-25 02:44:18 +02:00
i f n e q ( , $( filter -out $ ( valid_super_partition_list ) ,$ ( BOARD_SUPER_PARTITION_PARTITION_LIST ) ) )
2018-07-27 01:02:52 +02:00
$( error BOARD_SUPER_PARTITION_PARTITION_LIST contains invalid partition name \
( $( filter-out $( valid_super_partition_list) ,$( BOARD_SUPER_PARTITION_PARTITION_LIST) ) ) . \
Valid names are $( valid_super_partition_list) )
2018-07-25 02:44:18 +02:00
e n d i f
valid_super_partition_list :=
e n d i f # BOARD_SUPER_PARTITION_PARTITION_LIST
2018-07-31 21:47:27 +02:00
e n d i f # PRODUCT_BUILD_SUPER_PARTITION
2018-06-19 01:32:35 +02:00
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.
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-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
i f d e f T A R G E T _ 2 N D _ A R C H
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
e n d i f
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
i f d e f T A R G E T _ 2 N D _ A R C H
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
e n d i f
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.
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 15:11:17 +02: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 17:16:33 +02:00
# Resolve LOCAL_SDK_VERSION to prebuilt module name, e.g.:
2018-04-10 17:18:44 +02:00
# 23 -> sdk_public_23_android
# system_current -> sdk_system_current_android
2018-04-10 17:16:33 +02:00
# $(1): An sdk version (LOCAL_SDK_VERSION)
2018-04-12 17:17:55 +02:00
# $(2): optional library name (default: android)
2018-04-10 17:16:33 +02: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 17:18:44 +02:00
$( if $ ( findstring _ ,$ ( 1) ) ,\
2018-04-12 17:17:55 +02:00
sdk_$( 1) _$( or $( 2) ,android) ,\
sdk_public_$( 1) _$( or $( 2) ,android) )
2018-04-10 17:18:44 +02:00
e n d e f
2018-04-27 15:11:17 +02: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 17:18:44 +02:00
# Resolve LOCAL_SDK_VERSION to prebuilt framework.aidl
# $(1): An sdk version (LOCAL_SDK_VERSION)
2018-04-27 15:11:17 +02:00
resolve-prebuilt-sdk-aidl-path = $( call get-prebuilt-sdk-dir,$( call get-sdk-version,$( 1) ) ) /framework.aidl
2018-04-10 17:16:33 +02:00
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
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 17:18:44 +02: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 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) )
2018-03-13 00:33:26 +01:00
i f n d e f I N T E R N A L _ P L A T F O R M _ P R I V A T E _ A P I _ F I L E
2018-01-16 16:01:23 +01:00
INTERNAL_PLATFORM_PRIVATE_API_FILE := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/private.txt
2018-03-13 00:33:26 +01:00
e n d i f
i f n d e f I N T E R N A L _ P L A T F O R M _ P R I V A T E _ D E X _ A P I _ F I L E
2018-01-16 16:01:23 +01:00
INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/private-dex.txt
2018-03-13 00:33:26 +01:00
e n d i f
i f n d e f I N T E R N A L _ P L A T F O R M _ S Y S T E M _ P R I V A T E _ A P I _ F I L E
2018-01-16 16:01:23 +01:00
INTERNAL_PLATFORM_SYSTEM_PRIVATE_API_FILE := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/system-private.txt
2018-03-13 00:33:26 +01:00
e n d i f
i f n d e f I N T E R N A L _ P L A T F O R M _ S Y S T E M _ P R I V A T E _ D E X _ A P I _ F I L E
2018-01-16 16:01:23 +01:00
INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/system-private-dex.txt
2018-03-13 00:33:26 +01:00
e n d i f
2010-03-09 02:16:57 +01:00
2018-06-28 12:28:16 +02:00
INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/hiddenapi-public-list.txt
INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/hiddenapi-private-list.txt
2018-08-22 18:38:02 +02:00
INTERNAL_PLATFORM_HIDDENAPI_WHITELIST := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/hiddenapi-whitelist.txt
2018-01-22 20:47:44 +01:00
INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $( TARGET_OUT_COMMON_INTERMEDIATES) /PACKAGING/hiddenapi-light-greylist.txt
2018-01-26 12:07:18 +01: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-22 20:47:44 +01:00
2018-03-24 05:57:02 +01: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-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
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-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.
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-06 19:47:24 +01:00
# ANDROID_WARNING_ALLOWED_PROJECTS is generated by build/soong.
2016-10-12 00:38:39 +02: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 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 \
2017-11-27 09:04:47 +01:00
pnod productimage-nodeps \
2018-05-29 14:09:01 +02:00
psnod productservicesimage-nodeps \
2017-11-14 16:42:30 +01:00
onod odmimage-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
i f e q ( $( CALLED_FROM_SETUP ) , t r u e )
2016-11-10 02:22:15 +01: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 03:02:16 +02:00
i n c l u d e $( BUILD_SYSTEM ) / d u m p v a r . m k