2009-03-04 04:28:42 +01:00
|
|
|
#
|
|
|
|
# Copyright (C) 2007 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Functions for including AndroidProducts.mk files
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns the list of all AndroidProducts.mk files.
|
|
|
|
# $(call ) isn't necessary.
|
|
|
|
#
|
|
|
|
define _find-android-products-files
|
2010-01-22 22:25:24 +01:00
|
|
|
$(shell test -d device && find device -maxdepth 6 -name AndroidProducts.mk) \
|
|
|
|
$(shell test -d vendor && find vendor -maxdepth 6 -name AndroidProducts.mk) \
|
2009-03-04 04:28:42 +01:00
|
|
|
$(SRC_TARGET_DIR)/product/AndroidProducts.mk
|
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
2010-05-11 01:35:39 +02:00
|
|
|
# Returns the sorted concatenation of PRODUCT_MAKEFILES
|
|
|
|
# variables set in the given AndroidProducts.mk files.
|
|
|
|
# $(1): the list of AndroidProducts.mk files.
|
2009-03-04 04:28:42 +01:00
|
|
|
#
|
2010-05-11 01:35:39 +02:00
|
|
|
define get-product-makefiles
|
2009-03-04 04:28:42 +01:00
|
|
|
$(sort \
|
2010-05-11 01:35:39 +02:00
|
|
|
$(foreach f,$(1), \
|
2009-03-04 04:28:42 +01:00
|
|
|
$(eval PRODUCT_MAKEFILES :=) \
|
|
|
|
$(eval LOCAL_DIR := $(patsubst %/,%,$(dir $(f)))) \
|
|
|
|
$(eval include $(f)) \
|
|
|
|
$(PRODUCT_MAKEFILES) \
|
|
|
|
) \
|
|
|
|
$(eval PRODUCT_MAKEFILES :=) \
|
|
|
|
$(eval LOCAL_DIR :=) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2010-05-11 01:35:39 +02:00
|
|
|
#
|
|
|
|
# Returns the sorted concatenation of all PRODUCT_MAKEFILES
|
|
|
|
# variables set in all AndroidProducts.mk files.
|
|
|
|
# $(call ) isn't necessary.
|
|
|
|
#
|
|
|
|
define get-all-product-makefiles
|
|
|
|
$(call get-product-makefiles,$(_find-android-products-files))
|
|
|
|
endef
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
#
|
|
|
|
# Functions for including product makefiles
|
|
|
|
#
|
|
|
|
|
|
|
|
_product_var_list := \
|
|
|
|
PRODUCT_NAME \
|
|
|
|
PRODUCT_MODEL \
|
|
|
|
PRODUCT_LOCALES \
|
2011-03-15 21:19:30 +01:00
|
|
|
PRODUCT_AAPT_CONFIG \
|
2011-10-15 04:37:57 +02:00
|
|
|
PRODUCT_AAPT_PREF_CONFIG \
|
2009-03-04 04:28:42 +01:00
|
|
|
PRODUCT_PACKAGES \
|
2012-06-06 00:54:09 +02:00
|
|
|
PRODUCT_PACKAGES_DEBUG \
|
|
|
|
PRODUCT_PACKAGES_ENG \
|
|
|
|
PRODUCT_PACKAGES_TESTS \
|
2009-03-04 04:28:42 +01:00
|
|
|
PRODUCT_DEVICE \
|
|
|
|
PRODUCT_MANUFACTURER \
|
|
|
|
PRODUCT_BRAND \
|
|
|
|
PRODUCT_PROPERTY_OVERRIDES \
|
2011-06-09 23:54:40 +02:00
|
|
|
PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
|
2010-10-05 23:33:58 +02:00
|
|
|
PRODUCT_CHARACTERISTICS \
|
2009-03-04 04:28:42 +01:00
|
|
|
PRODUCT_COPY_FILES \
|
|
|
|
PRODUCT_OTA_PUBLIC_KEYS \
|
2011-03-16 15:49:13 +01:00
|
|
|
PRODUCT_EXTRA_RECOVERY_KEYS \
|
2009-03-04 04:28:42 +01:00
|
|
|
PRODUCT_PACKAGE_OVERLAYS \
|
|
|
|
DEVICE_PACKAGE_OVERLAYS \
|
2009-04-10 05:36:06 +02:00
|
|
|
PRODUCT_TAGS \
|
|
|
|
PRODUCT_SDK_ADDON_NAME \
|
|
|
|
PRODUCT_SDK_ADDON_COPY_FILES \
|
|
|
|
PRODUCT_SDK_ADDON_COPY_MODULES \
|
2011-11-11 19:52:12 +01:00
|
|
|
PRODUCT_SDK_ADDON_DOC_MODULES \
|
2011-10-04 19:50:08 +02:00
|
|
|
PRODUCT_DEFAULT_WIFI_CHANNELS \
|
|
|
|
PRODUCT_DEFAULT_DEV_CERTIFICATE \
|
2011-12-10 00:11:57 +01:00
|
|
|
PRODUCT_RESTRICT_VENDOR_FILES \
|
2012-03-16 17:57:11 +01:00
|
|
|
PRODUCT_VENDOR_KERNEL_HEADERS \
|
2011-12-16 20:27:52 +01:00
|
|
|
PRODUCT_FACTORY_RAMDISK_MODULES \
|
2012-05-17 20:32:26 +02:00
|
|
|
PRODUCT_FACTORY_BUNDLE_MODULES
|
2011-10-04 19:50:08 +02:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
define dump-product
|
|
|
|
$(info ==== $(1) ====)\
|
|
|
|
$(foreach v,$(_product_var_list),\
|
|
|
|
$(info PRODUCTS.$(1).$(v) := $(PRODUCTS.$(1).$(v))))\
|
|
|
|
$(info --------)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define dump-products
|
|
|
|
$(foreach p,$(PRODUCTS),$(call dump-product,$(p)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
|
|
|
# $(1): product to inherit
|
|
|
|
#
|
2009-03-05 23:34:30 +01:00
|
|
|
# Does three things:
|
|
|
|
# 1. Inherits all of the variables from $1.
|
|
|
|
# 2. Records the inheritance in the .INHERITS_FROM variable
|
|
|
|
# 3. Records that we've visited this node, in ALL_PRODUCTS
|
|
|
|
#
|
2009-03-04 04:28:42 +01:00
|
|
|
define inherit-product
|
|
|
|
$(foreach v,$(_product_var_list), \
|
2009-03-05 23:34:30 +01:00
|
|
|
$(eval $(v) := $($(v)) $(INHERIT_TAG)$(strip $(1)))) \
|
|
|
|
$(eval inherit_var := \
|
|
|
|
PRODUCTS.$(strip $(word 1,$(_include_stack))).INHERITS_FROM) \
|
|
|
|
$(eval $(inherit_var) := $(sort $($(inherit_var)) $(strip $(1)))) \
|
|
|
|
$(eval inherit_var:=) \
|
|
|
|
$(eval ALL_PRODUCTS := $(sort $(ALL_PRODUCTS) $(word 1,$(_include_stack))))
|
2009-03-04 04:28:42 +01:00
|
|
|
endef
|
|
|
|
|
2010-02-22 19:33:05 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Do inherit-product only if $(1) exists
|
|
|
|
#
|
|
|
|
define inherit-product-if-exists
|
|
|
|
$(if $(wildcard $(1)),$(call inherit-product,$(1)),)
|
|
|
|
endef
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
#
|
|
|
|
# $(1): product makefile list
|
|
|
|
#
|
|
|
|
#TODO: check to make sure that products have all the necessary vars defined
|
|
|
|
define import-products
|
|
|
|
$(call import-nodes,PRODUCTS,$(1),$(_product_var_list))
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Does various consistency checks on all of the known products.
|
|
|
|
# Takes no parameters, so $(call ) is not necessary.
|
|
|
|
#
|
|
|
|
define check-all-products
|
|
|
|
$(if ,, \
|
|
|
|
$(eval _cap_names :=) \
|
|
|
|
$(foreach p,$(PRODUCTS), \
|
|
|
|
$(eval pn := $(strip $(PRODUCTS.$(p).PRODUCT_NAME))) \
|
|
|
|
$(if $(pn),,$(error $(p): PRODUCT_NAME must be defined.)) \
|
|
|
|
$(if $(filter $(pn),$(_cap_names)), \
|
|
|
|
$(error $(p): PRODUCT_NAME must be unique; "$(pn)" already used by $(strip \
|
|
|
|
$(foreach \
|
|
|
|
pp,$(PRODUCTS),
|
|
|
|
$(if $(filter $(pn),$(PRODUCTS.$(pp).PRODUCT_NAME)), \
|
|
|
|
$(pp) \
|
|
|
|
))) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
$(eval _cap_names += $(pn)) \
|
|
|
|
$(if $(call is-c-identifier,$(pn)),, \
|
|
|
|
$(error $(p): PRODUCT_NAME must be a valid C identifier, not "$(pn)") \
|
|
|
|
) \
|
|
|
|
$(eval pb := $(strip $(PRODUCTS.$(p).PRODUCT_BRAND))) \
|
|
|
|
$(if $(pb),,$(error $(p): PRODUCT_BRAND must be defined.)) \
|
|
|
|
$(foreach cf,$(strip $(PRODUCTS.$(p).PRODUCT_COPY_FILES)), \
|
|
|
|
$(if $(filter 2,$(words $(subst :,$(space),$(cf)))),, \
|
|
|
|
$(error $(p): malformed COPY_FILE "$(cf)") \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Returns the product makefile path for the product with the provided name
|
|
|
|
#
|
|
|
|
# $(1): short product name like "generic"
|
|
|
|
#
|
|
|
|
define _resolve-short-product-name
|
|
|
|
$(eval pn := $(strip $(1)))
|
|
|
|
$(eval p := \
|
|
|
|
$(foreach p,$(PRODUCTS), \
|
|
|
|
$(if $(filter $(pn),$(PRODUCTS.$(p).PRODUCT_NAME)), \
|
|
|
|
$(p) \
|
|
|
|
)) \
|
|
|
|
)
|
|
|
|
$(eval p := $(sort $(p)))
|
|
|
|
$(if $(filter 1,$(words $(p))), \
|
|
|
|
$(p), \
|
|
|
|
$(if $(filter 0,$(words $(p))), \
|
|
|
|
$(error No matches for product "$(pn)"), \
|
|
|
|
$(error Product "$(pn)" ambiguous: matches $(p)) \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
define resolve-short-product-name
|
|
|
|
$(strip $(call _resolve-short-product-name,$(1)))
|
|
|
|
endef
|
2010-09-14 19:09:48 +02:00
|
|
|
|
|
|
|
|
2010-12-29 23:07:38 +01:00
|
|
|
_product_stash_var_list := $(_product_var_list) \
|
|
|
|
TARGET_ARCH \
|
|
|
|
TARGET_ARCH_VARIANT \
|
|
|
|
TARGET_BOARD_PLATFORM \
|
|
|
|
TARGET_BOARD_PLATFORM_GPU \
|
2012-03-16 17:57:11 +01:00
|
|
|
TARGET_BOARD_KERNEL_HEADERS \
|
|
|
|
TARGET_DEVICE_KERNEL_HEADERS \
|
|
|
|
TARGET_PRODUCT_KERNEL_HEADERS \
|
2010-12-29 23:07:38 +01:00
|
|
|
TARGET_BOOTLOADER_BOARD_NAME \
|
|
|
|
TARGET_COMPRESS_MODULE_SYMBOLS \
|
|
|
|
TARGET_NO_BOOTLOADER \
|
|
|
|
TARGET_NO_KERNEL \
|
|
|
|
TARGET_NO_RECOVERY \
|
|
|
|
TARGET_NO_RADIOIMAGE \
|
|
|
|
TARGET_HARDWARE_3D \
|
|
|
|
TARGET_PROVIDES_INIT_RC \
|
|
|
|
TARGET_CPU_ABI \
|
|
|
|
TARGET_CPU_ABI2 \
|
|
|
|
TARGET_CPU_SMP \
|
|
|
|
|
|
|
|
|
|
|
|
_product_stash_var_list += \
|
|
|
|
BOARD_WPA_SUPPLICANT_DRIVER \
|
|
|
|
BOARD_WLAN_DEVICE \
|
|
|
|
BOARD_USES_GENERIC_AUDIO \
|
|
|
|
BOARD_KERNEL_CMDLINE \
|
|
|
|
BOARD_KERNEL_BASE \
|
|
|
|
BOARD_HAVE_BLUETOOTH \
|
|
|
|
BOARD_HAVE_BLUETOOTH_BCM \
|
2012-08-15 17:12:01 +02:00
|
|
|
BOARD_HAVE_BLUETOOTH_QCOM \
|
2010-12-29 23:07:38 +01:00
|
|
|
BOARD_VENDOR_QCOM_AMSS_VERSION \
|
|
|
|
BOARD_VENDOR_USE_AKMD \
|
|
|
|
BOARD_EGL_CFG \
|
|
|
|
BOARD_BOOTIMAGE_PARTITION_SIZE \
|
|
|
|
BOARD_RECOVERYIMAGE_PARTITION_SIZE \
|
|
|
|
BOARD_SYSTEMIMAGE_PARTITION_SIZE \
|
|
|
|
BOARD_USERDATAIMAGE_PARTITION_SIZE \
|
2011-11-04 19:37:01 +01:00
|
|
|
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \
|
|
|
|
BOARD_CACHEIMAGE_PARTITION_SIZE \
|
2010-12-29 23:07:38 +01:00
|
|
|
BOARD_FLASH_BLOCK_SIZE \
|
|
|
|
BOARD_SYSTEMIMAGE_PARTITION_SIZE \
|
|
|
|
BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE \
|
|
|
|
BOARD_VENDOR_QCOM_GPS_LOC_API_AMSS_VERSION \
|
|
|
|
BOARD_INSTALLER_CMDLINE \
|
|
|
|
|
|
|
|
|
2011-10-04 19:50:08 +02:00
|
|
|
_product_stash_var_list += \
|
|
|
|
DEFAULT_SYSTEM_DEV_CERTIFICATE
|
|
|
|
|
2010-09-14 19:09:48 +02:00
|
|
|
#
|
2010-12-29 23:07:38 +01:00
|
|
|
# Stash vaues of the variables in _product_stash_var_list.
|
2010-09-14 19:09:48 +02:00
|
|
|
# $(1): Renamed prefix
|
|
|
|
#
|
|
|
|
define stash-product-vars
|
2010-12-29 23:07:38 +01:00
|
|
|
$(foreach v,$(_product_stash_var_list), \
|
2010-09-14 19:09:48 +02:00
|
|
|
$(eval $(strip $(1))_$(call rot13,$(v)):=$$($$(v))) \
|
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
#
|
|
|
|
# Assert that the the variable stashed by stash-product-vars remains untouched.
|
|
|
|
# $(1): The prefix as supplied to stash-product-vars
|
|
|
|
#
|
|
|
|
define assert-product-vars
|
|
|
|
$(strip \
|
|
|
|
$(eval changed_variables:=)
|
2010-12-29 23:07:38 +01:00
|
|
|
$(foreach v,$(_product_stash_var_list), \
|
2010-10-12 01:31:49 +02:00
|
|
|
$(if $(call streq,$($(v)),$($(strip $(1))_$(call rot13,$(v)))),, \
|
2010-09-14 19:09:48 +02:00
|
|
|
$(eval $(warning $(v) has been modified: $($(v)))) \
|
2010-10-12 01:31:49 +02:00
|
|
|
$(eval $(warning previous value: $($(strip $(1))_$(call rot13,$(v))))) \
|
2010-09-14 19:09:48 +02:00
|
|
|
$(eval changed_variables := $(changed_variables) $(v))) \
|
|
|
|
) \
|
|
|
|
$(if $(changed_variables),\
|
|
|
|
$(eval $(error The following variables have been changed: $(changed_variables))),)
|
|
|
|
)
|
|
|
|
endef
|
2012-05-30 19:22:29 +02:00
|
|
|
|
|
|
|
define add-to-product-copy-files-if-exists
|
|
|
|
$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
|
|
|
|
endef
|