vendor_module_check.mk revision e1b867dde77d59bb35f366c2e3d65fe37c696880
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 intel \ 28 lge \ 29 nvidia \ 30 nxp \ 31 qcom \ 32 samsung \ 33 samsung_arm \ 34 ti \ 35 trusted_logic \ 36 widevine 37 38 39ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)) 40 41_vendor_check_modules := $(product_MODULES) 42 43_vendor_module_owner_info := 44# Restrict owners 45ifneq (,$(filter true owner all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))) 46 47ifneq (,$(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) 48$(error Error: Product "$(TARGET_PRODUCT)" cannot have overlay in vendor tree: \ 49 $(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) 50endif 51_vendor_check_copy_files := $(filter vendor/%, $(PRODUCT_COPY_FILES)) 52ifneq (,$(_vendor_check_copy_files)) 53$(foreach c, $(_vendor_check_copy_files), \ 54 $(if $(filter $(_vendor_owner_whitelist), $(call word-colon,3,$(c))),,\ 55 $(error Error: vendor PRODUCT_COPY_FILES file "$(c)" has unknown owner))\ 56 $(eval _vendor_module_owner_info += $(call word-colon,2,$(c)):$(call word-colon,3,$(c)))) 57endif 58_vendor_check_copy_files := 59 60$(foreach m, $(_vendor_check_modules), \ 61 $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\ 62 $(if $(filter-out FAKE, $(ALL_MODULES.$(m).CLASS)),\ 63 $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\ 64 $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \ 65 "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)"))\ 66 $(if $(ALL_MODULES.$(m).INSTALLED),\ 67 $(eval _vendor_module_owner_info += $(patsubst $(PRODUCT_OUT)/%,%,$(ALL_MODULES.$(m).INSTALLED)):$(ALL_MODULES.$(m).OWNER)))))) 68 69endif 70 71 72# Restrict paths 73ifneq (,$(filter path all, $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))) 74 75$(foreach m, $(_vendor_check_modules), \ 76 $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\ 77 $(if $(filter-out FAKE, $(ALL_MODULES.$(m).CLASS)),\ 78 $(if $(filter-out ,$(ALL_MODULES.$(m).INSTALLED)),\ 79 $(if $(filter $(TARGET_OUT_VENDOR)/% $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED)),,\ 80 $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) \ 81 in product "$(TARGET_PRODUCT)" being installed to \ 82 $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor tree)))))) 83 84endif 85 86_vendor_module_owner_info_txt := $(call intermediates-dir-for,PACKAGING,vendor_owner_info)/vendor_owner_info.txt 87$(_vendor_module_owner_info_txt): PRIVATE_INFO := $(_vendor_module_owner_info) 88$(_vendor_module_owner_info_txt): 89 @echo "Write vendor module owner info $@" 90 @mkdir -p $(dir $@) && rm -f $@ 91ifdef _vendor_module_owner_info 92 @for w in $(PRIVATE_INFO); \ 93 do \ 94 echo $$w >> $@; \ 95 done 96else 97 @echo "No vendor module owner info." > $@ 98endif 99 100$(call dist-for-goals, droidcore, $(_vendor_module_owner_info_txt)) 101 102_vendor_module_owner_info_txt := 103_vendor_module_owner_info := 104_vendor_check_modules := 105endif 106