2016-09-06 22:19:14 +02:00
i f n d e f K A T I
2019-07-30 07:39:08 +02:00
$( warning Calling make directly is no longer supported .)
$( warning Either use 'envsetup .sh ; m ' or 'build /soong /soong_ui .bash --make -mode ')
$( error done )
2016-09-06 22:19:14 +02:00
e n d i f
2018-07-11 00:02:14 +02:00
$( info [1/1] initializing build system ...)
2012-05-23 03:29:02 +02: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 04:28:42 +01:00
# This is the default target. It must be the first declared target.
2010-06-10 03:18:31 +02:00
.PHONY : droid
2009-03-04 04:28:42 +01:00
DEFAULT_GOAL := droid
2015-09-26 01:43:36 +02:00
$(DEFAULT_GOAL) : droid_targets
.PHONY : droid_targets
droid_targets :
2009-03-04 04:28:42 +01:00
# Set up various standard variables based on configuration
# and host information.
2018-10-19 01:11:40 +02: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 04:28:42 +01:00
2016-11-10 01:35:34 +01:00
i f n e q ( $( filter $ ( dont_bother_goals ) , $ ( MAKECMDGOALS ) ) , )
dont_bother := true
e n d i f
2018-03-13 08:04:48 +01: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-29 21:32:16 +02:00
i n c l u d e $( SOONG_MAKEVARS_MK )
2020-07-18 04:52:55 +02:00
YACC := $= $( BISON) -d
2016-12-15 00:54:01 +01: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 02:15:19 +02: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.
2020-02-22 02:29:37 +01:00
$( shell mkdir -p $ ( SOONG_OUT_DIR ) && \
2021-03-09 03:48:37 +01:00
echo -n $( BUILD_NUMBER) > $( SOONG_OUT_DIR) /build_number.tmp; \
if ! cmp -s $( SOONG_OUT_DIR) /build_number.tmp $( SOONG_OUT_DIR) /build_number.txt; then \
mv $( SOONG_OUT_DIR) /build_number.tmp $( SOONG_OUT_DIR) /build_number.txt; \
else \
rm $( SOONG_OUT_DIR) /build_number.tmp; \
fi )
2020-02-22 02:29:37 +01:00
BUILD_NUMBER_FILE := $( SOONG_OUT_DIR) /build_number.txt
2018-10-22 04:41:49 +02:00
.KATI_READONLY := BUILD_NUMBER_FILE
$(KATI_obsolete_var BUILD_NUMBER,See https : //android .googlesource .com /platform /build /+/master /Changes .md #BUILD_NUMBER)
2020-02-22 02:29:37 +01:00
$(BUILD_NUMBER_FILE) :
touch $@
2018-02-21 02:00:39 +01:00
2015-08-12 00:25:12 +02:00
DATE_FROM_FILE := date -d @$( BUILD_DATETIME_FROM_FILE)
2018-10-22 04:41:49 +02:00
.KATI_READONLY := DATE_FROM_FILE
2015-07-17 02:15:19 +02:00
2018-02-21 02:00:39 +01: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-02 21:27:43 +01:00
FILE_NAME_TAG := eng.$( BUILD_USERNAME)
2018-02-21 02:00:39 +01:00
e l s e
FILE_NAME_TAG := $( file <$( BUILD_NUMBER_FILE) )
e n d i f
2018-10-22 04:41:49 +02:00
.KATI_READONLY := FILE_NAME_TAG
2018-02-21 02:00:39 +01:00
2017-08-11 00:24:10 +02: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-13 19:28:40 +01: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 00:41:01 +01: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-16 20:49:18 +01: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 16:45:40 +02: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-16 23:39:48 +02: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
2019-05-23 23:27:42 +02:00
# MTS-specific config.
- i n c l u d e t e s t / m t s / t o o l s / b u i l d / c o n f i g . m k
2019-09-13 19:05:46 +02:00
# VTS-Core-specific config.
- i n c l u d e t e s t / v t s / t o o l s / v t s - c o r e - t r a d e f e d / b u i l d / c o n f i g . m k
2019-09-19 03:29:27 +02:00
# CSUITE-specific config.
- i n c l u d e t e s t / a p p _ c o m p a t / c s u i t e / t o o l s / b u i l d / c o n f i g . m k
2021-02-03 13:05:55 +01:00
# CTS-Root-specific config.
- i n c l u d e t e s t / c t s - r o o t / t o o l s / b u i l d / c o n f i g . m k
2015-02-13 19:28:40 +01:00
2017-07-25 07:27:17 +02:00
# Clean rules
.PHONY : clean -dex -files
clean-dex-files :
2017-09-27 23:28:41 +02:00
$( hide) find $( OUT_DIR) -name "*.dex" | xargs rm -f
2017-07-25 07:27:17 +02: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 03:23:01 +01: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 04:28:42 +01: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 07:10:08 +02:00
INTERNAL_MODIFIER_TARGETS := all
2009-03-04 04:28:42 +01:00
2017-06-06 02:40:23 +02:00
# EMMA_INSTRUMENT_STATIC merges the static jacoco library to each
# jacoco-enabled module.
2012-08-22 01:59:01 +02:00
i f e q ( t r u e , $( EMMA_INSTRUMENT_STATIC ) )
EMMA_INSTRUMENT := true
e n d i f
2017-06-06 02:40:23 +02: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
2021-08-02 15:59:43 +02:00
# Mainline modules prebuilts do not support coverage. Build them from source.
2021-07-22 13:10:57 +02:00
# See b/159241638
MODULE_BUILD_FROM_SOURCE := true
2017-06-06 02:40:23 +02:00
e n d i f
2020-11-27 11:35:17 +01:00
i f d e f T A R G E T _ A R C H _ S U I T E
# TODO(b/175577370): Enable this error.
# $(error TARGET_ARCH_SUITE is not supported in kati/make builds)
e n d i f
2020-05-18 08:16:55 +02:00
# ADDITIONAL_<partition>_PROPERTIES are properties that are determined by the
# build system itself. Don't let it be defined from outside of the core build
# system like Android.mk or <product>.mk files.
_additional_prop_var_names := \
ADDITIONAL_SYSTEM_PROPERTIES \
ADDITIONAL_VENDOR_PROPERTIES \
ADDITIONAL_ODM_PROPERTIES \
ADDITIONAL_PRODUCT_PROPERTIES
$( foreach name , $ ( _additional_prop_var_names ) ,\
$( if $( $( name) ) ,\
$( error $( name) must not set before here. $( $( name) ) ) \
,) \
$( eval $( name) := ) \
)
_additional_prop_var_names :=
$( KATI_obsolete_var ADDITIONAL_BUILD_PROPERTIES , Please use ADDITIONAL_SYSTEM_PROPERTIES )
2018-07-27 22:11:50 +02:00
2017-01-20 05:17:12 +01: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
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += \
2017-01-20 05:17:12 +01:00
ro.product.first_api_level= $( PRODUCT_SHIPPING_API_LEVEL)
e n d i f
2017-01-31 12:07:02 +01:00
2017-03-21 03:46:49 +01:00
i f n e q ( $( BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED ) , t r u e )
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += $( PRODUCT_PROPERTY_OVERRIDES)
2017-01-31 12:07:02 +01:00
e l s e
ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += $( PRODUCT_PROPERTY_OVERRIDES)
2017-01-31 12:07:02 +01:00
endif
e n d i f
2017-01-20 05:17:12 +01:00
2009-03-04 04:28:42 +01: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
2012-05-22 23:08:50 +02:00
i f n e q ( $( filter user userdebug eng ,$ ( MAKECMDGOALS ) ) , )
2009-03-04 04:28:42 +01:00
$( info ***************************************************************)
$( info ***************************************************************)
2011-11-17 23:51:12 +01:00
$( info Do not pass '$ ( filter user userdebug eng ,$ ( MAKECMDGOALS ) ) ' on \
the make command line.)
2009-03-04 04:28:42 +01:00
$( info Set TARGET_BUILD_VARIANT in buildspec .mk , or use lunch or )
$( info choosecombo .)
$( info ***************************************************************)
$( info ***************************************************************)
$( error stopping )
e n d i f
2019-07-29 23:22:05 +02:00
# These are the valid values of TARGET_BUILD_VARIANT.
INTERNAL_VALID_VARIANTS := user userdebug eng
2009-03-09 19:52:11 +01:00
i f n e q ( $( filter -out $ ( INTERNAL_VALID_VARIANTS ) ,$ ( TARGET_BUILD_VARIANT ) ) , )
$( info ***************************************************************)
$( info ***************************************************************)
2015-01-21 03:23:05 +01:00
$(info Invalid variant : $( TARGET_BUILD_VARIANT ) )
$(info Valid values are : $( INTERNAL_VALID_VARIANTS ) )
2009-03-09 19:52:11 +01:00
$( info ***************************************************************)
$( info ***************************************************************)
$( error stopping )
e n d i f
2009-03-04 04:28:42 +01:00
2012-06-07 02:19:29 +02:00
# -----------------------------------------------------------------
2020-05-29 00:46:33 +02:00
# PDK builds are no longer supported, this is always platform
TARGET_BUILD_JAVA_SUPPORT_LEVEL := $= platform
2012-03-31 03:08:07 +02:00
2016-02-27 01:24:26 +01:00
# -----------------------------------------------------------------
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.treble.enabled= ${ PRODUCT_FULL_TREBLE }
2017-05-19 20:31:12 +02:00
2017-12-15 23:52:26 +01: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.)
2020-06-11 20:25:05 +02:00
# Sets ro.actionable_compatible_property.enabled to know on runtime whether the
# allowed list of actionable compatible properties is enabled or not.
2020-11-19 10:48:49 +01:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled= true
2018-01-16 06:14:59 +01:00
2019-02-21 12:51:26 +01: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_PRODUCT_PROPERTIES += dalvik.vm.systemservercompilerfilter= $( PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)
e n d i f
2019-04-15 17:11:36 +02:00
# Enable core platform API violation warnings on userdebug and eng builds.
i f n e q ( $( TARGET_BUILD_VARIANT ) , u s e r )
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy= just-warn
2019-04-15 17:11:36 +02:00
e n d i f
2019-10-10 02:06:01 +02:00
# Define ro.sanitize.<name> properties for all global sanitizers.
ADDITIONAL_SYSTEM_PROPERTIES += $( foreach s,$( SANITIZE_TARGET) ,ro.sanitize.$( s) = true )
2019-02-27 10:58:30 +01:00
# Sets the default value of ro.postinstall.fstab.prefix to /system.
# Device board config should override the value to /product when needed by:
#
# PRODUCT_PRODUCT_PROPERTIES += ro.postinstall.fstab.prefix=/product
#
# It then uses ${ro.postinstall.fstab.prefix}/etc/fstab.postinstall to
# mount system_other partition.
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.postinstall.fstab.prefix= /system
# -----------------------------------------------------------------
# ADDITIONAL_VENDOR_PROPERTIES will be installed in vendor/build.prop if
# property_overrides_split_enabled is true. Otherwise it will be installed in
# /system/build.prop
i f d e f B O A R D _ V N D K _ V E R S I O N
ifeq ( $( BOARD_VNDK_VERSION) ,current)
ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version= $( PLATFORM_VNDK_VERSION)
else
ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version= $( BOARD_VNDK_VERSION)
endif
e n d i f
# Add cpu properties for bionic and ART.
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.arch= $( TARGET_ARCH)
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.cpu_variant= $( TARGET_CPU_VARIANT_RUNTIME)
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_arch= $( TARGET_2ND_ARCH)
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_cpu_variant= $( TARGET_2ND_CPU_VARIANT_RUNTIME)
ADDITIONAL_VENDOR_PROPERTIES += persist.sys.dalvik.vm.lib.2= libart.so
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$( TARGET_ARCH) .variant= $( DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
i f n e q ( $( DEX 2OAT_TARGET_INSTRUCTION_SET_FEATURES ) , )
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$( TARGET_ARCH) .features= $( DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
e n d i f
i f d e f T A R G E T _ 2 N D _ A R C H
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$( TARGET_2ND_ARCH) .variant= $( $( TARGET_2ND_ARCH_VAR_PREFIX) DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
ifneq ( $( $( TARGET_2ND_ARCH_VAR_PREFIX) DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) ,)
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$( TARGET_2ND_ARCH) .features= $( $( TARGET_2ND_ARCH_VAR_PREFIX) DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
endif
e n d i f
# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
# mode (via libminui).
i f d e f T A R G E T _ R E C O V E R Y _ D E F A U L T _ R O T A T I O N
ADDITIONAL_VENDOR_PROPERTIES += \
ro.minui.default_rotation= $( TARGET_RECOVERY_DEFAULT_ROTATION)
e n d i f
i f d e f T A R G E T _ R E C O V E R Y _ O V E R S C A N _ P E R C E N T
ADDITIONAL_VENDOR_PROPERTIES += \
ro.minui.overscan_percent= $( TARGET_RECOVERY_OVERSCAN_PERCENT)
e n d i f
i f d e f T A R G E T _ R E C O V E R Y _ P I X E L _ F O R M A T
ADDITIONAL_VENDOR_PROPERTIES += \
ro.minui.pixel_format= $( TARGET_RECOVERY_PIXEL_FORMAT)
e n d i f
2019-02-27 10:58:30 +01:00
2020-05-18 08:46:49 +02:00
i f d e f P R O D U C T _ U S E _ D Y N A M I C _ P A R T I T I O N S
ADDITIONAL_VENDOR_PROPERTIES += \
ro.boot.dynamic_partitions= $( PRODUCT_USE_DYNAMIC_PARTITIONS)
e n d i f
i f d e f P R O D U C T _ R E T R O F I T _ D Y N A M I C _ P A R T I T I O N S
ADDITIONAL_VENDOR_PROPERTIES += \
ro.boot.dynamic_partitions_retrofit= $( PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)
e n d i f
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_VENDOR_PROPERTIES += \
ro.product.first_api_level= $( PRODUCT_SHIPPING_API_LEVEL)
e n d i f
2021-04-01 06:28:02 +02:00
i f n e q ( $( TARGET_BUILD_VARIANT ) , u s e r )
ifdef PRODUCT_SET_DEBUGFS_RESTRICTIONS
ADDITIONAL_VENDOR_PROPERTIES += \
2021-04-16 07:25:18 +02:00
ro.product.debugfs_restrictions.enabled= $( PRODUCT_SET_DEBUGFS_RESTRICTIONS)
2021-04-01 06:28:02 +02:00
endif
e n d i f
2021-03-17 07:00:23 +01:00
# Vendors with GRF must define BOARD_SHIPPING_API_LEVEL for the vendor API level.
# This must not be defined for the non-GRF devices.
i f d e f B O A R D _ S H I P P I N G _ A P I _ L E V E L
ADDITIONAL_VENDOR_PROPERTIES += \
ro.board.first_api_level= $( BOARD_SHIPPING_API_LEVEL)
2021-04-02 09:29:06 +02:00
# To manually set the vendor API level of the vendor modules, BOARD_API_LEVEL can be used.
# The values of the GRF properties will be verified by post_process_props.py
i f d e f B O A R D _ A P I _ L E V E L
ADDITIONAL_VENDOR_PROPERTIES += \
ro.board.api_level= $( BOARD_API_LEVEL)
e n d i f
2021-03-17 07:00:23 +01:00
e n d i f
2021-06-10 20:32:19 +02:00
# Set build prop. This prop is read by ota_from_target_files when generating OTA,
# to decide if VABC should be disabled.
i f e q ( $( BOARD_DONT_USE_VABC_OTA ) , t r u e )
ADDITIONAL_VENDOR_PROPERTIES += \
ro.vendor.build.dont_use_vabc= true
e n d i f
2021-05-25 00:27:05 +02:00
# Set the flag in vendor. So VTS would know if the new fingerprint format is in use when
# the system images are replaced by GSI.
i f e q ( $( BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT ) , t r u e )
ADDITIONAL_VENDOR_PROPERTIES += \
ro.vendor.build.fingerprint_has_digest= 1
e n d i f
2020-05-18 08:46:49 +02:00
ADDITIONAL_VENDOR_PROPERTIES += \
ro.vendor.build.security_patch= $( VENDOR_SECURITY_PATCH) \
ro.product.board= $( TARGET_BOOTLOADER_BOARD_NAME) \
ro.board.platform= $( TARGET_BOARD_PLATFORM) \
ro.hwui.use_vulkan= $( TARGET_USES_VULKAN)
i f d e f T A R G E T _ S C R E E N _ D E N S I T Y
ADDITIONAL_VENDOR_PROPERTIES += \
ro.sf.lcd_density= $( TARGET_SCREEN_DENSITY)
e n d i f
i f d e f A B _ O T A _ U P D A T E R
ADDITIONAL_VENDOR_PROPERTIES += \
ro.build.ab_update= $( AB_OTA_UPDATER)
e n d i f
2019-12-10 07:35:36 +01:00
# Set ro.product.vndk.version to know the VNDK version required by product
# modules. It uses the version in PRODUCT_PRODUCT_VNDK_VERSION. If the value
# is "current", use PLATFORM_VNDK_VERSION.
i f d e f P R O D U C T _ P R O D U C T _ V N D K _ V E R S I O N
i f e q ( $( PRODUCT_PRODUCT_VNDK_VERSION ) , c u r r e n t )
ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version= $( PLATFORM_VNDK_VERSION)
e l s e
ADDITIONAL_PRODUCT_PROPERTIES += ro.product.vndk.version= $( PRODUCT_PRODUCT_VNDK_VERSION)
e n d i f
e n d i f
2020-05-25 17:21:20 +02:00
ADDITIONAL_PRODUCT_PROPERTIES += ro.build.characteristics= $( TARGET_AAPT_CHARACTERISTICS)
2020-07-28 03:22:45 +02:00
i f e q ( $( AB_OTA_UPDATER ) , t r u e )
2021-05-13 22:37:53 +02:00
ADDITIONAL_PRODUCT_PROPERTIES += ro.product.ab_ota_partitions= $( subst $( space) ,$( comma) ,$( strip $( AB_OTA_PARTITIONS) ) )
2020-07-28 03:22:45 +02:00
e n d i f
2012-02-28 00:49:23 +01:00
# -----------------------------------------------------------------
2009-03-04 04:28:42 +01:00
###
### In this section we set up the things that are different
### between the build variants
###
2009-04-14 01:32:16 +02:00
is_sdk_build :=
2011-02-16 01:09:36 +01:00
i f n e q ( $( filter sdk win_sdk sdk_addon ,$ ( MAKECMDGOALS ) ) , )
2009-04-14 01:32:16 +02:00
is_sdk_build := true
e n d i f
2009-03-04 04:28:42 +01:00
## user/userdebug ##
2012-05-22 23:08:50 +02:00
user_variant := $( filter user userdebug,$( TARGET_BUILD_VARIANT) )
2009-03-04 04:28:42 +01:00
enable_target_debugging := true
2012-05-22 23:08:50 +02:00
tags_to_install :=
2009-03-04 04:28:42 +01:00
i f n e q ( , $( user_variant ) )
# Target is secure in user builds.
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.secure= 1
ADDITIONAL_SYSTEM_PROPERTIES += security.perf_harden= 1
2009-03-04 04:28:42 +01:00
2015-12-16 22:42:49 +01:00
ifeq ( $( user_variant) ,user)
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure= 1
2015-12-16 22:42:49 +01:00
endif
2009-03-04 04:28:42 +01:00
ifeq ( $( user_variant) ,userdebug)
# Pick up some extra useful tools
2009-03-09 19:52:11 +01:00
tags_to_install += debug
2009-03-04 04:28:42 +01:00
else
# Disable debugging in plain user builds.
enable_target_debugging :=
endif
2010-09-08 02:45:44 +02:00
2009-03-04 04:28:42 +01:00
# Disallow mock locations by default for user builds
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location= 0
2010-09-08 02:45:44 +02:00
2009-03-04 04:28:42 +01:00
e l s e # !user_variant
# Turn on checkjni for non-user builds.
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.kernel.android.checkjni= 1
2009-03-04 04:28:42 +01:00
# Set device insecure for non-user builds.
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.secure= 0
2009-03-04 04:28:42 +01:00
# Allow mock locations by default for non user builds
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location= 1
2009-03-04 04:28:42 +01:00
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
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable= 1
2014-09-19 20:30:27 +02:00
# Enable Dalvik lock contention logging.
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.lockprof.threshold= 500
2009-03-04 04:28:42 +01:00
e l s e # !enable_target_debugging
# Target is less debuggable and adbd is off by default
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable= 0
2009-03-04 04:28:42 +01:00
e n d i f # !enable_target_debugging
2009-03-09 19:52:11 +01:00
## eng ##
i f e q ( $( TARGET_BUILD_VARIANT ) , e n g )
2012-05-22 23:08:50 +02:00
tags_to_install := debug eng
2020-05-18 08:16:55 +02:00
i f n e q ( $( filter ro .setupwizard .mode =ENABLED , $ ( call collapse -pairs , $ ( ADDITIONAL_SYSTEM_PROPERTIES ) ) ) , )
2009-03-11 20:11:54 +01:00
# Don't require the setup wizard on eng builds
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES := $( filter-out ro.setupwizard.mode= %,\
$( call collapse-pairs, $( ADDITIONAL_SYSTEM_PROPERTIES) ) ) \
2009-10-07 19:01:13 +02:00
ro.setupwizard.mode= OPTIONAL
2009-03-09 19:52:11 +01:00
e n d i f
2014-10-03 22:36:51 +02:00
i f n d e f i s _ s d k _ b u i l d
2015-12-15 10:53:05 +01:00
# To speedup startup of non-preopted builds, don't verify or compile the boot image.
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.image-dex2oat-filter= extract
2014-10-03 22:36:51 +02:00
e n d i f
2011-12-01 21:46:12 +01:00
e n d i f
2009-03-09 19:52:11 +01:00
2018-03-26 23:17:03 +02: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
2019-06-11 19:27:47 +02:00
## java coverage ##
# Install additional tools on java coverage builds
i f e q ( t r u e , $( EMMA_INSTRUMENT ) )
i f n e q ( , $( filter debug ,$ ( tags_to_install ) ) )
tags_to_install += java_coverage
e n d i f
e n d i f
2009-03-04 04:28:42 +01:00
## sdk ##
2009-04-14 01:32:16 +02:00
i f d e f i s _ s d k _ b u i l d
2011-02-16 01:09:36 +01: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) ) )
2020-08-27 23:14:26 +02:00
i f n e q ( $( words $ ( sort $ ( filter -out $ ( INTERNAL_MODIFIER_TARGETS ) checkbuild emulator_tests ,$ ( MAKECMDGOALS ) ) ) ) , 1 )
2009-03-04 04:28:42 +01:00
$( error The 'sdk ' target may not be specified with any other targets )
e n d i f
2010-04-17 02:50:09 +02:00
2009-03-09 19:52:11 +01:00
# TODO: this should be eng I think. Since the sdk is built from the eng
# variant.
2012-05-22 23:08:50 +02:00
tags_to_install := debug eng
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += xmpp.auto-presence= true
ADDITIONAL_SYSTEM_PROPERTIES += ro.config.nocheckin= yes
2009-03-04 04:28:42 +01:00
e l s e # !sdk
e n d i f
2010-08-30 21:48:03 +02:00
BUILD_WITHOUT_PV := true
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES += net.bt.name= Android
2009-03-04 04:28:42 +01:00
# ------------------------------------------------------------
# Define a function that, given a list of module tags, returns
# non-empty if that module should be installed in /system.
2009-03-09 19:52:11 +01:00
# For most goals, anything not tagged with the "tests" tag should
2009-03-04 04:28:42 +01: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-09 19:52:11 +01:00
$( if $ ( filter tests ,$ ( 1) ) ,,true )
2009-03-04 04:28:42 +01:00
e n d e f
2009-04-14 01:32:16 +02:00
i f d e f i s _ s d k _ b u i l d
2009-03-04 04:28:42 +01: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-09 19:52:11 +01:00
$( if $ ( filter samples tests ,$ ( 1) ) ,,true )
2009-03-04 04:28:42 +01:00
e n d e f
e n d i f
2017-05-26 07:10:08 +02:00
# If they only used the modifier goals (all, etc), we'll actually
2009-07-17 21:33:40 +02: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 04:28:42 +01:00
e n d i f
#
# Typical build; include any Android.mk files we can find.
#
2020-07-01 14:16:07 +02:00
# Bring in dex_preopt.mk
# This creates some modules so it needs to be included after
# should-install-to-system is defined (in order for base_rules.mk to function
# properly), but before readonly-final-product-vars is called.
i n c l u d e $( BUILD_SYSTEM ) / d e x _ p r e o p t . m k
2019-03-28 15:47:25 +01:00
# Strip and readonly a few more variables so they won't be modified.
$( readonly -final -product -vars )
2020-05-18 08:16:55 +02:00
ADDITIONAL_SYSTEM_PROPERTIES := $( strip $( ADDITIONAL_SYSTEM_PROPERTIES) )
.KATI_READONLY := ADDITIONAL_SYSTEM_PROPERTIES
2018-07-27 22:11:50 +02:00
ADDITIONAL_PRODUCT_PROPERTIES := $( strip $( ADDITIONAL_PRODUCT_PROPERTIES) )
.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES
2010-09-14 19:09:48 +02:00
2017-03-30 04:25:02 +02:00
i f n e q ( $( PRODUCT_ENFORCE_RRO_TARGETS ) , )
2017-02-01 16:44:58 +01:00
ENFORCE_RRO_SOURCES :=
e n d i f
2018-10-19 01:11:40 +02: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 00:02:14 +02:00
subdir_makefiles_inc := .
2018-08-21 14:14:01 +02:00
FULL_BUILD :=
2018-07-11 00:02:14 +02:00
2013-09-09 21:11:02 +02:00
i f n e q ( $( dont_bother ) , t r u e )
2018-08-21 14:14:01 +02:00
FULL_BUILD := true
2009-07-30 20:20:04 +02:00
#
# Include all of the makefiles in the system
#
2020-06-08 03:16:38 +02:00
subdir_makefiles := $( SOONG_ANDROID_MK) $( file <$( OUT_DIR) /.module_paths/Android.mk.list) $( SOONG_OUT_DIR) /late-$( TARGET_PRODUCT) .mk
2018-07-11 00:02:14 +02:00
subdir_makefiles_total := $( words int $( subdir_makefiles) post finish)
2017-02-18 19:41:30 +01:00
.KATI_READONLY := subdir_makefiles_total
2016-01-11 21:33:23 +01:00
2017-02-18 19:41:30 +01:00
$( foreach mk ,$ ( subdir_makefiles ) ,$ ( info [$ ( call inc_and_print ,subdir_makefiles_inc ) /$ ( subdir_makefiles_total ) ] including $ ( mk ) ...) $ ( eval include $ ( mk ) ) )
2012-05-25 06:05:19 +02:00
2021-07-02 22:13:10 +02:00
# For an unbundled image, we can skip blueprint_tools because unbundled image
# aims to remove a large number framework projects from the manifest, the
# sources or dependencies for these tools may be missing from the tree.
i f e q ( , $( TARGET_BUILD_UNBUNDLED_IMAGE ) )
2017-05-27 02:12:29 +02:00
droid_targets : blueprint_tools
2021-07-02 22:13:10 +02:00
e n d i f
2017-05-27 02:12:29 +02:00
2013-09-09 21:11:02 +02:00
e n d i f # dont_bother
2018-07-11 00:02:14 +02: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 04:28:42 +01:00
# -------------------------------------------------------------------
# All module makefiles have been included at this point.
# -------------------------------------------------------------------
2018-10-19 01:11:40 +02: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 16:44:58 +01:00
# -------------------------------------------------------------------
# Enforce to generate all RRO packages for modules having resource
# overlays.
# -------------------------------------------------------------------
2017-03-30 04:25:02 +02:00
i f n e q ( $( PRODUCT_ENFORCE_RRO_TARGETS ) , )
2017-02-01 16:44:58 +01:00
$( call generate_all_enforce_rro_packages )
e n d i f
2009-03-04 04:28:42 +01:00
2020-06-03 11:03:26 +02:00
# -------------------------------------------------------------------
# Sort ALL_MODULES to remove duplicate entries.
# -------------------------------------------------------------------
ALL_MODULES := $( sort $( ALL_MODULES) )
# Cannot set to readonly because Makefile extends ALL_MODULES
# .KATI_READONLY := ALL_MODULES
2009-03-04 04:28:42 +01: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 07:26:23 +01:00
#
# Resolve the required module name to 32-bit or 64-bit variant.
2020-05-10 13:28:31 +02:00
# Get a list of corresponding module names for the second arch, if they exist.
# $(1): TARGET, HOST or HOST_CROSS
# $(2): A list of module names
d e f i n e g e t - m o d u l e s - f o r - 2 n d - a r c h
$( strip \
$( foreach m,$( 2) , \
$( if $( filter true,$( ALL_MODULES.$( m) $( $( 1) _2ND_ARCH_MODULE_SUFFIX) .FOR_2ND_ARCH) ) , \
$( m) $( $( 1) _2ND_ARCH_MODULE_SUFFIX) \
) \
) \
)
e n d e f
2020-05-07 12:47:16 +02:00
# Resolves module bitness for PRODUCT_PACKAGES and PRODUCT_HOST_PACKAGES.
# The returned list of module names can be used to access
# ALL_MODULES.<module>.<*> variables.
# Name resolution for PRODUCT_PACKAGES / PRODUCT_HOST_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 HOST_CROSS modules:
# foo:32 resolves to foo;
# foo:64 resolves to foo_64;
# foo resolves to both foo and foo_64 (if foo_64 is defined).
#
# $(1): TARGET, HOST or HOST_CROSS
# $(2): A list of simple module names with :32 and :64 suffix
d e f i n e r e s o l v e - b i t n e s s - f o r - m o d u l e s
$( strip \
$( eval modules_32 := $( patsubst %:32,%,$( filter %:32,$( 2) ) ) ) \
$( eval modules_64 := $( patsubst %:64,%,$( filter %:64,$( 2) ) ) ) \
$( eval modules_both := $( filter-out %:32 %:64,$( 2) ) ) \
2020-07-13 06:53:52 +02:00
$( eval ### if 2ND_HOST_CROSS_IS_64_BIT, then primary/secondary are reversed for HOST_CROSS modules) \
$( if $( filter HOST_CROSS_true,$( 1) _$( 2ND_HOST_CROSS_IS_64_BIT) ) , \
2020-05-07 12:47:16 +02:00
$( eval modules_1st_arch := $( modules_32) ) \
$( eval modules_2nd_arch := $( modules_64) ) , \
$( eval modules_1st_arch := $( modules_64) ) \
$( eval modules_2nd_arch := $( modules_32) ) ) \
$( eval ### Note for 32-bit product, 32 and 64 will be added as their original module names.) \
$( eval modules := $( modules_1st_arch) ) \
$( if $( $( 1) _2ND_ARCH) , \
$( eval modules += $( call get-modules-for-2nd-arch,$( 1) ,$( modules_2nd_arch) ) ) , \
$( eval modules += $( modules_2nd_arch) ) ) \
$( eval ### For the rest we add both) \
$( eval modules += $( modules_both) ) \
$( if $( $( 1) _2ND_ARCH) , \
$( eval modules += $( call get-modules-for-2nd-arch,$( 1) ,$( modules_both) ) ) ) \
$( modules) \
2019-04-02 23:43:32 +02:00
)
e n d e f
2020-05-07 12:47:16 +02:00
2020-06-20 13:11:32 +02:00
# Resolve the required module names to 32-bit or 64-bit variant for:
# ALL_MODULES.<*>.REQUIRED_FROM_TARGET
# ALL_MODULES.<*>.REQUIRED_FROM_HOST
# ALL_MODULES.<*>.REQUIRED_FROM_HOST_CROSS
#
2020-06-03 11:03:26 +02:00
# If a module is for cross host OS, the required modules are also for that OS.
2020-05-07 12:47:16 +02:00
# Required modules explicitly suffixed with :32 or :64 resolve to that bitness.
2020-06-03 11:03:26 +02:00
# Otherwise if the requiring module is native and the required module is shared
# library or native test, then the required module resolves to the same bitness.
# Otherwise the required module resolves to both variants, if they exist.
# $(1): TARGET, HOST or HOST_CROSS
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
$( foreach m ,$ ( ALL_MODULES ) , \
$( eval r := $( ALL_MODULES.$( m) .REQUIRED_FROM_$( 1) ) ) \
$( if $( r) , \
$( if $( filter HOST_CROSS,$( 1) ) , \
$( if $( ALL_MODULES.$( m) .FOR_HOST_CROSS) ,,$( error Only expected REQUIRED_FROM_HOST_CROSS on FOR_HOST_CROSS modules - $( m) ) ) \
$( eval r := $( addprefix host_cross_,$( r) ) ) ) \
$( eval module_is_native := \
$( filter EXECUTABLES SHARED_LIBRARIES NATIVE_TESTS,$( ALL_MODULES.$( m) .CLASS) ) ) \
2020-06-20 13:11:32 +02:00
$( eval r_r := \
$( foreach r_i,$( r) , \
$( if $( filter %:32 %:64,$( r_i) ) , \
$( eval r_m := $( call resolve-bitness-for-modules,$( 1) ,$( r_i) ) ) , \
$( eval r_m := \
$( eval r_i_2nd := $( call get-modules-for-2nd-arch,$( 1) ,$( r_i) ) ) \
$( eval required_is_shared_library_or_native_test := \
$( filter SHARED_LIBRARIES NATIVE_TESTS, \
$( ALL_MODULES.$( r_i) .CLASS) $( ALL_MODULES.$( r_i_2nd) .CLASS) ) ) \
$( if $( and $( module_is_native) ,$( required_is_shared_library_or_native_test) ) , \
$( if $( ALL_MODULES.$( m) .FOR_2ND_ARCH) ,$( r_i_2nd) ,$( r_i) ) , \
$( r_i) $( r_i_2nd) ) ) ) \
2020-07-15 12:35:12 +02:00
$( eval r_m := $( foreach r_j,$( r_m) ,$( if $( ALL_MODULES.$( r_j) .PATH) ,$( r_j) ) ) ) \
$( if $( r_m) ,,$( eval _nonexistent_required += $( 1) $( comma) $( m) $( comma) $( 1) $( comma) $( r_i) ) ) \
2020-06-20 13:11:32 +02:00
$( r_m) ) ) \
2020-06-03 11:03:26 +02:00
$( eval ALL_MODULES.$( m) .REQUIRED_FROM_$( 1) := $( sort $( r_r) ) ) \
) \
2019-04-02 23:43:32 +02:00
)
e n d e f
2020-06-03 11:03:26 +02:00
2020-06-20 13:11:32 +02:00
# Resolve the required module names to 32-bit or 64-bit variant for:
# ALL_MODULES.<*>.TARGET_REQUIRED_FROM_HOST
# ALL_MODULES.<*>.HOST_REQUIRED_FROM_TARGET
#
# This is like select-bitness-of-required-modules, but it doesn't have
# complicated logic for various module types.
# Calls resolve-bitness-for-modules to resolve module names.
# $(1): TARGET or HOST
# $(2): HOST or TARGET
d e f i n e s e l e c t - b i t n e s s - o f - t a r g e t - h o s t - r e q u i r e d - m o d u l e s
$( foreach m ,$ ( ALL_MODULES ) , \
$( eval r := $( ALL_MODULES.$( m) .$( 1) _REQUIRED_FROM_$( 2) ) ) \
$( if $( r) , \
$( eval r_r := \
$( foreach r_i,$( r) , \
$( eval r_m := $( call resolve-bitness-for-modules,$( 1) ,$( r_i) ) ) \
2020-07-15 12:35:12 +02:00
$( eval r_m := $( foreach r_j,$( r_m) ,$( if $( ALL_MODULES.$( r_j) .PATH) ,$( r_j) ) ) ) \
$( if $( r_m) ,,$( eval _nonexistent_required += $( 2) $( comma) $( m) $( comma) $( 1) $( comma) $( r_i) ) ) \
2020-06-20 13:11:32 +02:00
$( r_m) ) ) \
$( eval ALL_MODULES.$( m) .$( 1) _REQUIRED_FROM_$( 2) := $( sort $( r_r) ) ) \
) \
)
e n d e f
2020-07-15 12:35:12 +02:00
_nonexistent_required :=
2020-06-03 11:03:26 +02:00
$( call select -bitness -of -required -modules ,TARGET )
$( call select -bitness -of -required -modules ,HOST )
$( call select -bitness -of -required -modules ,HOST_CROSS )
2020-06-20 13:11:32 +02:00
$( call select -bitness -of -target -host -required -modules ,TARGET ,HOST )
$( call select -bitness -of -target -host -required -modules ,HOST ,TARGET )
2020-07-15 12:35:12 +02:00
_nonexistent_required := $( sort $( _nonexistent_required) )
2020-08-13 06:45:52 +02:00
check_missing_required_modules := true
i f n e q ( , $( filter true ,$ ( ALLOW_MISSING_DEPENDENCIES ) $ ( BUILD_BROKEN_MISSING_REQUIRED_MODULES ) ) )
check_missing_required_modules :=
e n d i f # ALLOW_MISSING_DEPENDENCIES == true || BUILD_BROKEN_MISSING_REQUIRED_MODULES == true
# Some executables are skipped in ASAN SANITIZE_TARGET build, thus breaking their dependencies.
i f n e q ( , $( filter address ,$ ( SANITIZE_TARGET ) ) )
check_missing_required_modules :=
e n d i f # SANITIZE_TARGET has ASAN
2020-07-25 11:05:06 +02:00
# HOST OS darwin build is broken, disable this check for darwin for now.
2020-08-13 06:45:52 +02:00
# TODO(b/162102724): Remove this when darwin host has no broken dependency.
i f n e q ( , $( filter $ ( HOST_OS ) ,darwin ) )
check_missing_required_modules :=
e n d i f # HOST_OS == darwin
i f e q ( t r u e , $( check_missing_required_modules ) )
2020-07-15 12:35:12 +02:00
i f n e q ( , $( _nonexistent_required ) )
$( warning Missing required dependencies:)
$( foreach r_i,$( _nonexistent_required) , \
$( eval r := $( subst $( comma) ,$( space) ,$( r_i) ) ) \
$( info $( word 1,$( r) ) module $( word 2,$( r) ) requires non-existent $( word 3,$( r) ) module: $( word 4,$( r) ) ) \
)
$( warning Set BUILD_BROKEN_MISSING_REQUIRED_MODULES := true to bypass this check if this is intentional)
$( error Build failed)
e n d i f # _nonexistent_required != empty
2020-08-13 06:45:52 +02:00
e n d i f # check_missing_required_modules == true
2014-02-11 07:26:23 +01:00
2009-03-04 04:28:42 +01:00
d e f i n e a d d - r e q u i r e d - d e p s
2013-02-22 23:32:30 +01:00
$(1) : | $( 2)
2009-03-04 04:28:42 +01:00
e n d e f
2014-02-11 07:26:23 +01:00
2016-10-04 01:49:02 +02: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 04:31:48 +02:00
# Sets up dependencies such that whenever a host module is installed,
2019-04-02 23:43:32 +02:00
# any other host modules listed in $(ALL_MODULES.$(m).REQUIRED_FROM_HOST) will also be installed
2017-08-30 04:31:48 +02:00
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 04:28:42 +01:00
$( foreach m ,$ ( ALL_MODULES ) , \
2019-04-02 23:43:32 +02:00
$( eval r := $( ALL_MODULES.$( m) .REQUIRED_FROM_HOST) ) \
2009-03-04 04:28:42 +01:00
$( if $( r) , \
$( eval r := $( call module-installed-files,$( r) ) ) \
2016-09-13 22:28:51 +02:00
$( eval h_m := $( filter $( HOST_OUT) /%, $( ALL_MODULES.$( m) .INSTALLED) ) ) \
$( eval h_r := $( filter $( HOST_OUT) /%, $( r) ) ) \
2020-06-01 11:55:16 +02:00
$( eval h_r := $( filter-out $( h_m) , $( h_r) ) ) \
2013-06-07 03:05:53 +02:00
$( if $( h_m) , $( eval $( call add-required-deps, $( h_m) ,$( h_r) ) ) ) \
2017-08-30 04:31:48 +02:00
) \
)
e n d e f
$( call add -all -host -to -host -required -modules -deps )
2019-04-02 23:43:32 +02:00
# Sets up dependencies such that whenever a host cross module is installed,
# any other host cross modules listed in $(ALL_MODULES.$(m).REQUIRED_FROM_HOST_CROSS) will also be installed
d e f i n e a d d - a l l - h o s t - c r o s s - t o - h o s t - c r o s s - 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_FROM_HOST_CROSS) ) \
$( if $( r) , \
$( eval r := $( call module-installed-files,$( r) ) ) \
$( eval hc_m := $( filter $( HOST_CROSS_OUT) /%, $( ALL_MODULES.$( m) .INSTALLED) ) ) \
$( eval hc_r := $( filter $( HOST_CROSS_OUT) /%, $( r) ) ) \
2020-06-01 11:55:16 +02:00
$( eval hc_r := $( filter-out $( hc_m) , $( hc_r) ) ) \
2019-04-02 23:43:32 +02:00
$( if $( hc_m) , $( eval $( call add-required-deps, $( hc_m) ,$( hc_r) ) ) ) \
) \
)
e n d e f
$( call add -all -host -cross -to -host -cross -required -modules -deps )
2017-08-30 04:31:48 +02:00
# Sets up dependencies such that whenever a target module is installed,
2019-04-02 23:43:32 +02:00
# any other target modules listed in $(ALL_MODULES.$(m).REQUIRED_FROM_TARGET) will also be installed
2017-08-30 04:31:48 +02:00
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 ) , \
2019-04-02 23:43:32 +02:00
$( eval r := $( ALL_MODULES.$( m) .REQUIRED_FROM_TARGET) ) \
2017-08-30 04:31:48 +02:00
$( 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) ) ) \
2020-06-01 11:55:16 +02:00
$( eval t_r := $( filter-out $( t_m) , $( t_r) ) ) \
2017-08-30 04:31:48 +02:00
$( 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,
2019-04-02 23:43:32 +02:00
# any target modules listed in $(ALL_MODULES.$(m).TARGET_REQUIRED_FROM_HOST) will also be installed
2017-08-30 04:31:48 +02:00
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 ) , \
2019-04-02 23:43:32 +02:00
$( eval req_mods := $( ALL_MODULES.$( m) .TARGET_REQUIRED_FROM_HOST) ) \
2017-08-30 04:31:48 +02:00
$( if $( req_mods) , \
$( eval req_files := ) \
$( foreach req_mod,$( req_mods) , \
$( eval req_file := $( filter $( TARGET_OUT_ROOT) /%, $( call module-installed-files,$( req_mod) ) ) ) \
2020-07-02 05:44:37 +02:00
$( if $( filter true,$( ALLOW_MISSING_DEPENDENCIES) ) , \
, \
$( 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) \
) \
) \
2017-08-30 04:31:48 +02:00
$( 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) ) ) ) \
$( 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 04:48:59 +01:00
# Sets up dependencies such that whenever a target module is installed,
2019-04-02 23:43:32 +02:00
# any host modules listed in $(ALL_MODULES.$(m).HOST_REQUIRED_FROM_TARGET) will also be installed
2018-02-02 04:48:59 +01:00
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 ) , \
2019-04-02 23:43:32 +02:00
$( eval req_mods := $( ALL_MODULES.$( m) .HOST_REQUIRED_FROM_TARGET) ) \
2018-02-02 04:48:59 +01:00
$( if $( req_mods) , \
$( eval req_files := ) \
$( foreach req_mod,$( req_mods) , \
$( eval req_file := $( filter $( HOST_OUT) /%, $( call module-installed-files,$( req_mod) ) ) ) \
2020-07-02 05:44:37 +02:00
$( if $( filter true,$( ALLOW_MISSING_DEPENDENCIES) ) , \
, \
$( 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) \
) \
) \
2018-02-02 04:48:59 +01:00
$( 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) ) ) ) \
$( 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-22 23:32:30 +01:00
2013-06-07 03:05:53 +02:00
t_m :=
h_m :=
2015-08-14 21:59:50 +02:00
hc_m :=
2013-06-07 03:05:53 +02:00
t_r :=
h_r :=
2015-08-14 21:59:50 +02:00
hc_r :=
2013-06-07 03:05:53 +02:00
2017-08-30 04:31:48 +02:00
# Establish the dependencies on the shared libraries.
2019-04-02 23:43:32 +02:00
# It also adds the shared library module names to ALL_MODULES.$(m).REQUIRED_FROM_(TARGET|HOST|HOST_CROSS),
2014-06-10 23:21:20 +02:00
# so they can be expanded to product_MODULES later.
2015-08-14 21:59:50 +02:00
# $(1): TARGET_ or HOST_ or HOST_CROSS_.
2014-06-10 23:21:20 +02:00
# $(2): non-empty for 2nd arch.
2015-08-14 21:59:50 +02:00
# $(3): non-empty for host cross compile.
2014-06-10 23:21:20 +02: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-13 22:28:51 +02:00
$( eval root := $( 1) OUT$( if $( call streq,$( 1) ,TARGET_) ,_ROOT) ) \
2014-06-10 23:21:20 +02:00
$( if $( 2) ,$( eval deps := $( addsuffix $( $( 1) 2ND_ARCH_MODULE_SUFFIX) ,$( deps) ) ) ) \
2015-08-14 21:59:50 +02:00
$( if $( 3) ,$( eval deps := $( addprefix host_cross_,$( deps) ) ) ) \
2016-09-13 22:28:51 +02:00
$( eval r := $( filter $( $( root) ) /%,$( call module-installed-files,\
2014-06-10 23:21:20 +02:00
$( deps) ) ) ) \
2016-10-04 01:49:02 +02:00
$( if $( filter $( 1) ,HOST_) ,\
2018-10-26 08:21:38 +02: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 01:49:02 +02:00
$( eval $( call add-required-host-so-deps,$( word 2,$( p) ) ,$( r) ) ) ,\
$( eval $( call add-required-deps,$( word 2,$( p) ) ,$( r) ) ) ) \
2019-04-02 23:43:32 +02:00
$( eval ALL_MODULES.$( mod) .REQUIRED_FROM_$( patsubst %_,%,$( 1) ) += $( deps) ) )
2014-06-10 23:21:20 +02:00
e n d e f
2018-10-26 08:21:38 +02: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
2020-04-13 18:29:16 +02:00
# Scan all modules in general-tests, device-tests and other selected suites and
# flatten the shared library dependencies.
2018-10-26 08:21:38 +02:00
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
2021-04-15 23:46:30 +02:00
$( foreach suite ,general -tests device -tests vts tvts art -host -tests host -unit -tests ,\
2018-10-26 08:21:38 +02:00
$( 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) ,\
2020-04-13 18:29:16 +02:00
$( if $( filter $( suite) ,device-tests general-tests) ,\
$( eval my_testcases := $( HOST_OUT_TESTCASES) ) ,\
$( eval my_testcases := $$ ( COMPATIBILITY_TESTCASES_OUT_$( suite) ) ) ) \
$( eval target := $( my_testcases) /$( lastword $( subst /, ,$( dir $( f) ) ) ) /$( notdir $( f) ) ) \
2018-10-26 08:21:38 +02:00
$( 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-10 23:21:20 +02:00
$( call resolve -shared -libs -depes ,TARGET_ )
2014-01-16 21:36:34 +01:00
i f d e f T A R G E T _ 2 N D _ A R C H
2014-06-10 23:21:20 +02:00
$( call resolve -shared -libs -depes ,TARGET_ ,true )
2014-01-16 21:36:34 +01:00
e n d i f
2014-06-10 23:21:20 +02:00
$( call resolve -shared -libs -depes ,HOST_ )
2014-05-20 23:43:51 +02:00
i f d e f H O S T _ 2 N D _ A R C H
2014-06-10 23:21:20 +02:00
$( call resolve -shared -libs -depes ,HOST_ ,true )
2014-01-16 21:36:34 +01:00
e n d i f
2018-10-26 08:21:38 +02: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-14 21:59:50 +02: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 )
2019-06-25 21:55:18 +02:00
i f d e f H O S T _ C R O S S _ 2 N D _ A R C H
$( call resolve -shared -libs -depes ,HOST_CROSS_ ,true ,true )
e n d i f
2015-08-14 21:59:50 +02:00
e n d i f
2013-02-22 23:32:30 +01:00
2018-11-06 10:32:40 +01: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) ) ) ) ) \
\
2020-04-28 23:30:56 +02:00
$( if $( and $( r) ,$( deps) ) ,\
2018-11-06 10:32:40 +01:00
$( eval stamp := $( dir $( r) ) check_elf_files.timestamp) \
2020-04-28 23:30:56 +02:00
$( if $( CHECK_ELF_FILES.$( stamp) ) ,\
$( eval $( call add-elf-file-check-shared-lib,$( stamp) ,$( deps) ) ) ) \
2018-11-06 10:32:40 +01:00
) )
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 04:28:42 +01:00
m :=
r :=
2013-02-22 23:32:30 +01:00
p :=
2018-11-06 10:32:40 +01:00
stamp :=
2014-06-10 23:21:20 +02:00
deps :=
2009-03-04 04:28:42 +01:00
add-required-deps :=
2017-04-08 09:31:31 +02: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
# 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 02:42:42 +02:00
d e f i n e l i n k - t y p e - p r e f i x
2020-03-07 03:09:06 +01:00
$(word 2,$(subst : , $( space ) , $( 1) ))
2017-08-01 02:42:42 +02:00
e n d e f
2017-04-08 09:31:31 +02: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) ,\
2020-03-07 03:09:06 +01:00
android) )
2017-04-08 09:31:31 +02:00
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
$( 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
2019-07-31 19:31:20 +02:00
# -------------------------------------------------------------------
# Handle exported/imported includes
# Recursively calculate flags
$( foreach export ,$ ( EXPORTS_LIST ) , \
$( eval EXPORTS.$$ ( export ) = $$ ( EXPORTS.$( export ) .FLAGS) \
$( foreach dep,$( EXPORTS.$( export ) .REEXPORT) ,$$ ( EXPORTS.$( dep) ) ) ) )
# Recursively calculate dependencies
$( foreach export ,$ ( EXPORTS_LIST ) , \
$( eval EXPORT_DEPS.$$ ( export ) = $$ ( EXPORTS.$( export ) .DEPS) \
$( foreach dep,$( EXPORTS.$( export ) .REEXPORT) ,$$ ( EXPORT_DEPS.$( dep) ) ) ) )
# Converts the recursive variables to simple variables so that we don't have to
# evaluate them for every .o rule
$(foreach export,$(EXPORTS_LIST),$(eval EXPORTS.$$(export) : = $$( strip $ $ ( EXPORTS .$ $ ( export ) ) ) ))
$(foreach export,$(EXPORTS_LIST),$(eval EXPORT_DEPS.$$(export) : = $$( sort $ $ ( EXPORT_DEPS .$ $ ( export ) ) ) ))
# Add dependencies
$( foreach export ,$ ( EXPORTS_LIST ) ,$ ( eval $ ( call add -dependency ,$ $ ( EXPORTS .$ $ ( export ) .USERS ) ,$ $ ( EXPORT_DEPS .$ $ ( export ) ) ) ) )
2009-03-04 04:28:42 +01:00
# -------------------------------------------------------------------
# Figure out our module sets.
2012-05-22 23:08:50 +02:00
#
2009-03-04 04:28:42 +01:00
# Of the modules defined by the component makefiles,
# determine what we actually want to build.
2018-09-12 19:01:32 +02: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
2020-12-18 18:28:50 +01:00
$( foreach m ,$ ( 1) ,\
$( eval _mo_overrides := $( PACKAGES.$( m) .OVERRIDES) $( EXECUTABLES.$( m) .OVERRIDES) $( SHARED_LIBRARIES.$( m) .OVERRIDES) $( ETC.$( m) .OVERRIDES) ) \
$( if $( filter $( m) ,$( _mo_overrides) ) ,\
$( error Module $( m) cannot override itself) ,\
$( _mo_overrides) ) )
2018-09-12 19:01:32 +02:00
e n d e f
2014-06-10 23:21:20 +02: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-12 19:01:32 +02:00
# $(3): The list of overridden modules.
2014-06-10 23:21:20 +02: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
2019-04-02 23:43:32 +02:00
$(eval _erm_req : = $( foreach m ,$ ( 2) ,$ ( ALL_MODULES .$ ( m ) .REQUIRED_FROM_TARGET ) ) ) \
2018-09-12 19:01:32 +02: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-10 23:21:20 +02:00
e n d e f
2019-02-23 00:06:03 +01:00
# Same as expand-required-modules above, but does not handle module overrides, as
# we don't intend to support them on the host.
2019-04-02 23:43:32 +02:00
# $(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.
# $(3): HOST or HOST_CROSS depending on whether we're expanding host or host cross modules
# Returns empty string (maybe with some whitespaces).
2019-02-23 00:06:03 +01:00
d e f i n e e x p a n d - r e q u i r e d - h o s t - m o d u l e s
2019-04-02 23:43:32 +02:00
$(eval _erm_req : = $( foreach m ,$ ( 2) ,$ ( ALL_MODULES .$ ( m ) .REQUIRED_FROM_ $ ( 3) ) ) ) \
2019-02-23 00:06:03 +01:00
$(eval _erm_new_modules : = $( sort $ ( filter -out $ ( $ ( 1) ) ,$ ( _erm_req ) ) ) ) \
$( eval $ ( 1) += $ ( _erm_new_modules ) ) \
$( if $ ( _erm_new_modules ) ,\
2019-04-02 23:43:32 +02:00
$( call expand-required-host-modules,$( 1) ,$( _erm_new_modules) ,$( 3) ) )
2019-02-23 00:06:03 +01:00
e n d e f
2018-07-13 16:32:57 +02: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) ,\
2019-06-25 08:58:13 +02:00
$( subst $( _system_ext_path_placeholder) ,$( TARGET_COPY_OUT_SYSTEM_EXT) ,\
2018-08-28 16:45:01 +02:00
$( subst $( _odm_path_placeholder) ,$( TARGET_COPY_OUT_ODM) ,\
2020-05-07 23:58:20 +02:00
$( subst $( _vendor_dlkm_path_placeholder) ,$( TARGET_COPY_OUT_VENDOR_DLKM) ,\
2020-07-16 01:52:59 +02:00
$( subst $( _odm_dlkm_path_placeholder) ,$( TARGET_COPY_OUT_ODM_DLKM) ,\
$( foreach p,$( 1) ,$( call append-path,$( PRODUCT_OUT) ,$( p) $( 2) ) ) ) ) ) ) ) )
2018-07-13 16:32:57 +02:00
e n d e f
2019-01-25 13:51:21 +01: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) \
2020-01-14 22:22:17 +01:00
$( if $( DEVICE_MANIFEST_FILE) ,vendor_manifest.xml) \
2020-02-27 03:10:57 +01:00
$( if $( DEVICE_MANIFEST_SKUS) ,$( foreach sku, $( DEVICE_MANIFEST_SKUS) ,vendor_manifest_$( sku) .xml) ) \
2019-02-14 01:32:40 +01:00
$( if $( ODM_MANIFEST_FILES) ,odm_manifest.xml) \
$( if $( ODM_MANIFEST_SKUS) ,$( foreach sku, $( ODM_MANIFEST_SKUS) ,odm_manifest_$( sku) .xml) ) \
2019-01-25 13:51:21 +01:00
e n d e f
2018-07-13 16:32:57 +02:00
# Lists most of the files a particular product installs, including:
# - PRODUCT_PACKAGES, and their LOCAL_REQUIRED_MODULES
# - PRODUCT_COPY_FILES
2018-06-01 15:02:05 +02: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 16:57:56 +02: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:
2020-06-03 11:03:26 +02:00
# See the select-bitness-of-required-modules definition.
2018-06-01 15:02:05 +02:00
# $(1): product makefile
2021-05-04 18:58:38 +02:00
# TODO(asmundak):
# `product-installed-files` and `host-installed-files` macros below used to
# call `get-product-var` directly to obtain per-file configuration variable
# values (the value of variable FOO is fetched from PRODUCT.<product-makefile>.FOO).
# Starlark-based configuration does not maintain per-file variable variable
# values. To work around this problem, we utilize the fact that
# `product-installed-files` and `host-installed-files` are called only in
# two places:
# 1. For the top-level product makefile (in this file). In this case
# $(call get-product-var <product>, FOO) is the same as $(FOO) as the
# product configuration has been run already. Therefore we define
# _product-var macro to pick the values directly from product config
# variables when using Starlark-based configuration.
# 2. To check the path requirements (in artifact_path_requirements.mk).
# Starlark-based configuration does not perform this check at the moment.
# In the longer run most of the logic of this file will be moved to the
# Starlark.
i f n d e f R B C _ P R O D U C T _ C O N F I G
d e f i n e _ p r o d u c t - v a r
$( call get-product-var,$( 1) ,$( 2) )
e n d e f
e l s e
d e f i n e _ p r o d u c t - v a r
$( call $( 2) )
e n d e f
e n d i f
2018-06-01 15:02:05 +02:00
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-09-12 18:30:09 +02:00
$( eval _pif_modules := \
2021-05-04 18:58:38 +02:00
$( call _product-var,$( 1) ,PRODUCT_PACKAGES) \
$( if $( filter eng,$( tags_to_install) ) ,$( call _product-var,$( 1) ,PRODUCT_PACKAGES_ENG) ) \
$( if $( filter debug,$( tags_to_install) ) ,$( call _product-var,$( 1) ,PRODUCT_PACKAGES_DEBUG) ) \
$( if $( filter tests,$( tags_to_install) ) ,$( call _product-var,$( 1) ,PRODUCT_PACKAGES_TESTS) ) \
$( if $( filter asan,$( tags_to_install) ) ,$( call _product-var,$( 1) ,PRODUCT_PACKAGES_DEBUG_ASAN) ) \
$( if $( filter java_coverage,$( tags_to_install) ) ,$( call _product-var,$( 1) ,PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE) ) \
2019-01-25 13:51:21 +01:00
$( call auto-included-modules) \
2018-09-12 18:30:09 +02:00
) \
2018-06-01 15:02:05 +02:00
$( eval ### Filter out the overridden packages and executables before doing expansion) \
2018-09-12 19:01:32 +02:00
$( eval _pif_overrides := $( call module-overrides,$( _pif_modules) ) ) \
2018-06-01 15:02:05 +02:00
$( eval _pif_modules := $( filter-out $( _pif_overrides) , $( _pif_modules) ) ) \
$( eval ### Resolve the :32 :64 module name) \
2020-05-10 13:28:31 +02:00
$( eval _pif_modules := $( sort $( call resolve-bitness-for-modules,TARGET,$( _pif_modules) ) ) ) \
2018-09-12 19:01:32 +02:00
$( call expand-required-modules,_pif_modules,$( _pif_modules) ,$( _pif_overrides) ) \
2019-02-10 08:11:00 +01:00
$( filter-out $( HOST_OUT_ROOT) /%,$( call module-installed-files, $( _pif_modules) ) ) \
2018-07-13 16:32:57 +02:00
$( call resolve-product-relative-paths,\
2021-05-04 18:58:38 +02:00
$( foreach cf,$( call _product-var,$( 1) ,PRODUCT_COPY_FILES) ,$( call word-colon,2,$( cf) ) ) )
2018-06-01 15:02:05 +02:00
e n d e f
2019-02-23 00:06:03 +01:00
# Similar to product-installed-files above, but handles PRODUCT_HOST_PACKAGES instead
# This does support the :32 / :64 syntax, but does not support module overrides.
d e f i n e h o s t - i n s t a l l e d - f i l e s
2021-05-04 18:58:38 +02:00
$( eval _hif_modules := $( call _product-var,$( 1) ,PRODUCT_HOST_PACKAGES) ) \
2019-04-02 23:43:32 +02:00
$( eval ### Split host vs host cross modules) \
$( eval _hcif_modules := $( filter host_cross_%,$( _hif_modules) ) ) \
$( eval _hif_modules := $( filter-out host_cross_%,$( _hif_modules) ) ) \
2020-05-10 13:28:31 +02:00
$( eval ### Resolve the :32 :64 module name) \
$( eval _hif_modules := $( sort $( call resolve-bitness-for-modules,HOST,$( _hif_modules) ) ) ) \
$( eval _hcif_modules := $( sort $( call resolve-bitness-for-modules,HOST_CROSS,$( _hcif_modules) ) ) ) \
2019-04-02 23:43:32 +02:00
$( call expand-required-host-modules,_hif_modules,$( _hif_modules) ,HOST) \
$( call expand-required-host-modules,_hcif_modules,$( _hcif_modules) ,HOST_CROSS) \
$( filter $( HOST_OUT) /%,$( call module-installed-files, $( _hif_modules) ) ) \
$( filter $( HOST_CROSS_OUT) /%,$( call module-installed-files, $( _hcif_modules) ) )
2019-02-23 00:06:03 +01:00
e n d e f
2018-07-04 18:17:23 +02: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
2019-03-08 02:18:15 +01:00
i f d e f F U L L _ B U I L D
2019-03-19 19:20:30 +01:00
ifneq ( true,$( ALLOW_MISSING_DEPENDENCIES) )
# Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product)
2019-03-28 16:45:40 +01:00
ifeq ( true,$( PRODUCT_ENFORCE_PACKAGES_EXIST) )
2020-06-11 20:25:05 +02:00
_allow_list := $( PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST)
2019-03-28 16:45:40 +01:00
_modules := $( PRODUCT_PACKAGES)
2019-06-02 21:00:59 +02:00
# Strip :32 and :64 suffixes
_modules := $( patsubst %:32,%,$( _modules) )
_modules := $( patsubst %:64,%,$( _modules) )
2020-07-30 23:23:31 +02:00
# Quickly check all modules in PRODUCT_PACKAGES exist. We check for the
2019-03-19 19:20:30 +01:00
# existence if either <module> or the <module>_32 variant.
2020-05-10 14:33:35 +02:00
_nonexistent_modules := $( foreach m,$( _modules) , \
$( if $( or $( ALL_MODULES.$( m) .PATH) ,$( call get-modules-for-2nd-arch,TARGET,$( m) ) ) ,,$( m) ) )
2020-06-11 20:25:05 +02:00
$( call maybe-print-list-and-error,$( filter-out $( _allow_list) ,$( _nonexistent_modules) ) ,\
2019-06-02 21:00:59 +02:00
$( INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_PACKAGES)
2021-03-07 00:25:54 +01:00
# TODO(b/182105280): Consider re-enabling this check when the ART modules
# have been cleaned up from the allowed_list in target/product/generic.mk.
#$(call maybe-print-list-and-error,$(filter-out $(_nonexistent_modules),$(_allow_list)),\
# $(INTERNAL_PRODUCT) includes redundant allow list entries for non-existent PRODUCT_PACKAGES)
2019-03-19 19:20:30 +01:00
endif
# Check to ensure that all modules in PRODUCT_HOST_PACKAGES exist
#
# Many host modules are Linux-only, so skip this check on Mac. If we ever have Mac-only modules,
# maybe it would make sense to have PRODUCT_HOST_PACKAGES_LINUX/_DARWIN?
ifneq ( $( HOST_OS) ,darwin)
2019-03-28 16:45:40 +01:00
_modules := $( PRODUCT_HOST_PACKAGES)
2019-06-02 21:00:59 +02:00
# Strip :32 and :64 suffixes
_modules := $( patsubst %:32,%,$( _modules) )
_modules := $( patsubst %:64,%,$( _modules) )
_nonexistent_modules := $( foreach m,$( _modules) ,\
2019-04-02 23:43:32 +02:00
$( if $( ALL_MODULES.$( m) .REQUIRED_FROM_HOST) $( filter $( HOST_OUT_ROOT) /%,$( ALL_MODULES.$( m) .INSTALLED) ) ,,$( m) ) )
2019-06-02 21:00:59 +02:00
$( call maybe-print-list-and-error,$( _nonexistent_modules) ,\
$( INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_HOST_PACKAGES)
2019-03-08 02:18:15 +01:00
endif
2019-02-23 00:06:03 +01:00
endif
2020-06-04 16:16:39 +02:00
# Modules may produce only host installed files in unbundled builds.
ifeq ( ,$( TARGET_BUILD_UNBUNDLED) )
2020-05-13 14:19:05 +02:00
_modules := $( call resolve-bitness-for-modules,TARGET, \
$( PRODUCT_PACKAGES) \
$( PRODUCT_PACKAGES_DEBUG) \
$( PRODUCT_PACKAGES_DEBUG_ASAN) \
$( PRODUCT_PACKAGES_ENG) \
$( PRODUCT_PACKAGES_TESTS) )
_host_modules := $( foreach m,$( _modules) , \
2019-02-10 08:11:00 +01:00
$( if $( ALL_MODULES.$( m) .INSTALLED) ,\
$( if $( filter-out $( HOST_OUT_ROOT) /%,$( ALL_MODULES.$( m) .INSTALLED) ) ,,\
$( m) ) ) )
2020-05-13 14:19:05 +02:00
$( call maybe-print-list-and-error,$( sort $( _host_modules) ) ,\
2019-02-10 08:11:00 +01:00
Host modules should be in PRODUCT_HOST_PACKAGES$( comma) not PRODUCT_PACKAGES)
endif
2019-02-23 00:06:03 +01:00
product_host_FILES := $( call host-installed-files,$( INTERNAL_PRODUCT) )
product_target_FILES := $( call product-installed-files, $( INTERNAL_PRODUCT) )
2018-10-12 12:34:29 +02:00
# WARNING: The product_MODULES variable is depended on by external files.
product_MODULES := $( _pif_modules)
2018-07-24 14:31:08 +02:00
# Verify the artifact path requirements made by included products.
2018-11-13 18:02:00 +01:00
is_asan := $( if $( filter address,$( SANITIZE_TARGET) ) ,true)
2021-05-04 18:58:38 +02:00
ifeq ( ,$( or $( is_asan) ,$( DISABLE_ARTIFACT_PATH_REQUIREMENTS) ,$( RBC_PRODUCT_CONFIG) ) )
2020-12-08 22:12:13 +01:00
include $( BUILD_SYSTEM) /artifact_path_requirements.mk
2018-11-09 14:32:12 +01:00
endif
2009-03-04 04:28:42 +01: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.
2019-02-23 00:06:03 +01:00
product_target_FILES :=
2019-03-08 02:18:15 +01:00
product_host_FILES :=
2009-03-04 04:28:42 +01:00
e n d i f
2012-05-22 23:08:50 +02: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 02:33:22 +02:00
$( ALL_DEFAULT_INSTALLED_MODULES) \
2019-02-23 00:06:03 +01:00
$( product_target_FILES) \
2019-02-10 07:35:46 +01:00
$( product_host_FILES) \
2012-05-23 02:33:22 +02:00
$( CUSTOM_MODULES) \
)
2009-03-04 04:28:42 +01:00
2020-03-05 00:12:52 +01:00
i f d e f F U L L _ B U I L D
Export list of "installable" files to soong_ui
These are a (partial) list of files that we'd install with a default
build. The idea is that if something is removed from this list, soong_ui
can remove it from the installed location before running ninja.
It's okay if there are things missing from this list, it's not intended
to be a 100% solution replacing installclean / CleanSpec.mk, just
something that handles 80% of the cases without user involvement.
In particular, if something is removed from PRODUCT_PACKAGES, we'll
remove it from disk, but not necessarily rebuild the image files. That's
the same as most use cases of CleanSpec.mk today, and often some other
change will trigger the necessary images to be rebuilt.
We should be able to fix that by changing all of the image creation
rules to depend on the (partial) list of files they care about, or by
fixing ninja to rebuild things when their list of dependencies change.
(Other tools run into this same problem)
The list of test files is also included so that we can remove obsolete
tests from their "installed" locations within test suites and the
testcases folders.
Test: remove a module from PRODUCT_PACKAGES, see the print and file removed
Test: change the name of a cts test, see the old one removed from cts
Change-Id: I67f270a6713369099ca523aaf991ee3beb815c0a
2020-01-03 22:26:36 +01:00
#
# Used by the cleanup logic in soong_ui to remove files that should no longer
# be installed.
#
# Include all tests, so that we remove them from the test suites / testcase
# folders when they are removed.
test_files := $( foreach ts,$( ALL_COMPATIBILITY_SUITES) ,$( COMPATIBILITY.$( ts) .FILES) )
$( shell mkdir -p $ ( PRODUCT_OUT ) $ ( HOST_OUT ) )
$( file >$ ( PRODUCT_OUT ) /.installable_files $ ( if $ ( filter address ,$ ( SANITIZE_TARGET ) ) ,_asan ) , \
$( sort $( patsubst $( PRODUCT_OUT) /%,%,$( filter $( PRODUCT_OUT) /%, \
$( modules_to_install) $( test_files) ) ) ) )
$( file >$ ( HOST_OUT ) /.installable_test_files ,$ ( sort \
$( patsubst $( HOST_OUT) /%,%,$( filter $( HOST_OUT) /%, \
$( test_files) ) ) ) )
test_files :=
2020-03-05 00:12:52 +01:00
e n d i f
Export list of "installable" files to soong_ui
These are a (partial) list of files that we'd install with a default
build. The idea is that if something is removed from this list, soong_ui
can remove it from the installed location before running ninja.
It's okay if there are things missing from this list, it's not intended
to be a 100% solution replacing installclean / CleanSpec.mk, just
something that handles 80% of the cases without user involvement.
In particular, if something is removed from PRODUCT_PACKAGES, we'll
remove it from disk, but not necessarily rebuild the image files. That's
the same as most use cases of CleanSpec.mk today, and often some other
change will trigger the necessary images to be rebuilt.
We should be able to fix that by changing all of the image creation
rules to depend on the (partial) list of files they care about, or by
fixing ninja to rebuild things when their list of dependencies change.
(Other tools run into this same problem)
The list of test files is also included so that we can remove obsolete
tests from their "installed" locations within test suites and the
testcases folders.
Test: remove a module from PRODUCT_PACKAGES, see the print and file removed
Test: change the name of a cts test, see the old one removed from cts
Change-Id: I67f270a6713369099ca523aaf991ee3beb815c0a
2020-01-03 22:26:36 +01:00
2020-08-27 00:27:26 +02:00
# Dedpulicate compatibility suite dist files across modules and packages before
# copying them to their requested locations. Assign the eval result to an unused
# var to prevent Make from trying to make a sense of it.
_unused := $( call copy-many-files, $( sort $( ALL_COMPATIBILITY_DIST_FILES) ) )
Export list of "installable" files to soong_ui
These are a (partial) list of files that we'd install with a default
build. The idea is that if something is removed from this list, soong_ui
can remove it from the installed location before running ninja.
It's okay if there are things missing from this list, it's not intended
to be a 100% solution replacing installclean / CleanSpec.mk, just
something that handles 80% of the cases without user involvement.
In particular, if something is removed from PRODUCT_PACKAGES, we'll
remove it from disk, but not necessarily rebuild the image files. That's
the same as most use cases of CleanSpec.mk today, and often some other
change will trigger the necessary images to be rebuilt.
We should be able to fix that by changing all of the image creation
rules to depend on the (partial) list of files they care about, or by
fixing ninja to rebuild things when their list of dependencies change.
(Other tools run into this same problem)
The list of test files is also included so that we can remove obsolete
tests from their "installed" locations within test suites and the
testcases folders.
Test: remove a module from PRODUCT_PACKAGES, see the print and file removed
Test: change the name of a cts test, see the old one removed from cts
Change-Id: I67f270a6713369099ca523aaf991ee3beb815c0a
2020-01-03 22:26:36 +01:00
2015-05-16 01:55:30 +02: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 01:32:16 +02:00
i f d e f i s _ s d k _ b u i l d
2009-03-04 04:28:42 +01:00
target_gnu_MODULES := \
$( filter \
$( TARGET_OUT_INTERMEDIATES) /% \
$( TARGET_OUT) /% \
$( TARGET_OUT_DATA) /%, \
$( sort $( call get-tagged-modules,gnu) ) )
2015-05-18 21:02:26 +02:00
target_gnu_MODULES := $( filter-out $( TARGET_OUT_EXECUTABLES) /%,$( target_gnu_MODULES) )
2017-05-20 00:07:02 +02:00
target_gnu_MODULES := $( filter-out %/libopenjdkjvmti.so,$( target_gnu_MODULES) )
target_gnu_MODULES := $( filter-out %/libopenjdkjvmtid.so,$( target_gnu_MODULES) )
2009-03-04 04:28:42 +01:00
$( info Removing from sdk:) $( foreach d,$( target_gnu_MODULES) ,$( info : $( d) ) )
2009-03-09 19:52:11 +01:00
modules_to_install := \
$( filter-out $( target_gnu_MODULES) ,$( modules_to_install) )
2011-10-08 23:31:54 +02:00
2012-06-06 00:54:09 +02: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 02:28:30 +01:00
dangling_modules :=
2019-03-28 16:45:40 +01:00
$( foreach m, $( PRODUCT_PACKAGES) , \
2014-06-11 04:23:29 +02:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) $( ALL_MODULES.$( m) $( TARGET_2ND_ARCH_MODULE_SUFFIX) .INSTALLED) ) ,,\
2014-02-12 02:28:30 +01:00
$( eval dangling_modules += $( m) ) ) )
ifneq ( $( dangling_modules) ,)
2014-02-18 20:17:53 +01:00
$( warning: Modules '$(dangling_modules)' in PRODUCT_PACKAGES have nothing to install!)
2014-02-12 02:28:30 +01:00
endif
2019-03-28 16:45:40 +01:00
$( foreach m, $( PRODUCT_PACKAGES_DEBUG) , \
2012-08-17 09:09:27 +02:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) ) ,,\
2012-08-17 10:26:41 +02:00
$( warning $( ALL_MODULES.$( m) .MAKEFILE) : Module '$(m)' in PRODUCT_PACKAGES_DEBUG has nothing to install!) ) )
2019-03-28 16:45:40 +01:00
$( foreach m, $( PRODUCT_PACKAGES_ENG) , \
2012-08-17 09:09:27 +02:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) ) ,,\
2012-08-17 10:26:41 +02:00
$( warning $( ALL_MODULES.$( m) .MAKEFILE) : Module '$(m)' in PRODUCT_PACKAGES_ENG has nothing to install!) ) )
2019-03-28 16:45:40 +01:00
$( foreach m, $( PRODUCT_PACKAGES_TESTS) , \
2012-08-17 09:09:27 +02:00
$( if $( strip $( ALL_MODULES.$( m) .INSTALLED) ) ,,\
2012-08-17 10:26:41 +02:00
$( warning $( ALL_MODULES.$( m) .MAKEFILE) : Module '$(m)' in PRODUCT_PACKAGES_TESTS has nothing to install!) ) )
2009-03-04 04:28:42 +01:00
e n d i f
2017-10-20 20:37:33 +02:00
# build/make/core/Makefile contains extra stuff that we don't want to pollute this
2009-03-04 04:28:42 +01: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-09 19:52:11 +01:00
ALL_DEFAULT_INSTALLED_MODULES := $( modules_to_install)
2009-03-04 04:28:42 +01:00
i n c l u d e $( BUILD_SYSTEM ) / M a k e f i l e
2009-03-09 19:52:11 +01:00
modules_to_install := $( sort $( ALL_DEFAULT_INSTALLED_MODULES) )
2009-03-04 04:28:42 +01:00
ALL_DEFAULT_INSTALLED_MODULES :=
2012-05-21 21:16:05 +02:00
2021-01-07 04:34:31 +01:00
# Some notice deps refer to module names without prefix or arch suffix where
# only the variants with them get built.
# fix-notice-deps replaces those unadorned module names with every built variant.
2021-01-07 04:34:31 +01:00
$( call fix -notice -deps )
2021-01-07 04:34:31 +01:00
# Create a license metadata rule per module. Could happen in base_rules.mk or
# notice_files.mk; except, it has to happen after fix-notice-deps to avoid
# missing dependency errors.
$( call build -license -metadata )
2021-01-07 04:34:31 +01:00
2009-07-17 21:33:40 +02: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-02 18:47:30 +01:00
# Build docs as part of checkbuild to catch more breakages.
2020-01-27 20:36:07 +01:00
modules_to_check += $( ALL_DOCS)
2018-11-02 18:47:30 +01:00
2009-07-17 21:33:40 +02:00
# for easier debugging
modules_to_check := $( sort $( modules_to_check) )
#$(error modules_to_check $(modules_to_check))
2009-03-04 04:28:42 +01: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-23 22:14:35 +01:00
files : $( modules_to_install ) \
$( INSTALLED_ANDROID_INFO_TXT_TARGET)
2009-03-04 04:28:42 +01:00
# -------------------------------------------------------------------
2009-07-17 21:33:40 +02:00
.PHONY : checkbuild
2019-09-13 06:26:09 +02:00
checkbuild : $( modules_to_check ) droid_targets check -elf -files
2016-05-25 21:55:43 +02:00
2015-09-26 01:43:36 +02:00
i f e q ( t r u e , $( ANDROID_BUILD_EVERYTHING_BY_DEFAULT ) )
2013-02-22 03:41:51 +01:00
droid : checkbuild
e n d i f
2009-07-17 21:33:40 +02:00
2009-03-04 04:28:42 +01:00
.PHONY : ramdisk
ramdisk : $( INSTALLED_RAMDISK_TARGET )
Adding boot-debug.img and ramdisk-debug.img
The two new debugging images adds additional files based on
boot.img and ramdisk.img/ramdisk-recovery.img, respectively.
File /force_debuggable is to trigger special logic in /init to load an
userdebug version of sepolicy and an additional property file from this
ramdisk to allow adb root, if the device is unlocked.
It's intentional to skip signing for boot-debug.img, as it can
only be used if the device is unlocked, where verification error
is allowed.
Those debugging images allows adb root on user build
system.img, vendor.img, product.img, etc. This can facilitate more
automated testings on user builds and is helpful to narrow down the
delta between what's being tested v.s. what's being shipped.
Bug: 126493225
Test: `make dist`, checks both boot-debug.img and ramdisk-debug.img
are in $OUT/ and out/dist.
Test: `make dist`, checks installed-files-ramdisk-debug.{json,txt} are
in out/dist.
Test: `system/core/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-debug.img`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-debug.img and $OUT/boot.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk ./ramdisk-debug`
Test: `make ramdisk_debug-nodeps` and `make bootimage_debug-nodeps`
Change-Id: I30137c3caef91805d9143d404e5e4d06c0fccc30
2019-03-20 10:59:52 +01:00
.PHONY : ramdisk_debug
ramdisk_debug : $( INSTALLED_DEBUG_RAMDISK_TARGET )
Adding boot-test-harness.img
In commit I30137c3caef91805d9143d404e5e4d06c0fccc30, we added
a boot-debug.img to allow adb root when using an user build GSI image.
However, to run automated tests, it requires additional properties,
which are not needed for GSI compliance:
ro.audio.silent=1
ro.test_harness=1
This CL adds an additional boot-test-harness.img for automated tests,
and keeps the original boot-debug.img for GSI compliance.
Note: boot-test-harness.img won't be built by default, it needs
explicit `make bootimage_test_harness`.
Bug: 140036184
Test: `m bootimage_test_harness`, flashes boot-test-harness.img and checks
adb root works and test harness props are set.
Test: `m bootimage_test_harness dist -j32`, checks both
boot-test-harness.img and ramdisk-test-harness.img are under ./out/dist/.
Test: `system/tools/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-test-harness.img --out ramdisk-test-harness`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-test-harness.img and $OUT/boot-debug.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk-test-harness ./ramdisk-debug`
Test: `m ramdisk_test_harness-nodeps` and `m bootimage_test_harness-nodeps`
Change-Id: Iadea0b5c933c3b7fa10dcf3d9e85596916b3333d
2019-10-08 04:22:19 +02:00
.PHONY : ramdisk_test_harness
ramdisk_test_harness : $( INSTALLED_TEST_HARNESS_RAMDISK_TARGET )
2009-03-04 04:28:42 +01:00
.PHONY : userdataimage
userdataimage : $( INSTALLED_USERDATAIMAGE_TARGET )
2011-02-01 23:52:05 +01:00
i f n e q ( , $( filter userdataimage , $ ( MAKECMDGOALS ) ) )
$( call dist -for -goals , userdataimage , $ ( BUILT_USERDATAIMAGE_TARGET ) )
e n d i f
2011-11-04 19:37:01 +01:00
.PHONY : cacheimage
cacheimage : $( INSTALLED_CACHEIMAGE_TARGET )
2016-04-08 21:08:03 +02:00
.PHONY : bptimage
bptimage : $( INSTALLED_BPTIMAGE_TARGET )
2013-03-20 19:02:05 +01:00
.PHONY : vendorimage
vendorimage : $( INSTALLED_VENDORIMAGE_TARGET )
2019-07-10 19:49:37 +02:00
.PHONY : vendorbootimage
vendorbootimage : $( INSTALLED_VENDOR_BOOTIMAGE_TARGET )
2020-02-14 12:00:15 +01:00
.PHONY : vendorbootimage_debug
vendorbootimage_debug : $( INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET )
2021-07-29 17:35:33 +02:00
.PHONY : vendorbootimage_test_harness
vendorbootimage_test_harness : $( INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET )
2021-03-04 20:04:03 +01:00
.PHONY : vendorramdisk
vendorramdisk : $( INSTALLED_VENDOR_RAMDISK_TARGET )
2021-03-10 21:38:15 +01:00
.PHONY : vendorramdisk_debug
vendorramdisk_debug : $( INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET )
2017-11-27 09:04:47 +01:00
.PHONY : productimage
productimage : $( INSTALLED_PRODUCTIMAGE_TARGET )
2019-06-25 08:58:13 +02:00
.PHONY : systemextimage
systemextimage : $( INSTALLED_SYSTEM_EXTIMAGE_TARGET )
2018-05-29 14:09:01 +02:00
2017-11-14 16:42:30 +01:00
.PHONY : odmimage
odmimage : $( INSTALLED_ODMIMAGE_TARGET )
2020-05-07 23:58:20 +02:00
.PHONY : vendor_dlkmimage
vendor_dlkmimage : $( INSTALLED_VENDOR_DLKMIMAGE_TARGET )
2020-07-16 01:52:59 +02:00
.PHONY : odm_dlkmimage
odm_dlkmimage : $( INSTALLED_ODM_DLKMIMAGE_TARGET )
2016-06-16 23:47:10 +02:00
.PHONY : systemotherimage
systemotherimage : $( INSTALLED_SYSTEMOTHERIMAGE_TARGET )
2018-08-13 22:01:14 +02:00
.PHONY : superimage_empty
superimage_empty : $( INSTALLED_SUPERIMAGE_EMPTY_TARGET )
2009-03-04 04:28:42 +01:00
.PHONY : bootimage
bootimage : $( INSTALLED_BOOTIMAGE_TARGET )
Adding boot-debug.img and ramdisk-debug.img
The two new debugging images adds additional files based on
boot.img and ramdisk.img/ramdisk-recovery.img, respectively.
File /force_debuggable is to trigger special logic in /init to load an
userdebug version of sepolicy and an additional property file from this
ramdisk to allow adb root, if the device is unlocked.
It's intentional to skip signing for boot-debug.img, as it can
only be used if the device is unlocked, where verification error
is allowed.
Those debugging images allows adb root on user build
system.img, vendor.img, product.img, etc. This can facilitate more
automated testings on user builds and is helpful to narrow down the
delta between what's being tested v.s. what's being shipped.
Bug: 126493225
Test: `make dist`, checks both boot-debug.img and ramdisk-debug.img
are in $OUT/ and out/dist.
Test: `make dist`, checks installed-files-ramdisk-debug.{json,txt} are
in out/dist.
Test: `system/core/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-debug.img`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-debug.img and $OUT/boot.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk ./ramdisk-debug`
Test: `make ramdisk_debug-nodeps` and `make bootimage_debug-nodeps`
Change-Id: I30137c3caef91805d9143d404e5e4d06c0fccc30
2019-03-20 10:59:52 +01:00
.PHONY : bootimage_debug
bootimage_debug : $( INSTALLED_DEBUG_BOOTIMAGE_TARGET )
Adding boot-test-harness.img
In commit I30137c3caef91805d9143d404e5e4d06c0fccc30, we added
a boot-debug.img to allow adb root when using an user build GSI image.
However, to run automated tests, it requires additional properties,
which are not needed for GSI compliance:
ro.audio.silent=1
ro.test_harness=1
This CL adds an additional boot-test-harness.img for automated tests,
and keeps the original boot-debug.img for GSI compliance.
Note: boot-test-harness.img won't be built by default, it needs
explicit `make bootimage_test_harness`.
Bug: 140036184
Test: `m bootimage_test_harness`, flashes boot-test-harness.img and checks
adb root works and test harness props are set.
Test: `m bootimage_test_harness dist -j32`, checks both
boot-test-harness.img and ramdisk-test-harness.img are under ./out/dist/.
Test: `system/tools/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-test-harness.img --out ramdisk-test-harness`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-test-harness.img and $OUT/boot-debug.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk-test-harness ./ramdisk-debug`
Test: `m ramdisk_test_harness-nodeps` and `m bootimage_test_harness-nodeps`
Change-Id: Iadea0b5c933c3b7fa10dcf3d9e85596916b3333d
2019-10-08 04:22:19 +02:00
.PHONY : bootimage_test_harness
bootimage_test_harness : $( INSTALLED_TEST_HARNESS_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-15 19:43:54 +02:00
.PHONY : vbmetaimage
vbmetaimage : $( INSTALLED_VBMETAIMAGE_TARGET )
Adding vbmeta_system.img and vbmeta_vendor.img to droidcore
In the concept of system/vendor build split, usually vbmeta.img
won't be built in a system-only build and/or a vendor-only build.
Instead, vbmeta.img will be generated later when combining system
and vendor artifacts.
- system-only artifacts: system.img, system_ext.img,
product.img and vbmeta_system.img
- vendor-only artifacts: boot.img, vendor.img, odm.img and
vbmeta_vendor.img
PRODUCT_BUILD_VBMETA_IMAGE can be used to disable building vbmeta.img.
However, it also disables vbmeta_system.img and vbmeta_vendor.img
generation because both are only depended by vbmeta.img.
This change adds both vbmeta_[system|vendor].img into droidcore,
so they will be built even if PRODUCT_BUILD_VBMETA_IMAGE is set
to false, when we're building system-only artifacts or vendor-only
artifacts.
Bug: 161425613
Test: sets PRODUCT_BUILD_VBMETA_IMAGE := false then build, checks
vbmeta_system.img is generated but vbmeta.img is not.
Change-Id: I39d9819da4704195b0e1ee58d13c848ae97d474a
2020-07-17 08:39:46 +02:00
.PHONY : vbmetasystemimage
vbmetasystemimage : $( INSTALLED_VBMETA_SYSTEMIMAGE_TARGET )
.PHONY : vbmetavendorimage
vbmetavendorimage : $( INSTALLED_VBMETA_VENDORIMAGE_TARGET )
2021-06-16 04:35:06 +02:00
# The droidcore-unbundled target depends on the subset of targets necessary to
# perform a full system build (either unbundled or not).
.PHONY : droidcore -unbundled
droidcore-unbundled : $( filter $ ( HOST_OUT_ROOT ) /%,$ ( modules_to_install ) ) \
2019-01-15 06:46:31 +01:00
$( INSTALLED_SYSTEMIMAGE_TARGET) \
2018-08-15 01:17:12 +02:00
$( INSTALLED_RAMDISK_TARGET) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_BOOTIMAGE_TARGET) \
2019-05-20 22:51:07 +02:00
$( INSTALLED_RADIOIMAGE_TARGET) \
Adding boot-debug.img and ramdisk-debug.img
The two new debugging images adds additional files based on
boot.img and ramdisk.img/ramdisk-recovery.img, respectively.
File /force_debuggable is to trigger special logic in /init to load an
userdebug version of sepolicy and an additional property file from this
ramdisk to allow adb root, if the device is unlocked.
It's intentional to skip signing for boot-debug.img, as it can
only be used if the device is unlocked, where verification error
is allowed.
Those debugging images allows adb root on user build
system.img, vendor.img, product.img, etc. This can facilitate more
automated testings on user builds and is helpful to narrow down the
delta between what's being tested v.s. what's being shipped.
Bug: 126493225
Test: `make dist`, checks both boot-debug.img and ramdisk-debug.img
are in $OUT/ and out/dist.
Test: `make dist`, checks installed-files-ramdisk-debug.{json,txt} are
in out/dist.
Test: `system/core/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-debug.img`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-debug.img and $OUT/boot.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk ./ramdisk-debug`
Test: `make ramdisk_debug-nodeps` and `make bootimage_debug-nodeps`
Change-Id: I30137c3caef91805d9143d404e5e4d06c0fccc30
2019-03-20 10:59:52 +01:00
$( INSTALLED_DEBUG_RAMDISK_TARGET) \
$( INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_RECOVERYIMAGE_TARGET) \
$( INSTALLED_VBMETAIMAGE_TARGET) \
Adding vbmeta_system.img and vbmeta_vendor.img to droidcore
In the concept of system/vendor build split, usually vbmeta.img
won't be built in a system-only build and/or a vendor-only build.
Instead, vbmeta.img will be generated later when combining system
and vendor artifacts.
- system-only artifacts: system.img, system_ext.img,
product.img and vbmeta_system.img
- vendor-only artifacts: boot.img, vendor.img, odm.img and
vbmeta_vendor.img
PRODUCT_BUILD_VBMETA_IMAGE can be used to disable building vbmeta.img.
However, it also disables vbmeta_system.img and vbmeta_vendor.img
generation because both are only depended by vbmeta.img.
This change adds both vbmeta_[system|vendor].img into droidcore,
so they will be built even if PRODUCT_BUILD_VBMETA_IMAGE is set
to false, when we're building system-only artifacts or vendor-only
artifacts.
Bug: 161425613
Test: sets PRODUCT_BUILD_VBMETA_IMAGE := false then build, checks
vbmeta_system.img is generated but vbmeta.img is not.
Change-Id: I39d9819da4704195b0e1ee58d13c848ae97d474a
2020-07-17 08:39:46 +02:00
$( INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
$( INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_USERDATAIMAGE_TARGET) \
$( INSTALLED_CACHEIMAGE_TARGET) \
$( INSTALLED_BPTIMAGE_TARGET) \
$( INSTALLED_VENDORIMAGE_TARGET) \
2019-07-10 19:49:37 +02:00
$( INSTALLED_VENDOR_BOOTIMAGE_TARGET) \
2020-02-14 12:00:15 +01:00
$( INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \
2021-07-29 17:35:33 +02:00
$( INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) \
2021-03-04 20:04:03 +01:00
$( INSTALLED_VENDOR_RAMDISK_TARGET) \
2021-03-10 21:38:15 +01:00
$( INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \
2017-11-14 16:42:30 +01:00
$( INSTALLED_ODMIMAGE_TARGET) \
2020-05-07 23:58:20 +02:00
$( INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
2020-07-16 01:52:59 +02:00
$( INSTALLED_ODM_DLKMIMAGE_TARGET) \
2018-08-13 22:01:14 +02:00
$( INSTALLED_SUPERIMAGE_EMPTY_TARGET) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_PRODUCTIMAGE_TARGET) \
$( INSTALLED_SYSTEMOTHERIMAGE_TARGET) \
2021-03-31 04:56:28 +02:00
$( INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \
$( INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_FILES_FILE) \
$( INSTALLED_FILES_JSON) \
$( INSTALLED_FILES_FILE_VENDOR) \
$( INSTALLED_FILES_JSON_VENDOR) \
2017-11-14 16:42:30 +01:00
$( INSTALLED_FILES_FILE_ODM) \
$( INSTALLED_FILES_JSON_ODM) \
2020-05-07 23:58:20 +02:00
$( INSTALLED_FILES_FILE_VENDOR_DLKM) \
$( INSTALLED_FILES_JSON_VENDOR_DLKM) \
2020-07-16 01:52:59 +02:00
$( INSTALLED_FILES_FILE_ODM_DLKM) \
$( INSTALLED_FILES_JSON_ODM_DLKM) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_FILES_FILE_PRODUCT) \
$( INSTALLED_FILES_JSON_PRODUCT) \
2019-06-25 08:58:13 +02:00
$( INSTALLED_FILES_FILE_SYSTEM_EXT) \
$( INSTALLED_FILES_JSON_SYSTEM_EXT) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_FILES_FILE_SYSTEMOTHER) \
$( INSTALLED_FILES_JSON_SYSTEMOTHER) \
2018-08-09 23:26:00 +02:00
$( INSTALLED_FILES_FILE_RAMDISK) \
$( INSTALLED_FILES_JSON_RAMDISK) \
Adding boot-debug.img and ramdisk-debug.img
The two new debugging images adds additional files based on
boot.img and ramdisk.img/ramdisk-recovery.img, respectively.
File /force_debuggable is to trigger special logic in /init to load an
userdebug version of sepolicy and an additional property file from this
ramdisk to allow adb root, if the device is unlocked.
It's intentional to skip signing for boot-debug.img, as it can
only be used if the device is unlocked, where verification error
is allowed.
Those debugging images allows adb root on user build
system.img, vendor.img, product.img, etc. This can facilitate more
automated testings on user builds and is helpful to narrow down the
delta between what's being tested v.s. what's being shipped.
Bug: 126493225
Test: `make dist`, checks both boot-debug.img and ramdisk-debug.img
are in $OUT/ and out/dist.
Test: `make dist`, checks installed-files-ramdisk-debug.{json,txt} are
in out/dist.
Test: `system/core/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-debug.img`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-debug.img and $OUT/boot.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk ./ramdisk-debug`
Test: `make ramdisk_debug-nodeps` and `make bootimage_debug-nodeps`
Change-Id: I30137c3caef91805d9143d404e5e4d06c0fccc30
2019-03-20 10:59:52 +01:00
$( INSTALLED_FILES_FILE_DEBUG_RAMDISK) \
$( INSTALLED_FILES_JSON_DEBUG_RAMDISK) \
2020-11-20 20:59:41 +01:00
$( INSTALLED_FILES_FILE_VENDOR_RAMDISK) \
$( INSTALLED_FILES_JSON_VENDOR_RAMDISK) \
2020-02-14 12:00:15 +01:00
$( INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK) \
$( INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK) \
2018-08-09 23:26:00 +02:00
$( INSTALLED_FILES_FILE_ROOT) \
$( INSTALLED_FILES_JSON_ROOT) \
2018-08-14 21:17:48 +02:00
$( INSTALLED_FILES_FILE_RECOVERY) \
$( INSTALLED_FILES_JSON_RECOVERY) \
2019-01-15 06:46:31 +01:00
$( INSTALLED_ANDROID_INFO_TXT_TARGET) \
2018-06-13 23:04:22 +02:00
soong_docs
2009-03-04 04:28:42 +01:00
2021-06-16 04:35:06 +02:00
# The droidcore target depends on the droidcore-unbundled subset and any other
# targets for a non-unbundled (full source) full system build.
.PHONY : droidcore
droidcore : droidcore -unbundled
2010-12-09 05:07:48 +01:00
# dist_files only for putting your library into the dist directory with a full build.
.PHONY : dist_files
2010-07-14 06:08:38 +02:00
2020-09-26 12:41:17 +02:00
i f e q ( $( SOONG_COLLECT_JAVA_DEPS ) , t r u e )
$( call dist-for-goals, dist_files, $( SOONG_OUT_DIR) /module_bp_java_deps.json)
2020-11-18 04:28:39 +01:00
$( call dist-for-goals, dist_files, $( PRODUCT_OUT) /module-info.json)
2020-09-26 12:41:17 +02:00
e n d i f
2018-09-12 07:47:45 +02:00
.PHONY : apps_only
2010-06-10 01:35:58 +02:00
i f n e q ( $( TARGET_BUILD_APPS ) , )
2010-06-10 03:18:31 +02:00
# If this build is just for apps, only build apps and not the full system by default.
2009-03-04 04:28:42 +01:00
2010-06-10 01:35:58 +02:00
unbundled_build_modules :=
ifneq ( $( filter all,$( TARGET_BUILD_APPS) ) ,)
2010-06-25 00:08:33 +02: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 01:35:58 +02:00
else
unbundled_build_modules := $( TARGET_BUILD_APPS)
endif
2010-05-11 23:36:32 +02:00
2013-06-13 00:25:23 +02:00
# Dist the installed files if they exist.
2012-08-15 21:22:44 +02: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 07:16:42 +01: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) )
2020-07-06 23:14:47 +02:00
# Dist the lint reports if they exist.
apps_only_lint_report_files := $( foreach m,$( unbundled_build_modules) ,\
$( foreach report,$( ALL_MODULES.$( m) .LINT_REPORTS) ,\
$( report) :$( m) -$( notdir $( report) ) ) )
.PHONY: lint-check
lint-check: $( foreach f, $( apps_only_lint_report_files) , $( call word-colon,1,$( f) ) )
$( call dist-for-goals,lint-check, $( apps_only_lint_report_files) )
2013-06-13 00:25:23 +02: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 02:00:53 +01: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 00:25:23 +02:00
$( call dist-for-goals,apps_only, $( apps_only_dist_built_files) )
2012-08-15 21:22:44 +02:00
ifeq ( $( EMMA_INSTRUMENT) ,true)
2017-09-27 23:28:41 +02:00
$( JACOCO_REPORT_CLASSES_ALL) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( JACOCO_REPORT_CLASSES_ALL) )
2012-08-15 21:22:44 +02:00
endif
2010-06-10 01:35:58 +02:00
2013-08-23 05:52:47 +02:00
$( PROGUARD_DICT_ZIP) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( PROGUARD_DICT_ZIP) )
2020-08-15 02:43:35 +02:00
$( PROGUARD_USAGE_ZIP) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( PROGUARD_USAGE_ZIP) )
2014-10-24 20:36:59 +02:00
$( SYMBOLS_ZIP) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( SYMBOLS_ZIP) )
2016-09-12 22:56:50 +02:00
$( COVERAGE_ZIP) : $( apps_only_installed_files)
$( call dist-for-goals,apps_only, $( COVERAGE_ZIP) )
2010-06-10 03:18:31 +02:00
apps_only : $( unbundled_build_modules )
2010-06-10 01:35:58 +02:00
2015-09-26 01:43:36 +02:00
droid_targets : apps_only
2010-06-10 03:18:31 +02:00
2013-08-23 05:02:03 +02:00
# Combine the NOTICE files for a apps_only build
2017-04-19 08:26:47 +02:00
$( eval $ ( call combine -notice -files , html , \
2013-08-23 05:02:03 +02:00
$( target_notice_file_txt) , \
2017-04-19 08:26:47 +02:00
$( target_notice_file_html_or_xml) , \
2013-08-23 05:02:03 +02:00
"Notices for files for apps:" , \
$( TARGET_OUT_NOTICE_FILES) , \
$( apps_only_installed_files) ) )
2021-06-16 04:35:06 +02:00
e l s e i f e q ( $( TARGET_BUILD_UNBUNDLED ) , $( TARGET_BUILD_UNBUNDLED_IMAGE ) )
# Truth table for entering this block of code:
# TARGET_BUILD_UNBUNDLED | TARGET_BUILD_UNBUNDLED_IMAGE | Action
# -----------------------|------------------------------|-------------------------
# not set | not set | droidcore path
# not set | true | invalid
# true | not set | skip
# true | true | droidcore-unbundled path
# We dist the following targets only for droidcore full build. These items
# can include java-related targets that would cause building framework java
# sources in a droidcore full build.
2010-06-10 03:18:31 +02:00
$( call dist-for-goals, droidcore, \
2021-06-16 04:35:06 +02:00
$( BUILT_OTATOOLS_PACKAGE) \
$( APPCOMPAT_ZIP) \
$( DEXPREOPT_TOOLS_ZIP) \
)
# We dist the following targets for droidcore-unbundled (and droidcore since
# droidcore depends on droidcore-unbundled). The droidcore-unbundled target
# is a subset of droidcore. It can be used used for an unbundled build to
# avoid disting targets that would cause building framework java sources,
# which we want to avoid in an unbundled build.
$( call dist-for-goals, droidcore-unbundled, \
2010-06-10 01:35:58 +02:00
$( INTERNAL_UPDATE_PACKAGE_TARGET) \
$( INTERNAL_OTA_PACKAGE_TARGET) \
2019-02-19 23:52:33 +01:00
$( INTERNAL_OTA_METADATA) \
2020-10-17 03:53:47 +02:00
$( INTERNAL_OTA_PARTIAL_PACKAGE_TARGET) \
2018-11-09 02:44:12 +01:00
$( INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) \
2010-06-10 01:35:58 +02:00
$( SYMBOLS_ZIP) \
2019-09-06 02:19:35 +02:00
$( PROGUARD_DICT_ZIP) \
2020-08-15 02:43:35 +02:00
$( PROGUARD_USAGE_ZIP) \
2016-09-12 22:56:50 +02:00
$( COVERAGE_ZIP) \
2010-06-10 01:35:58 +02:00
$( INSTALLED_FILES_FILE) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_FILES_JSON) \
2015-09-15 23:22:12 +02:00
$( INSTALLED_FILES_FILE_VENDOR) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_FILES_JSON_VENDOR) \
2017-11-14 16:42:30 +01:00
$( INSTALLED_FILES_FILE_ODM) \
$( INSTALLED_FILES_JSON_ODM) \
2020-05-07 23:58:20 +02:00
$( INSTALLED_FILES_FILE_VENDOR_DLKM) \
$( INSTALLED_FILES_JSON_VENDOR_DLKM) \
2020-07-16 01:52:59 +02:00
$( INSTALLED_FILES_FILE_ODM_DLKM) \
$( INSTALLED_FILES_JSON_ODM_DLKM) \
2017-11-27 09:04:47 +01:00
$( INSTALLED_FILES_FILE_PRODUCT) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_FILES_JSON_PRODUCT) \
2019-06-25 08:58:13 +02:00
$( INSTALLED_FILES_FILE_SYSTEM_EXT) \
$( INSTALLED_FILES_JSON_SYSTEM_EXT) \
2016-06-16 23:47:10 +02:00
$( INSTALLED_FILES_FILE_SYSTEMOTHER) \
2018-06-13 23:04:22 +02:00
$( INSTALLED_FILES_JSON_SYSTEMOTHER) \
2018-08-14 21:17:48 +02:00
$( INSTALLED_FILES_FILE_RECOVERY) \
$( INSTALLED_FILES_JSON_RECOVERY) \
2020-07-03 02:59:10 +02:00
$( INSTALLED_BUILD_PROP_TARGET) :build.prop \
$( INSTALLED_VENDOR_BUILD_PROP_TARGET) :build.prop-vendor \
$( INSTALLED_PRODUCT_BUILD_PROP_TARGET) :build.prop-product \
$( INSTALLED_ODM_BUILD_PROP_TARGET) :build.prop-odm \
$( INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) :build.prop-system_ext \
2020-09-25 03:18:26 +02:00
$( INSTALLED_RAMDISK_BUILD_PROP_TARGET) :build.prop-ramdisk \
2010-06-10 01:35:58 +02:00
$( BUILT_TARGET_FILES_PACKAGE) \
$( INSTALLED_ANDROID_INFO_TXT_TARGET) \
2019-12-20 05:48:43 +01:00
$( INSTALLED_MISC_INFO_TARGET) \
2010-07-01 19:07:28 +02:00
$( INSTALLED_RAMDISK_TARGET) \
2021-06-08 04:31:31 +02:00
$( DEXPREOPT_CONFIG_ZIP) \
2021-06-16 04:35:06 +02:00
)
2010-06-10 01:35:58 +02:00
2013-07-26 21:19:20 +02:00
# Put a copy of the radio/bootloader files in the dist dir.
$( foreach f,$( INSTALLED_RADIOIMAGE_TARGET) , \
2021-06-16 04:35:06 +02:00
$( call dist-for-goals, droidcore-unbundled, $( f) ) )
2013-07-26 21:19:20 +02:00
2013-10-02 16:51:11 +02:00
ifneq ( $( ANDROID_BUILD_EMBEDDED) ,true)
2012-03-29 23:31:08 +02:00
$( call dist-for-goals, droidcore, \
$( APPS_ZIP) \
$( INTERNAL_EMULATOR_PACKAGE_TARGET) \
)
endif
2021-06-16 04:35:06 +02:00
$( call dist-for-goals, droidcore-unbundled, \
2018-08-09 23:26:00 +02:00
$( INSTALLED_FILES_FILE_ROOT) \
$( INSTALLED_FILES_JSON_ROOT) \
)
ifneq ( $( BOARD_BUILD_SYSTEM_ROOT_IMAGE) ,true)
2021-06-16 04:35:06 +02:00
$( call dist-for-goals, droidcore-unbundled, \
2018-08-09 23:26:00 +02:00
$( INSTALLED_FILES_FILE_RAMDISK) \
$( INSTALLED_FILES_JSON_RAMDISK) \
Adding boot-debug.img and ramdisk-debug.img
The two new debugging images adds additional files based on
boot.img and ramdisk.img/ramdisk-recovery.img, respectively.
File /force_debuggable is to trigger special logic in /init to load an
userdebug version of sepolicy and an additional property file from this
ramdisk to allow adb root, if the device is unlocked.
It's intentional to skip signing for boot-debug.img, as it can
only be used if the device is unlocked, where verification error
is allowed.
Those debugging images allows adb root on user build
system.img, vendor.img, product.img, etc. This can facilitate more
automated testings on user builds and is helpful to narrow down the
delta between what's being tested v.s. what's being shipped.
Bug: 126493225
Test: `make dist`, checks both boot-debug.img and ramdisk-debug.img
are in $OUT/ and out/dist.
Test: `make dist`, checks installed-files-ramdisk-debug.{json,txt} are
in out/dist.
Test: `system/core/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-debug.img`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-debug.img and $OUT/boot.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk ./ramdisk-debug`
Test: `make ramdisk_debug-nodeps` and `make bootimage_debug-nodeps`
Change-Id: I30137c3caef91805d9143d404e5e4d06c0fccc30
2019-03-20 10:59:52 +01:00
$( INSTALLED_FILES_FILE_DEBUG_RAMDISK) \
$( INSTALLED_FILES_JSON_DEBUG_RAMDISK) \
2020-11-20 20:59:41 +01:00
$( INSTALLED_FILES_FILE_VENDOR_RAMDISK) \
$( INSTALLED_FILES_JSON_VENDOR_RAMDISK) \
2020-02-14 12:00:15 +01:00
$( INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK) \
$( INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK) \
Adding boot-debug.img and ramdisk-debug.img
The two new debugging images adds additional files based on
boot.img and ramdisk.img/ramdisk-recovery.img, respectively.
File /force_debuggable is to trigger special logic in /init to load an
userdebug version of sepolicy and an additional property file from this
ramdisk to allow adb root, if the device is unlocked.
It's intentional to skip signing for boot-debug.img, as it can
only be used if the device is unlocked, where verification error
is allowed.
Those debugging images allows adb root on user build
system.img, vendor.img, product.img, etc. This can facilitate more
automated testings on user builds and is helpful to narrow down the
delta between what's being tested v.s. what's being shipped.
Bug: 126493225
Test: `make dist`, checks both boot-debug.img and ramdisk-debug.img
are in $OUT/ and out/dist.
Test: `make dist`, checks installed-files-ramdisk-debug.{json,txt} are
in out/dist.
Test: `system/core/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-debug.img`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-debug.img and $OUT/boot.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk ./ramdisk-debug`
Test: `make ramdisk_debug-nodeps` and `make bootimage_debug-nodeps`
Change-Id: I30137c3caef91805d9143d404e5e4d06c0fccc30
2019-03-20 10:59:52 +01:00
$( INSTALLED_DEBUG_RAMDISK_TARGET) \
$( INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
2021-03-31 04:56:28 +02:00
$( INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \
$( INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \
2020-02-14 12:00:15 +01:00
$( INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \
2021-07-29 17:35:33 +02:00
$( INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) \
2021-03-10 21:51:55 +01:00
$( INSTALLED_VENDOR_RAMDISK_TARGET) \
$( INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \
Adding boot-test-harness.img
In commit I30137c3caef91805d9143d404e5e4d06c0fccc30, we added
a boot-debug.img to allow adb root when using an user build GSI image.
However, to run automated tests, it requires additional properties,
which are not needed for GSI compliance:
ro.audio.silent=1
ro.test_harness=1
This CL adds an additional boot-test-harness.img for automated tests,
and keeps the original boot-debug.img for GSI compliance.
Note: boot-test-harness.img won't be built by default, it needs
explicit `make bootimage_test_harness`.
Bug: 140036184
Test: `m bootimage_test_harness`, flashes boot-test-harness.img and checks
adb root works and test harness props are set.
Test: `m bootimage_test_harness dist -j32`, checks both
boot-test-harness.img and ramdisk-test-harness.img are under ./out/dist/.
Test: `system/tools/mkbootimg/unpack_bootimg.py --boot_img $OUT/boot-test-harness.img --out ramdisk-test-harness`,
checks the extracted out/ramdisk is as expected
Test: Run `gunzip -c ramdisk | cpio -idm` for the ramdisk extracted from
$OUT/boot-test-harness.img and $OUT/boot-debug.img, respectively.
Then compare the root dirs of both, e.g.,
`diff -rq --no-dereference ./ramdisk-test-harness ./ramdisk-debug`
Test: `m ramdisk_test_harness-nodeps` and `m bootimage_test_harness-nodeps`
Change-Id: Iadea0b5c933c3b7fa10dcf3d9e85596916b3333d
2019-10-08 04:22:19 +02:00
)
2018-07-04 00:41:40 +02:00
endif
2019-12-23 23:06:20 +01:00
ifeq ( $( BOARD_USES_RECOVERY_AS_BOOT) ,true)
2021-06-16 04:35:06 +02:00
$( call dist-for-goals, droidcore-unbundled, \
2019-12-23 23:06:20 +01:00
$( recovery_ramdisk) \
)
endif
2012-08-15 21:22:44 +02:00
ifeq ( $( EMMA_INSTRUMENT) ,true)
2017-09-27 23:28:41 +02:00
$( call dist-for-goals, dist_files, $( JACOCO_REPORT_CLASSES_ALL) )
2019-03-14 00:12:20 +01:00
endif
2018-06-20 20:39:16 +02:00
2019-03-14 00:12:20 +01:00
# Put XML formatted API files in the dist dir.
2019-12-10 01:36:15 +01:00
$( TARGET_OUT_COMMON_INTERMEDIATES) /api.xml: $( call java-lib-files,android_stubs_current) $( APICHECK)
$( TARGET_OUT_COMMON_INTERMEDIATES) /system-api.xml: $( call java-lib-files,android_system_stubs_current) $( APICHECK)
2020-04-01 15:36:28 +02:00
$( TARGET_OUT_COMMON_INTERMEDIATES) /module-lib-api.xml: $( call java-lib-files,android_module_lib_stubs_current) $( APICHECK)
$( TARGET_OUT_COMMON_INTERMEDIATES) /system-server-api.xml: $( call java-lib-files,android_system_server_stubs_current) $( APICHECK)
2019-12-10 01:36:15 +01:00
$( TARGET_OUT_COMMON_INTERMEDIATES) /test-api.xml: $( call java-lib-files,android_test_stubs_current) $( APICHECK)
2019-02-14 02:48:00 +01:00
2020-04-01 15:36:28 +02:00
api_xmls := $( addprefix $( TARGET_OUT_COMMON_INTERMEDIATES) /,api.xml system-api.xml module-lib-api.xml system-server-api.xml test-api.xml)
2019-03-14 00:12:20 +01:00
$( api_xmls) :
2018-06-20 20:39:16 +02:00
$( hide) echo " Converting API file to XML: $@ "
$( hide) mkdir -p $( dir $@ )
2019-02-14 02:48:00 +01:00
$( hide) $( APICHECK_COMMAND) --input-api-jar $< --api-xml $@
2018-06-20 20:39:16 +02:00
2019-03-14 00:12:20 +01:00
$( call dist-for-goals, dist_files, $( api_xmls) )
api_xmls :=
2012-08-15 21:22:44 +02:00
2020-06-15 20:01:49 +02:00
ifdef CLANG_COVERAGE
$( foreach f,$( SOONG_NDK_API_XML) , \
2020-06-17 23:30:14 +02:00
$( call dist-for-goals,droidcore,$( f) :ndk_apis/$( notdir $( f) ) ) )
2020-06-15 20:01:49 +02:00
endif
2021-06-16 04:35:06 +02:00
# For full system build (whether unbundled or not), we configure
# droid_targets to depend on droidcore-unbundled, which will set up the full
# system dependencies and also dist the subset of targets that correspond to
# an unbundled build (exclude building some framework sources).
droid_targets: droidcore-unbundled
ifeq ( ,$( TARGET_BUILD_UNBUNDLED_IMAGE) )
# If we're building a full system (including the framework sources excluded
# by droidcore-unbundled), we configure droid_targets also to depend on
# droidcore, which includes all dist for droidcore, and will build the
# necessary framework sources.
droid_targets: droidcore dist_files
endif
2010-05-14 01:46:21 +02:00
2021-06-16 04:35:06 +02:00
e n d i f # TARGET_BUILD_UNBUNDLED == TARGET_BUILD_UNBUNDLED_IMAGE
2009-03-04 04:28:42 +01:00
.PHONY : docs
docs : $( ALL_DOCS )
2018-10-26 20:17:25 +02:00
.PHONY : sdk win_sdk winsdk -tools sdk_addon
2009-03-04 04:28:42 +01:00
ALL_SDK_TARGETS := $( INTERNAL_SDK_TARGET)
sdk : $( ALL_SDK_TARGETS )
2011-02-16 01:09:36 +01:00
$( call dist -for -goals ,sdk win_sdk , \
2011-03-08 01:13:32 +01:00
$( ALL_SDK_TARGETS) \
$( SYMBOLS_ZIP) \
2016-09-12 22:56:50 +02:00
$( COVERAGE_ZIP) \
2018-07-23 21:20:15 +02:00
$( APPCOMPAT_ZIP) \
2011-03-08 01:13:32 +01:00
$( INSTALLED_BUILD_PROP_TARGET) \
)
2009-03-04 04:28:42 +01:00
2013-01-30 01:59:18 +01:00
# umbrella targets to assit engineers in verifying builds
2013-01-30 20:22:06 +01:00
.PHONY : java native target host java -host java -target native -host native -target \
2013-01-30 01:59:18 +01:00
java-host-tests java-target-tests native-host-tests native-target-tests \
2018-07-24 10:21:12 +02:00
java-tests native-tests host-tests target-tests tests java-dex \
native-host-cross
2013-01-30 01:59:18 +01: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 01:39:21 +02:00
tests : host -tests target -tests
2013-01-30 01:59:18 +01:00
2017-09-27 23:28:41 +02:00
# Phony target to run all java compilations that use javac
2016-03-24 19:00:30 +01:00
.PHONY : javac -check
2009-03-04 04:28:42 +01:00
.PHONY : findbugs
findbugs : $( INTERNAL_FINDBUGS_HTML_TARGET ) $( INTERNAL_FINDBUGS_XML_TARGET )
2019-02-20 09:47:56 +01:00
LSDUMP_PATHS_FILE := $( PRODUCT_OUT) /lsdump_paths.txt
2018-02-24 01:50:39 +01:00
.PHONY : findlsdumps
2019-07-31 11:36:05 +02:00
# LSDUMP_PATHS is a list of tag:path.
findlsdumps : $( LSDUMP_PATHS_FILE ) $( foreach p ,$ ( LSDUMP_PATHS ) ,$ ( call word -colon ,2,$ ( p ) ) )
2019-02-20 09:47:56 +01:00
$(LSDUMP_PATHS_FILE) : PRIVATE_LSDUMP_PATHS := $( LSDUMP_PATHS )
$(LSDUMP_PATHS_FILE) :
@echo " Generate $@ "
2019-07-31 11:36:05 +02:00
@rm -rf $@ && echo -e " $( subst :,:$( space) ,$( subst $( space) ,\n ,$( PRIVATE_LSDUMP_PATHS) ) ) " > $@
2018-02-24 01:50:39 +01:00
2018-11-06 10:32:40 +01:00
.PHONY : check -elf -files
check-elf-files :
2009-03-04 04:28:42 +01: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) ) " | \
2019-04-03 09:23:51 +02:00
tr -s ' ' '\n' | sort -u
2009-03-04 04:28:42 +01:00
2018-10-01 17:26:17 +02:00
.PHONY : dump -files
dump-files :
2020-07-13 15:02:21 +02:00
@echo " Target files for $( TARGET_PRODUCT) - $( TARGET_BUILD_VARIANT) ( $( INTERNAL_PRODUCT) ): "
@echo $( sort $( patsubst $( PRODUCT_OUT) /%,%,$( filter $( PRODUCT_OUT) /%,$( modules_to_install) ) ) ) | tr -s ' ' '\n'
@echo Successfully dumped product target file list.
2018-10-01 17:26:17 +02:00
2012-05-19 05:41:38 +02:00
.PHONY : nothing
nothing :
@echo Successfully read the makefiles.
2016-04-01 01:30:23 +02:00
.PHONY : tidy_only
tidy_only :
@echo Successfully make tidy_only.
2016-07-28 06:57:49 +02:00
ndk : $( SOONG_OUT_DIR ) /ndk .timestamp
.PHONY : ndk
2021-03-11 17:47:19 +01:00
# Checks that allowed_deps.txt remains up to date
2020-07-02 13:51:47 +02:00
i f n e q ( $( UNSAFE_DISABLE_APEX_ALLOWED_DEPS_CHECK ) , t r u e )
droidcore: ${ APEX_ALLOWED_DEPS_CHECK }
e n d i f
2018-10-18 01:50:49 +02:00
$( call dist -write -file ,$ ( KATI_PACKAGE_MK_DIR ) /dist .mk )
2018-07-11 00:02:14 +02:00
$( info [$ ( call inc_and_print ,subdir_makefiles_inc ) /$ ( subdir_makefiles_total ) ] writing build rules ...)