Ying Wang | dbb31be | 2011-12-09 15:11:57 -0800 | [diff] [blame^] | 1 | # |
| 2 | # Copyright (C) 2011 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 | # Restrict the vendor module owners here. |
| 18 | |
| 19 | _vendor_owner_whitelist := \ |
| 20 | |
| 21 | |
| 22 | ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)) |
| 23 | |
| 24 | ifneq (,$(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) |
| 25 | $(error Error: Product "$(TARGET_PRODUCT)" can not have overlay in vendor tree: \ |
| 26 | $(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) |
| 27 | endif |
| 28 | ifneq (,$(filter vendor/%, $(PRODUCT_COPY_FILES))) |
| 29 | $(error Error: Product "$(TARGET_PRODUCT)" can not have PRODUCT_COPY_FILES from vendor tree: \ |
| 30 | $(filter vendor/%, $(PRODUCT_COPY_FILES))) |
| 31 | endif |
| 32 | |
| 33 | _owner_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)) |
| 34 | |
| 35 | # expand with the required modules |
| 36 | # $(1) the module name set to expand |
| 37 | define _expand_required_modules |
| 38 | $(eval _erm_new_modules:=)\ |
| 39 | $(foreach m, $(1), $(eval r:=$(ALL_MODULES.$(m).REQUIRED))\ |
| 40 | $(if $(r), $(if $(filter $(_owner_check_modules), $(r)),,\ |
| 41 | $(eval _owner_check_modules := $(_owner_check_modules) $(r))\ |
| 42 | $(eval _erm_new_modules := $(_erm_new_modules) $(r)))))\ |
| 43 | $(if $(_erm_new_modules), $(call _expand_required_modules, $(_erm_new_modules))) |
| 44 | endef |
| 45 | |
| 46 | $(call _expand_required_modules, $(_owner_check_modules)) |
| 47 | |
| 48 | $(foreach m, $(_owner_check_modules), \ |
| 49 | $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\ |
| 50 | $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\ |
| 51 | $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \ |
| 52 | "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)")))) |
| 53 | |
| 54 | endif |