OSDN Git Service

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