The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 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 | # |
| 18 | # Functions for including AndroidProducts.mk files |
Ying Wang | 157a5e1 | 2012-09-27 13:26:25 -0700 | [diff] [blame] | 19 | # 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 Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 25 | |
| 26 | # |
| 27 | # Returns the list of all AndroidProducts.mk files. |
| 28 | # $(call ) isn't necessary. |
| 29 | # |
| 30 | define _find-android-products-files |
Dan Willemsen | b9d6351 | 2018-05-01 22:34:03 -0700 | [diff] [blame] | 31 | $(file <$(OUT_DIR)/.module_paths/AndroidProducts.mk.list) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 32 | $(SRC_TARGET_DIR)/product/AndroidProducts.mk |
| 33 | endef |
| 34 | |
| 35 | # |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 36 | # 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 | # |
| 44 | define _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))) |
| 50 | endef |
| 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 | # |
| 58 | define _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 | )) |
| 70 | endef |
| 71 | |
| 72 | # |
Ying Wang | 1a031e4 | 2010-05-10 16:35:39 -0700 | [diff] [blame] | 73 | # 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 Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 76 | # |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 77 | # 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 Wang | 1a031e4 | 2010-05-10 16:35:39 -0700 | [diff] [blame] | 81 | define get-product-makefiles |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 82 | $(sort \ |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 83 | $(eval _COMMON_LUNCH_CHOICES :=) \ |
Ying Wang | 1a031e4 | 2010-05-10 16:35:39 -0700 | [diff] [blame] | 84 | $(foreach f,$(1), \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 85 | $(eval PRODUCT_MAKEFILES :=) \ |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 86 | $(eval COMMON_LUNCH_CHOICES :=) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 87 | $(eval LOCAL_DIR := $(patsubst %/,%,$(dir $(f)))) \ |
| 88 | $(eval include $(f)) \ |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 89 | $(call _validate-common-lunch-choices,$(COMMON_LUNCH_CHOICES),$(PRODUCT_MAKEFILES)) \ |
| 90 | $(eval _COMMON_LUNCH_CHOICES += $(COMMON_LUNCH_CHOICES)) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 91 | $(PRODUCT_MAKEFILES) \ |
| 92 | ) \ |
| 93 | $(eval PRODUCT_MAKEFILES :=) \ |
| 94 | $(eval LOCAL_DIR :=) \ |
Dan Willemsen | 5436c7e | 2019-02-11 21:31:47 -0800 | [diff] [blame] | 95 | $(eval COMMON_LUNCH_CHOICES := $(sort $(_COMMON_LUNCH_CHOICES))) \ |
Dan Willemsen | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 96 | $(eval _COMMON_LUNCH_CHOICES :=) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 97 | ) |
| 98 | endef |
| 99 | |
| 100 | # |
Ying Wang | 1a031e4 | 2010-05-10 16:35:39 -0700 | [diff] [blame] | 101 | # Returns the sorted concatenation of all PRODUCT_MAKEFILES |
| 102 | # variables set in all AndroidProducts.mk files. |
| 103 | # $(call ) isn't necessary. |
| 104 | # |
| 105 | define get-all-product-makefiles |
| 106 | $(call get-product-makefiles,$(_find-android-products-files)) |
| 107 | endef |
| 108 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 109 | # 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 Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 117 | _product_single_value_vars += PRODUCT_NAME |
| 118 | _product_single_value_vars += PRODUCT_MODEL |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 119 | |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 120 | # The resoure configuration options to use for this product. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 121 | _product_list_vars += PRODUCT_LOCALES |
| 122 | _product_list_vars += PRODUCT_AAPT_CONFIG |
| 123 | _product_list_vars += PRODUCT_AAPT_PREF_CONFIG |
| 124 | _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 Gupta | 7185f8c | 2019-06-11 10:27:47 -0700 | [diff] [blame] | 129 | # Packages included only for eng/userdebug builds, when building with EMMA_INSTRUMENT=true |
| 130 | _product_list_vars += PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 131 | _product_list_vars += PRODUCT_PACKAGES_ENG |
| 132 | _product_list_vars += PRODUCT_PACKAGES_TESTS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 133 | |
| 134 | # The device that this product maps to. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 135 | _product_single_value_vars += PRODUCT_DEVICE |
| 136 | _product_single_value_vars += PRODUCT_MANUFACTURER |
| 137 | _product_single_value_vars += PRODUCT_BRAND |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 138 | |
| 139 | # These PRODUCT_SYSTEM_* flags, if defined, are used in place of the |
| 140 | # corresponding PRODUCT_* flags for the sysprops on /system. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 141 | _product_single_value_vars += \ |
Anton Hansson | ee4c970 | 2018-12-21 15:36:00 +0000 | [diff] [blame] | 142 | PRODUCT_SYSTEM_NAME \ |
| 143 | PRODUCT_SYSTEM_MODEL \ |
| 144 | PRODUCT_SYSTEM_DEVICE \ |
| 145 | PRODUCT_SYSTEM_BRAND \ |
| 146 | PRODUCT_SYSTEM_MANUFACTURER \ |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 147 | |
| 148 | # A list of property assignments, like "key = value", with zero or more |
| 149 | # whitespace characters on either side of the '='. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 150 | _product_list_vars += PRODUCT_PROPERTY_OVERRIDES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 151 | |
| 152 | # A list of property assignments, like "key = value", with zero or more |
| 153 | # whitespace characters on either side of the '='. |
| 154 | # used for adding properties to default.prop |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 155 | _product_list_vars += PRODUCT_DEFAULT_PROPERTY_OVERRIDES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 156 | |
| 157 | # A list of property assignments, like "key = value", with zero or more |
| 158 | # whitespace characters on either side of the '='. |
| 159 | # used for adding properties to build.prop of product partition |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 160 | _product_list_vars += PRODUCT_PRODUCT_PROPERTIES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 161 | |
| 162 | # A list of property assignments, like "key = value", with zero or more |
| 163 | # whitespace characters on either side of the '='. |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 164 | # used for adding properties to build.prop of system_ext and odm partitions |
| 165 | _product_list_vars += PRODUCT_SYSTEM_EXT_PROPERTIES |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 166 | _product_list_vars += PRODUCT_ODM_PROPERTIES |
Anton Hansson | 879b007 | 2019-05-13 18:06:45 +0100 | [diff] [blame] | 167 | |
| 168 | # The characteristics of the product, which among other things is passed to aapt |
| 169 | _product_single_value_vars += PRODUCT_CHARACTERISTICS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 170 | |
| 171 | # A list of words like <source path>:<destination path>[:<owner>]. |
| 172 | # The file at the source path should be copied to the destination path |
| 173 | # when building this product. <destination path> is relative to |
| 174 | # $(PRODUCT_OUT), so it should look like, e.g., "system/etc/file.xml". |
| 175 | # The rules for these copy steps are defined in build/make/core/Makefile. |
| 176 | # The optional :<owner> is used to indicate the owner of a vendor file. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 177 | _product_list_vars += PRODUCT_COPY_FILES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 178 | |
| 179 | # The OTA key(s) specified by the product config, if any. The names |
| 180 | # of these keys are stored in the target-files zip so that post-build |
| 181 | # signing tools can substitute them for the test key embedded by |
| 182 | # default. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 183 | _product_list_vars += PRODUCT_OTA_PUBLIC_KEYS |
| 184 | _product_list_vars += PRODUCT_EXTRA_RECOVERY_KEYS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 185 | |
| 186 | # Should we use the default resources or add any product specific overlays |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 187 | _product_list_vars += PRODUCT_PACKAGE_OVERLAYS |
| 188 | _product_list_vars += DEVICE_PACKAGE_OVERLAYS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 189 | |
| 190 | # Resource overlay list which must be excluded from enforcing RRO. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 191 | _product_list_vars += PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 192 | |
| 193 | # Package list to apply enforcing RRO. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 194 | _product_list_vars += PRODUCT_ENFORCE_RRO_TARGETS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 195 | |
Jeongik Cha | d99e77d | 2020-03-09 12:31:23 +0900 | [diff] [blame] | 196 | # Packages to skip auto-generating RROs for when PRODUCT_ENFORCE_RRO_TARGETS is set to *. |
| 197 | _product_list_vars += PRODUCT_ENFORCE_RRO_EXEMPTED_TARGETS |
| 198 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 199 | _product_list_vars += PRODUCT_SDK_ATREE_FILES |
| 200 | _product_list_vars += PRODUCT_SDK_ADDON_NAME |
| 201 | _product_list_vars += PRODUCT_SDK_ADDON_COPY_FILES |
| 202 | _product_list_vars += PRODUCT_SDK_ADDON_COPY_MODULES |
| 203 | _product_list_vars += PRODUCT_SDK_ADDON_DOC_MODULES |
| 204 | _product_list_vars += PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 205 | |
| 206 | # which Soong namespaces to export to Make |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 207 | _product_list_vars += PRODUCT_SOONG_NAMESPACES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 208 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 209 | _product_list_vars += PRODUCT_DEFAULT_WIFI_CHANNELS |
| 210 | _product_list_vars += PRODUCT_DEFAULT_DEV_CERTIFICATE |
Remi NGUYEN VAN | 87d0f27 | 2019-08-07 18:13:33 +0900 | [diff] [blame] | 211 | _product_list_vars += PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 212 | _product_list_vars += PRODUCT_RESTRICT_VENDOR_FILES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 213 | |
| 214 | # The list of product-specific kernel header dirs |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 215 | _product_list_vars += PRODUCT_VENDOR_KERNEL_HEADERS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 216 | |
| 217 | # A list of module names of BOOTCLASSPATH (jar files) |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 218 | _product_list_vars += PRODUCT_BOOT_JARS |
Po Hu | 012118d | 2020-03-13 14:14:27 +0800 | [diff] [blame] | 219 | |
| 220 | # A list of extra BOOTCLASSPATH jars (to be appended after common jars). |
| 221 | # Products that include device-specific makefiles before AOSP makefiles should use this |
| 222 | # instead of PRODUCT_BOOT_JARS, so that device-specific jars go after common jars. |
| 223 | _product_list_vars += PRODUCT_BOOT_JARS_EXTRA |
| 224 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 225 | _product_list_vars += PRODUCT_SUPPORTS_BOOT_SIGNER |
| 226 | _product_list_vars += PRODUCT_SUPPORTS_VBOOT |
| 227 | _product_list_vars += PRODUCT_SUPPORTS_VERITY |
| 228 | _product_list_vars += PRODUCT_SUPPORTS_VERITY_FEC |
| 229 | _product_list_vars += PRODUCT_OEM_PROPERTIES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 230 | |
| 231 | # A list of property assignments, like "key = value", with zero or more |
| 232 | # whitespace characters on either side of the '='. |
| 233 | # used for adding properties to default.prop of system partition |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 234 | _product_list_vars += PRODUCT_SYSTEM_DEFAULT_PROPERTIES |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 235 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 236 | _product_list_vars += PRODUCT_SYSTEM_PROPERTY_BLACKLIST |
| 237 | _product_list_vars += PRODUCT_VENDOR_PROPERTY_BLACKLIST |
| 238 | _product_list_vars += PRODUCT_SYSTEM_SERVER_APPS |
| 239 | _product_list_vars += PRODUCT_SYSTEM_SERVER_JARS |
Roshan Pius | d6e239f | 2019-11-22 08:47:40 -0800 | [diff] [blame] | 240 | # List of system_server jars delivered via apex. Format = <apex name>:<jar name>. |
| 241 | _product_list_vars += PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS |
Ulya Trafimovich | 40e55c2 | 2020-03-27 12:12:59 +0000 | [diff] [blame^] | 242 | # If true, then suboptimal order of system server jars does not cause an error. |
| 243 | _product_list_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 244 | |
Rock.Yeh | 2a703ce | 2020-04-22 17:01:10 +0800 | [diff] [blame] | 245 | # Additional system server jars to be appended at the end of the common list. |
| 246 | # This is necessary to avoid jars reordering due to makefile inheritance order. |
| 247 | _product_list_vars += PRODUCT_SYSTEM_SERVER_JARS_EXTRA |
| 248 | |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 249 | # All of the apps that we force preopt, this overrides WITH_DEXPREOPT. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 250 | _product_list_vars += PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK |
| 251 | _product_list_vars += PRODUCT_DEXPREOPT_SPEED_APPS |
| 252 | _product_list_vars += PRODUCT_LOADED_BY_PRIVILEGED_MODULES |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 253 | _product_single_value_vars += PRODUCT_VBOOT_SIGNING_KEY |
| 254 | _product_single_value_vars += PRODUCT_VBOOT_SIGNING_SUBKEY |
| 255 | _product_single_value_vars += PRODUCT_VERITY_SIGNING_KEY |
| 256 | _product_single_value_vars += PRODUCT_SYSTEM_VERITY_PARTITION |
| 257 | _product_single_value_vars += PRODUCT_VENDOR_VERITY_PARTITION |
| 258 | _product_single_value_vars += PRODUCT_PRODUCT_VERITY_PARTITION |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 259 | _product_single_value_vars += PRODUCT_SYSTEM_EXT_VERITY_PARTITION |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 260 | _product_single_value_vars += PRODUCT_ODM_VERITY_PARTITION |
| 261 | _product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO |
| 262 | _product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 263 | |
| 264 | # Per-module dex-preopt configs. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 265 | _product_list_vars += PRODUCT_DEX_PREOPT_MODULE_CONFIGS |
| 266 | _product_list_vars += PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER |
| 267 | _product_list_vars += PRODUCT_DEX_PREOPT_DEFAULT_FLAGS |
| 268 | _product_list_vars += PRODUCT_DEX_PREOPT_BOOT_FLAGS |
| 269 | _product_list_vars += PRODUCT_DEX_PREOPT_PROFILE_DIR |
| 270 | _product_list_vars += PRODUCT_DEX_PREOPT_GENERATE_DM_FILES |
| 271 | _product_list_vars += PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING |
| 272 | _product_list_vars += PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 273 | |
| 274 | # Boot image options. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 275 | _product_single_value_vars += \ |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 276 | PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \ |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 277 | PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION \ |
Calin Juravle | cdff6b1 | 2019-05-01 15:34:47 -0700 | [diff] [blame] | 278 | PRODUCT_USES_DEFAULT_ART_CONFIG \ |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 279 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 280 | _product_list_vars += PRODUCT_SYSTEM_SERVER_COMPILER_FILTER |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 281 | # Per-module sanitizer configs |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 282 | _product_list_vars += PRODUCT_SANITIZER_MODULE_CONFIGS |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 283 | _product_single_value_vars += PRODUCT_SYSTEM_BASE_FS_PATH |
| 284 | _product_single_value_vars += PRODUCT_VENDOR_BASE_FS_PATH |
| 285 | _product_single_value_vars += PRODUCT_PRODUCT_BASE_FS_PATH |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 286 | _product_single_value_vars += PRODUCT_SYSTEM_EXT_BASE_FS_PATH |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 287 | _product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH |
| 288 | |
| 289 | # The first API level this product shipped with |
| 290 | _product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL |
| 291 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 292 | _product_list_vars += VENDOR_PRODUCT_RESTRICT_VENDOR_FILES |
| 293 | _product_list_vars += VENDOR_EXCEPTION_MODULES |
| 294 | _product_list_vars += VENDOR_EXCEPTION_PATHS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 295 | # Whether the product wants to ship libartd. For rules and meaning, see art/Android.mk. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 296 | _product_single_value_vars += PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 297 | |
| 298 | # Make this art variable visible to soong_config.mk. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 299 | _product_single_value_vars += PRODUCT_ART_USE_READ_BARRIER |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 300 | |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 301 | # Add reserved headroom to a system image. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 302 | _product_single_value_vars += PRODUCT_SYSTEM_HEADROOM |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 303 | |
| 304 | # Whether to save disk space by minimizing java debug info |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 305 | _product_single_value_vars += PRODUCT_MINIMIZE_JAVA_DEBUG_INFO |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 306 | |
| 307 | # Whether any paths are excluded from sanitization when SANITIZE_TARGET=integer_overflow |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 308 | _product_list_vars += PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 309 | |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 310 | _product_single_value_vars += PRODUCT_ADB_KEYS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 311 | |
| 312 | # Whether any paths should have CFI enabled for components |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 313 | _product_list_vars += PRODUCT_CFI_INCLUDE_PATHS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 314 | |
| 315 | # Whether any paths are excluded from sanitization when SANITIZE_TARGET=cfi |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 316 | _product_list_vars += PRODUCT_CFI_EXCLUDE_PATHS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 317 | |
| 318 | # Whether the Scudo hardened allocator is disabled platform-wide |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 319 | _product_single_value_vars += PRODUCT_DISABLE_SCUDO |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 320 | |
| 321 | # A flag to override PRODUCT_COMPATIBLE_PROPERTY |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 322 | _product_single_value_vars += PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 323 | |
Isaac Chen | e972350 | 2019-05-06 16:55:48 +0800 | [diff] [blame] | 324 | # List of extra VNDK versions to be included |
| 325 | _product_list_vars += PRODUCT_EXTRA_VNDK_VERSIONS |
| 326 | |
Justin Yun | f19d840 | 2019-11-18 19:43:41 +0900 | [diff] [blame] | 327 | # VNDK version of product partition. It can be 'current' if the product |
| 328 | # partitions uses PLATFORM_VNDK_VERSION. |
| 329 | _product_single_value_var += PRODUCT_PRODUCT_VNDK_VERSION |
| 330 | |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 331 | # Whether the whitelist of actionable compatible properties should be disabled or not |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 332 | _product_single_value_vars += PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE |
| 333 | |
| 334 | _product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS |
| 335 | _product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 336 | _product_list_vars += PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST |
| 337 | _product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT |
| 338 | _product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 339 | |
| 340 | # List of modules that should be forcefully unmarked from being LOCAL_PRODUCT_MODULE, and hence |
| 341 | # installed on /system directory by default. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 342 | _product_list_vars += PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 343 | |
| 344 | # When this is true, dynamic partitions is retrofitted on a device that has |
| 345 | # already been launched without dynamic partitions. Otherwise, the device |
| 346 | # is launched with dynamic partitions. |
| 347 | # This flag implies PRODUCT_USE_DYNAMIC_PARTITIONS. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 348 | _product_single_value_vars += PRODUCT_RETROFIT_DYNAMIC_PARTITIONS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 349 | |
| 350 | # Other dynamic partition feature flags.PRODUCT_USE_DYNAMIC_PARTITION_SIZE and |
| 351 | # PRODUCT_BUILD_SUPER_PARTITION default to the value of PRODUCT_USE_DYNAMIC_PARTITIONS. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 352 | _product_single_value_vars += \ |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 353 | PRODUCT_USE_DYNAMIC_PARTITIONS \ |
Yifan Hong | 2dae572 | 2018-07-31 12:47:27 -0700 | [diff] [blame] | 354 | PRODUCT_USE_DYNAMIC_PARTITION_SIZE \ |
| 355 | PRODUCT_BUILD_SUPER_PARTITION \ |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 356 | |
| 357 | # If set, kernel configuration requirements are present in OTA package (and will be enforced |
| 358 | # during OTA). Otherwise, kernel configuration requirements are enforced in VTS. |
| 359 | # Devices that checks the running kernel (instead of the kernel in OTA package) should not |
| 360 | # set this variable to prevent OTA failures. |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 361 | _product_list_vars += PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 362 | |
Tao Bao | 9be20c7 | 2019-04-08 21:11:59 -0700 | [diff] [blame] | 363 | # If set to true, this product builds a generic OTA package, which installs generic system images |
| 364 | # onto matching devices. The product may only build a subset of system images (e.g. only |
| 365 | # system.img), so devices need to install the package in a system-only OTA manner. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 366 | _product_single_value_vars += PRODUCT_BUILD_GENERIC_OTA_PACKAGE |
Tao Bao | 9be20c7 | 2019-04-08 21:11:59 -0700 | [diff] [blame] | 367 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 368 | _product_list_vars += PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES |
| 369 | _product_list_vars += PRODUCT_PACKAGE_NAME_OVERRIDES |
| 370 | _product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 371 | |
| 372 | # Controls for whether different partitions are built for the current product. |
| 373 | _product_single_value_vars += PRODUCT_BUILD_SYSTEM_IMAGE |
| 374 | _product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE |
| 375 | _product_single_value_vars += PRODUCT_BUILD_VENDOR_IMAGE |
| 376 | _product_single_value_vars += PRODUCT_BUILD_PRODUCT_IMAGE |
Justin Yun | 6151e3f | 2019-06-25 15:58:13 +0900 | [diff] [blame] | 377 | _product_single_value_vars += PRODUCT_BUILD_SYSTEM_EXT_IMAGE |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 378 | _product_single_value_vars += PRODUCT_BUILD_ODM_IMAGE |
| 379 | _product_single_value_vars += PRODUCT_BUILD_CACHE_IMAGE |
| 380 | _product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE |
| 381 | _product_single_value_vars += PRODUCT_BUILD_USERDATA_IMAGE |
Chris Gross | a784ef1 | 2019-04-22 11:09:57 -0700 | [diff] [blame] | 382 | _product_single_value_vars += PRODUCT_BUILD_RECOVERY_IMAGE |
| 383 | _product_single_value_vars += PRODUCT_BUILD_BOOT_IMAGE |
Paul Trautrim | 4e14323 | 2019-08-13 16:30:57 +0900 | [diff] [blame] | 384 | _product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 385 | |
Roshan Pius | 626f637 | 2019-11-27 09:31:34 -0800 | [diff] [blame] | 386 | # List of boot jars delivered via apex |
| 387 | _product_list_vars += PRODUCT_UPDATABLE_BOOT_JARS |
Chris Gross | a784ef1 | 2019-04-22 11:09:57 -0700 | [diff] [blame] | 388 | |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 389 | # Whether the product would like to check prebuilt ELF files. |
Anton Hansson | c1c4c0b | 2019-05-06 15:09:19 +0100 | [diff] [blame] | 390 | _product_single_value_vars += PRODUCT_CHECK_ELF_FILES |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 391 | |
Yifan Hong | 7d37b40 | 2019-07-23 14:20:29 -0700 | [diff] [blame] | 392 | # If set, device uses virtual A/B. |
| 393 | _product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA |
| 394 | |
| 395 | # If set, device retrofits virtual A/B. |
| 396 | _product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT |
| 397 | |
Yifan Hong | 65afc07 | 2020-04-17 10:08:10 -0700 | [diff] [blame] | 398 | # If set, forcefully generate a non-A/B update package. |
| 399 | # Note: A device configuration should inherit from virtual_ab_ota_plus_non_ab.mk |
| 400 | # instead of setting this variable directly. |
| 401 | # Note: Use TARGET_OTA_ALLOW_NON_AB in the build system because |
| 402 | # TARGET_OTA_ALLOW_NON_AB takes the value of AB_OTA_UPDATER into account. |
| 403 | _product_single_value_vars += PRODUCT_OTA_FORCE_NON_AB_PACKAGE |
| 404 | |
Jeongik Cha | 7452979 | 2019-07-19 13:40:18 +0900 | [diff] [blame] | 405 | # If set, Java module in product partition cannot use hidden APIs. |
| 406 | _product_single_value_vars += PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE |
| 407 | |
Jooyung Han | 9efe534 | 2019-12-05 16:14:18 +0900 | [diff] [blame] | 408 | _product_single_value_vars += PRODUCT_INSTALL_EXTRA_FLATTENED_APEXES |
| 409 | |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 410 | .KATI_READONLY := _product_single_value_vars _product_list_vars |
| 411 | _product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars) |
Ying Wang | 20ebd2e | 2014-10-07 18:07:23 -0700 | [diff] [blame] | 412 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 413 | define dump-product |
Anton Hansson | dce3f92 | 2019-02-11 21:19:54 +0000 | [diff] [blame] | 414 | $(warning ==== $(1) ====)\ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 415 | $(foreach v,$(_product_var_list),\ |
Anton Hansson | cca8cdb | 2019-10-28 11:30:40 +0000 | [diff] [blame] | 416 | $(warning PRODUCTS.$(1).$(v) := $(call get-product-var,$(1),$(v))))\ |
Anton Hansson | dce3f92 | 2019-02-11 21:19:54 +0000 | [diff] [blame] | 417 | $(warning --------) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 418 | endef |
| 419 | |
| 420 | define dump-products |
| 421 | $(foreach p,$(PRODUCTS),$(call dump-product,$(p))) |
| 422 | endef |
| 423 | |
| 424 | # |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 425 | # Functions for including product makefiles |
| 426 | # |
| 427 | |
| 428 | # |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 429 | # $(1): product to inherit |
| 430 | # |
Anton Hansson | 061cbcf | 2018-05-30 18:24:41 +0100 | [diff] [blame] | 431 | # To be called from product makefiles, and is later evaluated during the import-nodes |
| 432 | # call below. It does three things: |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 433 | # 1. Inherits all of the variables from $1. |
| 434 | # 2. Records the inheritance in the .INHERITS_FROM variable |
Anton Hansson | 061cbcf | 2018-05-30 18:24:41 +0100 | [diff] [blame] | 435 | # 3. Records the calling makefile in PARENT_PRODUCT_FILES |
| 436 | # |
| 437 | # (2) and (3) can be used together to reconstruct the include hierarchy |
| 438 | # See e.g. product-graph.mk for an example of this. |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 439 | # |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 440 | define inherit-product |
Ying Wang | a174261 | 2015-10-28 14:33:40 -0700 | [diff] [blame] | 441 | $(if $(findstring ../,$(1)),\ |
| 442 | $(eval np := $(call normalize-paths,$(1))),\ |
| 443 | $(eval np := $(strip $(1))))\ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 444 | $(foreach v,$(_product_var_list), \ |
Ying Wang | a174261 | 2015-10-28 14:33:40 -0700 | [diff] [blame] | 445 | $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \ |
Anton Hansson | 061cbcf | 2018-05-30 18:24:41 +0100 | [diff] [blame] | 446 | $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \ |
| 447 | $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \ |
Ying Wang | a174261 | 2015-10-28 14:33:40 -0700 | [diff] [blame] | 448 | $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \ |
Anton Hansson | 061cbcf | 2018-05-30 18:24:41 +0100 | [diff] [blame] | 449 | $(eval PARENT_PRODUCT_FILES := $(sort $(PARENT_PRODUCT_FILES) $(current_mk))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 450 | endef |
| 451 | |
Anton Hansson | 837425b | 2018-06-01 14:18:14 +0100 | [diff] [blame] | 452 | # Specifies a number of path prefixes, relative to PRODUCT_OUT, where the |
| 453 | # product makefile hierarchy rooted in the current node places its artifacts. |
| 454 | # Creating artifacts outside the specified paths will cause a build-time error. |
| 455 | define require-artifacts-in-path |
| 456 | $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \ |
| 457 | $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENTS := $(strip $(1))) \ |
| 458 | $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_WHITELIST := $(strip $(2))) \ |
| 459 | $(eval ARTIFACT_PATH_REQUIREMENT_PRODUCTS := \ |
| 460 | $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk))) |
| 461 | endef |
Joe Onorato | 28a846d | 2010-02-22 10:33:05 -0800 | [diff] [blame] | 462 | |
Yo Chiang | 1db657a | 2020-05-10 20:33:35 +0800 | [diff] [blame] | 463 | # Makes including non-existent modules in PRODUCT_PACKAGES an error. |
| 464 | # $(1): whitelist of non-existent modules to allow. |
Anton Hansson | 1ebcbd5 | 2018-07-04 17:17:23 +0100 | [diff] [blame] | 465 | define enforce-product-packages-exist |
| 466 | $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \ |
| 467 | $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST := true) \ |
| 468 | $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST := $(1)) \ |
| 469 | $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST) \ |
| 470 | $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST) |
| 471 | endef |
| 472 | |
Joe Onorato | 28a846d | 2010-02-22 10:33:05 -0800 | [diff] [blame] | 473 | # |
| 474 | # Do inherit-product only if $(1) exists |
| 475 | # |
| 476 | define inherit-product-if-exists |
| 477 | $(if $(wildcard $(1)),$(call inherit-product,$(1)),) |
| 478 | endef |
| 479 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 480 | # |
| 481 | # $(1): product makefile list |
| 482 | # |
| 483 | #TODO: check to make sure that products have all the necessary vars defined |
| 484 | define import-products |
Anton Hansson | d26c647 | 2019-05-06 14:40:57 +0100 | [diff] [blame] | 485 | $(call import-nodes,PRODUCTS,$(1),$(_product_var_list),$(_product_single_value_vars)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 486 | endef |
| 487 | |
| 488 | |
| 489 | # |
| 490 | # Does various consistency checks on all of the known products. |
| 491 | # Takes no parameters, so $(call ) is not necessary. |
| 492 | # |
| 493 | define check-all-products |
| 494 | $(if ,, \ |
| 495 | $(eval _cap_names :=) \ |
| 496 | $(foreach p,$(PRODUCTS), \ |
| 497 | $(eval pn := $(strip $(PRODUCTS.$(p).PRODUCT_NAME))) \ |
| 498 | $(if $(pn),,$(error $(p): PRODUCT_NAME must be defined.)) \ |
| 499 | $(if $(filter $(pn),$(_cap_names)), \ |
| 500 | $(error $(p): PRODUCT_NAME must be unique; "$(pn)" already used by $(strip \ |
| 501 | $(foreach \ |
| 502 | pp,$(PRODUCTS), |
| 503 | $(if $(filter $(pn),$(PRODUCTS.$(pp).PRODUCT_NAME)), \ |
| 504 | $(pp) \ |
| 505 | ))) \ |
| 506 | ) \ |
| 507 | ) \ |
| 508 | $(eval _cap_names += $(pn)) \ |
| 509 | $(if $(call is-c-identifier,$(pn)),, \ |
| 510 | $(error $(p): PRODUCT_NAME must be a valid C identifier, not "$(pn)") \ |
| 511 | ) \ |
| 512 | $(eval pb := $(strip $(PRODUCTS.$(p).PRODUCT_BRAND))) \ |
| 513 | $(if $(pb),,$(error $(p): PRODUCT_BRAND must be defined.)) \ |
| 514 | $(foreach cf,$(strip $(PRODUCTS.$(p).PRODUCT_COPY_FILES)), \ |
Ying Wang | 4b0486b | 2012-09-20 16:35:36 -0700 | [diff] [blame] | 515 | $(if $(filter 2 3,$(words $(subst :,$(space),$(cf)))),, \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 516 | $(error $(p): malformed COPY_FILE "$(cf)") \ |
| 517 | ) \ |
| 518 | ) \ |
| 519 | ) \ |
| 520 | ) |
| 521 | endef |
| 522 | |
| 523 | |
| 524 | # |
| 525 | # Returns the product makefile path for the product with the provided name |
| 526 | # |
| 527 | # $(1): short product name like "generic" |
| 528 | # |
| 529 | define _resolve-short-product-name |
| 530 | $(eval pn := $(strip $(1))) |
| 531 | $(eval p := \ |
| 532 | $(foreach p,$(PRODUCTS), \ |
| 533 | $(if $(filter $(pn),$(PRODUCTS.$(p).PRODUCT_NAME)), \ |
| 534 | $(p) \ |
| 535 | )) \ |
| 536 | ) |
| 537 | $(eval p := $(sort $(p))) |
| 538 | $(if $(filter 1,$(words $(p))), \ |
| 539 | $(p), \ |
| 540 | $(if $(filter 0,$(words $(p))), \ |
| 541 | $(error No matches for product "$(pn)"), \ |
| 542 | $(error Product "$(pn)" ambiguous: matches $(p)) \ |
| 543 | ) \ |
| 544 | ) |
| 545 | endef |
| 546 | define resolve-short-product-name |
| 547 | $(strip $(call _resolve-short-product-name,$(1))) |
| 548 | endef |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 549 | |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 550 | # BoardConfig variables that are also inherited in product mks. Should ideally |
| 551 | # be cleaned up to not be product variables. |
| 552 | _readonly_late_variables := \ |
| 553 | DEVICE_PACKAGE_OVERLAYS \ |
| 554 | WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY \ |
| 555 | |
| 556 | # Modified internally in the build system |
| 557 | _readonly_late_variables += \ |
| 558 | PRODUCT_COPY_FILES \ |
| 559 | PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING \ |
| 560 | PRODUCT_DEX_PREOPT_BOOT_FLAGS \ |
| 561 | |
| 562 | _readonly_early_variables := $(filter-out $(_readonly_late_variables),$(_product_var_list)) |
Yifan Hong | e5d879a | 2018-11-27 11:37:38 -0800 | [diff] [blame] | 563 | |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 564 | # |
Dan Willemsen | c1f17ff | 2016-10-05 16:57:27 -0700 | [diff] [blame] | 565 | # Mark the variables in _product_stash_var_list as readonly |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 566 | # |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 567 | define readonly-variables |
| 568 | $(foreach v,$(1), \ |
Anton Hansson | 70222b2 | 2019-02-21 10:41:03 +0000 | [diff] [blame] | 569 | $(eval $(v) ?=) \ |
| 570 | $(eval .KATI_READONLY := $(v)) \ |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 571 | ) |
| 572 | endef |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 573 | define readonly-product-vars |
| 574 | $(call readonly-variables,$(_readonly_early_variables)) |
| 575 | endef |
| 576 | |
| 577 | define readonly-final-product-vars |
| 578 | $(call readonly-variables,$(_readonly_late_variables)) |
| 579 | endef |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 580 | |
Anton Hansson | cca8cdb | 2019-10-28 11:30:40 +0000 | [diff] [blame] | 581 | # Macro re-defined inside strip-product-vars. |
| 582 | get-product-var = $(PRODUCTS.$(strip $(1)).$(2)) |
Yifan Hong | e5d879a | 2018-11-27 11:37:38 -0800 | [diff] [blame] | 583 | # |
Anton Hansson | 528fdc0 | 2019-06-25 18:57:57 +0100 | [diff] [blame] | 584 | # Strip the variables in _product_var_list and a few build-system |
| 585 | # internal variables, and assign the ones for the current product |
| 586 | # to a shorthand that is more convenient to read from elsewhere. |
Yifan Hong | e5d879a | 2018-11-27 11:37:38 -0800 | [diff] [blame] | 587 | # |
| 588 | define strip-product-vars |
Anton Hansson | 528fdc0 | 2019-06-25 18:57:57 +0100 | [diff] [blame] | 589 | $(foreach v,\ |
| 590 | $(_product_var_list) \ |
| 591 | PRODUCT_ENFORCE_PACKAGES_EXIST \ |
| 592 | PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST, \ |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 593 | $(eval $(v) := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).$(v)))) \ |
Anton Hansson | cca8cdb | 2019-10-28 11:30:40 +0000 | [diff] [blame] | 594 | $(eval get-product-var = $$(if $$(filter $$(1),$$(INTERNAL_PRODUCT)),$$($$(2)),$$(PRODUCTS.$$(strip $$(1)).$$(2)))) \ |
| 595 | $(KATI_obsolete_var PRODUCTS.$(INTERNAL_PRODUCT).$(v),Use $(v) instead) \ |
Anton Hansson | 13ea2a6 | 2019-03-28 14:47:25 +0000 | [diff] [blame] | 596 | ) |
Yifan Hong | e5d879a | 2018-11-27 11:37:38 -0800 | [diff] [blame] | 597 | endef |
| 598 | |
Keun young Park | c41c5f4 | 2012-05-30 10:22:29 -0700 | [diff] [blame] | 599 | define add-to-product-copy-files-if-exists |
| 600 | $(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1)) |
| 601 | endef |
Ying Wang | 20ebd2e | 2014-10-07 18:07:23 -0700 | [diff] [blame] | 602 | |
| 603 | # whitespace placeholder when we record module's dex-preopt config. |
| 604 | _PDPMC_SP_PLACE_HOLDER := |@SP@| |
| 605 | # Set up dex-preopt config for a module. |
| 606 | # $(1) list of module names |
| 607 | # $(2) the modules' dex-preopt config |
| 608 | define add-product-dex-preopt-module-config |
| 609 | $(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\ |
| 610 | $(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \ |
| 611 | $(foreach m,$(1),$(m)=$(_c))) |
| 612 | endef |
Andreas Gampe | 6b30d77 | 2016-06-27 15:15:31 -0700 | [diff] [blame] | 613 | |
| 614 | # whitespace placeholder when we record module's sanitizer config. |
| 615 | _PSMC_SP_PLACE_HOLDER := |@SP@| |
| 616 | # Set up sanitizer config for a module. |
| 617 | # $(1) list of module names |
| 618 | # $(2) the modules' sanitizer config |
| 619 | define add-product-sanitizer-module-config |
| 620 | $(eval _c := $(subst $(space),$(_PSMC_SP_PLACE_HOLDER),$(strip $(2))))\ |
| 621 | $(eval PRODUCT_SANITIZER_MODULE_CONFIGS += \ |
| 622 | $(foreach m,$(1),$(m)=$(_c))) |
| 623 | endef |