2 # Copyright (C) 2008 The Android Open Source Project
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 ifneq ($(LOCAL_MODULE)$(LOCAL_MODULE_CLASS),)
18 $(error $(LOCAL_PATH): LOCAL_MODULE or LOCAL_MODULE_CLASS not needed by \
19 BUILD_MULTI_PREBUILT, use BUILD_PREBUILT instead!)
22 # Save these before they get cleared by CLEAR_VARS.
23 prebuilt_static_libs := $(filter %.a,$(LOCAL_PREBUILT_LIBS))
24 prebuilt_shared_libs := $(filter-out %.a,$(LOCAL_PREBUILT_LIBS))
25 prebuilt_executables := $(LOCAL_PREBUILT_EXECUTABLES)
26 prebuilt_java_libraries := $(LOCAL_PREBUILT_JAVA_LIBRARIES)
27 prebuilt_static_java_libraries := $(LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES)
28 prebuilt_is_host := $(LOCAL_IS_HOST_MODULE)
29 prebuilt_module_tags := $(LOCAL_MODULE_TAGS)
30 prebuilt_strip_module := $(LOCAL_STRIP_MODULE)
33 ifndef multi_prebuilt_once
34 multi_prebuilt_once := true
37 # $(2): IS_HOST_MODULE
40 # $(5): OVERRIDE_BUILT_MODULE_PATH
41 # $(6): UNINSTALLABLE_MODULE
42 # $(7): BUILT_MODULE_STEM
43 # $(8): LOCAL_STRIP_MODULE
45 # Elements in the file list may be bare filenames,
46 # or of the form "<modulename>:<filename>".
47 # If the module name is not specified, the module
48 # name will be the filename with the suffix removed.
50 define auto-prebuilt-boilerplate
51 $(if $(filter %: :%,$(1)), \
52 $(error $(LOCAL_PATH): Leading or trailing colons in "$(1)")) \
54 $(eval include $(CLEAR_VARS)) \
55 $(eval LOCAL_IS_HOST_MODULE := $(2)) \
56 $(eval LOCAL_MODULE_CLASS := $(3)) \
57 $(eval LOCAL_MODULE_TAGS := $(4)) \
58 $(eval OVERRIDE_BUILT_MODULE_PATH := $(5)) \
59 $(eval LOCAL_UNINSTALLABLE_MODULE := $(6)) \
60 $(eval tw := $(subst :, ,$(strip $(t)))) \
61 $(if $(word 3,$(tw)),$(error $(LOCAL_PATH): Bad prebuilt filename '$(t)')) \
62 $(if $(word 2,$(tw)), \
63 $(eval LOCAL_MODULE := $(word 1,$(tw))) \
64 $(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \
66 $(eval LOCAL_MODULE := $(basename $(notdir $(t)))) \
67 $(eval LOCAL_SRC_FILES := $(t)) \
70 $(eval LOCAL_BUILT_MODULE_STEM := $(7)) \
72 $(if $(word 2,$(tw)), \
73 $(eval LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)$(suffix $(LOCAL_SRC_FILES))) \
75 $(eval LOCAL_BUILT_MODULE_STEM := $(notdir $(LOCAL_SRC_FILES))) \
78 $(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \
79 $(eval LOCAL_STRIP_MODULE := $(8)) \
80 $(eval include $(BUILD_PREBUILT)) \
84 endif # multi_prebuilt_once
87 $(call auto-prebuilt-boilerplate, \
88 $(prebuilt_static_libs), \
89 $(prebuilt_is_host), \
91 $(prebuilt_module_tags), \
95 $(call auto-prebuilt-boilerplate, \
96 $(prebuilt_shared_libs), \
97 $(prebuilt_is_host), \
99 $(prebuilt_module_tags), \
100 $($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES), \
103 $(prebuilt_strip_module))
105 $(call auto-prebuilt-boilerplate, \
106 $(prebuilt_executables), \
107 $(prebuilt_is_host), \
109 $(prebuilt_module_tags))
111 $(call auto-prebuilt-boilerplate, \
112 $(prebuilt_java_libraries), \
113 $(prebuilt_is_host), \
115 $(prebuilt_module_tags), \
120 $(call auto-prebuilt-boilerplate, \
121 $(prebuilt_static_java_libraries), \
122 $(prebuilt_is_host), \
124 $(prebuilt_module_tags), \
129 prebuilt_static_libs :=
130 prebuilt_shared_libs :=
131 prebuilt_executables :=
132 prebuilt_java_libraries :=
133 prebuilt_static_java_libraries :=
135 prebuilt_module_tags :=