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 in config.mk, since envsetup.sh runs that 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
2016-09-07 04:19:14 +08:00
i f n d e f K A T I
host_prebuilts := linux-x86
i f e q ( $( shell uname ) , D a r w i n )
host_prebuilts := darwin-x86
e n d i f
.PHONY : run_soong_ui
run_soong_ui :
+@prebuilts/build-tools/$( host_prebuilts) /bin/makeparallel --ninja build/soong/soong_ui.bash --make-mode $( MAKECMDGOALS)
.PHONY : $( MAKECMDGOALS )
2017-02-09 11:50:16 +08:00
$(sort $(MAKECMDGOALS)) : run_soong_ui
@#empty
2016-09-07 04:19:14 +08:00
2017-03-02 09:41:43 +08:00
e l s e # KATI
2016-09-07 04:19:14 +08:00
2018-07-11 06:02:14 +08:00
$( info [1/1] initializing build system ...)
2012-05-23 09:29:02 +08:00
# Absolute path of the present working direcotry.
# This overrides the shell variable $PWD, which does not necessarily points to
# the top of the source tree, for example when "make -C" is used in m/mm/mmm.
PWD := $( shell pwd )
2009-03-04 11:28:42 +08:00
TOP := .
TOPDIR :=
# This is the default target. It must be the first declared target.
2010-06-10 09:18:31 +08:00
.PHONY : droid
2009-03-04 11:28:42 +08:00
DEFAULT_GOAL := droid
2015-09-26 07:43:36 +08:00
$(DEFAULT_GOAL) : droid_targets
.PHONY : droid_targets
droid_targets :
2009-03-04 11:28:42 +08:00
# Set up various standard variables based on configuration
# and host information.
2018-10-19 07:11:40 +08:00
i n c l u d e b u i l d / m a k e / c o r e / c o n f i g . m k
2009-03-04 11:28:42 +08:00
2016-11-10 08:35:34 +08:00
i f n e q ( $( filter $ ( dont_bother_goals ) , $ ( MAKECMDGOALS ) ) , )
dont_bother := true
e n d i f
2018-03-13 15:04:48 +08:00
.KATI_READONLY := SOONG_CONFIG_NAMESPACES
.KATI_READONLY := $( foreach n,$( SOONG_CONFIG_NAMESPACES) ,SOONG_CONFIG_$( n) )
.KATI_READONLY := $( foreach n,$( SOONG_CONFIG_NAMESPACES) ,$( foreach k,$( SOONG_CONFIG_$( n) ) ,SOONG_CONFIG_$( n) _$( k) ) )
2016-03-30 03:32:16 +08:00
i n c l u d e $( SOONG_MAKEVARS_MK )
2016-12-15 07:54:01 +08:00
i n c l u d e $( BUILD_SYSTEM ) / c l a n g / c o n f i g . m k
2015-07-17 08:15:19 +08:00
# Write the build number to a file so it can be read back in
# without changing the command line every time. Avoids rebuilds
# when using ninja.
2015-08-12 06:25:12 +08:00
$( shell mkdir -p $ ( OUT_DIR ) && \
2018-02-15 05:30:53 +08:00
echo -n $( BUILD_NUMBER) > $( OUT_DIR) /build_number.txt)
2018-02-21 09:00:39 +08:00
BUILD_NUMBER_FILE := $( OUT_DIR) /build_number.txt
2018-10-22 10:41:49 +08:00
.KATI_READONLY := BUILD_NUMBER_FILE
$(KATI_obsolete_var BUILD_NUMBER,See https : //android .googlesource .com /platform /build /+/master /Changes .md #BUILD_NUMBER)
2018-02-21 09:00:39 +08:00
2015-08-12 06:25:12 +08:00
i f e q ( $( HOST_OS ) , d a r w i n )
DATE_FROM_FILE := date -r $( BUILD_DATETIME_FROM_FILE)
e l s e
DATE_FROM_FILE := date -d @$( BUILD_DATETIME_FROM_FILE)
e n d i f
2018-10-22 10:41:49 +08:00
.KATI_READONLY := DATE_FROM_FILE
2015-07-17 08:15:19 +08:00
2018-02-21 09:00:39 +08:00
# Pick a reasonable string to use to identify files.
i f e q ( $( strip $ ( HAS_BUILD_NUMBER ) ) , f a l s e )
# BUILD_NUMBER has a timestamp in it, which means that
# it will change every time. Pick a stable value.
2019-01-03 04:27:43 +08:00
FILE_NAME_TAG := eng.$( BUILD_USERNAME)
2018-02-21 09:00:39 +08:00
e l s e
FILE_NAME_TAG := $( file <$( BUILD_NUMBER_FILE) )
e n d i f
2018-10-22 10:41:49 +08:00
.KATI_READONLY := FILE_NAME_TAG
2018-02-21 09:00:39 +08:00
2017-08-11 06:24:10 +08:00
# Make an empty directory, which can be used to make empty jars
EMPTY_DIRECTORY := $( OUT_DIR) /empty
$( shell mkdir -p $ ( EMPTY_DIRECTORY ) && rm -rf $ ( EMPTY_DIRECTORY ) /*)
2015-02-14 02:28:40 +08:00
# CTS-specific config.
- i n c l u d e c t s / b u i l d / c o n f i g . m k
2016-02-25 07:41:01 +08:00
# VTS-specific config.
- i n c l u d e t e s t / v t s / t o o l s / v t s - t r a d e f e d / b u i l d / c o n f i g . m k
2017-02-17 03:49:18 +08:00
# device-tests-specific-config.
- i n c l u d e t o o l s / t r a d e f e d e r a t i o n / b u i l d / s u i t e s / d e v i c e - t e s t s / c o n f i g . m k
# general-tests-specific-config.
- i n c l u d e t o o l s / t r a d e f e d e r a t i o n / b u i l d / s u i t e s / g e n e r a l - t e s t s / c o n f i g . m k
2017-10-04 22:45:40 +08:00
# STS-specific config.
- i n c l u d e t e s t / s t s / t o o l s / s t s - t r a d e f e d / b u i l d / c o n f i g . m k
2018-05-17 05:39:48 +08:00
# CTS-Instant-specific config
- i n c l u d e t e s t / s u i t e _ h a r n e s s / t o o l s / c t s - i n s t a n t - t r a d e f e d / b u i l d / c o n f i g . m k
2015-02-14 02:28:40 +08:00
2017-07-25 13:27:17 +08:00
# Clean rules
.PHONY : clean -dex -files
clean-dex-files :
2017-09-28 05:28:41 +08:00
$( hide) find $( OUT_DIR) -name "*.dex" | xargs rm -f
2017-07-25 13:27:17 +08:00
$( hide) for i in ` find $( OUT_DIR) -name "*.jar" -o -name "*.apk" ` ; do ( ( unzip -l $$ i 2> /dev/null | \
grep -q " \.dex $$ " && rm -f $$ i) || continue ) ; done
@echo "All dex files and archives containing dex files have been removed."
Build from source or prebuilt
With this change, you can easily switch between building from source
code and prebuilt.
Set LOCAL_PREBUILT_MODULE_FILE to the path of the prebuilt file,
relative to the top of the source tree, in the usual module definition.
The prebuilt will be used unless any of the followings satisfied:
1) ANDROID_BUILD_FROM_SOURCE is "true", which disable prebuilt globally;
2) The module name is in ANDROID_NO_PREBUILT_MODULES;
3) The LOCAL_PATH is prefixed by any of ANDROID_NO_PREBUILT_PATHS.
A developer can set ANDROID_NO_PREBUILT_MODULES or
ANDROID_NO_PREBUILT_PATHS to build only his own module(s) from source,
while build other modules from prebuilts.
You can set ANDROID_BUILD_FROM_SOURCE to true to build everything from
source.
Those variables can be set with shell environmental variable or in your
buildspec.mk.
Sometimes module B is able to be built from source only if module A is
also
built from source, for example, if B is the test apk of A.
In that case, you can use the macro include-if-build-from-source to
include B's Android.mk only if A is built from source too, or
if-build-from-source to conditionally include the definition of module
B,
if their module definitions are in the same Android.mk.
Support host-executable-hook and host-shared-library-hook.
Change-Id: Icab7cf028c87eaba0dd7efc2a7749fd6f32b44e4
2012-12-14 10:23:01 +08:00
# Include the google-specific config
- i n c l u d e v e n d o r / g o o g l e / b u i l d / c o n f i g . m k
2009-03-04 11:28:42 +08:00
# These are the modifier targets that don't do anything themselves, but
# change the behavior of the build.
# (must be defined before including definitions.make)
2017-05-26 13:10:08 +08:00
INTERNAL_MODIFIER_TARGETS := all
2009-03-04 11:28:42 +08:00
2017-06-06 08:40:23 +08:00
# EMMA_INSTRUMENT_STATIC merges the static jacoco library to each
# jacoco-enabled module.
2012-08-22 07:59:01 +08:00
i f e q ( t r u e , $( EMMA_INSTRUMENT_STATIC ) )
EMMA_INSTRUMENT := true
e n d i f
2017-06-06 08:40:23 +08:00
i f e q ( t r u e , $( EMMA_INSTRUMENT ) )
# Adding the jacoco library can cause the inclusion of
# some typically banned classes
# So if the user didn't specify SKIP_BOOT_JARS_CHECK, enable it here
i f n d e f S K I P _ B O O T _ J A R S _ C H E C K
SKIP_BOOT_JARS_CHECK := true
e n d i f
e n d i f
2017-01-20 12:17:12 +08:00
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_DEFAULT_PROPERTIES.
i f n e q ( $( ADDITIONAL_DEFAULT_PROPERTIES ) , )
$(error ADDITIONAL_DEFAULT_PROPERTIES must not be set before here : $( ADDITIONAL_DEFAULT_PROPERTIES ) )
e n d i f
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_BUILD_PROPERTIES.
i f n e q ( $( ADDITIONAL_BUILD_PROPERTIES ) , )
$(error ADDITIONAL_BUILD_PROPERTIES must not be set before here : $( ADDITIONAL_BUILD_PROPERTIES ) )
e n d i f
2017-12-16 06:52:26 +08:00
ADDITIONAL_BUILD_PROPERTIES :=
2018-07-28 04:11:50 +08:00
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_PRODUCT_PROPERTIES.
i f n e q ( $( ADDITIONAL_PRODUCT_PROPERTIES ) , )
$(error ADDITIONAL_PRODUCT_PROPERTIES must not be set before here : $( ADDITIONAL_PRODUCT_PROPERTIES ) )
e n d i f
ADDITIONAL_PRODUCT_PROPERTIES :=
2017-01-20 12:17:12 +08:00
#
# -----------------------------------------------------------------
# Add the product-defined properties to the build properties.
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
ADDITIONAL_BUILD_PROPERTIES += \
ro.product.first_api_level= $( PRODUCT_SHIPPING_API_LEVEL)
e n d i f
2017-01-31 19:07:02 +08:00
2017-03-21 10:46:49 +08:00
i f n e q ( $( BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED ) , t r u e )
2017-01-31 19:07:02 +08:00
ADDITIONAL_BUILD_PROPERTIES += $( PRODUCT_PROPERTY_OVERRIDES)
e l s e
ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
ADDITIONAL_BUILD_PROPERTIES += $( PRODUCT_PROPERTY_OVERRIDES)
endif
e n d i f
2017-01-20 12:17:12 +08:00
2009-03-04 11:28:42 +08:00
# Bring in standard build system definitions.
i n c l u d e $( BUILD_SYSTEM ) / d e f i n i t i o n s . m k
2010-09-18 07:36:06 +08:00
# Bring in dex_preopt.mk
i n c l u d e $( BUILD_SYSTEM ) / d e x _ p r e o p t . m k
2012-05-23 05:08:50 +08:00
i f n e q ( $( filter user userdebug eng ,$ ( MAKECMDGOALS ) ) , )
2009-03-04 11:28:42 +08:00
$( info ***************************************************************)
$( info ***************************************************************)
2011-11-18 06:51:12 +08:00
$( info Do not pass '$ ( filter user userdebug eng ,$ ( MAKECMDGOALS ) ) ' on \
the make command line.)
2009-03-04 11:28:42 +08:00
$( info Set TARGET_BUILD_VARIANT in buildspec .mk , or use lunch or )
$( info choosecombo .)
$( info ***************************************************************)
$( info ***************************************************************)
$( error stopping )
e n d i f
2009-03-10 02:52:11 +08:00
i f n e q ( $( filter -out $ ( INTERNAL_VALID_VARIANTS ) ,$ ( TARGET_BUILD_VARIANT ) ) , )
$( info ***************************************************************)
$( info ***************************************************************)
2015-01-21 10:23:05 +08:00
$(info Invalid variant : $( TARGET_BUILD_VARIANT ) )
$(info Valid values are : $( INTERNAL_VALID_VARIANTS ) )
2009-03-10 02:52:11 +08:00
$( info ***************************************************************)
$( info ***************************************************************)
$( error stopping )
e n d i f
2009-03-04 11:28:42 +08:00
2012-06-07 08:19:29 +08:00
# -----------------------------------------------------------------
# Variable to check java support level inside PDK build.
# Not necessary if the components is not in PDK.
# not defined : not supported
# "sdk" : sdk API only
# "platform" : platform API supproted
TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
2012-02-28 07:49:23 +08:00
# -----------------------------------------------------------------
# The pdk (Platform Development Kit) build
2017-10-21 02:37:33 +08:00
i n c l u d e b u i l d / m a k e / c o r e / p d k _ c o n f i g . m k
2012-03-31 09:08:07 +08:00
2016-02-27 08:24:26 +08:00
#
# -----------------------------------------------------------------
2018-01-26 04:18:59 +08:00
# Enable dynamic linker and hidden API developer warnings for
# userdebug, eng and non-REL builds
2017-06-21 05:39:22 +08:00
i f n e q ( $( TARGET_BUILD_VARIANT ) , u s e r )
2018-10-31 02:22:40 +08:00
ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning= 1
2017-06-21 05:39:22 +08:00
e l s e
# Enable it for user builds as long as they are not final.
2016-02-27 08:24:26 +08:00
i f n e q ( $( PLATFORM_VERSION_CODENAME ) , R E L )
2018-10-31 02:22:40 +08:00
ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning= 1
2016-02-27 08:24:26 +08:00
e n d i f
2017-06-21 05:39:22 +08:00
e n d i f
2016-02-27 08:24:26 +08:00
2017-05-20 02:31:12 +08:00
ADDITIONAL_BUILD_PROPERTIES += ro.treble.enabled= ${ PRODUCT_FULL_TREBLE }
2017-12-16 06:52:26 +08:00
$( KATI_obsolete_var PRODUCT_FULL_TREBLE ,\
Code should be written to work regardless of a device being Treble or \
variables like PRODUCT_SEPOLICY_SPLIT should be used until that is \
possible.)
2018-01-16 13:14:59 +08:00
# Sets ro.actionable_compatible_property.enabled to know on runtime whether the whitelist
# of actionable compatible properties is enabled or not.
i f e q ( $( PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE ) , t r u e )
ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled= false
e l s e
ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled= ${ PRODUCT_COMPATIBLE_PROPERTY }
e n d i f
2018-11-21 08:05:05 +08:00
i f e q ( $( PRODUCT_USE_DYNAMIC_PARTITIONS ) , t r u e )
ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.dynamic_partitions= true
e n d i f
i f e q ( $( PRODUCT_RETROFIT_DYNAMIC_PARTITIONS ) , t r u e )
ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.dynamic_partitions_retrofit= true
e n d i f
2018-05-25 04:09:40 +08:00
2012-02-28 07:49:23 +08:00
# -----------------------------------------------------------------
2009-03-04 11:28:42 +08:00
###
### In this section we set up the things that are different
### between the build variants
###
2009-04-14 07:32:16 +08:00
is_sdk_build :=
2011-02-16 08:09:36 +08:00
i f n e q ( $( filter sdk win_sdk sdk_addon ,$ ( MAKECMDGOALS ) ) , )
2009-04-14 07:32:16 +08:00
is_sdk_build := true
e n d i f
2014-10-17 16:05:50 +08:00
# Add build properties for ART. These define system properties used by installd
# to pass flags to dex2oat.
2015-11-10 15:42:49 +08:00
ADDITIONAL_BUILD_PROPERTIES += persist.sys.dalvik.vm.lib.2= libart.so
2014-10-17 16:05:50 +08:00
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$( TARGET_ARCH) .variant= $( DEX2OAT_TARGET_CPU_VARIANT)
i f n e q ( $( DEX 2OAT_TARGET_INSTRUCTION_SET_FEATURES ) , )
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$( TARGET_ARCH) .features= $( DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
e n d i f
2014-08-20 03:28:08 +08:00
i f d e f T A R G E T _ 2 N D _ A R C H
2014-10-17 16:05:50 +08:00
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$( TARGET_2ND_ARCH) .variant= $( $( TARGET_2ND_ARCH_VAR_PREFIX) DEX2OAT_TARGET_CPU_VARIANT)
ifneq ( $( $( TARGET_2ND_ARCH_VAR_PREFIX) DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) ,)
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.isa.$( TARGET_2ND_ARCH) .features= $( $( TARGET_2ND_ARCH_VAR_PREFIX) DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
endif
2014-08-20 03:28:08 +08:00
e n d i f
2017-06-24 01:44:45 +08:00
# Add the system server compiler filter if they are specified for the product.
i f n e q ( , $( PRODUCT_SYSTEM_SERVER_COMPILER_FILTER ) )
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.systemservercompilerfilter= $( PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
e n d i f
2009-03-04 11:28:42 +08:00
## user/userdebug ##
2012-05-23 05:08:50 +08:00
user_variant := $( filter user userdebug,$( TARGET_BUILD_VARIANT) )
2009-03-04 11:28:42 +08:00
enable_target_debugging := true
2012-05-23 05:08:50 +08:00
tags_to_install :=
2009-03-04 11:28:42 +08:00
i f n e q ( , $( user_variant ) )
# Target is secure in user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure= 1
2016-05-17 12:40:52 +08:00
ADDITIONAL_DEFAULT_PROPERTIES += security.perf_harden= 1
2009-03-04 11:28:42 +08:00
2015-12-17 05:42:49 +08:00
ifeq ( $( user_variant) ,user)
ADDITIONAL_DEFAULT_PROPERTIES += ro.adb.secure= 1
endif
2009-03-04 11:28:42 +08:00
ifeq ( $( user_variant) ,userdebug)
# Pick up some extra useful tools
2009-03-10 02:52:11 +08:00
tags_to_install += debug
2009-03-04 11:28:42 +08:00
else
# Disable debugging in plain user builds.
enable_target_debugging :=
endif
2010-09-08 08:45:44 +08:00
2009-03-04 11:28:42 +08:00
# Disallow mock locations by default for user builds
ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location= 0
2010-09-08 08:45:44 +08:00
2009-03-04 11:28:42 +08:00
e l s e # !user_variant
# Turn on checkjni for non-user builds.
ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni= 1
# Set device insecure for non-user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure= 0
# Allow mock locations by default for non user builds
ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location= 1
e n d i f # !user_variant
i f e q ( t r u e , $( strip $ ( enable_target_debugging ) ) )
# Target is more debuggable and adbd is on by default
2011-07-02 00:31:47 +08:00
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable= 1
2014-09-20 02:30:27 +08:00
# Enable Dalvik lock contention logging.
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold= 500
2009-03-04 11:28:42 +08:00
e l s e # !enable_target_debugging
# Target is less debuggable and adbd is off by default
2011-07-02 00:31:47 +08:00
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable= 0
2009-03-04 11:28:42 +08:00
e n d i f # !enable_target_debugging
2009-03-10 02:52:11 +08:00
## eng ##
i f e q ( $( TARGET_BUILD_VARIANT ) , e n g )
2012-05-23 05:08:50 +08:00
tags_to_install := debug eng
2011-12-02 04:46:12 +08:00
i f n e q ( $( filter ro .setupwizard .mode =ENABLED , $ ( call collapse -pairs , $ ( ADDITIONAL_BUILD_PROPERTIES ) ) ) , )
2009-03-12 03:11:54 +08:00
# Don't require the setup wizard on eng builds
ADDITIONAL_BUILD_PROPERTIES := $( filter-out ro.setupwizard.mode= %,\
2009-10-08 01:01:13 +08:00
$( call collapse-pairs, $( ADDITIONAL_BUILD_PROPERTIES) ) ) \
ro.setupwizard.mode= OPTIONAL
2009-03-10 02:52:11 +08:00
e n d i f
2014-10-04 04:36:51 +08:00
i f n d e f i s _ s d k _ b u i l d
2015-12-15 17:53:05 +08:00
# To speedup startup of non-preopted builds, don't verify or compile the boot image.
2015-03-20 01:34:23 +08:00
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter= verify-at-runtime
2014-10-04 04:36:51 +08:00
e n d i f
2011-12-02 04:46:12 +08:00
e n d i f
2009-03-10 02:52:11 +08:00
2018-03-27 05:17:03 +08:00
## asan ##
# Install some additional tools on ASAN builds IFF we are also installing debug tools
i f n e q ( $( filter address ,$ ( SANITIZE_TARGET ) ) , )
i f n e q ( , $( filter debug ,$ ( tags_to_install ) ) )
tags_to_install += asan
e n d i f
e n d i f
2009-03-04 11:28:42 +08:00
## sdk ##
2009-04-14 07:32:16 +08:00
i f d e f i s _ s d k _ b u i l d
2011-02-16 08:09:36 +08:00
# Detect if we want to build a repository for the SDK
sdk_repo_goal := $( strip $( filter sdk_repo,$( MAKECMDGOALS) ) )
MAKECMDGOALS := $( strip $( filter-out sdk_repo,$( MAKECMDGOALS) ) )
2015-10-29 03:34:03 +08:00
i f n e q ( $( words $ ( sort $ ( filter -out $ ( INTERNAL_MODIFIER_TARGETS ) checkbuild emulator_tests target -files -package ,$ ( MAKECMDGOALS ) ) ) ) , 1 )
2009-03-04 11:28:42 +08:00
$( error The 'sdk ' target may not be specified with any other targets )
e n d i f
2010-04-17 08:50:09 +08:00
2016-08-02 08:41:49 +08:00
# AUX dependencies are already added by now; remove triggers from the MAKECMDGOALS
MAKECMDGOALS := $( strip $( filter-out AUX-%,$( MAKECMDGOALS) ) )
2009-03-10 02:52:11 +08:00
# TODO: this should be eng I think. Since the sdk is built from the eng
# variant.
2012-05-23 05:08:50 +08:00
tags_to_install := debug eng
2009-03-04 11:28:42 +08:00
ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence= true
ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin= yes
e l s e # !sdk
e n d i f
2010-08-31 03:48:03 +08:00
BUILD_WITHOUT_PV := true
2009-03-04 11:28:42 +08:00
ADDITIONAL_BUILD_PROPERTIES += net.bt.name= Android
# ------------------------------------------------------------
# Define a function that, given a list of module tags, returns
# non-empty if that module should be installed in /system.
2009-03-10 02:52:11 +08:00
# For most goals, anything not tagged with the "tests" tag should
2009-03-04 11:28:42 +08:00
# be installed in /system.
d e f i n e s h o u l d - i n s t a l l - t o - s y s t e m
2009-03-10 02:52:11 +08:00
$( if $ ( filter tests ,$ ( 1) ) ,,true )
2009-03-04 11:28:42 +08:00
e n d e f
2009-04-14 07:32:16 +08:00
i f d e f i s _ s d k _ b u i l d
2009-03-04 11:28:42 +08:00
# For the sdk goal, anything with the "samples" tag should be
# installed in /data even if that module also has "eng"/"debug"/"user".
d e f i n e s h o u l d - i n s t a l l - t o - s y s t e m
2009-03-10 02:52:11 +08:00
$( if $ ( filter samples tests ,$ ( 1) ) ,,true )
2009-03-04 11:28:42 +08:00
e n d e f
e n d i f
2017-05-26 13:10:08 +08:00
# If they only used the modifier goals (all, etc), we'll actually
2009-07-18 03:33:40 +08:00
# build the default target.
i f e q ( $( filter -out $ ( INTERNAL_MODIFIER_TARGETS ) ,$ ( MAKECMDGOALS ) ) , )
.PHONY : $( INTERNAL_MODIFIER_TARGETS )
$(INTERNAL_MODIFIER_TARGETS) : $( DEFAULT_GOAL )
2009-03-04 11:28:42 +08:00
e n d i f
#
# Typical build; include any Android.mk files we can find.
#
2018-11-28 03:37:38 +08:00
# Before we go and include all of the module makefiles, strip values for easier
# processing.
$( call strip -product -vars )
2016-10-06 07:57:27 +08:00
# Before we go and include all of the module makefiles, mark the PRODUCT_*
2017-01-20 12:17:12 +08:00
# and ADDITIONAL*PROPERTIES values readonly so that they won't be modified.
2016-10-06 07:57:27 +08:00
$( call readonly -product -vars )
2017-01-20 12:17:12 +08:00
ADDITIONAL_DEFAULT_PROPERTIES := $( strip $( ADDITIONAL_DEFAULT_PROPERTIES) )
.KATI_READONLY := ADDITIONAL_DEFAULT_PROPERTIES
ADDITIONAL_BUILD_PROPERTIES := $( strip $( ADDITIONAL_BUILD_PROPERTIES) )
.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES
2018-07-28 04:11:50 +08:00
ADDITIONAL_PRODUCT_PROPERTIES := $( strip $( ADDITIONAL_PRODUCT_PROPERTIES) )
.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES
2010-09-15 01:09:48 +08:00
2017-03-30 10:25:02 +08:00
i f n e q ( $( PRODUCT_ENFORCE_RRO_TARGETS ) , )
2017-02-01 23:44:58 +08:00
ENFORCE_RRO_SOURCES :=
e n d i f
2018-10-19 07:11:40 +08:00
# Color-coded warnings including current module info
# $(1): message to print
d e f i n e p r e t t y - w a r n i n g
$(shell $(call echo-warning,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE) : $( 1) ))
e n d e f
# Color-coded errors including current module info
# $(1): message to print
d e f i n e p r e t t y - e r r o r
$(shell $(call echo-error,$(LOCAL_MODULE_MAKEFILE),$(LOCAL_MODULE) : $( 1) ))
$( error done )
e n d e f
2018-07-11 06:02:14 +08:00
subdir_makefiles_inc := .
2018-08-21 20:14:01 +08:00
FULL_BUILD :=
2018-07-11 06:02:14 +08:00
2009-03-04 11:28:42 +08:00
i f n e q ( $( ONE_SHOT_MAKEFILE ) , )
# We've probably been invoked by the "mm" shell function
# with a subdirectory's makefile.
2016-07-12 07:57:33 +08:00
i n c l u d e $( SOONG_ANDROID_MK ) $( wildcard $ ( ONE_SHOT_MAKEFILE ) )
2009-03-04 11:28:42 +08:00
# Change CUSTOM_MODULES to include only modules that were
# defined by this makefile; this will install all of those
# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
# so that the modules will be installed in the same place they
# would have been with a normal make.
2010-01-08 03:19:39 +08:00
CUSTOM_MODULES := $( sort $( call get-tagged-modules,$( ALL_MODULE_TAGS) ) )
2009-07-31 02:20:04 +08:00
2013-08-17 04:24:47 +08:00
# A helper goal printing out install paths
2016-08-12 08:20:33 +08:00
d e f i n e r e g i s t e r _ m o d u l e _ i n s t a l l _ p a t h
.PHONY : GET -MODULE -INSTALL -PATH -$( 1)
GET-MODULE-INSTALL-PATH-$(1) :
echo 'INSTALL-PATH: $(1) $(ALL_MODULES.$(1).INSTALLED)'
e n d e f
SORTED_ALL_MODULES := $( sort $( ALL_MODULES) )
UNIQUE_ALL_MODULES :=
$( foreach m ,$ ( SORTED_ALL_MODULES ) ,\
$( if $( call streq,$( m) ,$( lastword $( UNIQUE_ALL_MODULES) ) ) ,,\
$( eval UNIQUE_ALL_MODULES += $( m) ) ) )
SORTED_ALL_MODULES :=
$( foreach mod ,$ ( UNIQUE_ALL_MODULES ) ,$ ( if $ ( ALL_MODULES .$ ( mod ) .INSTALLED ) ,\
$( eval $( call register_module_install_path,$( mod) ) ) \
$( foreach path,$( ALL_MODULES.$( mod) .PATH) ,\
$( eval my_path_prefix := GET-INSTALL-PATH-IN) \
$( foreach component,$( subst /,$( space) ,$( path) ) ,\
$( eval my_path_prefix := $$ ( my_path_prefix) -$$ ( component) ) \
$( eval .PHONY: $$ ( my_path_prefix) ) \
$( eval $$ ( my_path_prefix) : GET-MODULE-INSTALL-PATH-$( mod) ) ) ) ) )
UNIQUE_ALL_MODULES :=
2013-08-17 04:24:47 +08:00
2009-07-31 02:20:04 +08:00
e l s e # ONE_SHOT_MAKEFILE
2013-09-10 03:11:02 +08:00
i f n e q ( $( dont_bother ) , t r u e )
2018-08-21 20:14:01 +08:00
FULL_BUILD := true
2009-07-31 02:20:04 +08:00
#
# Include all of the makefiles in the system
#
2017-08-18 10:46:39 +08:00
subdir_makefiles := $( SOONG_ANDROID_MK) $( file <$( OUT_DIR) /.module_paths/Android.mk.list)
2018-07-11 06:02:14 +08:00
subdir_makefiles_total := $( words int $( subdir_makefiles) post finish)
2017-02-19 02:41:30 +08:00
.KATI_READONLY := subdir_makefiles_total
2016-01-12 04:33:23 +08:00
2017-02-19 02:41:30 +08:00
$( foreach mk ,$ ( subdir_makefiles ) ,$ ( info [$ ( call inc_and_print ,subdir_makefiles_inc ) /$ ( subdir_makefiles_total ) ] including $ ( mk ) ...) $ ( eval include $ ( mk ) ) )
2012-05-25 12:05:19 +08:00
2018-03-07 06:07:21 +08:00
i f n e q ( , $( PDK_FUSION_PLATFORM_ZIP ) $( PDK_FUSION_PLATFORM_DIR ) )
2016-03-12 02:32:01 +08:00
# Bring in the PDK platform.zip modules.
i n c l u d e $( BUILD_SYSTEM ) / p d k _ f u s i o n _ m o d u l e s . m k
2018-03-07 06:07:21 +08:00
e n d i f # PDK_FUSION_PLATFORM_ZIP || PDK_FUSION_PLATFORM_DIR
2016-03-12 02:32:01 +08:00
2017-05-27 08:12:29 +08:00
droid_targets : blueprint_tools
2013-09-10 03:11:02 +08:00
e n d i f # dont_bother
2009-07-31 02:20:04 +08:00
e n d i f # ONE_SHOT_MAKEFILE
2018-07-11 06:02:14 +08:00
i f n d e f s u b d i r _ m a k e f i l e s _ t o t a l
subdir_makefiles_total := $( words init post finish)
e n d i f
$( info [$ ( call inc_and_print ,subdir_makefiles_inc ) /$ ( subdir_makefiles_total ) ] finishing build rules ...)
2009-03-04 11:28:42 +08:00
# -------------------------------------------------------------------
# All module makefiles have been included at this point.
# -------------------------------------------------------------------
2018-10-19 07:11:40 +08:00
# -------------------------------------------------------------------
# Use basic warning/error messages now that LOCAL_MODULE_MAKEFILE
# and LOCAL_MODULE aren't useful anymore.
# -------------------------------------------------------------------
d e f i n e p r e t t y - w a r n i n g
$( warning $ ( 1) )
e n d e f
d e f i n e p r e t t y - e r r o r
$( error $ ( 1) )
e n d e f
2017-02-01 23:44:58 +08:00
# -------------------------------------------------------------------
# Enforce to generate all RRO packages for modules having resource
# overlays.
# -------------------------------------------------------------------
2017-03-30 10:25:02 +08:00
i f n e q ( $( PRODUCT_ENFORCE_RRO_TARGETS ) , )
2017-02-01 23:44:58 +08:00
$( call generate_all_enforce_rro_packages )
e n d i f
2009-03-04 11:28:42 +08:00
# -------------------------------------------------------------------
# Fix up CUSTOM_MODULES to refer to installed files rather than
# just bare module names. Leave unknown modules alone in case
# they're actually full paths to a particular file.
known_custom_modules := $( filter $( ALL_MODULES) ,$( CUSTOM_MODULES) )
unknown_custom_modules := $( filter-out $( ALL_MODULES) ,$( CUSTOM_MODULES) )
CUSTOM_MODULES := \
$( call module-installed-files,$( known_custom_modules) ) \
$( unknown_custom_modules)
# -------------------------------------------------------------------
# Define dependencies for modules that require other modules.
# This can only happen now, after we've read in all module makefiles.
#
# TODO: deal with the fact that a bare module name isn't
# unambiguous enough. Maybe declare short targets like
# APPS:Quake or HOST:SHARED_LIBRARIES:libutils.
# BUG: the system image won't know to depend on modules that are
# brought in as requirements of other modules.
2014-02-11 14:26:23 +08:00
#
# Resolve the required module name to 32-bit or 64-bit variant.
# Get a list of corresponding 32-bit module names, if one exists.
2016-03-17 10:53:19 +08:00
i f n e q ( $( TARGET_TRANSLATE_ 2ND_ARCH ) , t r u e )
2014-02-11 14:26:23 +08:00
d e f i n e g e t - 3 2 - b i t - m o d u l e s
2016-03-17 10:53:19 +08:00
$( sort $ ( foreach m ,$ ( 1) ,\
2014-02-11 14:26:23 +08:00
$( if $( ALL_MODULES.$( m) $( TARGET_2ND_ARCH_MODULE_SUFFIX) .CLASS) ,\
2016-03-17 10:53:19 +08:00
$( m) $( TARGET_2ND_ARCH_MODULE_SUFFIX) ) \
$( if $( ALL_MODULES.$( m) $( HOST_2ND_ARCH_MODULE_SUFFIX) .CLASS) ,\
$( m) $( HOST_2ND_ARCH_MODULE_SUFFIX) ) \
) )
2014-02-11 14:26:23 +08:00
e n d e f
# Get a list of corresponding 32-bit module names, if one exists;
# otherwise return the original module name
d e f i n e g e t - 3 2 - b i t - m o d u l e s - i f - w e - c a n
2016-03-17 10:53:19 +08:00
$( sort $ ( foreach m ,$ ( 1) ,\
$( if $( ALL_MODULES.$( m) $( TARGET_2ND_ARCH_MODULE_SUFFIX) .CLASS) $( ALL_MODULES.$( m) $( HOST_2ND_ARCH_MODULE_SUFFIX) .CLASS) ,\
$( if $( ALL_MODULES.$( m) $( TARGET_2ND_ARCH_MODULE_SUFFIX) .CLASS) ,$( m) $( TARGET_2ND_ARCH_MODULE_SUFFIX) ) \
$( if $( ALL_MODULES.$( m) $( HOST_2ND_ARCH_MODULE_SUFFIX) .CLASS) ,$( m) $( HOST_2ND_ARCH_MODULE_SUFFIX) ) ,\
$( m) ) ) )
e n d e f
e l s e # TARGET_TRANSLATE_2ND_ARCH
# For binary translation config, by default only install the first arch.
d e f i n e g e t - 3 2 - b i t - m o d u l e s
e n d e f
d e f i n e g e t - 3 2 - b i t - m o d u l e s - i f - w e - c a n
$( strip $ ( 1) )
2014-02-11 14:26:23 +08:00
e n d e f
2016-03-17 10:53:19 +08:00
e n d i f # TARGET_TRANSLATE_2ND_ARCH
2014-02-11 14:26:23 +08:00
2015-08-15 03:59:50 +08:00
# If a module is for a cross host os, the required modules must be for
# that OS too.
2014-02-11 14:26:23 +08:00
# If a module is built for 32-bit, the required modules must be 32-bit too;
2017-08-30 10:31:48 +08:00
# Otherwise if the module is an executable or shared library,
2014-02-11 14:26:23 +08:00
# the required modules must be 64-bit;
# otherwise we require both 64-bit and 32-bit variant, if one exists.
2017-08-30 10:31:48 +08:00
d e f i n e s e l e c t - b i t n e s s - o f - r e q u i r e d - m o d u l e s
2014-02-11 14:26:23 +08:00
$( foreach m ,$ ( ALL_MODULES ) ,\
$( eval r := $( ALL_MODULES.$( m) .REQUIRED) ) \
$( if $( r) ,\
2015-08-15 03:59:50 +08:00
$( if $( ALL_MODULES.$( m) .FOR_HOST_CROSS) ,\
$( eval r := $( addprefix host_cross_,$( r) ) ) ) \
2014-02-11 14:26:23 +08:00
$( if $( ALL_MODULES.$( m) .FOR_2ND_ARCH) ,\
$( eval r_r := $( call get-32-bit-modules-if-we-can,$( r) ) ) ,\
Add NATIVE_TESTS class, move host native tests
Host native tests have been getting installed into
out/host/linux-x86/bin/..., but this pollutes the bin directory with a
lot of poorly named tests. Also, to support 32-bit and 64-bit tests, we
need to have different names with different suffixes. This causes
problems when tests expect to be named something specific (like gtest).
It's also convenient to store test data next to the test itself.
So with this change, native tests will be installed in
out/host/linux-x86/nativetest[64]/$(LOCAL_MODULE)/$(LOCAL_MODULE_STEM)
just like target tests get installed into /data/nativetest[64].
Implement this using a new NATIVE_TESTS class, which is like
EXECUTABLES, but sets up the install path differently, and configures
the rpath to load shared libraries with the proper relative path.
LOCAL_MODULE_RELATIVE_PATH can be used to control the directory name, it
will default to $(LOCAL_MODULE). This way multiple related tests can be
grouped together.
Target native tests also use NATIVE_TESTS now, but nothing should change
other than LOCAL_MODULE_RELATIVE_PATH can be used.
Change-Id: I535e42b1a6b21c5b8d6a580aa2f944d2be35e27d
2016-03-03 05:54:51 +08:00
$( if $( filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$( ALL_MODULES.$( m) .CLASS) ) ,\
2014-02-11 14:26:23 +08:00
$( eval r_r := $( r) ) ,\
$( eval r_r := $( r) $( call get-32-bit-modules,$( r) ) ) \
) \
) \
2014-06-11 10:23:29 +08:00
$( eval ALL_MODULES.$( m) .REQUIRED := $( strip $( r_r) ) ) \
2014-02-11 14:26:23 +08:00
) \
)
2017-08-30 10:31:48 +08:00
e n d e f
$( call select -bitness -of -required -modules )
2014-02-11 14:26:23 +08:00
r_r :=
2009-03-04 11:28:42 +08:00
d e f i n e a d d - r e q u i r e d - d e p s
2013-02-23 06:32:30 +08:00
$(1) : | $( 2)
2009-03-04 11:28:42 +08:00
e n d e f
2014-02-11 14:26:23 +08:00
2016-10-04 07:49:02 +08:00
# Use a normal dependency instead of an order-only dependency when installing
# host dynamic binaries so that the timestamp of the final binary always
# changes, even if the toc optimization has skipped relinking the binary
# and its dependant shared libraries.
d e f i n e a d d - r e q u i r e d - h o s t - s o - d e p s
$(1) : $( 2)
e n d e f
2017-08-30 10:31:48 +08:00
# Sets up dependencies such that whenever a host module is installed,
# any other host modules listed in $(ALL_MODULES.$(m).REQUIRED) will also be installed
d e f i n e a d d - a l l - h o s t - t o - h o s t - r e q u i r e d - m o d u l e s - d e p s
2009-03-04 11:28:42 +08:00
$( foreach m ,$ ( ALL_MODULES ) , \
$( eval r := $( ALL_MODULES.$( m) .REQUIRED) ) \
$( if $( r) , \
$( eval r := $( call module-installed-files,$( r) ) ) \
2016-09-14 04:28:51 +08:00
$( eval h_m := $( filter $( HOST_OUT) /%, $( ALL_MODULES.$( m) .INSTALLED) ) ) \
$( eval hc_m := $( filter $( HOST_CROSS_OUT) /%, $( ALL_MODULES.$( m) .INSTALLED) ) ) \
$( eval h_r := $( filter $( HOST_OUT) /%, $( r) ) ) \
$( eval hc_r := $( filter $( HOST_CROSS_OUT) /%, $( r) ) ) \
2014-02-01 11:22:35 +08:00
$( eval h_m := $( filter-out $( h_r) , $( h_m) ) ) \
2015-08-15 03:59:50 +08:00
$( eval hc_m := $( filter-out $( hc_r) , $( hc_m) ) ) \
2013-06-07 09:05:53 +08:00
$( if $( h_m) , $( eval $( call add-required-deps, $( h_m) ,$( h_r) ) ) ) \
2015-08-15 03:59:50 +08:00
$( if $( hc_m) , $( eval $( call add-required-deps, $( hc_m) ,$( hc_r) ) ) ) \
2017-08-30 10:31:48 +08:00
) \
)
e n d e f
$( call add -all -host -to -host -required -modules -deps )
# Sets up dependencies such that whenever a target module is installed,
# any other target modules listed in $(ALL_MODULES.$(m).REQUIRED) will also be installed
d e f i n e a d d - a l l - t a r g e t - t o - t a r g e t - r e q u i r e d - m o d u l e s - d e p s
$( foreach m ,$ ( ALL_MODULES ) , \
$( eval r := $( ALL_MODULES.$( m) .REQUIRED) ) \
$( if $( r) , \
$( eval r := $( call module-installed-files,$( r) ) ) \
$( eval t_m := $( filter $( TARGET_OUT_ROOT) /%, $( ALL_MODULES.$( m) .INSTALLED) ) ) \
$( eval t_r := $( filter $( TARGET_OUT_ROOT) /%, $( r) ) ) \
$( eval t_m := $( filter-out $( t_r) , $( t_m) ) ) \
$( if $( t_m) , $( eval $( call add-required-deps, $( t_m) ,$( t_r) ) ) ) \
) \
)
e n d e f
$( call add -all -target -to -target -required -modules -deps )
# Sets up dependencies such that whenever a host module is installed,
# any target modules listed in $(ALL_MODULES.$(m).TARGET_REQUIRED) will also be installed
d e f i n e a d d - a l l - h o s t - t o - t a r g e t - r e q u i r e d - m o d u l e s - d e p s
$( foreach m ,$ ( ALL_MODULES ) , \
$( eval req_mods := $( ALL_MODULES.$( m) .TARGET_REQUIRED) ) \
$( if $( req_mods) , \
$( eval req_files := ) \
$( foreach req_mod,$( req_mods) , \
$( eval req_file := $( filter $( TARGET_OUT_ROOT) /%, $( call module-installed-files,$( req_mod) ) ) ) \
$( if $( strip $( req_file) ) ,\
,\
$( error $( m) .LOCAL_TARGET_REQUIRED_MODULES : illegal value $( req_mod) : not a device module. If you want to specify host modules to be required to be installed along with your host module, add those module names to LOCAL_REQUIRED_MODULES instead) \
) \
$( eval req_files := $( req_files) $( space) $( req_file) ) \
) \
$( eval req_files := $( strip $( req_files) ) ) \
$( eval mod_files := $( filter $( HOST_OUT) /%, $( call module-installed-files,$( m) ) ) ) \
$( eval mod_files := $( filter-out $( req_files) ,$( mod_files) ) ) \
$( if $( mod_files) ,\
$( eval $( call add-required-deps, $( mod_files) ,$( req_files) ) ) \
) \
) \
)
e n d e f
$( call add -all -host -to -target -required -modules -deps )
2018-02-02 11:48:59 +08:00
# Sets up dependencies such that whenever a target module is installed,
# any host modules listed in $(ALL_MODULES.$(m).HOST_REQUIRED) will also be installed
d e f i n e a d d - a l l - t a r g e t - t o - h o s t - r e q u i r e d - m o d u l e s - d e p s
$( foreach m ,$ ( ALL_MODULES ) , \
$( eval req_mods := $( ALL_MODULES.$( m) .HOST_REQUIRED) ) \
$( if $( req_mods) , \
$( eval req_files := ) \
$( foreach req_mod,$( req_mods) , \
$( eval req_file := $( filter $( HOST_OUT) /%, $( call module-installed-files,$( req_mod) ) ) ) \
$( if $( strip $( req_file) ) ,\
,\
$( error $( m) .LOCAL_HOST_REQUIRED_MODULES : illegal value $( req_mod) : not a host module. If you want to specify target modules to be required to be installed along with your target module, add those module names to LOCAL_REQUIRED_MODULES instead) \
) \
$( eval req_files := $( req_files) $( space) $( req_file) ) \
) \
$( eval req_files := $( strip $( req_files) ) ) \
$( eval mod_files := $( filter $( TARGET_OUT_ROOT) /%, $( call module-installed-files,$( m) ) ) ) \
$( eval mod_files := $( filter-out $( req_files) ,$( mod_files) ) ) \
$( if $( mod_files) ,\
$( eval $( call add-required-deps, $( mod_files) ,$( req_files) ) ) \
) \
) \
)
e n d e f
$( call add -all -target -to -host -required -modules -deps )
2013-02-23 06:32:30 +08:00
2013-06-07 09:05:53 +08:00
t_m :=
h_m :=
2015-08-15 03:59:50 +08:00
hc_m :=
2013-06-07 09:05:53 +08:00
t_r :=
h_r :=
2015-08-15 03:59:50 +08:00
hc_r :=
2013-06-07 09:05:53 +08:00
2017-08-30 10:31:48 +08:00
# Establish the dependencies on the shared libraries.
2014-06-11 05:21:20 +08:00
# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED,
# so they can be expanded to product_MODULES later.
2015-08-15 03:59:50 +08:00
# $(1): TARGET_ or HOST_ or HOST_CROSS_.
2014-06-11 05:21:20 +08:00
# $(2): non-empty for 2nd arch.
2015-08-15 03:59:50 +08:00
# $(3): non-empty for host cross compile.
2014-06-11 05:21:20 +08:00
d e f i n e r e s o l v e - s h a r e d - l i b s - d e p e s
$( foreach m ,$ ( $ ( if $ ( 2) ,$ ( $ ( 1) 2ND_ARCH_VAR_PREFIX ) ) $ ( 1) DEPENDENCIES_ON_SHARED_LIBRARIES ) ,\
$( eval p := $( subst :,$( space) ,$( m) ) ) \
$( eval mod := $( firstword $( p) ) ) \
$( eval deps := $( subst $( comma) ,$( space) ,$( lastword $( p) ) ) ) \
2016-09-14 04:28:51 +08:00
$( eval root := $( 1) OUT$( if $( call streq,$( 1) ,TARGET_) ,_ROOT) ) \
2014-06-11 05:21:20 +08:00
$( if $( 2) ,$( eval deps := $( addsuffix $( $( 1) 2ND_ARCH_MODULE_SUFFIX) ,$( deps) ) ) ) \
2015-08-15 03:59:50 +08:00
$( if $( 3) ,$( eval deps := $( addprefix host_cross_,$( deps) ) ) ) \
2016-09-14 04:28:51 +08:00
$( eval r := $( filter $( $( root) ) /%,$( call module-installed-files,\
2014-06-11 05:21:20 +08:00
$( deps) ) ) ) \
2016-10-04 07:49:02 +08:00
$( if $( filter $( 1) ,HOST_) ,\
2018-10-26 14:21:38 +08:00
$( eval ALL_MODULES.$( mod) .HOST_SHARED_LIBRARY_FILES := $$ ( ALL_MODULES.$( mod) .HOST_SHARED_LIBRARY_FILES) $( word 2,$( p) ) $( r) ) \
$( eval ALL_MODULES.$( mod) .HOST_SHARED_LIBRARIES := $$ ( ALL_MODULES.$( mod) .HOST_SHARED_LIBRARIES) $( deps) ) \
2016-10-04 07:49:02 +08:00
$( eval $( call add-required-host-so-deps,$( word 2,$( p) ) ,$( r) ) ) ,\
$( eval $( call add-required-deps,$( word 2,$( p) ) ,$( r) ) ) ) \
2014-06-11 05:21:20 +08:00
$( eval ALL_MODULES.$( mod) .REQUIRED += $( deps) ) )
e n d e f
2018-10-26 14:21:38 +08:00
# Recursively resolve host shared library dependency for a given module.
# $(1): module name
# Returns all dependencies of shared library.
d e f i n e g e t - a l l - s h a r e d - l i b s - d e p s
$( if $ ( _all_deps_for_ $ ( 1) _set_ ) ,$ ( _all_deps_for_ $ ( 1) _ ) ,\
$( eval _all_deps_for_$( 1) _ := ) \
$( foreach dep,$( ALL_MODULES.$( 1) .HOST_SHARED_LIBRARIES) ,\
$( foreach m,$( call get-all-shared-libs-deps,$( dep) ) ,\
$( eval _all_deps_for_$( 1) _ := $$ ( _all_deps_for_$( 1) _) $( m) ) \
$( eval _all_deps_for_$( 1) _ := $( sort $( _all_deps_for_$( 1) _) ) ) ) \
$( eval _all_deps_for_$( 1) _ := $$ ( _all_deps_for_$( 1) _) $( dep) ) \
$( eval _all_deps_for_$( 1) _ := $( sort $( _all_deps_for_$( 1) _) $( dep) ) ) \
$( eval _all_deps_for_$( 1) _set_ := true ) ) \
$( _all_deps_for_ $ ( 1) _ ) )
e n d e f
# Scan all modules in general-tests and device-tests suite and flatten the
# shared library dependencies.
d e f i n e u p d a t e - h o s t - s h a r e d - l i b s - d e p s - f o r - s u i t e s
$( foreach suite ,general -tests device -tests ,\
$( foreach m,$( COMPATIBILITY.$( suite) .MODULES) ,\
$( eval my_deps := $( call get-all-shared-libs-deps,$( m) ) ) \
$( foreach dep,$( my_deps) ,\
$( foreach f,$( ALL_MODULES.$( dep) .HOST_SHARED_LIBRARY_FILES) ,\
$( eval target := $( HOST_OUT_TESTCASES) /$( lastword $( subst /, ,$( dir $( f) ) ) ) /$( notdir $( f) ) ) \
$( eval COMPATIBILITY.$( suite) .HOST_SHARED_LIBRARY.FILES := \
$$ ( COMPATIBILITY.$( suite) .HOST_SHARED_LIBRARY.FILES) $( f) :$( target) ) \
$( eval COMPATIBILITY.$( suite) .HOST_SHARED_LIBRARY.FILES := \
$( sort $( COMPATIBILITY.$( suite) .HOST_SHARED_LIBRARY.FILES) ) ) ) ) ) )
e n d e f
2014-06-11 05:21:20 +08:00
$( call resolve -shared -libs -depes ,TARGET_ )
2014-01-17 04:36:34 +08:00
i f d e f T A R G E T _ 2 N D _ A R C H
2014-06-11 05:21:20 +08:00
$( call resolve -shared -libs -depes ,TARGET_ ,true )
2014-01-17 04:36:34 +08:00
e n d i f
2014-06-11 05:21:20 +08:00
$( call resolve -shared -libs -depes ,HOST_ )
2014-05-21 05:43:51 +08:00
i f d e f H O S T _ 2 N D _ A R C H
2014-06-11 05:21:20 +08:00
$( call resolve -shared -libs -depes ,HOST_ ,true )
2014-01-17 04:36:34 +08:00
e n d i f
2018-10-26 14:21:38 +08:00
# Update host side shared library dependencies for tests in suite device-tests and general-tests.
# This should be called after calling resolve-shared-libs-depes for HOST_2ND_ARCH.
$( call update -host -shared -libs -deps -for -suites )
2015-08-15 03:59:50 +08:00
i f d e f H O S T _ C R O S S _ O S
$( call resolve -shared -libs -depes ,HOST_CROSS_ ,,true )
e n d i f
2013-02-23 06:32:30 +08:00
2018-11-06 17:32:40 +08:00
# Pass the shared libraries dependencies to prebuilt ELF file check.
d e f i n e a d d - e l f - f i l e - c h e c k - s h a r e d - l i b
$(1) : PRIVATE_SHARED_LIBRARY_FILES += $( 2)
$(1) : $( 2)
e n d e f
d e f i n e r e s o l v e - s h a r e d - l i b s - f o r - e l f - f i l e - c h e c k
$( foreach m ,$ ( $ ( if $ ( 2) ,$ ( $ ( 1) 2ND_ARCH_VAR_PREFIX ) ) $ ( 1) DEPENDENCIES_ON_SHARED_LIBRARIES ) ,\
$( eval p := $( subst :,$( space) ,$( m) ) ) \
$( eval mod := $( firstword $( p) ) ) \
\
$( eval deps := $( subst $( comma) ,$( space) ,$( lastword $( p) ) ) ) \
$( if $( 2) ,$( eval deps := $( addsuffix $( $( 1) 2ND_ARCH_MODULE_SUFFIX) ,$( deps) ) ) ) \
$( eval root := $( 1) OUT$( if $( call streq,$( 1) ,TARGET_) ,_ROOT) ) \
$( eval deps := $( filter $( $( root) ) /%$( $( 1) SHLIB_SUFFIX) ,$( call module-built-files,$( deps) ) ) ) \
\
$( eval r := $( firstword $( filter \
$( $( if $( 2) ,$( $( 1) 2ND_ARCH_VAR_PREFIX) ) TARGET_OUT_INTERMEDIATES) /EXECUTABLES/%\
$( $( if $( 2) ,$( $( 1) 2ND_ARCH_VAR_PREFIX) ) TARGET_OUT_INTERMEDIATES) /NATIVE_TESTS/%\
$( $( if $( 2) ,$( $( 1) 2ND_ARCH_VAR_PREFIX) ) TARGET_OUT_INTERMEDIATES) /SHARED_LIBRARIES/%,\
$( call module-built-files,$( mod) ) ) ) ) \
\
$( if $( r) ,\
$( eval stamp := $( dir $( r) ) check_elf_files.timestamp) \
$( eval $( call add-elf-file-check-shared-lib,$( stamp) ,$( deps) ) ) \
) )
e n d e f
$( call resolve -shared -libs -for -elf -file -check ,TARGET_ )
i f d e f T A R G E T _ 2 N D _ A R C H
$( call resolve -shared -libs -for -elf -file -check ,TARGET_ ,true )
e n d i f
2009-03-04 11:28:42 +08:00
m :=
r :=
2013-02-23 06:32:30 +08:00
p :=
2018-11-06 17:32:40 +08:00
stamp :=
2014-06-11 05:21:20 +08:00
deps :=
2009-03-04 11:28:42 +08:00
add-required-deps :=
2017-04-08 15:31:31 +08:00
################################################################################
# Link type checking
#
# ALL_LINK_TYPES contains a list of all link type prefixes (generally one per
# module, but APKs can "link" to both java and native code). The link type
# prefix consists of all the information needed by intermediates-dir-for:
#
# LINK_TYPE:TARGET:_:2ND:STATIC_LIBRARIES:libfoo
#
# 1: LINK_TYPE literal
# 2: prefix
# - TARGET
# - HOST
# - HOST_CROSS
2017-08-01 08:42:42 +08:00
# - AUX-<variant-name>
2017-04-08 15:31:31 +08:00
# 3: Whether to use the common intermediates directory or not
# - _
# - COMMON
# 4: Whether it's the second arch or not
# - _
# - 2ND_
# 5: Module Class
# - STATIC_LIBRARIES
# - SHARED_LIBRARIES
# - ...
# 6: Module Name
#
# Then fields under that are separated by a period and the field name:
# - TYPE: the link types for this module
# - MAKEFILE: Where this module was defined
# - BUILT: The built module location
# - DEPS: the link type prefixes for the module's dependencies
# - ALLOWED: the link types to allow in this module's dependencies
# - WARN: the link types to warn about in this module's dependencies
#
# All of the dependency link types not listed in ALLOWED or WARN will become
# errors.
################################################################################
link_type_error :=
2017-08-01 08:42:42 +08:00
d e f i n e l i n k - t y p e - p r e f i x - b a s e
2017-04-08 15:31:31 +08:00
$(word 2,$(subst : , $( space ) , $( 1) ))
e n d e f
2017-08-01 08:42:42 +08:00
d e f i n e l i n k - t y p e - p r e f i x
$( if $ ( filter AUX -%,$ ( link -type -prefix -base ) ) ,$ ( patsubst AUX -%,AUX ,$ ( link -type -prefix -base ) ) ,$ ( link -type -prefix -base ) )
e n d e f
d e f i n e l i n k - t y p e - a u x - v a r i a n t
$( if $ ( filter AUX -%,$ ( link -type -prefix -base ) ) ,$ ( patsubst AUX -%,%,$ ( link -type -prefix -base ) ) )
e n d e f
2017-04-08 15:31:31 +08:00
d e f i n e l i n k - t y p e - c o m m o n
$(patsubst _,,$(word 3,$(subst : , $( space ) , $( 1) )))
e n d e f
d e f i n e l i n k - t y p e - 2 n d a r c h p r e f i x
$(patsubst _,,$(word 4,$(subst : , $( space ) , $( 1) )))
e n d e f
d e f i n e l i n k - t y p e - c l a s s
$(word 5,$(subst : , $( space ) , $( 1) ))
e n d e f
d e f i n e l i n k - t y p e - n a m e
$(word 6,$(subst : , $( space ) , $( 1) ))
e n d e f
d e f i n e l i n k - t y p e - o s
$(strip $(eval _p : = $( link -type -prefix ) )\
$( if $( filter HOST HOST_CROSS,$( _p) ) ,\
$( $( _p) _OS) ,\
$( if $( filter AUX,$( _p) ) ,AUX,android) ) )
e n d e f
d e f i n e l i n k - t y p e - a r c h
$( $ ( link -type -prefix ) _ $ ( link -type -2ndarchprefix ) ARCH )
e n d e f
d e f i n e l i n k - t y p e - n a m e - v a r i a n t
$( link -type -name ) ( $( link -type -class ) $( link -type -os ) - $( link -type -arch ) )
e n d e f
# $(1): the prefix of the module doing the linking
# $(2): the prefix of the linked module
d e f i n e l i n k - t y p e - w a r n i n g
$( shell $ ( call echo -warning ,$ ( $ ( 1) .MAKEFILE ) ,"$ ( call link -type -name ,$ ( 1) ) ( $ ( $ ( 1) .TYPE ) ) should not link against $ ( call link -type -name ,$ ( 2) ) ( $ ( 3) ) ") )
e n d e f
# $(1): the prefix of the module doing the linking
# $(2): the prefix of the linked module
d e f i n e l i n k - t y p e - e r r o r
$( shell $ ( call echo -error ,$ ( $ ( 1) .MAKEFILE ) ,"$ ( call link -type -name ,$ ( 1) ) ( $ ( $ ( 1) .TYPE ) ) can not link against $ ( call link -type -name ,$ ( 2) ) ( $ ( 3) ) ") ) \
$(eval link_type_error : = true )
e n d e f
link-type-missing :=
i f n e q ( $( ALLOW_MISSING_DEPENDENCIES ) , t r u e )
# Print an error message if the linked-to module is missing
# $(1): the prefix of the module doing the linking
# $(2): the prefix of the missing module
define link-type-missing
$( shell $( call echo-error,$( $( 1) .MAKEFILE) ," $( call link-type-name-variant,$( 1) ) missing $( call link-type-name-variant,$( 2) ) " ) ) \
$( eval available_variants := $( filter %:$( call link-type-name,$( 2) ) ,$( ALL_LINK_TYPES) ) ) \
$( if $( available_variants) ,\
$( info Available variants:) \
$( foreach v,$( available_variants) ,$( info $( space) $( space) $( call link-type-name-variant,$( v) ) ) ) ) \
$( info You can set ALLOW_MISSING_DEPENDENCIES = true in your environment if this is intentional, but that may defer real problems until later in the build.) \
$( eval link_type_error := true )
endef
e l s e
define link-type-missing
$( eval $$ ( 1) .MISSING := true )
endef
e n d i f
# Verify that $(1) can link against $(2)
# Both $(1) and $(2) are the link type prefix defined above
d e f i n e v e r i f y - l i n k - t y p e
$( foreach t ,$ ( $ ( 2) .TYPE ) ,\
$( if $( filter-out $( $( 1) .ALLOWED) ,$( t) ) ,\
$( if $( filter $( t) ,$( $( 1) .WARN) ) ,\
$( call link-type-warning,$( 1) ,$( 2) ,$( t) ) ,\
$( call link-type-error,$( 1) ,$( 2) ,$( t) ) ) ) )
e n d e f
# TODO: Verify all branches/configs have reasonable warnings/errors, and remove
Enable missing dependency checks
With this enabled, we'll check the entire build graph for missing
dependencies -- even if you don't need to build the module. So it'll
present more errors, but surface them earlier.
These can be turned off manually with an environment variable if the
branch is expected to have missing dependencies:
ALLOW_MISSING_DEPENDENCIES=true
SOONG_ALLOW_MISSING_DEPENDENCIES=true (previous method)
That will be set automatically when using 'mm', which doesn't load the
entire build graph. It will also be set when using 'tapas' to build
unbundled apps, since those are usually on reduced branches.
This provides better error messages when a library is missing:
system/core/init/Android.mk: error: init_tests (NATIVE_TESTS android-arm64) missing libinit (SHARED_LIBRARIES android-arm64)
Available variants:
libinit (STATIC_LIBRARIES android-arm64)
libinit (STATIC_LIBRARIES android-arm)
You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.
system/core/init/Android.mk: error: init_tests (NATIVE_TESTS android-arm) missing libinit (SHARED_LIBRARIES android-arm)
Available variants:
libinit (STATIC_LIBRARIES android-arm64)
libinit (STATIC_LIBRARIES android-arm)
You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.
build/core/main.mk:852: error: exiting from previous errors.
instead of:
ninja: error: 'out/target/product/generic_arm64/obj/SHARED_LIBRARIES/libinit_intermediates/export_includes', needed by 'out/target/product/generic_arm64/obj/NATIVE_TESTS/init_tests_intermediates/import_includes', missing and no known rule to make it
Bug: 37572490
Test: Manually introduce errors, check for expected output
Test: multiproduct_kati, no new breakages
Change-Id: I5847f813045929813214137403c499b44ef67907
2017-04-19 05:23:21 +08:00
# this override
2017-04-08 15:31:31 +08:00
verify-link-type = $( eval $$ ( 1) .MISSING := true )
$( foreach lt ,$ ( ALL_LINK_TYPES ) ,\
$( foreach d,$( $( lt) .DEPS) ,\
$( if $( $( d) .TYPE) ,\
$( call verify-link-type,$( lt) ,$( d) ) ,\
$( call link-type-missing,$( lt) ,$( d) ) ) ) )
i f d e f l i n k _ t y p e _ e r r o r
$( error exiting from previous errors)
e n d i f
# The intermediate filename for link type rules
#
# APPS are special -- they have up to three different rules:
# 1. The COMMON rule for Java libraries
# 2. The jni_link_type rule for embedded native code
# 3. The 2ND_jni_link_type for the second architecture native code
d e f i n e l i n k - t y p e - f i l e
2017-08-01 08:42:42 +08:00
$(eval _ltf_aux_variant : =$( link -type -aux -variant ) )\
$( if $ ( _ltf_aux_variant ) ,$ ( call aux -variant -load -env ,$ ( _ltf_aux_variant ) ) ) \
$( call intermediates -dir -for ,$ ( link -type -class ) ,$ ( link -type -name ) ,$ ( filter AUX HOST HOST_CROSS ,$ ( link -type -prefix ) ) ,$ ( link -type -common ) ,$ ( link -type -2ndarchprefix ) ,$ ( filter HOST_CROSS ,$ ( link -type -prefix ) ) ) / $( if $ ( filter APPS ,$ ( link -type -class ) ) ,$ ( if $ ( link -type -common ) ,,$ ( link -type -2ndarchprefix ) jni_ ) ) l i n k _ t y p e \
$( if $ ( _ltf_aux_variant ) ,$ ( call aux -variant -load -env ,none ) ) \
$(eval _ltf_aux_variant : =)
2017-04-08 15:31:31 +08:00
e n d e f
# Write out the file-based link_type rules for the ALLOW_MISSING_DEPENDENCIES
# case. We always need to write the file for mm to work, but only need to
# check it if we weren't able to check it when reading the Android.mk files.
d e f i n e l i n k - t y p e - f i l e - r u l e
my_link_type_deps := $( foreach l,$( $( 1) .DEPS) ,$( call link-type-file,$( l) ) )
my_link_type_file := $( call link-type-file,$( 1) )
$($(1).BUILT) : | $$( my_link_type_file )
$$ (my_link_type_file) : PRIVATE_DEPS := $$( my_link_type_deps )
i f e q ( $( $ ( 1) .MISSING ) , t r u e )
$$ (my_link_type_file) : $( CHECK_LINK_TYPE )
e n d i f
$$ (my_link_type_file) : $$( my_link_type_deps )
@echo Check module type: $$ @
$$ ( hide) mkdir -p $$ ( dir $$ @) && rm -f $$ @
i f e q ( $( $ ( 1) .MISSING ) , t r u e )
$$ ( hide) $( CHECK_LINK_TYPE) --makefile $( $( 1) .MAKEFILE) --module $( link-type-name) \
--type " $( $( 1) .TYPE) " $( addprefix --allowed ,$( $( 1) .ALLOWED) ) \
$( addprefix --warn ,$( $( 1) .WARN) ) $$ ( PRIVATE_DEPS)
e n d i f
$$ ( hide) echo " $( $( 1) .TYPE) " >$$ @
e n d e f
$( foreach lt ,$ ( ALL_LINK_TYPES ) ,\
$( eval $( call link-type-file-rule,$( lt) ) ) )
2009-03-04 11:28:42 +08:00
# -------------------------------------------------------------------
# Figure out our module sets.
2012-05-23 05:08:50 +08:00
#
2009-03-04 11:28:42 +08:00
# Of the modules defined by the component makefiles,
# determine what we actually want to build.
2018-09-13 01:01:32 +08:00
# Expand a list of modules to the modules that they override (if any)
# $(1): The list of modules.
d e f i n e m o d u l e - o v e r r i d e s
2018-11-07 17:39:34 +08:00
$( foreach m ,$ ( 1) ,$ ( PACKAGES .$ ( m ) .OVERRIDES ) $ ( EXECUTABLES .$ ( m ) .OVERRIDES ) $ ( SHARED_LIBRARIES .$ ( m ) .OVERRIDES ) )
2018-09-13 01:01:32 +08:00
e n d e f
2014-06-11 05:21:20 +08:00
###########################################################
## Expand a module name list with REQUIRED modules
###########################################################
# $(1): The variable name that holds the initial module name list.
# the variable will be modified to hold the expanded results.
# $(2): The initial module name list.
2018-09-13 01:01:32 +08:00
# $(3): The list of overridden modules.
2014-06-11 05:21:20 +08:00
# Returns empty string (maybe with some whitespaces).
d e f i n e e x p a n d - r e q u i r e d - m o d u l e s
2018-06-01 21:02:05 +08:00
$(eval _erm_req : = $( foreach m ,$ ( 2) ,$ ( ALL_MODULES .$ ( m ) .REQUIRED ) ) ) \
2018-09-13 01:01:32 +08:00
$(eval _erm_new_modules : = $( sort $ ( filter -out $ ( $ ( 1) ) ,$ ( _erm_req ) ) ) ) \
$(eval _erm_new_overrides : = $( call module -overrides ,$ ( _erm_new_modules ) ) ) \
$(eval _erm_all_overrides : = $( 3) $( _erm_new_overrides ) ) \
$(eval _erm_new_modules : = $( filter -out $ ( _erm_all_overrides ) , $ ( _erm_new_modules ) ) ) \
$(eval $(1) : = $( filter -out $ ( _erm_new_overrides ) ,$ ( $ ( 1) ) ) ) \
$( eval $ ( 1) += $ ( _erm_new_modules ) ) \
$( if $ ( _erm_new_modules ) ,\
$( call expand-required-modules,$( 1) ,$( _erm_new_modules) ,$( _erm_all_overrides) ) )
2014-06-11 05:21:20 +08:00
e n d e f
2018-07-13 22:32:57 +08:00
# Transforms paths relative to PRODUCT_OUT to absolute paths.
# $(1): list of relative paths
# $(2): optional suffix to append to paths
d e f i n e r e s o l v e - p r o d u c t - r e l a t i v e - p a t h s
$( subst $( _vendor_path_placeholder) ,$( TARGET_COPY_OUT_VENDOR) ,\
$( subst $( _product_path_placeholder) ,$( TARGET_COPY_OUT_PRODUCT) ,\
2018-08-28 22:45:01 +08:00
$( subst $( _product_services_path_placeholder) ,$( TARGET_COPY_OUT_PRODUCT_SERVICES) ,\
$( subst $( _odm_path_placeholder) ,$( TARGET_COPY_OUT_ODM) ,\
$( foreach p,$( 1) ,$( call append-path,$( PRODUCT_OUT) ,$( p) $( 2) ) ) ) ) ) )
2018-07-13 22:32:57 +08:00
e n d e f
2019-01-25 20:51:21 +08:00
# Returns modules included automatically as a result of certain BoardConfig
# variables being set.
d e f i n e a u t o - i n c l u d e d - m o d u l e s
$( if $( BOARD_VNDK_VERSION) ,vndk_package) \
$( if $( DEVICE_MANIFEST_FILE) ,device_manifest.xml) \
e n d e f
2018-07-13 22:32:57 +08:00
# Lists most of the files a particular product installs, including:
# - PRODUCT_PACKAGES, and their LOCAL_REQUIRED_MODULES
# - PRODUCT_COPY_FILES
2018-06-01 21:02:05 +08:00
# The base list of modules to build for this product is specified
# by the appropriate product definition file, which was included
# by product_config.mk.
2018-07-05 22:57:56 +08:00
# Name resolution for PRODUCT_PACKAGES:
# foo:32 resolves to foo_32;
# foo:64 resolves to foo;
# foo resolves to both foo and foo_32 (if foo_32 is defined).
#
# Name resolution for LOCAL_REQUIRED_MODULES:
# If a module is built for 2nd arch, its required module resolves to
# 32-bit variant, if it exits. See the select-bitness-of-required-modules definition.
2018-06-01 21:02:05 +08:00
# $(1): product makefile
d e f i n e p r o d u c t - i n s t a l l e d - f i l e s
2018-07-13 22:32:57 +08:00
$( eval _mk := $( strip $( 1) ) ) \
2018-09-13 00:30:09 +08:00
$( eval _pif_modules := \
$( PRODUCTS.$( _mk) .PRODUCT_PACKAGES) \
$( if $( filter eng,$( tags_to_install) ) ,$( PRODUCTS.$( _mk) .PRODUCT_PACKAGES_ENG) ) \
$( if $( filter debug,$( tags_to_install) ) ,$( PRODUCTS.$( _mk) .PRODUCT_PACKAGES_DEBUG) ) \
$( if $( filter tests,$( tags_to_install) ) ,$( PRODUCTS.$( _mk) .PRODUCT_PACKAGES_TESTS) ) \
$( if $( filter asan,$( tags_to_install) ) ,$( PRODUCTS.$( _mk) .PRODUCT_PACKAGES_DEBUG_ASAN) ) \
2019-01-25 20:51:21 +08:00
$( call auto-included-modules) \
2018-09-13 00:30:09 +08:00
) \
2018-06-01 21:02:05 +08:00
$( eval ### Filter out the overridden packages and executables before doing expansion) \
2018-09-13 01:01:32 +08:00
$( eval _pif_overrides := $( call module-overrides,$( _pif_modules) ) ) \
2018-06-01 21:02:05 +08:00
$( eval _pif_modules := $( filter-out $( _pif_overrides) , $( _pif_modules) ) ) \
$( eval ### Resolve the :32 :64 module name) \
$( eval _pif_modules_32 := $( patsubst %:32,%,$( filter %:32, $( _pif_modules) ) ) ) \
$( eval _pif_modules_64 := $( patsubst %:64,%,$( filter %:64, $( _pif_modules) ) ) ) \
$( eval _pif_modules_rest := $( filter-out %:32 %:64,$( _pif_modules) ) ) \
$( eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
$( eval _pif_modules := $( call get-32-bit-modules-if-we-can, $( _pif_modules_32) ) ) \
$( eval _pif_modules += $( _pif_modules_64) ) \
$( eval ### For the rest we add both) \
$( eval _pif_modules += $( call get-32-bit-modules, $( _pif_modules_rest) ) ) \
$( eval _pif_modules += $( _pif_modules_rest) ) \
2018-09-13 01:01:32 +08:00
$( call expand-required-modules,_pif_modules,$( _pif_modules) ,$( _pif_overrides) ) \
2018-07-13 22:32:57 +08:00
$( call module-installed-files, $( _pif_modules) ) \
$( call resolve-product-relative-paths,\
$( foreach cf,$( PRODUCTS.$( _mk) .PRODUCT_COPY_FILES) ,$( call word-colon,2,$( cf) ) ) )
2018-06-01 21:02:05 +08:00
e n d e f
2018-07-05 00:17:23 +08:00
# Fails the build if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT).
# $(1): list of files to print
# $(2): heading to print on failure
d e f i n e m a y b e - p r i n t - l i s t - a n d - e r r o r
$( if $ ( strip $ ( 1) ) , \
$( warning $( 2) ) \
$( info Offending entries:) \
$( foreach e,$( sort $( 1) ) ,$( info $( patsubst $( PRODUCT_OUT) /%,%,$( e) ) ) ) \
$( error Build failed) \
)
e n d e f
i f e q ( t r u e | , $( PRODUCTS .$ ( INTERNAL_PRODUCT ) .PRODUCT_ENFORCE_PACKAGES_EXIST ) | $( filter true ,$ ( ALLOW_MISSING_DEPENDENCIES ) ) )
_whitelist := $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST)
_modules := $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_PACKAGES)
# Sanity check all modules in PRODUCT_PACKAGES exist. We check for the
# existence if either <module> or the <module>_32 variant.
_nonexistant_modules := $( filter-out $( ALL_MODULES) ,$( _modules) )
_nonexistant_modules := $( foreach m,$( _nonexistant_modules) ,\
$( if $( call get-32-bit-modules,$( m) ) ,,$( m) ) )
$( call maybe-print-list-and-error,$( filter-out $( _whitelist) ,$( _nonexistant_modules) ) ,\
$( INTERNAL_PRODUCT) includes non-existant modules in PRODUCT_PACKAGES)
$( call maybe-print-list-and-error,$( filter-out $( _nonexistant_modules) ,$( _whitelist) ) ,\
$( INTERNAL_PRODUCT) includes redundant whitelist entries for nonexistant PRODUCT_PACKAGES)
e n d i f
2009-03-04 11:28:42 +08:00
i f d e f F U L L _ B U I L D
2018-06-01 21:02:05 +08:00
product_FILES := $( call product-installed-files, $( INTERNAL_PRODUCT) )
2018-10-12 18:34:29 +08:00
# WARNING: The product_MODULES variable is depended on by external files.
product_MODULES := $( _pif_modules)
2018-07-24 20:31:08 +08:00
# Verify the artifact path requirements made by included products.
2018-11-14 01:02:00 +08:00
is_asan := $( if $( filter address,$( SANITIZE_TARGET) ) ,true)
ifneq ( true,$( or $( is_asan) ,$( DISABLE_ARTIFACT_PATH_REQUIREMENTS) ) )
2019-01-19 11:40:56 +08:00
# Fakes don't get installed, host files are irrelevant, and NDK stubs aren't installed to device.
static_whitelist_patterns := $( TARGET_OUT_FAKE) /% $( HOST_OUT) /% $( SOONG_OUT_DIR) /ndk/%
2018-10-15 18:35:15 +08:00
# RROs become REQUIRED by the source module, but are always placed on the vendor partition.
static_whitelist_patterns += %__auto_generated_rro.apk
2019-01-25 20:51:21 +08:00
# Auto-included targets are not considered
static_whitelist_patterns += $( call module-installed-files,$( call auto-included-modules) )
2019-01-12 23:38:14 +08:00
# $(PRODUCT_OUT)/apex is where shared libraries in APEXes get installed.
# The path can be considered as a fake path, as the shared libraries
# are installed there just to have symbols files for them under
# $(PRODUCT_OUT)/symbols/apex for debugging purpose. The /apex directory
# is never compiled into a filesystem image.
static_whitelist_patterns += $( PRODUCT_OUT) /apex/%
2018-10-15 18:35:15 +08:00
ifeq ( true,$( BOARD_USES_SYSTEM_OTHER_ODEX) )
# Allow system_other odex space optimization.
static_whitelist_patterns += \
$( TARGET_OUT_SYSTEM_OTHER) /%.odex \
$( TARGET_OUT_SYSTEM_OTHER) /%.vdex \
$( TARGET_OUT_SYSTEM_OTHER) /%.art
endif
2018-12-17 13:45:15 +08:00
CERTIFICATE_VIOLATION_MODULES_FILENAME := $( PRODUCT_OUT) /certificate_violation_modules.txt
$(CERTIFICATE_VIOLATION_MODULES_FILENAME) :
rm -f $@
$( foreach m,$( sort $( CERTIFICATE_VIOLATION_MODULES) ) , echo $( m) >> $@ ; )
$( call dist -for -goals ,droidcore ,$ ( CERTIFICATE_VIOLATION_MODULES_FILENAME ) )
2018-07-24 20:31:08 +08:00
all_offending_files :=
$( foreach makefile,$( ARTIFACT_PATH_REQUIREMENT_PRODUCTS) ,\
$( eval requirements := $( PRODUCTS.$( makefile) .ARTIFACT_PATH_REQUIREMENTS) ) \
$( eval ### Verify that the product only produces files inside its path requirements.) \
$( eval whitelist := $( PRODUCTS.$( makefile) .ARTIFACT_PATH_WHITELIST) ) \
$( eval path_patterns := $( call resolve-product-relative-paths,$( requirements) ,%) ) \
$( eval whitelist_patterns := $( call resolve-product-relative-paths,$( whitelist) ) ) \
$( eval files := $( call product-installed-files, $( makefile) ) ) \
2018-10-15 18:35:15 +08:00
$( eval offending_files := $( filter-out $( path_patterns) $( whitelist_patterns) $( static_whitelist_patterns) ,$( files) ) ) \
2018-07-24 20:31:08 +08:00
$( call maybe-print-list-and-error,$( offending_files) ,$( makefile) produces files outside its artifact path requirement.) \
$( eval unused_whitelist := $( filter-out $( files) ,$( whitelist_patterns) ) ) \
$( call maybe-print-list-and-error,$( unused_whitelist) ,$( makefile) includes redundant whitelist entries in its artifact path requirement.) \
$( eval ### Optionally verify that nothing else produces files inside this artifact path requirement.) \
$( eval extra_files := $( filter-out $( files) $( HOST_OUT) /%,$( product_FILES) ) ) \
$( eval files_in_requirement := $( filter $( path_patterns) ,$( extra_files) ) ) \
$( eval all_offending_files += $( files_in_requirement) ) \
$( eval whitelist := $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST) ) \
$( eval whitelist_patterns := $( call resolve-product-relative-paths,$( whitelist) ) ) \
$( eval offending_files := $( filter-out $( whitelist_patterns) ,$( files_in_requirement) ) ) \
2018-10-12 22:52:27 +08:00
$( eval enforcement := $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS) ) \
$( if $( enforcement) ,\
2018-10-12 23:15:49 +08:00
$( call maybe-print-list-and-error,$( offending_files) ,\
$( INTERNAL_PRODUCT) produces files inside $( makefile) s artifact path requirement. \
$( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT) ) \
2018-10-12 22:52:27 +08:00
$( eval unused_whitelist := $( if $( filter true strict,$( enforcement) ) ,\
$( foreach p,$( whitelist_patterns) ,$( if $( filter $( p) ,$( extra_files) ) ,,$( p) ) ) ) ) \
2018-07-24 20:31:08 +08:00
$( call maybe-print-list-and-error,$( unused_whitelist) ,$( INTERNAL_PRODUCT) includes redundant artifact path requirement whitelist entries.) \
) \
)
$(PRODUCT_OUT)/offending_artifacts.txt :
rm -f $@
$( foreach f,$( sort $( all_offending_files) ) ,echo $( f) >> $@ ; )
2018-11-09 21:32:12 +08:00
endif
2009-03-04 11:28:42 +08:00
e l s e
# We're not doing a full build, and are probably only including
# a subset of the module makefiles. Don't try to build any modules
# requested by the product, because we probably won't have rules
# to build them.
2012-07-12 10:38:48 +08:00
product_FILES :=
2009-03-04 11:28:42 +08:00
e n d i f
2012-05-23 05:08:50 +08:00
# TODO: Remove the 3 places in the tree that use ALL_DEFAULT_INSTALLED_MODULES
# and get rid of it from this list.
modules_to_install := $( sort \
2012-05-23 08:33:22 +08:00
$( ALL_DEFAULT_INSTALLED_MODULES) \
2012-07-12 10:38:48 +08:00
$( product_FILES) \
2018-09-13 00:30:09 +08:00
$( call get-tagged-modules,$( tags_to_install) ) \
2012-05-23 08:33:22 +08:00
$( CUSTOM_MODULES) \
)
2009-03-04 11:28:42 +08:00
2015-05-16 07:55:30 +08:00
# Don't include any GNU General Public License shared objects or static
# libraries in SDK images. GPL executables (not static/dynamic libraries)
# are okay if they don't link against any closed source libraries (directly
# or indirectly)
# It's ok (and necessary) to build the host tools, but nothing that's
# going to be installed on the target (including static libraries).
2009-04-14 07:32:16 +08:00
i f d e f i s _ s d k _ b u i l d
2009-03-04 11:28:42 +08:00
target_gnu_MODULES := \
$( filter \
$( TARGET_OUT_INTERMEDIATES) /% \
$( TARGET_OUT) /% \
$( TARGET_OUT_DATA) /%, \
$( sort $( call get-tagged-modules,gnu) ) )
2015-05-19 03:02:26 +08:00
target_gnu_MODULES := $( filter-out $( TARGET_OUT_EXECUTABLES) /%,$( target_gnu_MODULES) )
2017-05-20 06:07:02 +08:00
target_gnu_MODULES := $( filter-out %/libopenjdkjvmti.so,$( target_gnu_MODULES) )
target_gnu_MODULES := $( filter-out %/libopenjdkjvmtid.so,$( target_gnu_MODULES) )
2009-03-04 11:28:42 +08:00
$( info Removing from sdk:) $( foreach d,$( target_gnu_MODULES) ,$( info : $( d) ) )
2009-03-10 02:52:11 +08:00
modules_to_install := \
$( filter-out $( target_gnu_MODULES) ,$( modules_to_install) )
2011-10-09 05:31:54 +08:00
2012-06-06 06:54:09 +08:00
# Ensure every module listed in PRODUCT_PACKAGES* gets something installed
# TODO: Should we do this for all builds and not just the sdk?
2014-02-12 09:28:30 +08:00
dangling_modules :=
2011-10-09 05:31:54 +08:00
$( foreach m, $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_PACKAGES) , \
2014-06-11 10:23:29 +08:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) $( ALL_MODULES.$( m) $( TARGET_2ND_ARCH_MODULE_SUFFIX) .INSTALLED) ) ,,\
2014-02-12 09:28:30 +08:00
$( eval dangling_modules += $( m) ) ) )
ifneq ( $( dangling_modules) ,)
2014-02-19 03:17:53 +08:00
$( warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES have nothing to install!)
2014-02-12 09:28:30 +08:00
endif
2012-06-06 06:54:09 +08:00
$( foreach m, $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_PACKAGES_DEBUG) , \
2012-08-17 15:09:27 +08:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) ) ,,\
2012-08-17 16:26:41 +08:00
$( warning $( ALL_MODULES.$( m) .MAKEFILE) : Module '$(m)' in PRODUCT_PACKAGES_DEBUG has nothing to install!) ) )
2012-06-06 06:54:09 +08:00
$( foreach m, $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_PACKAGES_ENG) , \
2012-08-17 15:09:27 +08:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) ) ,,\
2012-08-17 16:26:41 +08:00
$( warning $( ALL_MODULES.$( m) .MAKEFILE) : Module '$(m)' in PRODUCT_PACKAGES_ENG has nothing to install!) ) )
2012-06-06 06:54:09 +08:00
$( foreach m, $( PRODUCTS.$( INTERNAL_PRODUCT) .PRODUCT_PACKAGES_TESTS) , \
2012-08-17 15:09:27 +08:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) ) ,,\
2012-08-17 16:26:41 +08:00
$( warning $( ALL_MODULES.$( m) .MAKEFILE) : Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!) ) )
2009-03-04 11:28:42 +08:00
e n d i f
2017-10-21 02:37:33 +08:00
# build/make/core/Makefile contains extra stuff that we don't want to pollute this
2009-03-04 11:28:42 +08:00
# top-level makefile with. It expects that ALL_DEFAULT_INSTALLED_MODULES
# contains everything that's built during the current make, but it also further
# extends ALL_DEFAULT_INSTALLED_MODULES.
2009-03-10 02:52:11 +08:00
ALL_DEFAULT_INSTALLED_MODULES := $( modules_to_install)
2009-03-04 11:28:42 +08:00
i n c l u d e $( BUILD_SYSTEM ) / M a k e f i l e
2009-03-10 02:52:11 +08:00
modules_to_install := $( sort $( ALL_DEFAULT_INSTALLED_MODULES) )
2009-03-04 11:28:42 +08:00
ALL_DEFAULT_INSTALLED_MODULES :=
2012-05-22 03:16:05 +08:00
2009-07-18 03:33:40 +08:00
# These are additional goals that we build, in order to make sure that there
# is as little code as possible in the tree that doesn't build.
modules_to_check := $( foreach m,$( ALL_MODULES) ,$( ALL_MODULES.$( m) .CHECKED) )
# If you would like to build all goals, and not skip any intermediate
# steps, you can pass the "all" modifier goal on the commandline.
i f n e q ( $( filter all ,$ ( MAKECMDGOALS ) ) , )
modules_to_check += $( foreach m,$( ALL_MODULES) ,$( ALL_MODULES.$( m) .BUILT) )
e n d i f
2018-11-03 01:47:30 +08:00
# Build docs as part of checkbuild to catch more breakages.
module_to_check += $( ALL_DOCS)
2009-07-18 03:33:40 +08:00
# for easier debugging
modules_to_check := $( sort $( modules_to_check) )
#$(error modules_to_check $(modules_to_check))
2009-03-04 11:28:42 +08:00
# -------------------------------------------------------------------
# This is used to to get the ordering right, you can also use these,
# but they're considered undocumented, so don't complain if their
# behavior changes.
# An internal target that depends on all copied headers
# (see copy_headers.make). Other targets that need the
# headers to be copied first can depend on this target.
.PHONY : all_copied_headers
all_copied_headers : ;
$(ALL_C_CPP_ETC_OBJECTS) : | all_copied_headers
# All the droid stuff, in directories
.PHONY : files
2016-03-24 05:14:35 +08:00
files : $( modules_to_install ) \
$( INSTALLED_ANDROID_INFO_TXT_TARGET)
2009-03-04 11:28:42 +08:00
# -------------------------------------------------------------------
2009-07-18 03:33:40 +08:00
.PHONY : checkbuild
2015-09-26 07:43:36 +08:00
checkbuild : $( modules_to_check ) droid_targets
2016-05-26 03:55:43 +08:00
2015-09-26 07:43:36 +08:00
i f e q ( t r u e , $( ANDROID_BUILD_EVERYTHING_BY_DEFAULT ) )
2013-02-22 10:41:51 +08:00
droid : checkbuild
e n d i f
2009-07-18 03:33:40 +08:00
2009-03-04 11:28:42 +08:00
.PHONY : ramdisk
ramdisk : $( INSTALLED_RAMDISK_TARGET )
.PHONY : systemtarball
systemtarball : $( INSTALLED_SYSTEMTARBALL_TARGET )
2010-06-05 06:24:49 +08:00
.PHONY : boottarball
boottarball : $( INSTALLED_BOOTTARBALL_TARGET )
2009-03-04 11:28:42 +08:00
.PHONY : userdataimage
userdataimage : $( INSTALLED_USERDATAIMAGE_TARGET )
2011-02-02 06:52:05 +08:00
i f n e q ( , $( filter userdataimage , $ ( MAKECMDGOALS ) ) )
$( call dist -for -goals , userdataimage , $ ( BUILT_USERDATAIMAGE_TARGET ) )
e n d i f
2009-03-04 11:28:42 +08:00
.PHONY : userdatatarball
userdatatarball : $( INSTALLED_USERDATATARBALL_TARGET )
2011-11-05 02:37:01 +08:00
.PHONY : cacheimage
cacheimage : $( INSTALLED_CACHEIMAGE_TARGET )
2016-04-09 03:08:03 +08:00
.PHONY : bptimage
bptimage : $( INSTALLED_BPTIMAGE_TARGET )
2013-03-21 02:02:05 +08:00
.PHONY : vendorimage
vendorimage : $( INSTALLED_VENDORIMAGE_TARGET )
2017-11-27 16:04:47 +08:00
.PHONY : productimage
productimage : $( INSTALLED_PRODUCTIMAGE_TARGET )
2018-05-29 20:09:01 +08:00
.PHONY : productservicesimage
productservicesimage : $( INSTALLED_PRODUCT_SERVICESIMAGE_TARGET )
2017-11-14 23:42:30 +08:00
.PHONY : odmimage
odmimage : $( INSTALLED_ODMIMAGE_TARGET )
2016-06-17 05:47:10 +08:00
.PHONY : systemotherimage
systemotherimage : $( INSTALLED_SYSTEMOTHERIMAGE_TARGET )
2018-07-25 08:45:08 +08:00
.PHONY : superimage
superimage : $( INSTALLED_SUPERIMAGE_TARGET )
2018-08-14 04:01:14 +08:00
.PHONY : superimage_empty
superimage_empty : $( INSTALLED_SUPERIMAGE_EMPTY_TARGET )
2009-03-04 11:28:42 +08:00
.PHONY : bootimage
bootimage : $( INSTALLED_BOOTIMAGE_TARGET )
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
.PHONY : vbmetaimage
vbmetaimage : $( INSTALLED_VBMETAIMAGE_TARGET )
2016-08-02 08:41:49 +08:00
.PHONY : auxiliary
auxiliary : $( INSTALLED_AUX_TARGETS )
2013-02-09 10:01:04 +08:00
2009-03-04 11:28:42 +08:00
# Build files and then package it into the rom formats
.PHONY : droidcore
2019-01-15 13:46:31 +08:00
droidcore : $( filter $ ( HOST_OUT_ROOT ) /%,$ ( modules_to_install ) ) \
$( INSTALLED_SYSTEMIMAGE_TARGET) \
2018-08-15 07:17:12 +08:00
$( INSTALLED_RAMDISK_TARGET) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_BOOTIMAGE_TARGET) \
$( INSTALLED_RECOVERYIMAGE_TARGET) \
$( INSTALLED_VBMETAIMAGE_TARGET) \
$( INSTALLED_USERDATAIMAGE_TARGET) \
$( INSTALLED_CACHEIMAGE_TARGET) \
$( INSTALLED_BPTIMAGE_TARGET) \
$( INSTALLED_VENDORIMAGE_TARGET) \
2017-11-14 23:42:30 +08:00
$( INSTALLED_ODMIMAGE_TARGET) \
2018-08-14 04:01:14 +08:00
$( INSTALLED_SUPERIMAGE_EMPTY_TARGET) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_PRODUCTIMAGE_TARGET) \
$( INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
$( INSTALLED_FILES_FILE) \
$( INSTALLED_FILES_JSON) \
$( INSTALLED_FILES_FILE_VENDOR) \
$( INSTALLED_FILES_JSON_VENDOR) \
2017-11-14 23:42:30 +08:00
$( INSTALLED_FILES_FILE_ODM) \
$( INSTALLED_FILES_JSON_ODM) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_FILES_FILE_PRODUCT) \
$( INSTALLED_FILES_JSON_PRODUCT) \
2018-05-29 20:09:01 +08:00
$( INSTALLED_FILES_FILE_PRODUCT_SERVICES) \
$( INSTALLED_FILES_JSON_PRODUCT_SERVICES) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_FILES_FILE_SYSTEMOTHER) \
$( INSTALLED_FILES_JSON_SYSTEMOTHER) \
2018-08-10 05:26:00 +08:00
$( INSTALLED_FILES_FILE_RAMDISK) \
$( INSTALLED_FILES_JSON_RAMDISK) \
$( INSTALLED_FILES_FILE_ROOT) \
$( INSTALLED_FILES_JSON_ROOT) \
2018-08-15 03:17:48 +08:00
$( INSTALLED_FILES_FILE_RECOVERY) \
$( INSTALLED_FILES_JSON_RECOVERY) \
2019-01-15 13:46:31 +08:00
$( INSTALLED_ANDROID_INFO_TXT_TARGET) \
2019-02-05 12:52:14 +08:00
auxiliary \
2018-06-14 05:04:22 +08:00
soong_docs
2009-03-04 11:28:42 +08:00
2010-12-09 12:07:48 +08:00
# dist_files only for putting your library into the dist directory with a full build.
.PHONY : dist_files
2010-07-14 12:08:38 +08:00
2018-09-12 13:47:45 +08:00
.PHONY : apps_only
2010-06-10 07:35:58 +08:00
i f n e q ( $( TARGET_BUILD_APPS ) , )
2010-06-10 09:18:31 +08:00
# If this build is just for apps, only build apps and not the full system by default.
2009-03-04 11:28:42 +08:00
2010-06-10 07:35:58 +08:00
unbundled_build_modules :=
ifneq ( $( filter all,$( TARGET_BUILD_APPS) ) ,)
2010-06-25 06:08:33 +08:00
# If they used the magic goal "all" then build all apps in the source tree.
unbundled_build_modules := $( foreach m,$( sort $( ALL_MODULES) ) ,$( if $( filter APPS,$( ALL_MODULES.$( m) .CLASS) ) ,$( m) ) )
2010-06-10 07:35:58 +08:00
else
unbundled_build_modules := $( TARGET_BUILD_APPS)
endif
2010-05-12 05:36:32 +08:00
2013-06-13 06:25:23 +08:00
# Dist the installed files if they exist.
2012-08-16 03:22:44 +08:00
apps_only_installed_files := $( foreach m,$( unbundled_build_modules) ,$( ALL_MODULES.$( m) .INSTALLED) )
$( call dist-for-goals,apps_only, $( apps_only_installed_files) )
2018-10-30 14:16:42 +08:00
# Dist the bundle files if they exist.
apps_only_bundle_files := $( foreach m,$( unbundled_build_modules) ,\
$( if $( ALL_MODULES.$( m) .BUNDLE) ,$( ALL_MODULES.$( m) .BUNDLE) :$( m) -base.zip) )
$( call dist-for-goals,apps_only, $( apps_only_bundle_files) )
2013-06-13 06:25:23 +08:00
# For uninstallable modules such as static Java library, we have to dist the built file,
# as <module_name>.<suffix>
apps_only_dist_built_files := $( foreach m,$( unbundled_build_modules) ,$( if $( ALL_MODULES.$( m) .INSTALLED) ,,\
2014-12-18 09:00:53 +08:00
$( if $( ALL_MODULES.$( m) .BUILT) ,$( ALL_MODULES.$( m) .BUILT) :$( m) $( suffix $( ALL_MODULES.$( m) .BUILT) ) ) \
$( if $( ALL_MODULES.$( m) .AAR) ,$( ALL_MODULES.$( m) .AAR) :$( m) .aar) \
) )
2013-06-13 06:25:23 +08:00
$( call dist-for-goals,apps_only, $( apps_only_dist_built_files) )
2012-08-16 03:22:44 +08:00
ifeq ( $( EMMA_INSTRUMENT) ,true)
2017-09-28 05:28:41 +08:00
$( JACOCO_REPORT_CLASSES_ALL) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( JACOCO_REPORT_CLASSES_ALL) )
2012-08-16 03:22:44 +08:00
endif
2010-06-10 07:35:58 +08:00
2013-08-23 11:52:47 +08:00
$( PROGUARD_DICT_ZIP) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( PROGUARD_DICT_ZIP) )
2014-10-25 02:36:59 +08:00
$( SYMBOLS_ZIP) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( SYMBOLS_ZIP) )
2016-09-13 04:56:50 +08:00
$( COVERAGE_ZIP) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( COVERAGE_ZIP) )
2010-06-10 09:18:31 +08:00
apps_only : $( unbundled_build_modules )
2010-06-10 07:35:58 +08:00
2015-09-26 07:43:36 +08:00
droid_targets : apps_only
2010-06-10 09:18:31 +08:00
2013-08-23 11:02:03 +08:00
# Combine the NOTICE files for a apps_only build
2017-04-19 14:26:47 +08:00
$( eval $ ( call combine -notice -files , html , \
2013-08-23 11:02:03 +08:00
$( target_notice_file_txt) , \
2017-04-19 14:26:47 +08:00
$( target_notice_file_html_or_xml) , \
2013-08-23 11:02:03 +08:00
"Notices for files for apps:" , \
$( TARGET_OUT_NOTICE_FILES) , \
$( apps_only_installed_files) ) )
2010-06-10 09:18:31 +08:00
e l s e # TARGET_BUILD_APPS
$( call dist-for-goals, droidcore, \
2010-06-10 07:35:58 +08:00
$( INTERNAL_UPDATE_PACKAGE_TARGET) \
$( INTERNAL_OTA_PACKAGE_TARGET) \
2018-11-09 09:44:12 +08:00
$( INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) \
2015-08-25 08:13:53 +08:00
$( BUILT_OTATOOLS_PACKAGE) \
2010-06-10 07:35:58 +08:00
$( SYMBOLS_ZIP) \
2016-09-13 04:56:50 +08:00
$( COVERAGE_ZIP) \
2018-07-24 03:20:15 +08:00
$( APPCOMPAT_ZIP) \
2010-06-10 07:35:58 +08:00
$( INSTALLED_FILES_FILE) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_FILES_JSON) \
2015-09-16 05:22:12 +08:00
$( INSTALLED_FILES_FILE_VENDOR) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_FILES_JSON_VENDOR) \
2017-11-14 23:42:30 +08:00
$( INSTALLED_FILES_FILE_ODM) \
$( INSTALLED_FILES_JSON_ODM) \
2017-11-27 16:04:47 +08:00
$( INSTALLED_FILES_FILE_PRODUCT) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_FILES_JSON_PRODUCT) \
2018-05-29 20:09:01 +08:00
$( INSTALLED_FILES_FILE_PRODUCT_SERVICES) \
$( INSTALLED_FILES_JSON_PRODUCT_SERVICES) \
2016-06-17 05:47:10 +08:00
$( INSTALLED_FILES_FILE_SYSTEMOTHER) \
2018-06-14 05:04:22 +08:00
$( INSTALLED_FILES_JSON_SYSTEMOTHER) \
2018-08-15 03:17:48 +08:00
$( INSTALLED_FILES_FILE_RECOVERY) \
$( INSTALLED_FILES_JSON_RECOVERY) \
2010-06-10 07:35:58 +08:00
$( INSTALLED_BUILD_PROP_TARGET) \
$( BUILT_TARGET_FILES_PACKAGE) \
$( INSTALLED_ANDROID_INFO_TXT_TARGET) \
2010-07-02 01:07:28 +08:00
$( INSTALLED_RAMDISK_TARGET) \
2010-06-10 07:35:58 +08:00
)
2013-07-27 03:19:20 +08:00
# Put a copy of the radio/bootloader files in the dist dir.
$( foreach f,$( INSTALLED_RADIOIMAGE_TARGET) , \
$( call dist-for-goals, droidcore, $( f) ) )
2013-10-02 22:51:11 +08:00
ifneq ( $( ANDROID_BUILD_EMBEDDED) ,true)
2012-03-30 05:31:08 +08:00
ifneq ( $( TARGET_BUILD_PDK) ,true)
$( call dist-for-goals, droidcore, \
$( APPS_ZIP) \
$( INTERNAL_EMULATOR_PACKAGE_TARGET) \
$( PACKAGE_STATS_FILE) \
)
endif
2013-10-02 22:51:11 +08:00
endif
2012-03-30 05:31:08 +08:00
2018-08-10 05:26:00 +08:00
$( call dist-for-goals, droidcore, \
$( INSTALLED_FILES_FILE_ROOT) \
$( INSTALLED_FILES_JSON_ROOT) \
)
ifneq ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE) ,true)
2018-07-04 06:41:40 +08:00
$( call dist-for-goals, droidcore, \
2018-08-10 05:26:00 +08:00
$( INSTALLED_FILES_FILE_RAMDISK) \
$( INSTALLED_FILES_JSON_RAMDISK) \
2018-07-04 06:41:40 +08:00
)
endif
2012-08-16 03:22:44 +08:00
ifeq ( $( EMMA_INSTRUMENT) ,true)
2018-08-21 12:09:07 +08:00
$( JACOCO_REPORT_CLASSES_ALL) : $( INSTALLED_SYSTEMIMAGE_TARGET)
2017-09-28 05:28:41 +08:00
$( call dist-for-goals, dist_files, $( JACOCO_REPORT_CLASSES_ALL) )
2018-06-21 02:39:16 +08:00
# Put XML formatted API files in the dist dir.
2019-02-14 09:48:00 +08:00
$( TARGET_OUT_COMMON_INTERMEDIATES) /api.xml: $( call java-lib-header-files,android_stubs_current) $( APICHECK)
$( TARGET_OUT_COMMON_INTERMEDIATES) /system-api.xml: $( call java-lib-header-files,android_system_stubs_current) $( APICHECK)
$( TARGET_OUT_COMMON_INTERMEDIATES) /test-api.xml: $( call java-lib-header-files,android_test_stubs_current) $( APICHECK)
2018-06-21 02:39:16 +08:00
api_xmls := $( addprefix $( TARGET_OUT_COMMON_INTERMEDIATES) /,api.xml system-api.xml test-api.xml)
2019-02-14 09:48:00 +08:00
$( api_xmls) :
2018-06-21 02:39:16 +08:00
$( hide) echo " Converting API file to XML: $@ "
$( hide) mkdir -p $( dir $@ )
2019-02-14 09:48:00 +08:00
$( hide) $( APICHECK_COMMAND) --input-api-jar $< --api-xml $@
2018-06-21 02:39:16 +08:00
$( call dist-for-goals, dist_files, $( api_xmls) )
api_xmls :=
2012-08-16 03:22:44 +08:00
endif
2010-06-10 09:18:31 +08:00
# Building a full system-- the default is to build droidcore
2015-09-26 07:43:36 +08:00
droid_targets : droidcore dist_files
2010-05-14 07:46:21 +08:00
2010-06-16 06:43:13 +08:00
e n d i f # TARGET_BUILD_APPS
2009-03-04 11:28:42 +08:00
.PHONY : docs
docs : $( ALL_DOCS )
2018-10-27 02:17:25 +08:00
.PHONY : sdk win_sdk winsdk -tools sdk_addon
2009-03-04 11:28:42 +08:00
ALL_SDK_TARGETS := $( INTERNAL_SDK_TARGET)
sdk : $( ALL_SDK_TARGETS )
2011-02-16 08:09:36 +08:00
$( call dist -for -goals ,sdk win_sdk , \
2011-03-08 08:13:32 +08:00
$( ALL_SDK_TARGETS) \
$( SYMBOLS_ZIP) \
2016-09-13 04:56:50 +08:00
$( COVERAGE_ZIP) \
2018-07-24 03:20:15 +08:00
$( APPCOMPAT_ZIP) \
2011-03-08 08:13:32 +08:00
$( INSTALLED_BUILD_PROP_TARGET) \
)
2009-03-04 11:28:42 +08:00
2013-01-30 08:59:18 +08:00
# umbrella targets to assit engineers in verifying builds
2013-01-31 03:22:06 +08:00
.PHONY : java native target host java -host java -target native -host native -target \
2013-01-30 08:59:18 +08:00
java-host-tests java-target-tests native-host-tests native-target-tests \
2018-07-24 16:21:12 +08:00
java-tests native-tests host-tests target-tests tests java-dex \
native-host-cross
2013-01-30 08:59:18 +08:00
# some synonyms
.PHONY : host -java target -java host -native target -native \
target-java-tests target-native-tests
host-java : java -host
target-java : java -target
host-native : native -host
target-native : native -target
target-java-tests : java -target -tests
target-native-tests : native -target -tests
2014-05-08 07:39:21 +08:00
tests : host -tests target -tests
2013-01-30 08:59:18 +08:00
2017-09-28 05:28:41 +08:00
# Phony target to run all java compilations that use javac
2016-03-25 02:00:30 +08:00
.PHONY : javac -check
2014-02-27 03:55:38 +08:00
i f n e q ( , $( filter samplecode , $ ( MAKECMDGOALS ) ) )
2010-02-26 12:20:43 +08:00
.PHONY : samplecode
sample_MODULES := $( sort $( call get-tagged-modules,samples) )
sample_APKS_DEST_PATH := $( TARGET_COMMON_OUT_ROOT) /samples
sample_APKS_COLLECTION := \
$( foreach module,$( sample_MODULES) ,$( sample_APKS_DEST_PATH) /$( notdir $( module) ) )
$( foreach module ,$ ( sample_MODULES ) ,$ ( eval $ ( call \
copy-one-file,$( module) ,$( sample_APKS_DEST_PATH) /$( notdir $( module) ) ) ) )
sample_ADDITIONAL_INSTALLED := \
2016-03-24 05:14:35 +08:00
$( filter-out $( modules_to_install) $( modules_to_check) ,$( sample_MODULES) )
2010-02-26 12:20:43 +08:00
samplecode : $( sample_APKS_COLLECTION )
@echo " Collect sample code apks: $^ "
# remove apks that are not intended to be installed.
rm -f $( sample_ADDITIONAL_INSTALLED)
2014-02-27 03:55:38 +08:00
e n d i f # samplecode in $(MAKECMDGOALS)
2010-02-26 12:20:43 +08:00
2009-03-04 11:28:42 +08:00
.PHONY : findbugs
findbugs : $( INTERNAL_FINDBUGS_HTML_TARGET ) $( INTERNAL_FINDBUGS_XML_TARGET )
2018-02-24 08:50:39 +08:00
.PHONY : findlsdumps
findlsdumps : $( FIND_LSDUMPS_FILE )
2018-11-06 17:32:40 +08:00
.PHONY : check -elf -files
check-elf-files :
2009-03-04 11:28:42 +08:00
#xxx scrape this from ALL_MODULE_NAME_TAGS
.PHONY : modules
modules :
@echo "Available sub-modules:"
@echo " $( call module-names-for-tag-list,$( ALL_MODULE_TAGS) ) " | \
2009-01-24 00:11:30 +08:00
tr -s ' ' '\n' | sort -u | $( COLUMN)
2009-03-04 11:28:42 +08:00
2018-10-01 23:26:17 +08:00
.PHONY : dump -files
dump-files :
$( info product_FILES for $( TARGET_DEVICE) ( $( INTERNAL_PRODUCT) ) :)
2018-11-19 22:33:19 +08:00
$( foreach p,$( sort $( product_FILES) ) ,$( info : $( p) ) )
2018-10-01 23:26:17 +08:00
@echo Successfully dumped product file list
2012-05-19 11:41:38 +08:00
.PHONY : nothing
nothing :
@echo Successfully read the makefiles.
2016-04-01 07:30:23 +08:00
.PHONY : tidy_only
tidy_only :
@echo Successfully make tidy_only.
2016-07-28 12:57:49 +08:00
ndk : $( SOONG_OUT_DIR ) /ndk .timestamp
.PHONY : ndk
2018-10-18 07:50:49 +08:00
$( call dist -write -file ,$ ( KATI_PACKAGE_MK_DIR ) /dist .mk )
2018-07-11 06:02:14 +08:00
$( info [$ ( call inc_and_print ,subdir_makefiles_inc ) /$ ( subdir_makefiles_total ) ] writing build rules ...)
2016-01-07 06:28:36 +08:00
e n d i f # KATI