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