blob: be60e2f1a1cee358ae7b34b2ca55a69c60ac6e10 [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
Ying Wanga8ae7f72013-07-31 16:26:01 -070017ifneq ($(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!)
20endif
21
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070022# Save these before they get cleared by CLEAR_VARS.
23prebuilt_static_libs := $(filter %.a,$(LOCAL_PREBUILT_LIBS))
24prebuilt_shared_libs := $(filter-out %.a,$(LOCAL_PREBUILT_LIBS))
25prebuilt_executables := $(LOCAL_PREBUILT_EXECUTABLES)
26prebuilt_java_libraries := $(LOCAL_PREBUILT_JAVA_LIBRARIES)
27prebuilt_static_java_libraries := $(LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES)
28prebuilt_is_host := $(LOCAL_IS_HOST_MODULE)
Dima Zavind2ebc182010-09-15 22:03:26 -070029prebuilt_module_tags := $(LOCAL_MODULE_TAGS)
Doug Zongkere1a8e3a2011-09-02 16:12:56 -070030prebuilt_strip_module := $(LOCAL_STRIP_MODULE)
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070031
32
33ifndef multi_prebuilt_once
34multi_prebuilt_once := true
35
36# $(1): file list
37# $(2): IS_HOST_MODULE
38# $(3): MODULE_CLASS
Dima Zavind2ebc182010-09-15 22:03:26 -070039# $(4): MODULE_TAGS
40# $(5): OVERRIDE_BUILT_MODULE_PATH
41# $(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)) \
58 $(eval OVERRIDE_BUILT_MODULE_PATH := $(5)) \
59 $(eval LOCAL_UNINSTALLABLE_MODULE := $(6)) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070060 $(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))) \
65 , \
Ravi K Yenduri93f49672009-03-10 15:05:09 -050066 $(eval LOCAL_MODULE := $(basename $(notdir $(t)))) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070067 $(eval LOCAL_SRC_FILES := $(t)) \
68 ) \
Dima Zavind2ebc182010-09-15 22:03:26 -070069 $(if $(7), \
70 $(eval LOCAL_BUILT_MODULE_STEM := $(7)) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070071 , \
Ravi K Yenduri93f49672009-03-10 15:05:09 -050072 $(eval LOCAL_BUILT_MODULE_STEM := $(notdir $(LOCAL_SRC_FILES))) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070073 ) \
74 $(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \
Doug Zongkere1a8e3a2011-09-02 16:12:56 -070075 $(if $(filter user,$(TARGET_BUILD_VARIANT)), \
76 $(eval LOCAL_STRIP_MODULE := $(8))) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070077 $(eval include $(BUILD_PREBUILT)) \
78 )
79endef
80
81endif # multi_prebuilt_once
82
83
84$(call auto-prebuilt-boilerplate, \
85 $(prebuilt_static_libs), \
86 $(prebuilt_is_host), \
87 STATIC_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -070088 $(prebuilt_module_tags), \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070089 , \
90 true)
91
92$(call auto-prebuilt-boilerplate, \
93 $(prebuilt_shared_libs), \
94 $(prebuilt_is_host), \
95 SHARED_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -070096 $(prebuilt_module_tags), \
Doug Zongkere1a8e3a2011-09-02 16:12:56 -070097 $($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES), \
98 , \
99 , \
100 $(prebuilt_strip_module))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700101
102$(call auto-prebuilt-boilerplate, \
103 $(prebuilt_executables), \
104 $(prebuilt_is_host), \
Dima Zavind2ebc182010-09-15 22:03:26 -0700105 EXECUTABLES, \
106 $(prebuilt_module_tags))
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700107
108$(call auto-prebuilt-boilerplate, \
109 $(prebuilt_java_libraries), \
110 $(prebuilt_is_host), \
111 JAVA_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -0700112 $(prebuilt_module_tags), \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700113 , \
114 , \
115 javalib.jar)
116
117$(call auto-prebuilt-boilerplate, \
118 $(prebuilt_static_java_libraries), \
119 $(prebuilt_is_host), \
120 JAVA_LIBRARIES, \
Dima Zavind2ebc182010-09-15 22:03:26 -0700121 $(prebuilt_module_tags), \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -0700122 , \
123 true, \
124 javalib.jar)
125
126prebuilt_static_libs :=
127prebuilt_shared_libs :=
128prebuilt_executables :=
129prebuilt_java_libraries :=
130prebuilt_static_java_libraries :=
131prebuilt_is_host :=
Dima Zavind2ebc182010-09-15 22:03:26 -0700132prebuilt_module_tags :=