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 | af2e1f8 | 2018-04-04 15:41:41 -0700 | [diff] [blame] | 95 | $(eval COMMON_LUNCH_CHOICES := $(sort $(_COMMON_LUNCH_CHOICES) $(LUNCH_MENU_CHOICES))) \ |
| 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 | |
| 109 | # |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 110 | # Functions for including product makefiles |
| 111 | # |
| 112 | |
| 113 | _product_var_list := \ |
| 114 | PRODUCT_NAME \ |
| 115 | PRODUCT_MODEL \ |
| 116 | PRODUCT_LOCALES \ |
Ying Wang | 4f1ab92 | 2011-03-15 13:19:30 -0700 | [diff] [blame] | 117 | PRODUCT_AAPT_CONFIG \ |
Dianne Hackborn | a0f464a | 2011-10-14 19:37:57 -0700 | [diff] [blame] | 118 | PRODUCT_AAPT_PREF_CONFIG \ |
Ying Wang | 6068658 | 2014-12-10 12:40:09 -0800 | [diff] [blame] | 119 | PRODUCT_AAPT_PREBUILT_DPI \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 120 | PRODUCT_PACKAGES \ |
Joe Onorato | d7d0afc | 2012-06-05 15:54:09 -0700 | [diff] [blame] | 121 | PRODUCT_PACKAGES_DEBUG \ |
Zach Riggle | 9323b7f | 2018-03-26 16:17:03 -0500 | [diff] [blame] | 122 | PRODUCT_PACKAGES_DEBUG_ASAN \ |
Joe Onorato | d7d0afc | 2012-06-05 15:54:09 -0700 | [diff] [blame] | 123 | PRODUCT_PACKAGES_ENG \ |
| 124 | PRODUCT_PACKAGES_TESTS \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 125 | PRODUCT_DEVICE \ |
| 126 | PRODUCT_MANUFACTURER \ |
| 127 | PRODUCT_BRAND \ |
| 128 | PRODUCT_PROPERTY_OVERRIDES \ |
Mike Lockwood | 0d23fec | 2011-06-09 14:54:40 -0700 | [diff] [blame] | 129 | PRODUCT_DEFAULT_PROPERTY_OVERRIDES \ |
Jaekyun Seok | b7735d8 | 2017-11-27 17:04:47 +0900 | [diff] [blame] | 130 | PRODUCT_PRODUCT_PROPERTIES \ |
Joe Onorato | 700b88e | 2010-10-05 17:33:58 -0400 | [diff] [blame] | 131 | PRODUCT_CHARACTERISTICS \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 132 | PRODUCT_COPY_FILES \ |
| 133 | PRODUCT_OTA_PUBLIC_KEYS \ |
Doug Zongker | 5d4808d | 2011-03-16 07:49:13 -0700 | [diff] [blame] | 134 | PRODUCT_EXTRA_RECOVERY_KEYS \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 135 | PRODUCT_PACKAGE_OVERLAYS \ |
| 136 | DEVICE_PACKAGE_OVERLAYS \ |
Jaekyun Seok | ccee95e | 2017-09-01 17:23:25 +0900 | [diff] [blame] | 137 | PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS \ |
Jaekyun Seok | 1b22428 | 2017-03-30 11:25:02 +0900 | [diff] [blame] | 138 | PRODUCT_ENFORCE_RRO_TARGETS \ |
Ying Wang | 780128a | 2014-01-29 13:35:55 -0800 | [diff] [blame] | 139 | PRODUCT_SDK_ATREE_FILES \ |
Joe Onorato | 214a42b | 2009-04-09 20:36:06 -0700 | [diff] [blame] | 140 | PRODUCT_SDK_ADDON_NAME \ |
| 141 | PRODUCT_SDK_ADDON_COPY_FILES \ |
| 142 | PRODUCT_SDK_ADDON_COPY_MODULES \ |
Ying Wang | a032d3d | 2011-11-11 10:52:12 -0800 | [diff] [blame] | 143 | PRODUCT_SDK_ADDON_DOC_MODULES \ |
Raphael Moll | 0d7d09a | 2014-08-21 15:22:08 -0700 | [diff] [blame] | 144 | PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP \ |
Jeff Gaston | 1fe28d3 | 2017-11-21 15:05:07 -0800 | [diff] [blame] | 145 | PRODUCT_SOONG_NAMESPACES \ |
Ying Wang | 3c21fe5 | 2011-10-04 10:50:08 -0700 | [diff] [blame] | 146 | PRODUCT_DEFAULT_WIFI_CHANNELS \ |
| 147 | PRODUCT_DEFAULT_DEV_CERTIFICATE \ |
Ying Wang | dbb31be | 2011-12-09 15:11:57 -0800 | [diff] [blame] | 148 | PRODUCT_RESTRICT_VENDOR_FILES \ |
Dima Zavin | f926990 | 2012-03-16 09:57:11 -0700 | [diff] [blame] | 149 | PRODUCT_VENDOR_KERNEL_HEADERS \ |
Geremy Condra | fd6f751 | 2013-06-16 17:26:08 -0700 | [diff] [blame] | 150 | PRODUCT_BOOT_JARS \ |
Sami Tolvanen | 8b3f08b | 2015-04-07 15:08:59 +0100 | [diff] [blame] | 151 | PRODUCT_SUPPORTS_BOOT_SIGNER \ |
David Riley | 17be3d3 | 2015-03-03 08:54:11 -0800 | [diff] [blame] | 152 | PRODUCT_SUPPORTS_VBOOT \ |
Geremy Condra | fd6f751 | 2013-06-16 17:26:08 -0700 | [diff] [blame] | 153 | PRODUCT_SUPPORTS_VERITY \ |
Sami Tolvanen | f99b531 | 2015-05-20 07:30:57 +0100 | [diff] [blame] | 154 | PRODUCT_SUPPORTS_VERITY_FEC \ |
Jeff Sharkey | 26d22f7 | 2014-03-18 17:20:10 -0700 | [diff] [blame] | 155 | PRODUCT_OEM_PROPERTIES \ |
Jaekyun Seok | b31b9ba | 2017-11-03 15:18:55 +0900 | [diff] [blame] | 156 | PRODUCT_SYSTEM_DEFAULT_PROPERTIES \ |
Jeff Sharkey | 26d22f7 | 2014-03-18 17:20:10 -0700 | [diff] [blame] | 157 | PRODUCT_SYSTEM_PROPERTY_BLACKLIST \ |
Ivan Podogov | d572632 | 2018-03-29 15:22:33 +0100 | [diff] [blame] | 158 | PRODUCT_VENDOR_PROPERTY_BLACKLIST \ |
Nicolas Geoffray | b08ada1 | 2017-03-22 12:36:05 +0000 | [diff] [blame] | 159 | PRODUCT_SYSTEM_SERVER_APPS \ |
Narayan Kamath | 89ec496 | 2014-08-05 14:51:08 +0100 | [diff] [blame] | 160 | PRODUCT_SYSTEM_SERVER_JARS \ |
Mathieu Chartier | 55eabd5 | 2017-09-15 13:40:48 -0700 | [diff] [blame] | 161 | PRODUCT_ALWAYS_PREOPT_EXTRACTED_APK \ |
Nicolas Geoffray | 4a0ad4a | 2017-06-12 15:19:16 +0100 | [diff] [blame] | 162 | PRODUCT_DEXPREOPT_SPEED_APPS \ |
Nicolas Geoffray | a95fbd1 | 2017-09-19 13:10:31 +0100 | [diff] [blame] | 163 | PRODUCT_LOADED_BY_PRIVILEGED_MODULES \ |
David Riley | 17be3d3 | 2015-03-03 08:54:11 -0800 | [diff] [blame] | 164 | PRODUCT_VBOOT_SIGNING_KEY \ |
Furquan Shaikh | e8c2122 | 2015-08-07 11:58:05 -0700 | [diff] [blame] | 165 | PRODUCT_VBOOT_SIGNING_SUBKEY \ |
Geremy Condra | 5b5f495 | 2014-05-05 22:19:37 -0700 | [diff] [blame] | 166 | PRODUCT_VERITY_SIGNING_KEY \ |
Daniel Rosenberg | f4eabc3 | 2014-07-10 15:42:38 -0700 | [diff] [blame] | 167 | PRODUCT_SYSTEM_VERITY_PARTITION \ |
Ying Wang | 8755756 | 2014-10-09 19:29:53 -0700 | [diff] [blame] | 168 | PRODUCT_VENDOR_VERITY_PARTITION \ |
Jaekyun Seok | b7735d8 | 2017-11-27 17:04:47 +0900 | [diff] [blame] | 169 | PRODUCT_PRODUCT_VERITY_PARTITION \ |
Mathieu Chartier | f0db908 | 2017-06-23 14:47:56 -0700 | [diff] [blame] | 170 | PRODUCT_SYSTEM_SERVER_DEBUG_INFO \ |
Andreas Gampe | c3e1519 | 2018-03-19 14:28:15 -0700 | [diff] [blame] | 171 | PRODUCT_OTHER_JAVA_DEBUG_INFO \ |
Ying Wang | 20ebd2e | 2014-10-07 18:07:23 -0700 | [diff] [blame] | 172 | PRODUCT_DEX_PREOPT_MODULE_CONFIGS \ |
Mathieu Chartier | e8fb7cf | 2018-02-15 13:19:38 -0800 | [diff] [blame] | 173 | PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER \ |
Ying Wang | 20ebd2e | 2014-10-07 18:07:23 -0700 | [diff] [blame] | 174 | PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \ |
| 175 | PRODUCT_DEX_PREOPT_BOOT_FLAGS \ |
Mathieu Chartier | fcc8d8b | 2017-05-05 17:22:37 -0700 | [diff] [blame] | 176 | PRODUCT_DEX_PREOPT_PROFILE_DIR \ |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 177 | PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION \ |
Mathieu Chartier | 5c658ac | 2018-02-15 13:19:38 -0800 | [diff] [blame] | 178 | PRODUCT_DEX_PREOPT_GENERATE_DM_FILES \ |
Mathieu Chartier | a61acf6 | 2017-06-28 18:23:37 -0700 | [diff] [blame] | 179 | PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \ |
Mathieu Chartier | 6228ec2 | 2017-06-23 10:44:45 -0700 | [diff] [blame] | 180 | PRODUCT_SYSTEM_SERVER_COMPILER_FILTER \ |
Andreas Gampe | 6b30d77 | 2016-06-27 15:15:31 -0700 | [diff] [blame] | 181 | PRODUCT_SANITIZER_MODULE_CONFIGS \ |
Mohamad Ayyash | 1868a60 | 2016-04-22 17:22:07 -0700 | [diff] [blame] | 182 | PRODUCT_SYSTEM_BASE_FS_PATH \ |
| 183 | PRODUCT_VENDOR_BASE_FS_PATH \ |
Jaekyun Seok | b7735d8 | 2017-11-27 17:04:47 +0900 | [diff] [blame] | 184 | PRODUCT_PRODUCT_BASE_FS_PATH \ |
Gustav Sennton | 81ee186 | 2016-05-27 14:07:54 +0100 | [diff] [blame] | 185 | PRODUCT_SHIPPING_API_LEVEL \ |
Hung-ying Tyan | 3c054d8 | 2016-05-20 19:08:30 +0800 | [diff] [blame] | 186 | VENDOR_PRODUCT_RESTRICT_VENDOR_FILES \ |
| 187 | VENDOR_EXCEPTION_MODULES \ |
| 188 | VENDOR_EXCEPTION_PATHS \ |
Andreas Gampe | 831fc71 | 2017-06-30 11:36:26 -0700 | [diff] [blame] | 189 | PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD \ |
Hiroshi Yamauchi | 64594c4 | 2016-12-15 16:00:41 -0800 | [diff] [blame] | 190 | PRODUCT_ART_USE_READ_BARRIER \ |
Alex Deymo | 8fe63c3 | 2017-03-02 22:08:41 -0800 | [diff] [blame] | 191 | PRODUCT_IOT \ |
Julius D'souza | 001c676 | 2017-05-03 13:43:27 -0700 | [diff] [blame] | 192 | PRODUCT_SYSTEM_HEADROOM \ |
Przemyslaw Szczepaniak | 2e81b3c | 2017-06-30 14:51:12 +0100 | [diff] [blame] | 193 | PRODUCT_MINIMIZE_JAVA_DEBUG_INFO \ |
Ivan Lozano | 9a82bfd | 2017-07-13 14:49:12 -0700 | [diff] [blame] | 194 | PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS \ |
Dan Willemsen | 0bd7938 | 2017-11-03 15:53:52 -0700 | [diff] [blame] | 195 | PRODUCT_ADB_KEYS \ |
Vishwath Mohan | 23b2d2e | 2017-10-31 02:25:16 -0700 | [diff] [blame] | 196 | PRODUCT_CFI_INCLUDE_PATHS \ |
| 197 | PRODUCT_CFI_EXCLUDE_PATHS \ |
Jaekyun Seok | 0538ff7 | 2018-01-16 14:14:59 +0900 | [diff] [blame] | 198 | PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \ |
| 199 | PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \ |
Ying Wang | 20ebd2e | 2014-10-07 18:07:23 -0700 | [diff] [blame] | 200 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 201 | define dump-product |
| 202 | $(info ==== $(1) ====)\ |
| 203 | $(foreach v,$(_product_var_list),\ |
| 204 | $(info PRODUCTS.$(1).$(v) := $(PRODUCTS.$(1).$(v))))\ |
| 205 | $(info --------) |
| 206 | endef |
| 207 | |
| 208 | define dump-products |
| 209 | $(foreach p,$(PRODUCTS),$(call dump-product,$(p))) |
| 210 | endef |
| 211 | |
| 212 | # |
| 213 | # $(1): product to inherit |
| 214 | # |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 215 | # Does three things: |
| 216 | # 1. Inherits all of the variables from $1. |
| 217 | # 2. Records the inheritance in the .INHERITS_FROM variable |
| 218 | # 3. Records that we've visited this node, in ALL_PRODUCTS |
| 219 | # |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 220 | define inherit-product |
Ying Wang | a174261 | 2015-10-28 14:33:40 -0700 | [diff] [blame] | 221 | $(if $(findstring ../,$(1)),\ |
| 222 | $(eval np := $(call normalize-paths,$(1))),\ |
| 223 | $(eval np := $(strip $(1))))\ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 224 | $(foreach v,$(_product_var_list), \ |
Ying Wang | a174261 | 2015-10-28 14:33:40 -0700 | [diff] [blame] | 225 | $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \ |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 226 | $(eval inherit_var := \ |
| 227 | PRODUCTS.$(strip $(word 1,$(_include_stack))).INHERITS_FROM) \ |
Ying Wang | a174261 | 2015-10-28 14:33:40 -0700 | [diff] [blame] | 228 | $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \ |
The Android Open Source Project | 6a5f7f0 | 2009-03-05 14:34:30 -0800 | [diff] [blame] | 229 | $(eval inherit_var:=) \ |
| 230 | $(eval ALL_PRODUCTS := $(sort $(ALL_PRODUCTS) $(word 1,$(_include_stack)))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 231 | endef |
| 232 | |
Joe Onorato | 28a846d | 2010-02-22 10:33:05 -0800 | [diff] [blame] | 233 | |
| 234 | # |
| 235 | # Do inherit-product only if $(1) exists |
| 236 | # |
| 237 | define inherit-product-if-exists |
| 238 | $(if $(wildcard $(1)),$(call inherit-product,$(1)),) |
| 239 | endef |
| 240 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 241 | # |
| 242 | # $(1): product makefile list |
| 243 | # |
| 244 | #TODO: check to make sure that products have all the necessary vars defined |
| 245 | define import-products |
| 246 | $(call import-nodes,PRODUCTS,$(1),$(_product_var_list)) |
| 247 | endef |
| 248 | |
| 249 | |
| 250 | # |
| 251 | # Does various consistency checks on all of the known products. |
| 252 | # Takes no parameters, so $(call ) is not necessary. |
| 253 | # |
| 254 | define check-all-products |
| 255 | $(if ,, \ |
| 256 | $(eval _cap_names :=) \ |
| 257 | $(foreach p,$(PRODUCTS), \ |
| 258 | $(eval pn := $(strip $(PRODUCTS.$(p).PRODUCT_NAME))) \ |
| 259 | $(if $(pn),,$(error $(p): PRODUCT_NAME must be defined.)) \ |
| 260 | $(if $(filter $(pn),$(_cap_names)), \ |
| 261 | $(error $(p): PRODUCT_NAME must be unique; "$(pn)" already used by $(strip \ |
| 262 | $(foreach \ |
| 263 | pp,$(PRODUCTS), |
| 264 | $(if $(filter $(pn),$(PRODUCTS.$(pp).PRODUCT_NAME)), \ |
| 265 | $(pp) \ |
| 266 | ))) \ |
| 267 | ) \ |
| 268 | ) \ |
| 269 | $(eval _cap_names += $(pn)) \ |
| 270 | $(if $(call is-c-identifier,$(pn)),, \ |
| 271 | $(error $(p): PRODUCT_NAME must be a valid C identifier, not "$(pn)") \ |
| 272 | ) \ |
| 273 | $(eval pb := $(strip $(PRODUCTS.$(p).PRODUCT_BRAND))) \ |
| 274 | $(if $(pb),,$(error $(p): PRODUCT_BRAND must be defined.)) \ |
| 275 | $(foreach cf,$(strip $(PRODUCTS.$(p).PRODUCT_COPY_FILES)), \ |
Ying Wang | 4b0486b | 2012-09-20 16:35:36 -0700 | [diff] [blame] | 276 | $(if $(filter 2 3,$(words $(subst :,$(space),$(cf)))),, \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 277 | $(error $(p): malformed COPY_FILE "$(cf)") \ |
| 278 | ) \ |
| 279 | ) \ |
| 280 | ) \ |
| 281 | ) |
| 282 | endef |
| 283 | |
| 284 | |
| 285 | # |
| 286 | # Returns the product makefile path for the product with the provided name |
| 287 | # |
| 288 | # $(1): short product name like "generic" |
| 289 | # |
| 290 | define _resolve-short-product-name |
| 291 | $(eval pn := $(strip $(1))) |
| 292 | $(eval p := \ |
| 293 | $(foreach p,$(PRODUCTS), \ |
| 294 | $(if $(filter $(pn),$(PRODUCTS.$(p).PRODUCT_NAME)), \ |
| 295 | $(p) \ |
| 296 | )) \ |
| 297 | ) |
| 298 | $(eval p := $(sort $(p))) |
| 299 | $(if $(filter 1,$(words $(p))), \ |
| 300 | $(p), \ |
| 301 | $(if $(filter 0,$(words $(p))), \ |
| 302 | $(error No matches for product "$(pn)"), \ |
| 303 | $(error Product "$(pn)" ambiguous: matches $(p)) \ |
| 304 | ) \ |
| 305 | ) |
| 306 | endef |
| 307 | define resolve-short-product-name |
| 308 | $(strip $(call _resolve-short-product-name,$(1))) |
| 309 | endef |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 310 | |
| 311 | |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 312 | _product_stash_var_list := $(_product_var_list) \ |
Ying Wang | 0650d15 | 2013-07-23 17:57:38 -0700 | [diff] [blame] | 313 | PRODUCT_BOOTCLASSPATH \ |
Narayan Kamath | 89ec496 | 2014-08-05 14:51:08 +0100 | [diff] [blame] | 314 | PRODUCT_SYSTEM_SERVER_CLASSPATH \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 315 | TARGET_ARCH \ |
| 316 | TARGET_ARCH_VARIANT \ |
Ben Cheng | 7028f5e | 2013-01-15 14:36:42 -0800 | [diff] [blame] | 317 | TARGET_CPU_VARIANT \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 318 | TARGET_BOARD_PLATFORM \ |
| 319 | TARGET_BOARD_PLATFORM_GPU \ |
Dima Zavin | f926990 | 2012-03-16 09:57:11 -0700 | [diff] [blame] | 320 | TARGET_BOARD_KERNEL_HEADERS \ |
| 321 | TARGET_DEVICE_KERNEL_HEADERS \ |
| 322 | TARGET_PRODUCT_KERNEL_HEADERS \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 323 | TARGET_BOOTLOADER_BOARD_NAME \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 324 | TARGET_NO_BOOTLOADER \ |
| 325 | TARGET_NO_KERNEL \ |
| 326 | TARGET_NO_RECOVERY \ |
| 327 | TARGET_NO_RADIOIMAGE \ |
| 328 | TARGET_HARDWARE_3D \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 329 | TARGET_CPU_ABI \ |
| 330 | TARGET_CPU_ABI2 \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 331 | |
| 332 | |
| 333 | _product_stash_var_list += \ |
| 334 | BOARD_WPA_SUPPLICANT_DRIVER \ |
| 335 | BOARD_WLAN_DEVICE \ |
| 336 | BOARD_USES_GENERIC_AUDIO \ |
| 337 | BOARD_KERNEL_CMDLINE \ |
| 338 | BOARD_KERNEL_BASE \ |
| 339 | BOARD_HAVE_BLUETOOTH \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 340 | BOARD_VENDOR_USE_AKMD \ |
| 341 | BOARD_EGL_CFG \ |
| 342 | BOARD_BOOTIMAGE_PARTITION_SIZE \ |
| 343 | BOARD_RECOVERYIMAGE_PARTITION_SIZE \ |
| 344 | BOARD_SYSTEMIMAGE_PARTITION_SIZE \ |
Mohamad Ayyash | 6894695 | 2015-03-03 12:30:37 -0800 | [diff] [blame] | 345 | BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE \ |
JP Abgrall | 5bfed5a | 2014-06-16 14:17:40 -0700 | [diff] [blame] | 346 | BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 347 | BOARD_USERDATAIMAGE_PARTITION_SIZE \ |
Ying Wang | 9f8e8db | 2011-11-04 11:37:01 -0700 | [diff] [blame] | 348 | BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \ |
| 349 | BOARD_CACHEIMAGE_PARTITION_SIZE \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 350 | BOARD_FLASH_BLOCK_SIZE \ |
Daniel Rosenberg | dde3184 | 2014-05-28 13:51:53 -0700 | [diff] [blame] | 351 | BOARD_VENDORIMAGE_PARTITION_SIZE \ |
| 352 | BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \ |
Jaekyun Seok | b7735d8 | 2017-11-27 17:04:47 +0900 | [diff] [blame] | 353 | BOARD_PRODUCTIMAGE_PARTITION_SIZE \ |
| 354 | BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \ |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 355 | BOARD_INSTALLER_CMDLINE \ |
| 356 | |
| 357 | |
Ying Wang | 3c21fe5 | 2011-10-04 10:50:08 -0700 | [diff] [blame] | 358 | _product_stash_var_list += \ |
Ying Wang | 9c44021 | 2014-05-01 20:55:30 -0700 | [diff] [blame] | 359 | DEFAULT_SYSTEM_DEV_CERTIFICATE \ |
Alex Light | 7326f7b | 2014-08-04 17:09:41 -0700 | [diff] [blame] | 360 | WITH_DEXPREOPT \ |
Mathieu Chartier | 2594230 | 2018-03-06 13:09:01 -0800 | [diff] [blame] | 361 | WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY |
Ying Wang | 3c21fe5 | 2011-10-04 10:50:08 -0700 | [diff] [blame] | 362 | |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 363 | # |
Dan Willemsen | c1f17ff | 2016-10-05 16:57:27 -0700 | [diff] [blame] | 364 | # Mark the variables in _product_stash_var_list as readonly |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 365 | # |
Dan Willemsen | c1f17ff | 2016-10-05 16:57:27 -0700 | [diff] [blame] | 366 | define readonly-product-vars |
Ying Wang | f9953b4 | 2010-12-29 14:07:38 -0800 | [diff] [blame] | 367 | $(foreach v,$(_product_stash_var_list), \ |
Dan Willemsen | c1f17ff | 2016-10-05 16:57:27 -0700 | [diff] [blame] | 368 | $(eval $(v) ?=) \ |
| 369 | $(eval .KATI_READONLY := $(v)) \ |
Joe Onorato | 8dc8faa | 2010-09-14 13:09:48 -0400 | [diff] [blame] | 370 | ) |
| 371 | endef |
| 372 | |
Keun young Park | c41c5f4 | 2012-05-30 10:22:29 -0700 | [diff] [blame] | 373 | define add-to-product-copy-files-if-exists |
| 374 | $(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1)) |
| 375 | endef |
Ying Wang | 20ebd2e | 2014-10-07 18:07:23 -0700 | [diff] [blame] | 376 | |
| 377 | # whitespace placeholder when we record module's dex-preopt config. |
| 378 | _PDPMC_SP_PLACE_HOLDER := |@SP@| |
| 379 | # Set up dex-preopt config for a module. |
| 380 | # $(1) list of module names |
| 381 | # $(2) the modules' dex-preopt config |
| 382 | define add-product-dex-preopt-module-config |
| 383 | $(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\ |
| 384 | $(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \ |
| 385 | $(foreach m,$(1),$(m)=$(_c))) |
| 386 | endef |
Andreas Gampe | 6b30d77 | 2016-06-27 15:15:31 -0700 | [diff] [blame] | 387 | |
| 388 | # whitespace placeholder when we record module's sanitizer config. |
| 389 | _PSMC_SP_PLACE_HOLDER := |@SP@| |
| 390 | # Set up sanitizer config for a module. |
| 391 | # $(1) list of module names |
| 392 | # $(2) the modules' sanitizer config |
| 393 | define add-product-sanitizer-module-config |
| 394 | $(eval _c := $(subst $(space),$(_PSMC_SP_PLACE_HOLDER),$(strip $(2))))\ |
| 395 | $(eval PRODUCT_SANITIZER_MODULE_CONFIGS += \ |
| 396 | $(foreach m,$(1),$(m)=$(_c))) |
| 397 | endef |