blob: c97d481f5871e84bb491c08a9fd6526ba220d8af [file] [log] [blame]
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -07001#
2# Copyright (C) 2008 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
Dan Willemsen3bf15e72016-07-25 16:03:53 -070017$(call record-module-type,MULTI_PREBUILT)
Ying Wanga8ae7f72013-07-31 16:26:01 -070018ifneq ($(LOCAL_MODULE)$(LOCAL_MODULE_CLASS),)
19$(error $(LOCAL_PATH): LOCAL_MODULE or LOCAL_MODULE_CLASS not needed by \
20 BUILD_MULTI_PREBUILT, use BUILD_PREBUILT instead!)
21endif
22
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070023# Save these before they get cleared by CLEAR_VARS.
24prebuilt_static_libs := $(filter %.a,$(LOCAL_PREBUILT_LIBS))
25prebuilt_shared_libs := $(filter-out %.a,$(LOCAL_PREBUILT_LIBS))
26prebuilt_executables := $(LOCAL_PREBUILT_EXECUTABLES)
27prebuilt_java_libraries := $(LOCAL_PREBUILT_JAVA_LIBRARIES)
28prebuilt_static_java_libraries := $(LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES)
29prebuilt_is_host := $(LOCAL_IS_HOST_MODULE)
Dima Zavind2ebc182010-09-15 22:03:26 -070030prebuilt_module_tags := $(LOCAL_MODULE_TAGS)
Doug Zongkere1a8e3a2011-09-02 16:12:56 -070031prebuilt_strip_module := $(LOCAL_STRIP_MODULE)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070032
33
34ifndef multi_prebuilt_once
35multi_prebuilt_once := true
36
37# $(1): file list
38# $(2): IS_HOST_MODULE
39# $(3): MODULE_CLASS
Dima Zavind2ebc182010-09-15 22:03:26 -070040# $(4): MODULE_TAGS
Dima Zavind2ebc182010-09-15 22:03:26 -070041# $(6): UNINSTALLABLE_MODULE
42# $(7): BUILT_MODULE_STEM
Doug Zongkere1a8e3a2011-09-02 16:12:56 -070043# $(8): LOCAL_STRIP_MODULE
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070044#
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.
49#
50define auto-prebuilt-boilerplate
51$(if $(filter %: :%,$(1)), \
52 $(error $(LOCAL_PATH): Leading or trailing colons in "$(1)")) \
53$(foreach t,$(1), \
54 $(eval include $(CLEAR_VARS)) \
55 $(eval LOCAL_IS_HOST_MODULE := $(2)) \
56 $(eval LOCAL_MODULE_CLASS := $(3)) \
Dima Zavind2ebc182010-09-15 22:03:26 -070057 $(eval LOCAL_MODULE_TAGS := $(4)) \
Dima Zavind2ebc182010-09-15 22:03:26 -070058 $(eval LOCAL_UNINSTALLABLE_MODULE := $(6)) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070059 $(eval tw := $(subst :, ,$(strip $(t)))) \
60 $(if $(word 3,$(tw)),$(error $(LOCAL_PATH): Bad prebuilt filename '$(t)')) \
61 $(if $(word 2,$(tw)), \
62 $(eval LOCAL_MODULE := $(word 1,$(tw))) \
63 $(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \
64 , \
Ravi K Yenduri93f49672009-03-10 15:05:09 -050065 $(eval LOCAL_MODULE := $(basename $(notdir $(t)))) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070066 $(eval LOCAL_SRC_FILES := $(t)) \
67 ) \
Dima Zavind2ebc182010-09-15 22:03:26 -070068 $(if $(7), \
69 $(eval LOCAL_BUILT_MODULE_STEM := $(7)) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070070 , \
Daniel Tsaid54129e2013-10-17 16:20:56 +080071 $(if $(word 2,$(tw)), \
72 $(eval LOCAL_BUILT_MODULE_STEM := $(LOCAL_MODULE)$(suffix $(LOCAL_SRC_FILES))) \
73 , \
74 $(eval LOCAL_BUILT_MODULE_STEM := $(notdir $(LOCAL_SRC_FILES))) \
75 ) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070076 ) \
77 $(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \
Ying Wangbfb52a22014-08-20 17:12:32 -070078 $(eval LOCAL_STRIP_MODULE := $(8)) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070079 $(eval include $(BUILD_PREBUILT)) \
80 )
81endef
82
83endif # multi_prebuilt_once
84
85
86$(call auto-prebuilt-boilerplate, \
87 $(prebuilt_static_libs), \
88 $(prebuilt_is_host), \
89 STATIC_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -070090 $(prebuilt_module_tags), \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070091 , \
92 true)
93
94$(call auto-prebuilt-boilerplate, \
95 $(prebuilt_shared_libs), \
96 $(prebuilt_is_host), \
97 SHARED_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -070098 $(prebuilt_module_tags), \
Dan Willemsen8cf6b652018-09-05 11:01:12 -070099 , \
Doug Zongkere1a8e3a2011-09-02 16:12:56 -0700100 , \
101 , \
102 $(prebuilt_strip_module))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700103
104$(call auto-prebuilt-boilerplate, \
105 $(prebuilt_executables), \
106 $(prebuilt_is_host), \
Dima Zavind2ebc182010-09-15 22:03:26 -0700107 EXECUTABLES, \
108 $(prebuilt_module_tags))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700109
110$(call auto-prebuilt-boilerplate, \
111 $(prebuilt_java_libraries), \
112 $(prebuilt_is_host), \
113 JAVA_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -0700114 $(prebuilt_module_tags), \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700115 , \
116 , \
Colin Cross96476c12017-04-06 09:56:19 -0700117 javalib.jar)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700118
119$(call auto-prebuilt-boilerplate, \
120 $(prebuilt_static_java_libraries), \
121 $(prebuilt_is_host), \
122 JAVA_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -0700123 $(prebuilt_module_tags), \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700124 , \
125 true, \
Colin Cross96476c12017-04-06 09:56:19 -0700126 javalib.jar)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700127
128prebuilt_static_libs :=
129prebuilt_shared_libs :=
130prebuilt_executables :=
131prebuilt_java_libraries :=
132prebuilt_static_java_libraries :=
133prebuilt_is_host :=
Dima Zavind2ebc182010-09-15 22:03:26 -0700134prebuilt_module_tags :=