vendor_module_check.mk revision 228e8cf6603bb637c09256496f0f281efe8c2ea4
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_vendor_owner_whitelist := \ 19 asus \ 20 audience \ 21 broadcom \ 22 csr \ 23 elan \ 24 google \ 25 imgtec \ 26 invensense \ 27 lge \ 28 nvidia \ 29 nxp \ 30 qcom \ 31 samsung \ 32 samsung_arm \ 33 ti \ 34 trusted_logic \ 35 widevine 36 37 38ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)) 39 40_vendor_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)) 41$(call expand-required-modules,_vendor_check_modules,$(_vendor_check_modules)) 42 43# Restrict owners 44ifneq (,$(filter true owner all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))) 45 46ifneq (,$(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) 47$(error Error: Product "$(TARGET_PRODUCT)" can not have overlay in vendor tree: \ 48 $(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) 49endif 50ifneq (,$(filter vendor/%, $(PRODUCT_COPY_FILES))) 51$(error Error: Product "$(TARGET_PRODUCT)" can not have PRODUCT_COPY_FILES from vendor tree: \ 52 $(filter vendor/%, $(PRODUCT_COPY_FILES))) 53endif 54 55$(foreach m, $(_vendor_check_modules), \ 56 $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\ 57 $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\ 58 $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \ 59 "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)")))) 60 61endif 62 63 64# Restrict paths 65ifneq (,$(filter path all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))) 66 67$(foreach m, $(_vendor_check_modules), \ 68 $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\ 69 $(if $(filter $(TARGET_OUT_VENDOR)/%, $(ALL_MODULES.$(m).INSTALLED)),,\ 70 $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) \ 71 in product "$(TARGET_PRODUCT)" being installed to \ 72 $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor tree)))) 73 74endif 75 76_vendor_check_modules := 77endif 78