• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
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# Variables that are meant to hold only a single value.
18# - The value set in the current makefile takes precedence over inherited values
19# - If multiple inherited makefiles set the var, the first-inherited value wins
20_product_single_value_vars :=
21
22# Variables that are lists of values.
23_product_list_vars :=
24
25_product_single_value_vars += PRODUCT_NAME
26_product_single_value_vars += PRODUCT_MODEL
27_product_single_value_vars += PRODUCT_NAME_FOR_ATTESTATION
28_product_single_value_vars += PRODUCT_MODEL_FOR_ATTESTATION
29
30# Defines the ELF segment alignment for binaries (executables and shared libraries).
31# The ELF segment alignment has to be a PAGE_SIZE multiple. For example, if
32# PRODUCT_MAX_PAGE_SIZE_SUPPORTED=65536, the possible values for PAGE_SIZE could be
33# 4096, 16384 and 65536.
34_product_single_value_vars += PRODUCT_MAX_PAGE_SIZE_SUPPORTED
35
36# The resource configuration options to use for this product.
37_product_list_vars += PRODUCT_LOCALES
38_product_list_vars += PRODUCT_AAPT_CONFIG
39_product_single_value_vars += PRODUCT_AAPT_PREF_CONFIG
40_product_list_vars += PRODUCT_AAPT_PREBUILT_DPI
41_product_list_vars += PRODUCT_HOST_PACKAGES
42_product_list_vars += PRODUCT_PACKAGES
43_product_list_vars += PRODUCT_PACKAGES_DEBUG
44_product_list_vars += PRODUCT_PACKAGES_DEBUG_ASAN
45_product_list_vars += PRODUCT_PACKAGES_ARM64
46# Packages included only for eng/userdebug builds, when building with EMMA_INSTRUMENT=true
47_product_list_vars += PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE
48_product_list_vars += PRODUCT_PACKAGES_ENG
49_product_list_vars += PRODUCT_PACKAGES_TESTS
50
51# The device that this product maps to.
52_product_single_value_vars += PRODUCT_DEVICE
53_product_single_value_vars += PRODUCT_MANUFACTURER
54_product_single_value_vars += PRODUCT_BRAND
55_product_single_value_vars += PRODUCT_BRAND_FOR_ATTESTATION
56
57# These PRODUCT_SYSTEM_* flags, if defined, are used in place of the
58# corresponding PRODUCT_* flags for the sysprops on /system.
59_product_single_value_vars += \
60    PRODUCT_SYSTEM_NAME \
61    PRODUCT_SYSTEM_MODEL \
62    PRODUCT_SYSTEM_DEVICE \
63    PRODUCT_SYSTEM_BRAND \
64    PRODUCT_SYSTEM_MANUFACTURER \
65
66# PRODUCT_<PARTITION>_PROPERTIES are lists of property assignments
67# that go to <partition>/build.prop. Each property assignment is
68# "key = value" with zero or more whitespace characters on either
69# side of the '='.
70_product_list_vars += \
71    PRODUCT_SYSTEM_PROPERTIES \
72    PRODUCT_SYSTEM_EXT_PROPERTIES \
73    PRODUCT_VENDOR_PROPERTIES \
74    PRODUCT_ODM_PROPERTIES \
75    PRODUCT_PRODUCT_PROPERTIES
76
77# TODO(b/117892318) deprecate these:
78# ... in favor or PRODUCT_SYSTEM_PROPERTIES
79_product_list_vars += PRODUCT_SYSTEM_DEFAULT_PROPERTIES
80# ... in favor of PRODUCT_VENDOR_PROPERTIES
81_product_list_vars += PRODUCT_PROPERTY_OVERRIDES
82_product_list_vars += PRODUCT_DEFAULT_PROPERTY_OVERRIDES
83
84# TODO(b/117892318) consider deprecating these too
85_product_list_vars += PRODUCT_SYSTEM_PROPERTY_BLACKLIST
86_product_list_vars += PRODUCT_VENDOR_PROPERTY_BLACKLIST
87
88# The characteristics of the product, which among other things is passed to aapt
89_product_single_value_vars += PRODUCT_CHARACTERISTICS
90
91# A list of words like <source path>:<destination path>[:<owner>].
92# The file at the source path should be copied to the destination path
93# when building  this product.  <destination path> is relative to
94# $(PRODUCT_OUT), so it should look like, e.g., "system/etc/file.xml".
95# The rules for these copy steps are defined in build/make/core/Makefile.
96# The optional :<owner> is used to indicate the owner of a vendor file.
97_product_list_vars += PRODUCT_COPY_FILES
98
99# The OTA key(s) specified by the product config, if any.  The names
100# of these keys are stored in the target-files zip so that post-build
101# signing tools can substitute them for the test key embedded by
102# default.
103_product_list_vars += PRODUCT_OTA_PUBLIC_KEYS
104_product_list_vars += PRODUCT_EXTRA_OTA_KEYS
105_product_list_vars += PRODUCT_EXTRA_RECOVERY_KEYS
106
107# Should we use the default resources or add any product specific overlays
108_product_list_vars += PRODUCT_PACKAGE_OVERLAYS
109_product_list_vars += DEVICE_PACKAGE_OVERLAYS
110
111# Resource overlay list which must be excluded from enforcing RRO.
112_product_list_vars += PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS
113
114# Package list to apply enforcing RRO.
115_product_list_vars += PRODUCT_ENFORCE_RRO_TARGETS
116
117_product_list_vars += PRODUCT_SDK_ATREE_FILES
118_product_list_vars += PRODUCT_SDK_ADDON_NAME
119_product_list_vars += PRODUCT_SDK_ADDON_COPY_FILES
120_product_list_vars += PRODUCT_SDK_ADDON_COPY_MODULES
121_product_list_vars += PRODUCT_SDK_ADDON_DOC_MODULES
122_product_list_vars += PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP
123
124# which Soong namespaces to export to Make
125_product_list_vars += PRODUCT_SOONG_NAMESPACES
126
127_product_list_vars += PRODUCT_DEFAULT_WIFI_CHANNELS
128_product_single_value_vars += PRODUCT_DEFAULT_DEV_CERTIFICATE
129_product_list_vars += PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES
130_product_list_vars += PRODUCT_RESTRICT_VENDOR_FILES
131
132# The list of product-specific kernel header dirs
133_product_list_vars += PRODUCT_VENDOR_KERNEL_HEADERS
134
135# A list of module names in BOOTCLASSPATH (jar files). Each module may be
136# prefixed with "<apex>:", which identifies the APEX that provides it. APEXes
137# are identified by their "variant" names, i.e. their `apex_name` values in
138# Soong, which default to the `name` values. The prefix can also be "platform:"
139# or "system_ext:", and defaults to "platform:" if left out. See the long
140# comment in build/soong/java/dexprepopt_bootjars.go for details.
141_product_list_vars += PRODUCT_BOOT_JARS
142
143# A list of extra BOOTCLASSPATH jars (to be appended after common jars),
144# following the same format as PRODUCT_BOOT_JARS. Products that include
145# device-specific makefiles before AOSP makefiles should use this instead of
146# PRODUCT_BOOT_JARS, so that device-specific jars go after common jars.
147_product_list_vars += PRODUCT_BOOT_JARS_EXTRA
148
149_product_single_value_vars += PRODUCT_SUPPORTS_VBOOT
150_product_list_vars += PRODUCT_SYSTEM_SERVER_APPS
151# List of system_server classpath jars on the platform.
152_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS
153# List of system_server classpath jars delivered via apex. Format = <apex name>:<jar name>.
154_product_list_vars += PRODUCT_APEX_SYSTEM_SERVER_JARS
155# List of jars on the platform that system_server loads dynamically using separate classloaders.
156_product_list_vars += PRODUCT_STANDALONE_SYSTEM_SERVER_JARS
157# List of jars delivered via apex that system_server loads dynamically using separate classloaders.
158# Format = <apex name>:<jar name>
159_product_list_vars += PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS
160# If true, then suboptimal order of system server jars does not cause an error.
161_product_single_value_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS
162# If true, then system server jars defined in Android.mk are supported.
163_product_single_value_vars += PRODUCT_BROKEN_DEPRECATED_MK_SYSTEM_SERVER_JARS
164
165# Additional system server jars to be appended at the end of the common list.
166# This is necessary to avoid jars reordering due to makefile inheritance order.
167_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS_EXTRA
168
169# Set to true to disable <uses-library> checks for a product.
170_product_list_vars += PRODUCT_BROKEN_VERIFY_USES_LIBRARIES
171
172# All of the apps that we force preopt, this overrides WITH_DEXPREOPT.
173_product_list_vars += PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK
174_product_list_vars += PRODUCT_DEXPREOPT_SPEED_APPS
175_product_list_vars += PRODUCT_LOADED_BY_PRIVILEGED_MODULES
176_product_single_value_vars += PRODUCT_VBOOT_SIGNING_KEY
177_product_single_value_vars += PRODUCT_VBOOT_SIGNING_SUBKEY
178_product_single_value_vars += PRODUCT_SYSTEM_VERITY_PARTITION
179_product_single_value_vars += PRODUCT_VENDOR_VERITY_PARTITION
180_product_single_value_vars += PRODUCT_PRODUCT_VERITY_PARTITION
181_product_single_value_vars += PRODUCT_SYSTEM_EXT_VERITY_PARTITION
182_product_single_value_vars += PRODUCT_ODM_VERITY_PARTITION
183_product_single_value_vars += PRODUCT_VENDOR_DLKM_VERITY_PARTITION
184_product_single_value_vars += PRODUCT_ODM_DLKM_VERITY_PARTITION
185_product_single_value_vars += PRODUCT_SYSTEM_DLKM_VERITY_PARTITION
186_product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO
187_product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO
188
189# Per-module dex-preopt configs.
190_product_list_vars += PRODUCT_DEX_PREOPT_MODULE_CONFIGS
191_product_single_value_vars += PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER
192_product_list_vars += PRODUCT_DEX_PREOPT_DEFAULT_FLAGS
193_product_single_value_vars += PRODUCT_DEX_PREOPT_BOOT_FLAGS
194_product_single_value_vars += PRODUCT_DEX_PREOPT_PROFILE_DIR
195_product_single_value_vars += PRODUCT_DEX_PREOPT_GENERATE_DM_FILES
196_product_single_value_vars += PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING
197_product_single_value_vars += PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS
198
199# Boot image options.
200_product_list_vars += PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION
201_product_single_value_vars += \
202    PRODUCT_EXPORT_BOOT_IMAGE_TO_DIST \
203    PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \
204    PRODUCT_USES_DEFAULT_ART_CONFIG \
205
206_product_single_value_vars += PRODUCT_SYSTEM_SERVER_COMPILER_FILTER
207# Per-module sanitizer configs
208_product_list_vars += PRODUCT_SANITIZER_MODULE_CONFIGS
209_product_single_value_vars += PRODUCT_SYSTEM_BASE_FS_PATH
210_product_single_value_vars += PRODUCT_VENDOR_BASE_FS_PATH
211_product_single_value_vars += PRODUCT_PRODUCT_BASE_FS_PATH
212_product_single_value_vars += PRODUCT_SYSTEM_EXT_BASE_FS_PATH
213_product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH
214_product_single_value_vars += PRODUCT_VENDOR_DLKM_BASE_FS_PATH
215_product_single_value_vars += PRODUCT_ODM_DLKM_BASE_FS_PATH
216_product_single_value_vars += PRODUCT_SYSTEM_DLKM_BASE_FS_PATH
217
218# The first API level this product shipped with
219_product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL
220
221_product_list_vars += VENDOR_PRODUCT_RESTRICT_VENDOR_FILES
222_product_list_vars += VENDOR_EXCEPTION_MODULES
223_product_list_vars += VENDOR_EXCEPTION_PATHS
224# Whether the product wants to ship libartd. For rules and meaning, see art/Android.mk.
225_product_single_value_vars += PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD
226
227# Make this art variable visible to soong_config.mk.
228_product_single_value_vars += PRODUCT_ART_USE_READ_BARRIER
229
230# Add reserved headroom to a system image.
231_product_single_value_vars += PRODUCT_SYSTEM_HEADROOM
232
233# Whether to save disk space by minimizing java debug info
234_product_single_value_vars += PRODUCT_MINIMIZE_JAVA_DEBUG_INFO
235
236# Whether any paths are excluded from sanitization when SANITIZE_TARGET=integer_overflow
237_product_list_vars += PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS
238
239_product_single_value_vars += PRODUCT_ADB_KEYS
240
241# Whether any paths should have CFI enabled for components
242_product_list_vars += PRODUCT_CFI_INCLUDE_PATHS
243
244# Whether any paths are excluded from sanitization when SANITIZE_TARGET=cfi
245_product_list_vars += PRODUCT_CFI_EXCLUDE_PATHS
246
247# Whether any paths should have HWASan enabled for components
248_product_list_vars += PRODUCT_HWASAN_INCLUDE_PATHS
249
250# Whether any paths should have Memtag_heap enabled for components
251_product_list_vars += PRODUCT_MEMTAG_HEAP_ASYNC_INCLUDE_PATHS
252_product_list_vars += PRODUCT_MEMTAG_HEAP_ASYNC_DEFAULT_INCLUDE_PATHS
253_product_list_vars += PRODUCT_MEMTAG_HEAP_SYNC_INCLUDE_PATHS
254_product_list_vars += PRODUCT_MEMTAG_HEAP_SYNC_DEFAULT_INCLUDE_PATHS
255_product_list_vars += PRODUCT_MEMTAG_HEAP_EXCLUDE_PATHS
256
257# Whether this product wants to start with an empty list of default memtag_heap include paths
258_product_single_value_vars += PRODUCT_MEMTAG_HEAP_SKIP_DEFAULT_PATHS
259
260# Whether the Scudo hardened allocator is disabled platform-wide
261_product_single_value_vars += PRODUCT_DISABLE_SCUDO
262
263# List of extra VNDK versions to be included
264_product_list_vars += PRODUCT_EXTRA_VNDK_VERSIONS
265
266# Whether APEX should be compressed or not
267_product_single_value_vars += PRODUCT_COMPRESSED_APEX
268
269# VNDK version of product partition. It can be 'current' if the product
270# partitions uses PLATFORM_VNDK_VERSION.
271_product_single_value_vars += PRODUCT_PRODUCT_VNDK_VERSION
272
273_product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS
274_product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT
275_product_list_vars += PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST
276_product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT
277_product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST
278
279# List of modules that should be forcefully unmarked from being LOCAL_PRODUCT_MODULE, and hence
280# installed on /system directory by default.
281_product_list_vars += PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION
282
283# When this is true, dynamic partitions is retrofitted on a device that has
284# already been launched without dynamic partitions. Otherwise, the device
285# is launched with dynamic partitions.
286# This flag implies PRODUCT_USE_DYNAMIC_PARTITIONS.
287_product_single_value_vars += PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
288
289# List of tags that will be used to gate blueprint modules from the build graph
290_product_list_vars += PRODUCT_INCLUDE_TAGS
291
292# List of directories that will be used to gate blueprint modules from the build graph
293_product_list_vars += PRODUCT_SOURCE_ROOT_DIRS
294
295# When this is true, various build time as well as runtime debugfs restrictions are enabled.
296_product_single_value_vars += PRODUCT_SET_DEBUGFS_RESTRICTIONS
297
298# Other dynamic partition feature flags.PRODUCT_USE_DYNAMIC_PARTITION_SIZE and
299# PRODUCT_BUILD_SUPER_PARTITION default to the value of PRODUCT_USE_DYNAMIC_PARTITIONS.
300_product_single_value_vars += \
301    PRODUCT_USE_DYNAMIC_PARTITIONS \
302    PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
303    PRODUCT_BUILD_SUPER_PARTITION \
304
305# If set, kernel configuration requirements are present in OTA package (and will be enforced
306# during OTA). Otherwise, kernel configuration requirements are enforced in VTS.
307# Devices that checks the running kernel (instead of the kernel in OTA package) should not
308# set this variable to prevent OTA failures.
309_product_list_vars += PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
310
311# If set to true, this product builds a generic OTA package, which installs generic system images
312# onto matching devices. The product may only build a subset of system images (e.g. only
313# system.img), so devices need to install the package in a system-only OTA manner.
314_product_single_value_vars += PRODUCT_BUILD_GENERIC_OTA_PACKAGE
315
316_product_list_vars += PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
317_product_list_vars += PRODUCT_PACKAGE_NAME_OVERRIDES
318_product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES
319
320# Controls for whether different partitions are built for the current product.
321_product_single_value_vars += PRODUCT_BUILD_SYSTEM_IMAGE
322_product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE
323_product_single_value_vars += PRODUCT_BUILD_VENDOR_IMAGE
324_product_single_value_vars += PRODUCT_BUILD_PRODUCT_IMAGE
325_product_single_value_vars += PRODUCT_BUILD_SYSTEM_EXT_IMAGE
326_product_single_value_vars += PRODUCT_BUILD_ODM_IMAGE
327_product_single_value_vars += PRODUCT_BUILD_VENDOR_DLKM_IMAGE
328_product_single_value_vars += PRODUCT_BUILD_ODM_DLKM_IMAGE
329_product_single_value_vars += PRODUCT_BUILD_SYSTEM_DLKM_IMAGE
330_product_single_value_vars += PRODUCT_BUILD_CACHE_IMAGE
331_product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE
332_product_single_value_vars += PRODUCT_BUILD_USERDATA_IMAGE
333_product_single_value_vars += PRODUCT_BUILD_RECOVERY_IMAGE
334_product_single_value_vars += PRODUCT_BUILD_BOOT_IMAGE
335_product_single_value_vars += PRODUCT_BUILD_INIT_BOOT_IMAGE
336_product_single_value_vars += PRODUCT_BUILD_DEBUG_BOOT_IMAGE
337_product_single_value_vars += PRODUCT_BUILD_VENDOR_BOOT_IMAGE
338_product_single_value_vars += PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE
339_product_single_value_vars += PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE
340_product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE
341_product_single_value_vars += PRODUCT_BUILD_SUPER_EMPTY_IMAGE
342_product_single_value_vars += PRODUCT_BUILD_PVMFW_IMAGE
343
344# List of boot jars delivered via updatable APEXes, following the same format as
345# PRODUCT_BOOT_JARS.
346_product_list_vars += PRODUCT_APEX_BOOT_JARS
347
348# If set, device uses virtual A/B.
349_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA
350
351# If set, device uses virtual A/B Compression.
352_product_single_value_vars += PRODUCT_VIRTUAL_AB_COMPRESSION
353
354# If set, device retrofits virtual A/B.
355_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT
356
357# If set, forcefully generate a non-A/B update package.
358# Note: A device configuration should inherit from virtual_ab_ota_plus_non_ab.mk
359# instead of setting this variable directly.
360# Note: Use TARGET_OTA_ALLOW_NON_AB in the build system because
361# TARGET_OTA_ALLOW_NON_AB takes the value of AB_OTA_UPDATER into account.
362_product_single_value_vars += PRODUCT_OTA_FORCE_NON_AB_PACKAGE
363
364# If set, Java module in product partition cannot use hidden APIs.
365_product_single_value_vars += PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE
366
367# If set, only java_sdk_library can be used at inter-partition dependency.
368# Note: Build error if BOARD_VNDK_VERSION is not set while
369#       PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY is true, because
370#       PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY has no meaning if
371#       BOARD_VNDK_VERSION is not set.
372# Note: When PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is not set, there are
373#       no restrictions at dependency between system and product partition.
374_product_single_value_vars += PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY
375
376# Allowlist for PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY option.
377# Listed modules are allowed at inter-partition dependency even if it isn't
378# a java_sdk_library module.
379_product_list_vars += PRODUCT_INTER_PARTITION_JAVA_LIBRARY_ALLOWLIST
380
381_product_single_value_vars += PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES
382
383# Install a copy of the debug policy to the system_ext partition, and allow
384# init-second-stage to load debug policy from system_ext.
385# This option is only meant to be set by compliance GSI targets.
386_product_single_value_vars += PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT
387
388# If set, fsverity metadata files will be generated for each files in the
389# allowlist, plus an manifest APK per partition. For example,
390# /system/framework/service.jar will come with service.jar.fsv_meta in the same
391# directory; the file information will also be included in
392# /system/etc/security/fsverity/BuildManifest.apk
393_product_single_value_vars += PRODUCT_FSVERITY_GENERATE_METADATA
394
395# If true, sets the default for MODULE_BUILD_FROM_SOURCE. This overrides
396# BRANCH_DEFAULT_MODULE_BUILD_FROM_SOURCE but not an explicitly set value.
397_product_single_value_vars += PRODUCT_MODULE_BUILD_FROM_SOURCE
398
399# If true, installs a full version of com.android.virt APEX.
400_product_single_value_vars += PRODUCT_AVF_ENABLED
401
402# List of .json files to be merged/compiled into vendor/etc/linker.config.pb
403_product_list_vars += PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS
404
405# Whether to use userfaultfd GC.
406# Possible values are:
407# - "default" or empty: both the build system and the runtime determine whether to use userfaultfd
408#   GC based on the vendor API level
409# - "true": forces the build system to use userfaultfd GC regardless of the vendor API level; the
410#   runtime determines whether to use userfaultfd GC based on the kernel support. Note that the
411#   device may have to re-compile everything on the first boot if the kernel doesn't support
412#   userfaultfd
413# - "false": disallows the build system and the runtime to use userfaultfd GC even if the device
414#   supports it
415_product_single_value_vars += PRODUCT_ENABLE_UFFD_GC
416
417_product_list_vars += PRODUCT_AFDO_PROFILES
418
419.KATI_READONLY := _product_single_value_vars _product_list_vars
420_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
421
422#
423# Functions for including product makefiles
424#
425
426#
427# $(1): product to inherit
428#
429# To be called from product makefiles, and is later evaluated during the import-nodes
430# call below. It does the following:
431#  1. Inherits all of the variables from $1.
432#  2. Records the inheritance in the .INHERITS_FROM variable
433#
434# (2) and the PRODUCTS variable can be used together to reconstruct the include hierarchy
435# See e.g. product-graph.mk for an example of this.
436#
437define inherit-product
438  $(eval _inherit_product_wildcard := $(wildcard $(1)))\
439  $(if $(_inherit_product_wildcard),,$(error $(1) does not exist.))\
440  $(foreach part,$(_inherit_product_wildcard),\
441    $(if $(findstring ../,$(part)),\
442      $(eval np := $(call normalize-paths,$(part))),\
443      $(eval np := $(strip $(part))))\
444    $(foreach v,$(_product_var_list), \
445        $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
446    $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
447    $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \
448    $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
449    $(call dump-inherit,$(current_mk),$(1)) \
450    $(call dump-config-vals,$(current_mk),inherit))
451endef
452
453# Specifies a number of path prefixes, relative to PRODUCT_OUT, where the
454# product makefile hierarchy rooted in the current node places its artifacts.
455# Creating artifacts outside the specified paths will cause a build-time error.
456define require-artifacts-in-path
457  $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
458  $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENTS := $(strip $(1))) \
459  $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_ALLOWED_LIST := $(strip $(2))) \
460  $(eval ARTIFACT_PATH_REQUIREMENT_PRODUCTS := \
461    $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
462endef
463
464# Like require-artifacts-in-path, but does not require all allow-list entries to
465# have an effect.
466define require-artifacts-in-path-relaxed
467  $(require-artifacts-in-path) \
468  $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENT_IS_RELAXED := true)
469endef
470
471# Makes including non-existent modules in PRODUCT_PACKAGES an error.
472# $(1): list of non-existent modules to allow.
473define enforce-product-packages-exist
474  $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
475  $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST := true) \
476  $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST := $(1)) \
477  $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST) \
478  $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST)
479endef
480
481#
482# Do inherit-product only if $(1) exists
483#
484define inherit-product-if-exists
485  $(if $(wildcard $(1)),$(call inherit-product,$(1)),)
486endef
487
488#
489# $(1): product makefile list
490#
491#TODO: check to make sure that products have all the necessary vars defined
492define import-products
493$(call import-nodes,PRODUCTS,$(1),$(_product_var_list),$(_product_single_value_vars))
494endef
495
496
497#
498# Does various consistency checks on the current product.
499# Takes no parameters, so $(call ) is not necessary.
500#
501define check-current-product
502$(if ,, \
503  $(if $(call is-c-identifier,$(PRODUCT_NAME)),, \
504    $(error $(INTERNAL_PRODUCT): PRODUCT_NAME must be a valid C identifier, not "$(pn)")) \
505  $(if $(PRODUCT_BRAND),, \
506    $(error $(INTERNAL_PRODUCT): PRODUCT_BRAND must be defined.)) \
507  $(foreach cf,$(strip $(PRODUCT_COPY_FILES)), \
508    $(if $(filter 2 3,$(words $(subst :,$(space),$(cf)))),, \
509      $(error $(p): malformed COPY_FILE "$(cf)"))))
510endef
511
512# BoardConfig variables that are also inherited in product mks. Should ideally
513# be cleaned up to not be product variables.
514_readonly_late_variables := \
515  DEVICE_PACKAGE_OVERLAYS \
516  WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY \
517
518# Modified internally in the build system
519_readonly_late_variables += \
520  PRODUCT_COPY_FILES \
521  PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING \
522  PRODUCT_DEX_PREOPT_BOOT_FLAGS \
523
524_readonly_early_variables := $(filter-out $(_readonly_late_variables),$(_product_var_list))
525
526#
527# Mark the variables in _product_stash_var_list as readonly
528#
529define readonly-variables
530$(foreach v,$(1), \
531  $(eval $(v) ?=) \
532  $(eval .KATI_READONLY := $(v)) \
533 )
534endef
535define readonly-product-vars
536$(call readonly-variables,$(_readonly_early_variables))
537endef
538
539define readonly-final-product-vars
540$(call readonly-variables,$(_readonly_late_variables))
541endef
542
543# Macro re-defined inside strip-product-vars.
544get-product-var = $(PRODUCTS.$(strip $(1)).$(2))
545#
546# Strip the variables in _product_var_list and a few build-system
547# internal variables, and assign the ones for the current product
548# to a shorthand that is more convenient to read from elsewhere.
549#
550define strip-product-vars
551$(call dump-phase-start,PRODUCT-EXPAND,,$(_product_var_list),$(_product_single_value_vars), \
552		build/make/core/product.mk) \
553$(foreach v,\
554  $(_product_var_list) \
555    PRODUCT_ENFORCE_PACKAGES_EXIST \
556    PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST, \
557  $(eval $(v) := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).$(v)))) \
558  $(eval get-product-var = $$(if $$(filter $$(1),$$(INTERNAL_PRODUCT)),$$($$(2)),$$(PRODUCTS.$$(strip $$(1)).$$(2)))) \
559  $(KATI_obsolete_var PRODUCTS.$(INTERNAL_PRODUCT).$(v),Use $(v) instead) \
560) \
561$(call dump-phase-end,build/make/core/product.mk)
562endef
563
564define add-to-product-copy-files-if-exists
565$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
566endef
567
568# whitespace placeholder when we record module's dex-preopt config.
569_PDPMC_SP_PLACE_HOLDER := |@SP@|
570# Set up dex-preopt config for a module.
571# $(1) list of module names
572# $(2) the modules' dex-preopt config
573define add-product-dex-preopt-module-config
574$(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\
575$(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \
576  $(foreach m,$(1),$(m)=$(_c)))
577endef
578
579# whitespace placeholder when we record module's sanitizer config.
580_PSMC_SP_PLACE_HOLDER := |@SP@|
581# Set up sanitizer config for a module.
582# $(1) list of module names
583# $(2) the modules' sanitizer config
584define add-product-sanitizer-module-config
585$(eval _c := $(subst $(space),$(_PSMC_SP_PLACE_HOLDER),$(strip $(2))))\
586$(eval PRODUCT_SANITIZER_MODULE_CONFIGS += \
587  $(foreach m,$(1),$(m)=$(_c)))
588endef
589