blob: c2a83fdedad39737efd46de4543e655722aba1e1 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001#
2# Copyright (C) 2007 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17#
18# Functions for including AndroidProducts.mk files
Ying Wang157a5e12012-09-27 13:26:25 -070019# PRODUCT_MAKEFILES is set up in AndroidProducts.mks.
20# Format of PRODUCT_MAKEFILES:
21# <product_name>:<path_to_the_product_makefile>
22# If the <product_name> is the same as the base file name (without dir
23# and the .mk suffix) of the product makefile, "<product_name>:" can be
24# omitted.
The Android Open Source Project88b60792009-03-03 19:28:42 -080025
26#
27# Returns the list of all AndroidProducts.mk files.
28# $(call ) isn't necessary.
29#
30define _find-android-products-files
Dan Willemsenb9d63512018-05-01 22:34:03 -070031$(file <$(OUT_DIR)/.module_paths/AndroidProducts.mk.list) \
The Android Open Source Project88b60792009-03-03 19:28:42 -080032 $(SRC_TARGET_DIR)/product/AndroidProducts.mk
33endef
34
35#
Dan Willemsenaf2e1f82018-04-04 15:41:41 -070036# For entries returned by get-product-makefiles, decode an entry to a short
37# product name. These either may be in the form of <name>:path/to/file.mk or
38# path/to/<name>.mk
39# $(1): The entry to decode
40#
41# Returns two words:
42# <name> <file>
43#
44define _decode-product-name
45$(strip \
46 $(eval _cpm_words := $(subst :,$(space),$(1))) \
47 $(if $(word 2,$(_cpm_words)), \
48 $(wordlist 1,2,$(_cpm_words)), \
49 $(basename $(notdir $(1))) $(1)))
50endef
51
52#
53# Validates the new common lunch choices -- ensures that they're in an
54# appropriate form, and are paired with definitions of their products.
55# $(1): The new list of COMMON_LUNCH_CHOICES
56# $(2): The new list of PRODUCT_MAKEFILES
57#
58define _validate-common-lunch-choices
59$(strip $(foreach choice,$(1),\
60 $(eval _parts := $(subst -,$(space),$(choice))) \
61 $(if $(call math_lt,$(words $(_parts)),2), \
62 $(error $(LOCAL_DIR): $(choice): Invalid lunch choice)) \
63 $(if $(call math_gt_or_eq,$(words $(_parts)),4), \
64 $(error $(LOCAL_DIR): $(choice): Invalid lunch choice)) \
65 $(if $(filter-out eng userdebug user,$(word 2,$(_parts))), \
66 $(error $(LOCAL_DIR): $(choice): Invalid variant: $(word 2,$(_parts)))) \
67 $(if $(filter-out $(foreach p,$(2),$(call _decode-product-name,$(p))),$(word 1,$(_parts))), \
68 $(error $(LOCAL_DIR): $(word 1,$(_parts)): Product not defined in this file)) \
69 ))
70endef
71
72#
Ying Wang1a031e42010-05-10 16:35:39 -070073# Returns the sorted concatenation of PRODUCT_MAKEFILES
74# variables set in the given AndroidProducts.mk files.
75# $(1): the list of AndroidProducts.mk files.
The Android Open Source Project88b60792009-03-03 19:28:42 -080076#
Dan Willemsenaf2e1f82018-04-04 15:41:41 -070077# As a side-effect, COMMON_LUNCH_CHOICES will be set to a
78# union of all of the COMMON_LUNCH_CHOICES definitions within
79# each AndroidProducts.mk file.
80#
Ying Wang1a031e42010-05-10 16:35:39 -070081define get-product-makefiles
The Android Open Source Project88b60792009-03-03 19:28:42 -080082$(sort \
Dan Willemsenaf2e1f82018-04-04 15:41:41 -070083 $(eval _COMMON_LUNCH_CHOICES :=) \
Ying Wang1a031e42010-05-10 16:35:39 -070084 $(foreach f,$(1), \
The Android Open Source Project88b60792009-03-03 19:28:42 -080085 $(eval PRODUCT_MAKEFILES :=) \
Dan Willemsenaf2e1f82018-04-04 15:41:41 -070086 $(eval COMMON_LUNCH_CHOICES :=) \
The Android Open Source Project88b60792009-03-03 19:28:42 -080087 $(eval LOCAL_DIR := $(patsubst %/,%,$(dir $(f)))) \
88 $(eval include $(f)) \
Dan Willemsenaf2e1f82018-04-04 15:41:41 -070089 $(call _validate-common-lunch-choices,$(COMMON_LUNCH_CHOICES),$(PRODUCT_MAKEFILES)) \
90 $(eval _COMMON_LUNCH_CHOICES += $(COMMON_LUNCH_CHOICES)) \
The Android Open Source Project88b60792009-03-03 19:28:42 -080091 $(PRODUCT_MAKEFILES) \
92 ) \
93 $(eval PRODUCT_MAKEFILES :=) \
94 $(eval LOCAL_DIR :=) \
Dan Willemsen5436c7e2019-02-11 21:31:47 -080095 $(eval COMMON_LUNCH_CHOICES := $(sort $(_COMMON_LUNCH_CHOICES))) \
Dan Willemsenaf2e1f82018-04-04 15:41:41 -070096 $(eval _COMMON_LUNCH_CHOICES :=) \
The Android Open Source Project88b60792009-03-03 19:28:42 -080097 )
98endef
99
100#
Ying Wang1a031e42010-05-10 16:35:39 -0700101# Returns the sorted concatenation of all PRODUCT_MAKEFILES
102# variables set in all AndroidProducts.mk files.
103# $(call ) isn't necessary.
104#
105define get-all-product-makefiles
106$(call get-product-makefiles,$(_find-android-products-files))
107endef
108
Anton Hanssond26c6472019-05-06 14:40:57 +0100109# Variables that are meant to hold only a single value.
110# - The value set in the current makefile takes precedence over inherited values
111# - If multiple inherited makefiles set the var, the first-inherited value wins
112_product_single_value_vars :=
113
114# Variables that are lists of values.
115_product_list_vars :=
116
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100117_product_single_value_vars += PRODUCT_NAME
118_product_single_value_vars += PRODUCT_MODEL
The Android Open Source Project88b60792009-03-03 19:28:42 -0800119
Anton Hansson13ea2a62019-03-28 14:47:25 +0000120# The resoure configuration options to use for this product.
Anton Hanssond26c6472019-05-06 14:40:57 +0100121_product_list_vars += PRODUCT_LOCALES
122_product_list_vars += PRODUCT_AAPT_CONFIG
Sasha Smundak0301d642020-11-11 14:41:08 -0800123_product_single_value_vars += PRODUCT_AAPT_PREF_CONFIG
Anton Hanssond26c6472019-05-06 14:40:57 +0100124_product_list_vars += PRODUCT_AAPT_PREBUILT_DPI
125_product_list_vars += PRODUCT_HOST_PACKAGES
126_product_list_vars += PRODUCT_PACKAGES
127_product_list_vars += PRODUCT_PACKAGES_DEBUG
128_product_list_vars += PRODUCT_PACKAGES_DEBUG_ASAN
Kavi Gupta7185f8c2019-06-11 10:27:47 -0700129# Packages included only for eng/userdebug builds, when building with EMMA_INSTRUMENT=true
130_product_list_vars += PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE
Anton Hanssond26c6472019-05-06 14:40:57 +0100131_product_list_vars += PRODUCT_PACKAGES_ENG
132_product_list_vars += PRODUCT_PACKAGES_TESTS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000133
134# The device that this product maps to.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100135_product_single_value_vars += PRODUCT_DEVICE
136_product_single_value_vars += PRODUCT_MANUFACTURER
137_product_single_value_vars += PRODUCT_BRAND
Anton Hansson13ea2a62019-03-28 14:47:25 +0000138
139# These PRODUCT_SYSTEM_* flags, if defined, are used in place of the
140# corresponding PRODUCT_* flags for the sysprops on /system.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100141_product_single_value_vars += \
Anton Hanssonee4c9702018-12-21 15:36:00 +0000142 PRODUCT_SYSTEM_NAME \
143 PRODUCT_SYSTEM_MODEL \
144 PRODUCT_SYSTEM_DEVICE \
145 PRODUCT_SYSTEM_BRAND \
146 PRODUCT_SYSTEM_MANUFACTURER \
Anton Hansson13ea2a62019-03-28 14:47:25 +0000147
Jiyong Parkeb49b342020-05-29 17:50:03 +0900148# PRODUCT_<PARTITION>_PROPERTIES are lists of property assignments
149# that go to <partition>/build.prop. Each property assignment is
150# "key = value" with zero or more whitespace characters on either
151# side of the '='.
152_product_list_vars += \
153 PRODUCT_SYSTEM_PROPERTIES \
154 PRODUCT_SYSTEM_EXT_PROPERTIES \
155 PRODUCT_VENDOR_PROPERTIES \
156 PRODUCT_ODM_PROPERTIES \
157 PRODUCT_PRODUCT_PROPERTIES
Anton Hansson13ea2a62019-03-28 14:47:25 +0000158
Jiyong Parkeb49b342020-05-29 17:50:03 +0900159# TODO(b/117892318) deprecate these:
160# ... in favor or PRODUCT_SYSTEM_PROPERTIES
161_product_list_vars += PRODUCT_SYSTEM_DEFAULT_PROPERTIES
162# ... in favor of PRODUCT_VENDOR_PROPERTIES
163_product_list_vars += PRODUCT_PROPERTY_OVERRIDES
Anton Hanssond26c6472019-05-06 14:40:57 +0100164_product_list_vars += PRODUCT_DEFAULT_PROPERTY_OVERRIDES
Anton Hansson13ea2a62019-03-28 14:47:25 +0000165
Jiyong Parkeb49b342020-05-29 17:50:03 +0900166# TODO(b/117892318) consider deprecating these too
167_product_list_vars += PRODUCT_SYSTEM_PROPERTY_BLACKLIST
168_product_list_vars += PRODUCT_VENDOR_PROPERTY_BLACKLIST
Anton Hansson879b0072019-05-13 18:06:45 +0100169
170# The characteristics of the product, which among other things is passed to aapt
171_product_single_value_vars += PRODUCT_CHARACTERISTICS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000172
173# A list of words like <source path>:<destination path>[:<owner>].
174# The file at the source path should be copied to the destination path
175# when building this product. <destination path> is relative to
176# $(PRODUCT_OUT), so it should look like, e.g., "system/etc/file.xml".
177# The rules for these copy steps are defined in build/make/core/Makefile.
178# The optional :<owner> is used to indicate the owner of a vendor file.
Anton Hanssond26c6472019-05-06 14:40:57 +0100179_product_list_vars += PRODUCT_COPY_FILES
Anton Hansson13ea2a62019-03-28 14:47:25 +0000180
181# The OTA key(s) specified by the product config, if any. The names
182# of these keys are stored in the target-files zip so that post-build
183# signing tools can substitute them for the test key embedded by
184# default.
Anton Hanssond26c6472019-05-06 14:40:57 +0100185_product_list_vars += PRODUCT_OTA_PUBLIC_KEYS
186_product_list_vars += PRODUCT_EXTRA_RECOVERY_KEYS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000187
188# Should we use the default resources or add any product specific overlays
Anton Hanssond26c6472019-05-06 14:40:57 +0100189_product_list_vars += PRODUCT_PACKAGE_OVERLAYS
190_product_list_vars += DEVICE_PACKAGE_OVERLAYS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000191
192# Resource overlay list which must be excluded from enforcing RRO.
Anton Hanssond26c6472019-05-06 14:40:57 +0100193_product_list_vars += PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000194
195# Package list to apply enforcing RRO.
Anton Hanssond26c6472019-05-06 14:40:57 +0100196_product_list_vars += PRODUCT_ENFORCE_RRO_TARGETS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000197
Anton Hanssond26c6472019-05-06 14:40:57 +0100198_product_list_vars += PRODUCT_SDK_ATREE_FILES
199_product_list_vars += PRODUCT_SDK_ADDON_NAME
200_product_list_vars += PRODUCT_SDK_ADDON_COPY_FILES
201_product_list_vars += PRODUCT_SDK_ADDON_COPY_MODULES
202_product_list_vars += PRODUCT_SDK_ADDON_DOC_MODULES
203_product_list_vars += PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP
Anton Hansson13ea2a62019-03-28 14:47:25 +0000204
205# which Soong namespaces to export to Make
Anton Hanssond26c6472019-05-06 14:40:57 +0100206_product_list_vars += PRODUCT_SOONG_NAMESPACES
Anton Hansson13ea2a62019-03-28 14:47:25 +0000207
Anton Hanssond26c6472019-05-06 14:40:57 +0100208_product_list_vars += PRODUCT_DEFAULT_WIFI_CHANNELS
Sasha Smundak0301d642020-11-11 14:41:08 -0800209_product_single_value_vars += PRODUCT_DEFAULT_DEV_CERTIFICATE
Remi NGUYEN VAN87d0f272019-08-07 18:13:33 +0900210_product_list_vars += PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES
Anton Hanssond26c6472019-05-06 14:40:57 +0100211_product_list_vars += PRODUCT_RESTRICT_VENDOR_FILES
Anton Hansson13ea2a62019-03-28 14:47:25 +0000212
213# The list of product-specific kernel header dirs
Anton Hanssond26c6472019-05-06 14:40:57 +0100214_product_list_vars += PRODUCT_VENDOR_KERNEL_HEADERS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000215
Martin Stjernholm743513c2021-07-05 20:53:57 +0100216# A list of module names in BOOTCLASSPATH (jar files). Each module may be
217# prefixed with "<apex>:", which identifies the APEX that provides it. APEXes
218# are identified by their "variant" names, i.e. their `apex_name` values in
219# Soong, which default to the `name` values. The prefix can also be "platform:"
220# or "system_ext:", and defaults to "platform:" if left out. See the long
221# comment in build/soong/java/dexprepopt_bootjars.go for details.
Anton Hanssond26c6472019-05-06 14:40:57 +0100222_product_list_vars += PRODUCT_BOOT_JARS
Po Hu012118d2020-03-13 14:14:27 +0800223
Martin Stjernholm743513c2021-07-05 20:53:57 +0100224# A list of extra BOOTCLASSPATH jars (to be appended after common jars),
225# following the same format as PRODUCT_BOOT_JARS. Products that include
226# device-specific makefiles before AOSP makefiles should use this instead of
227# PRODUCT_BOOT_JARS, so that device-specific jars go after common jars.
Po Hu012118d2020-03-13 14:14:27 +0800228_product_list_vars += PRODUCT_BOOT_JARS_EXTRA
229
Sasha Smundak94da1402021-02-10 22:27:36 -0800230_product_single_value_vars += PRODUCT_SUPPORTS_BOOT_SIGNER
231_product_single_value_vars += PRODUCT_SUPPORTS_VBOOT
232_product_single_value_vars += PRODUCT_SUPPORTS_VERITY
233_product_single_value_vars += PRODUCT_SUPPORTS_VERITY_FEC
Anton Hanssond26c6472019-05-06 14:40:57 +0100234_product_list_vars += PRODUCT_SYSTEM_SERVER_APPS
235_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS
Roshan Piusd6e239f2019-11-22 08:47:40 -0800236# List of system_server jars delivered via apex. Format = <apex name>:<jar name>.
satayeva85d5222021-07-27 12:32:40 +0100237_product_list_vars += PRODUCT_APEX_SYSTEM_SERVER_JARS
Ulya Trafimovich40e55c22020-03-27 12:12:59 +0000238# If true, then suboptimal order of system server jars does not cause an error.
Sasha Smundak0301d642020-11-11 14:41:08 -0800239_product_single_value_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000240
Rock.Yeh2a703ce2020-04-22 17:01:10 +0800241# Additional system server jars to be appended at the end of the common list.
242# This is necessary to avoid jars reordering due to makefile inheritance order.
243_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS_EXTRA
244
Ulya Trafimovich1a3b1452021-03-22 17:24:18 +0000245# Set to true to disable <uses-library> checks for a product.
246_product_list_vars += PRODUCT_BROKEN_VERIFY_USES_LIBRARIES
247
Anton Hansson13ea2a62019-03-28 14:47:25 +0000248# All of the apps that we force preopt, this overrides WITH_DEXPREOPT.
Anton Hanssond26c6472019-05-06 14:40:57 +0100249_product_list_vars += PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK
250_product_list_vars += PRODUCT_DEXPREOPT_SPEED_APPS
251_product_list_vars += PRODUCT_LOADED_BY_PRIVILEGED_MODULES
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100252_product_single_value_vars += PRODUCT_VBOOT_SIGNING_KEY
253_product_single_value_vars += PRODUCT_VBOOT_SIGNING_SUBKEY
254_product_single_value_vars += PRODUCT_VERITY_SIGNING_KEY
255_product_single_value_vars += PRODUCT_SYSTEM_VERITY_PARTITION
256_product_single_value_vars += PRODUCT_VENDOR_VERITY_PARTITION
257_product_single_value_vars += PRODUCT_PRODUCT_VERITY_PARTITION
Justin Yun6151e3f2019-06-25 15:58:13 +0900258_product_single_value_vars += PRODUCT_SYSTEM_EXT_VERITY_PARTITION
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100259_product_single_value_vars += PRODUCT_ODM_VERITY_PARTITION
Yifan Hongcfb917a2020-05-07 14:58:20 -0700260_product_single_value_vars += PRODUCT_VENDOR_DLKM_VERITY_PARTITION
Yifan Hongf496f1b2020-07-15 16:52:59 -0700261_product_single_value_vars += PRODUCT_ODM_DLKM_VERITY_PARTITION
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100262_product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO
263_product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO
Anton Hansson13ea2a62019-03-28 14:47:25 +0000264
265# Per-module dex-preopt configs.
Anton Hanssond26c6472019-05-06 14:40:57 +0100266_product_list_vars += PRODUCT_DEX_PREOPT_MODULE_CONFIGS
Sasha Smundak0301d642020-11-11 14:41:08 -0800267_product_single_value_vars += PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER
Anton Hanssond26c6472019-05-06 14:40:57 +0100268_product_list_vars += PRODUCT_DEX_PREOPT_DEFAULT_FLAGS
Sasha Smundak0301d642020-11-11 14:41:08 -0800269_product_single_value_vars += PRODUCT_DEX_PREOPT_BOOT_FLAGS
270_product_single_value_vars += PRODUCT_DEX_PREOPT_PROFILE_DIR
271_product_single_value_vars += PRODUCT_DEX_PREOPT_GENERATE_DM_FILES
272_product_single_value_vars += PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING
273_product_single_value_vars += PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000274
275# Boot image options.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100276_product_single_value_vars += \
Howard Chen95339b02021-09-29 17:28:48 +0800277 PRODUCT_EXPORT_BOOT_IMAGE_TO_DIST \
Mathieu Chartiera61acf62017-06-28 18:23:37 -0700278 PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \
Anton Hansson13ea2a62019-03-28 14:47:25 +0000279 PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION \
Calin Juravlecdff6b12019-05-01 15:34:47 -0700280 PRODUCT_USES_DEFAULT_ART_CONFIG \
Anton Hansson13ea2a62019-03-28 14:47:25 +0000281
Bowgo Tsaia2a5db42021-09-23 15:46:33 +0800282# The file name for the boot image with a debug ramdisk.
283_product_single_value_vars += PRODUCT_DEBUG_RAMDISK_BOOT_IMAGE_NAME
284
Sasha Smundak0301d642020-11-11 14:41:08 -0800285_product_single_value_vars += PRODUCT_SYSTEM_SERVER_COMPILER_FILTER
Anton Hansson13ea2a62019-03-28 14:47:25 +0000286# Per-module sanitizer configs
Anton Hanssond26c6472019-05-06 14:40:57 +0100287_product_list_vars += PRODUCT_SANITIZER_MODULE_CONFIGS
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100288_product_single_value_vars += PRODUCT_SYSTEM_BASE_FS_PATH
289_product_single_value_vars += PRODUCT_VENDOR_BASE_FS_PATH
290_product_single_value_vars += PRODUCT_PRODUCT_BASE_FS_PATH
Justin Yun6151e3f2019-06-25 15:58:13 +0900291_product_single_value_vars += PRODUCT_SYSTEM_EXT_BASE_FS_PATH
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100292_product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH
Yifan Hongcfb917a2020-05-07 14:58:20 -0700293_product_single_value_vars += PRODUCT_VENDOR_DLKM_BASE_FS_PATH
Yifan Hongf496f1b2020-07-15 16:52:59 -0700294_product_single_value_vars += PRODUCT_ODM_DLKM_BASE_FS_PATH
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100295
296# The first API level this product shipped with
297_product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL
298
Anton Hanssond26c6472019-05-06 14:40:57 +0100299_product_list_vars += VENDOR_PRODUCT_RESTRICT_VENDOR_FILES
300_product_list_vars += VENDOR_EXCEPTION_MODULES
301_product_list_vars += VENDOR_EXCEPTION_PATHS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000302# Whether the product wants to ship libartd. For rules and meaning, see art/Android.mk.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100303_product_single_value_vars += PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD
Anton Hansson13ea2a62019-03-28 14:47:25 +0000304
305# Make this art variable visible to soong_config.mk.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100306_product_single_value_vars += PRODUCT_ART_USE_READ_BARRIER
Anton Hansson13ea2a62019-03-28 14:47:25 +0000307
Anton Hansson13ea2a62019-03-28 14:47:25 +0000308# Add reserved headroom to a system image.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100309_product_single_value_vars += PRODUCT_SYSTEM_HEADROOM
Anton Hansson13ea2a62019-03-28 14:47:25 +0000310
311# Whether to save disk space by minimizing java debug info
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100312_product_single_value_vars += PRODUCT_MINIMIZE_JAVA_DEBUG_INFO
Anton Hansson13ea2a62019-03-28 14:47:25 +0000313
314# Whether any paths are excluded from sanitization when SANITIZE_TARGET=integer_overflow
Anton Hanssond26c6472019-05-06 14:40:57 +0100315_product_list_vars += PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000316
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100317_product_single_value_vars += PRODUCT_ADB_KEYS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000318
319# Whether any paths should have CFI enabled for components
Anton Hanssond26c6472019-05-06 14:40:57 +0100320_product_list_vars += PRODUCT_CFI_INCLUDE_PATHS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000321
322# Whether any paths are excluded from sanitization when SANITIZE_TARGET=cfi
Anton Hanssond26c6472019-05-06 14:40:57 +0100323_product_list_vars += PRODUCT_CFI_EXCLUDE_PATHS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000324
325# Whether the Scudo hardened allocator is disabled platform-wide
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100326_product_single_value_vars += PRODUCT_DISABLE_SCUDO
Anton Hansson13ea2a62019-03-28 14:47:25 +0000327
Isaac Chene9723502019-05-06 16:55:48 +0800328# List of extra VNDK versions to be included
329_product_list_vars += PRODUCT_EXTRA_VNDK_VERSIONS
330
Mohammad Samiul Islamc87781a2020-11-25 16:00:38 +0000331# Whether APEX should be compressed or not
332_product_single_value_vars += PRODUCT_COMPRESSED_APEX
333
Justin Yunf19d8402019-11-18 19:43:41 +0900334# VNDK version of product partition. It can be 'current' if the product
335# partitions uses PLATFORM_VNDK_VERSION.
GeQi6e44e3d2020-09-04 13:44:09 +0800336_product_single_value_vars += PRODUCT_PRODUCT_VNDK_VERSION
Justin Yunf19d8402019-11-18 19:43:41 +0900337
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100338_product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS
339_product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT
Colin Crossc3ad8042020-06-11 11:25:05 -0700340_product_list_vars += PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST
Anton Hanssond26c6472019-05-06 14:40:57 +0100341_product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT
Colin Crossc3ad8042020-06-11 11:25:05 -0700342_product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST
Anton Hansson13ea2a62019-03-28 14:47:25 +0000343
344# List of modules that should be forcefully unmarked from being LOCAL_PRODUCT_MODULE, and hence
345# installed on /system directory by default.
Anton Hanssond26c6472019-05-06 14:40:57 +0100346_product_list_vars += PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION
Anton Hansson13ea2a62019-03-28 14:47:25 +0000347
348# When this is true, dynamic partitions is retrofitted on a device that has
349# already been launched without dynamic partitions. Otherwise, the device
350# is launched with dynamic partitions.
351# This flag implies PRODUCT_USE_DYNAMIC_PARTITIONS.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100352_product_single_value_vars += PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000353
Hridya Valsarajub39ec702021-03-31 21:28:02 -0700354# When this is true, various build time as well as runtime debugfs restrictions are enabled.
355_product_single_value_vars += PRODUCT_SET_DEBUGFS_RESTRICTIONS
356
Anton Hansson13ea2a62019-03-28 14:47:25 +0000357# Other dynamic partition feature flags.PRODUCT_USE_DYNAMIC_PARTITION_SIZE and
358# PRODUCT_BUILD_SUPER_PARTITION default to the value of PRODUCT_USE_DYNAMIC_PARTITIONS.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100359_product_single_value_vars += \
Anton Hansson13ea2a62019-03-28 14:47:25 +0000360 PRODUCT_USE_DYNAMIC_PARTITIONS \
Yifan Hong2dae5722018-07-31 12:47:27 -0700361 PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
362 PRODUCT_BUILD_SUPER_PARTITION \
Anton Hansson13ea2a62019-03-28 14:47:25 +0000363
364# If set, kernel configuration requirements are present in OTA package (and will be enforced
365# during OTA). Otherwise, kernel configuration requirements are enforced in VTS.
366# Devices that checks the running kernel (instead of the kernel in OTA package) should not
367# set this variable to prevent OTA failures.
Anton Hanssond26c6472019-05-06 14:40:57 +0100368_product_list_vars += PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
Anton Hansson13ea2a62019-03-28 14:47:25 +0000369
Tao Bao9be20c72019-04-08 21:11:59 -0700370# If set to true, this product builds a generic OTA package, which installs generic system images
371# onto matching devices. The product may only build a subset of system images (e.g. only
372# system.img), so devices need to install the package in a system-only OTA manner.
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100373_product_single_value_vars += PRODUCT_BUILD_GENERIC_OTA_PACKAGE
Tao Bao9be20c72019-04-08 21:11:59 -0700374
Anton Hanssond26c6472019-05-06 14:40:57 +0100375_product_list_vars += PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
376_product_list_vars += PRODUCT_PACKAGE_NAME_OVERRIDES
377_product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100378
379# Controls for whether different partitions are built for the current product.
380_product_single_value_vars += PRODUCT_BUILD_SYSTEM_IMAGE
381_product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE
382_product_single_value_vars += PRODUCT_BUILD_VENDOR_IMAGE
383_product_single_value_vars += PRODUCT_BUILD_PRODUCT_IMAGE
Justin Yun6151e3f2019-06-25 15:58:13 +0900384_product_single_value_vars += PRODUCT_BUILD_SYSTEM_EXT_IMAGE
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100385_product_single_value_vars += PRODUCT_BUILD_ODM_IMAGE
Yifan Hongcfb917a2020-05-07 14:58:20 -0700386_product_single_value_vars += PRODUCT_BUILD_VENDOR_DLKM_IMAGE
Yifan Hongf496f1b2020-07-15 16:52:59 -0700387_product_single_value_vars += PRODUCT_BUILD_ODM_DLKM_IMAGE
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100388_product_single_value_vars += PRODUCT_BUILD_CACHE_IMAGE
389_product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE
390_product_single_value_vars += PRODUCT_BUILD_USERDATA_IMAGE
Chris Grossa784ef12019-04-22 11:09:57 -0700391_product_single_value_vars += PRODUCT_BUILD_RECOVERY_IMAGE
392_product_single_value_vars += PRODUCT_BUILD_BOOT_IMAGE
Daniel Norman42879ff2020-10-06 11:09:56 -0700393_product_single_value_vars += PRODUCT_BUILD_VENDOR_BOOT_IMAGE
Paul Trautrim4e143232019-08-13 16:30:57 +0900394_product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE
Yo Chiange86bab42021-03-25 10:12:28 +0000395_product_single_value_vars += PRODUCT_BUILD_SUPER_EMPTY_IMAGE
Anton Hanssonc1c4c0b2019-05-06 15:09:19 +0100396
Martin Stjernholm743513c2021-07-05 20:53:57 +0100397# List of boot jars delivered via updatable APEXes, following the same format as
398# PRODUCT_BOOT_JARS.
satayev65e68bb2021-07-15 18:19:56 +0100399_product_list_vars += PRODUCT_APEX_BOOT_JARS
Chris Grossa784ef12019-04-22 11:09:57 -0700400
Yifan Hong7d37b402019-07-23 14:20:29 -0700401# If set, device uses virtual A/B.
402_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA
403
Kelvin Zhang239a79a2021-01-15 13:47:52 -0500404# If set, device uses virtual A/B Compression.
405_product_single_value_vars += PRODUCT_VIRTUAL_AB_COMPRESSION
406
Yifan Hong7d37b402019-07-23 14:20:29 -0700407# If set, device retrofits virtual A/B.
408_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT
409
Yifan Hong65afc072020-04-17 10:08:10 -0700410# If set, forcefully generate a non-A/B update package.
411# Note: A device configuration should inherit from virtual_ab_ota_plus_non_ab.mk
412# instead of setting this variable directly.
413# Note: Use TARGET_OTA_ALLOW_NON_AB in the build system because
414# TARGET_OTA_ALLOW_NON_AB takes the value of AB_OTA_UPDATER into account.
415_product_single_value_vars += PRODUCT_OTA_FORCE_NON_AB_PACKAGE
416
Jeongik Cha74529792019-07-19 13:40:18 +0900417# If set, Java module in product partition cannot use hidden APIs.
418_product_single_value_vars += PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE
419
JaeMan Park33d9aad2020-12-02 16:34:12 +0900420# If set, only java_sdk_library can be used at inter-partition dependency.
421# Note: Build error if BOARD_VNDK_VERSION is not set while
422# PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY is true, because
423# PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY has no meaning if
424# BOARD_VNDK_VERSION is not set.
425# Note: When PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is not set, there are
426# no restrictions at dependency between system and product partition.
427_product_single_value_vars += PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY
428
429# Allowlist for PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY option.
430# Listed modules are allowed at inter-partition dependency even if it isn't
431# a java_sdk_library module.
432_product_list_vars += PRODUCT_INTER_PARTITION_JAVA_LIBRARY_ALLOWLIST
433
Jooyung Han9efe5342019-12-05 16:14:18 +0900434_product_single_value_vars += PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES
435
Yi-Yo Chiangf63bd5d2021-09-23 14:14:16 +0000436# Install a copy of the debug policy to the system_ext partition, and allow
437# init-second-stage to load debug policy from system_ext.
438# This option is only meant to be set by GSI products.
439_product_single_value_vars += PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT
440
Anton Hanssond26c6472019-05-06 14:40:57 +0100441.KATI_READONLY := _product_single_value_vars _product_list_vars
442_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
Ying Wang20ebd2e2014-10-07 18:07:23 -0700443
The Android Open Source Project88b60792009-03-03 19:28:42 -0800444define dump-product
Anton Hanssondce3f922019-02-11 21:19:54 +0000445$(warning ==== $(1) ====)\
The Android Open Source Project88b60792009-03-03 19:28:42 -0800446$(foreach v,$(_product_var_list),\
Anton Hanssoncca8cdb2019-10-28 11:30:40 +0000447$(warning PRODUCTS.$(1).$(v) := $(call get-product-var,$(1),$(v))))\
Anton Hanssondce3f922019-02-11 21:19:54 +0000448$(warning --------)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800449endef
450
451define dump-products
452$(foreach p,$(PRODUCTS),$(call dump-product,$(p)))
453endef
454
455#
Anton Hansson13ea2a62019-03-28 14:47:25 +0000456# Functions for including product makefiles
457#
458
459#
The Android Open Source Project88b60792009-03-03 19:28:42 -0800460# $(1): product to inherit
461#
Anton Hansson061cbcf2018-05-30 18:24:41 +0100462# To be called from product makefiles, and is later evaluated during the import-nodes
463# call below. It does three things:
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800464# 1. Inherits all of the variables from $1.
465# 2. Records the inheritance in the .INHERITS_FROM variable
Anton Hansson061cbcf2018-05-30 18:24:41 +0100466# 3. Records the calling makefile in PARENT_PRODUCT_FILES
467#
468# (2) and (3) can be used together to reconstruct the include hierarchy
469# See e.g. product-graph.mk for an example of this.
The Android Open Source Project6a5f7f02009-03-05 14:34:30 -0800470#
The Android Open Source Project88b60792009-03-03 19:28:42 -0800471define inherit-product
Ying Wanga1742612015-10-28 14:33:40 -0700472 $(if $(findstring ../,$(1)),\
473 $(eval np := $(call normalize-paths,$(1))),\
474 $(eval np := $(strip $(1))))\
The Android Open Source Project88b60792009-03-03 19:28:42 -0800475 $(foreach v,$(_product_var_list), \
Ying Wanga1742612015-10-28 14:33:40 -0700476 $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
Anton Hansson061cbcf2018-05-30 18:24:41 +0100477 $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
478 $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \
Ying Wanga1742612015-10-28 14:33:40 -0700479 $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
Joe Onoratof20c93a2021-01-19 22:34:22 -0800480 $(eval PARENT_PRODUCT_FILES := $(sort $(PARENT_PRODUCT_FILES) $(current_mk))) \
481 $(call dump-inherit,$(strip $(word 1,$(_include_stack))),$(1)) \
482 $(call dump-config-vals,$(current_mk),inherit)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800483endef
484
Anton Hansson837425b2018-06-01 14:18:14 +0100485# Specifies a number of path prefixes, relative to PRODUCT_OUT, where the
486# product makefile hierarchy rooted in the current node places its artifacts.
487# Creating artifacts outside the specified paths will cause a build-time error.
488define require-artifacts-in-path
489 $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
490 $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENTS := $(strip $(1))) \
Colin Crossc3ad8042020-06-11 11:25:05 -0700491 $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_ALLOWED_LIST := $(strip $(2))) \
Anton Hansson837425b2018-06-01 14:18:14 +0100492 $(eval ARTIFACT_PATH_REQUIREMENT_PRODUCTS := \
493 $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
494endef
Joe Onorato28a846d2010-02-22 10:33:05 -0800495
Anton Hanssond1258eb2020-12-08 12:13:50 +0000496# Like require-artifacts-in-path, but does not require all allow-list entries to
497# have an effect.
498define require-artifacts-in-path-relaxed
499 $(require-artifacts-in-path) \
500 $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENT_IS_RELAXED := true)
501endef
502
Yo Chiang1db657a2020-05-10 20:33:35 +0800503# Makes including non-existent modules in PRODUCT_PACKAGES an error.
Colin Crossc3ad8042020-06-11 11:25:05 -0700504# $(1): list of non-existent modules to allow.
Anton Hansson1ebcbd52018-07-04 17:17:23 +0100505define enforce-product-packages-exist
506 $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
507 $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST := true) \
Colin Crossc3ad8042020-06-11 11:25:05 -0700508 $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST := $(1)) \
Anton Hansson1ebcbd52018-07-04 17:17:23 +0100509 $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST) \
Colin Crossc3ad8042020-06-11 11:25:05 -0700510 $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST)
Anton Hansson1ebcbd52018-07-04 17:17:23 +0100511endef
512
Joe Onorato28a846d2010-02-22 10:33:05 -0800513#
514# Do inherit-product only if $(1) exists
515#
516define inherit-product-if-exists
517 $(if $(wildcard $(1)),$(call inherit-product,$(1)),)
518endef
519
The Android Open Source Project88b60792009-03-03 19:28:42 -0800520#
521# $(1): product makefile list
522#
523#TODO: check to make sure that products have all the necessary vars defined
524define import-products
Anton Hanssond26c6472019-05-06 14:40:57 +0100525$(call import-nodes,PRODUCTS,$(1),$(_product_var_list),$(_product_single_value_vars))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800526endef
527
528
529#
530# Does various consistency checks on all of the known products.
531# Takes no parameters, so $(call ) is not necessary.
532#
533define check-all-products
534$(if ,, \
535 $(eval _cap_names :=) \
536 $(foreach p,$(PRODUCTS), \
537 $(eval pn := $(strip $(PRODUCTS.$(p).PRODUCT_NAME))) \
538 $(if $(pn),,$(error $(p): PRODUCT_NAME must be defined.)) \
539 $(if $(filter $(pn),$(_cap_names)), \
540 $(error $(p): PRODUCT_NAME must be unique; "$(pn)" already used by $(strip \
541 $(foreach \
542 pp,$(PRODUCTS),
543 $(if $(filter $(pn),$(PRODUCTS.$(pp).PRODUCT_NAME)), \
544 $(pp) \
545 ))) \
546 ) \
547 ) \
548 $(eval _cap_names += $(pn)) \
549 $(if $(call is-c-identifier,$(pn)),, \
550 $(error $(p): PRODUCT_NAME must be a valid C identifier, not "$(pn)") \
551 ) \
552 $(eval pb := $(strip $(PRODUCTS.$(p).PRODUCT_BRAND))) \
553 $(if $(pb),,$(error $(p): PRODUCT_BRAND must be defined.)) \
554 $(foreach cf,$(strip $(PRODUCTS.$(p).PRODUCT_COPY_FILES)), \
Ying Wang4b0486b2012-09-20 16:35:36 -0700555 $(if $(filter 2 3,$(words $(subst :,$(space),$(cf)))),, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800556 $(error $(p): malformed COPY_FILE "$(cf)") \
557 ) \
558 ) \
559 ) \
560)
561endef
562
563
564#
565# Returns the product makefile path for the product with the provided name
566#
567# $(1): short product name like "generic"
568#
569define _resolve-short-product-name
570 $(eval pn := $(strip $(1)))
571 $(eval p := \
572 $(foreach p,$(PRODUCTS), \
573 $(if $(filter $(pn),$(PRODUCTS.$(p).PRODUCT_NAME)), \
574 $(p) \
575 )) \
576 )
577 $(eval p := $(sort $(p)))
578 $(if $(filter 1,$(words $(p))), \
579 $(p), \
580 $(if $(filter 0,$(words $(p))), \
581 $(error No matches for product "$(pn)"), \
582 $(error Product "$(pn)" ambiguous: matches $(p)) \
583 ) \
584 )
585endef
586define resolve-short-product-name
587$(strip $(call _resolve-short-product-name,$(1)))
588endef
Joe Onorato8dc8faa2010-09-14 13:09:48 -0400589
Anton Hansson13ea2a62019-03-28 14:47:25 +0000590# BoardConfig variables that are also inherited in product mks. Should ideally
591# be cleaned up to not be product variables.
592_readonly_late_variables := \
593 DEVICE_PACKAGE_OVERLAYS \
594 WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY \
595
596# Modified internally in the build system
597_readonly_late_variables += \
598 PRODUCT_COPY_FILES \
599 PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING \
600 PRODUCT_DEX_PREOPT_BOOT_FLAGS \
601
602_readonly_early_variables := $(filter-out $(_readonly_late_variables),$(_product_var_list))
Yifan Honge5d879a2018-11-27 11:37:38 -0800603
Joe Onorato8dc8faa2010-09-14 13:09:48 -0400604#
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700605# Mark the variables in _product_stash_var_list as readonly
Joe Onorato8dc8faa2010-09-14 13:09:48 -0400606#
Anton Hansson13ea2a62019-03-28 14:47:25 +0000607define readonly-variables
608$(foreach v,$(1), \
Anton Hansson70222b22019-02-21 10:41:03 +0000609 $(eval $(v) ?=) \
610 $(eval .KATI_READONLY := $(v)) \
Joe Onorato8dc8faa2010-09-14 13:09:48 -0400611 )
612endef
Anton Hansson13ea2a62019-03-28 14:47:25 +0000613define readonly-product-vars
614$(call readonly-variables,$(_readonly_early_variables))
615endef
616
617define readonly-final-product-vars
618$(call readonly-variables,$(_readonly_late_variables))
619endef
Joe Onorato8dc8faa2010-09-14 13:09:48 -0400620
Anton Hanssoncca8cdb2019-10-28 11:30:40 +0000621# Macro re-defined inside strip-product-vars.
622get-product-var = $(PRODUCTS.$(strip $(1)).$(2))
Yifan Honge5d879a2018-11-27 11:37:38 -0800623#
Anton Hansson528fdc02019-06-25 18:57:57 +0100624# Strip the variables in _product_var_list and a few build-system
625# internal variables, and assign the ones for the current product
626# to a shorthand that is more convenient to read from elsewhere.
Yifan Honge5d879a2018-11-27 11:37:38 -0800627#
628define strip-product-vars
Joe Onorato38a57bf2021-02-08 13:38:01 -0800629$(call dump-phase-start,PRODUCT-EXPAND,,$(_product_var_list),$(_product_single_value_vars), \
630 build/make/core/product.mk) \
Anton Hansson528fdc02019-06-25 18:57:57 +0100631$(foreach v,\
632 $(_product_var_list) \
633 PRODUCT_ENFORCE_PACKAGES_EXIST \
Colin Crossc3ad8042020-06-11 11:25:05 -0700634 PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST, \
Anton Hansson13ea2a62019-03-28 14:47:25 +0000635 $(eval $(v) := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).$(v)))) \
Anton Hanssoncca8cdb2019-10-28 11:30:40 +0000636 $(eval get-product-var = $$(if $$(filter $$(1),$$(INTERNAL_PRODUCT)),$$($$(2)),$$(PRODUCTS.$$(strip $$(1)).$$(2)))) \
637 $(KATI_obsolete_var PRODUCTS.$(INTERNAL_PRODUCT).$(v),Use $(v) instead) \
Joe Onorato38a57bf2021-02-08 13:38:01 -0800638) \
639$(call dump-phase-end,build/make/core/product.mk)
Yifan Honge5d879a2018-11-27 11:37:38 -0800640endef
641
Keun young Parkc41c5f42012-05-30 10:22:29 -0700642define add-to-product-copy-files-if-exists
643$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
644endef
Ying Wang20ebd2e2014-10-07 18:07:23 -0700645
646# whitespace placeholder when we record module's dex-preopt config.
647_PDPMC_SP_PLACE_HOLDER := |@SP@|
648# Set up dex-preopt config for a module.
649# $(1) list of module names
650# $(2) the modules' dex-preopt config
651define add-product-dex-preopt-module-config
652$(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\
653$(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \
654 $(foreach m,$(1),$(m)=$(_c)))
655endef
Andreas Gampe6b30d772016-06-27 15:15:31 -0700656
657# whitespace placeholder when we record module's sanitizer config.
658_PSMC_SP_PLACE_HOLDER := |@SP@|
659# Set up sanitizer config for a module.
660# $(1) list of module names
661# $(2) the modules' sanitizer config
662define add-product-sanitizer-module-config
663$(eval _c := $(subst $(space),$(_PSMC_SP_PLACE_HOLDER),$(strip $(2))))\
664$(eval PRODUCT_SANITIZER_MODULE_CONFIGS += \
665 $(foreach m,$(1),$(m)=$(_c)))
666endef