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