blob: 738a88dd20403259d5b35a245f2685053c3c84db [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
17# Save these before they get cleared by CLEAR_VARS.
18prebuilt_static_libs := $(filter %.a,$(LOCAL_PREBUILT_LIBS))
19prebuilt_shared_libs := $(filter-out %.a,$(LOCAL_PREBUILT_LIBS))
20prebuilt_executables := $(LOCAL_PREBUILT_EXECUTABLES)
21prebuilt_java_libraries := $(LOCAL_PREBUILT_JAVA_LIBRARIES)
22prebuilt_static_java_libraries := $(LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES)
23prebuilt_is_host := $(LOCAL_IS_HOST_MODULE)
24
25
26ifndef multi_prebuilt_once
27multi_prebuilt_once := true
28
29# $(1): file list
30# $(2): IS_HOST_MODULE
31# $(3): MODULE_CLASS
32# $(4): OVERRIDE_BUILT_MODULE_PATH
33# $(5): UNINSTALLABLE_MODULE
34# $(6): BUILT_MODULE_STEM
35#
36# Elements in the file list may be bare filenames,
37# or of the form "<modulename>:<filename>".
38# If the module name is not specified, the module
39# name will be the filename with the suffix removed.
40#
41define auto-prebuilt-boilerplate
42$(if $(filter %: :%,$(1)), \
43 $(error $(LOCAL_PATH): Leading or trailing colons in "$(1)")) \
44$(foreach t,$(1), \
45 $(eval include $(CLEAR_VARS)) \
46 $(eval LOCAL_IS_HOST_MODULE := $(2)) \
47 $(eval LOCAL_MODULE_CLASS := $(3)) \
48 $(eval OVERRIDE_BUILT_MODULE_PATH := $(4)) \
49 $(eval LOCAL_UNINSTALLABLE_MODULE := $(5)) \
50 $(eval tw := $(subst :, ,$(strip $(t)))) \
51 $(if $(word 3,$(tw)),$(error $(LOCAL_PATH): Bad prebuilt filename '$(t)')) \
52 $(if $(word 2,$(tw)), \
53 $(eval LOCAL_MODULE := $(word 1,$(tw))) \
54 $(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \
55 , \
Ravi K Yenduri93f49672009-03-10 15:05:09 -050056 $(eval LOCAL_MODULE := $(basename $(notdir $(t)))) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070057 $(eval LOCAL_SRC_FILES := $(t)) \
58 ) \
59 $(if $(6), \
60 $(eval LOCAL_BUILT_MODULE_STEM := $(6)) \
61 , \
Ravi K Yenduri93f49672009-03-10 15:05:09 -050062 $(eval LOCAL_BUILT_MODULE_STEM := $(notdir $(LOCAL_SRC_FILES))) \
The Android Open Source Projectb6c1cf62008-10-21 07:00:00 -070063 ) \
64 $(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \
65 $(eval include $(BUILD_PREBUILT)) \
66 )
67endef
68
69endif # multi_prebuilt_once
70
71
72$(call auto-prebuilt-boilerplate, \
73 $(prebuilt_static_libs), \
74 $(prebuilt_is_host), \
75 STATIC_LIBRARIES, \
76 , \
77 true)
78
79$(call auto-prebuilt-boilerplate, \
80 $(prebuilt_shared_libs), \
81 $(prebuilt_is_host), \
82 SHARED_LIBRARIES, \
83 $($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES))
84
85$(call auto-prebuilt-boilerplate, \
86 $(prebuilt_executables), \
87 $(prebuilt_is_host), \
88 EXECUTABLES)
89
90$(call auto-prebuilt-boilerplate, \
91 $(prebuilt_java_libraries), \
92 $(prebuilt_is_host), \
93 JAVA_LIBRARIES, \
94 , \
95 , \
96 javalib.jar)
97
98$(call auto-prebuilt-boilerplate, \
99 $(prebuilt_static_java_libraries), \
100 $(prebuilt_is_host), \
101 JAVA_LIBRARIES, \
102 , \
103 true, \
104 javalib.jar)
105
106prebuilt_static_libs :=
107prebuilt_shared_libs :=
108prebuilt_executables :=
109prebuilt_java_libraries :=
110prebuilt_static_java_libraries :=
111prebuilt_is_host :=