The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 1 | # |
| 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. |
| 18 | prebuilt_static_libs := $(filter %.a,$(LOCAL_PREBUILT_LIBS)) |
| 19 | prebuilt_shared_libs := $(filter-out %.a,$(LOCAL_PREBUILT_LIBS)) |
| 20 | prebuilt_executables := $(LOCAL_PREBUILT_EXECUTABLES) |
| 21 | prebuilt_java_libraries := $(LOCAL_PREBUILT_JAVA_LIBRARIES) |
| 22 | prebuilt_static_java_libraries := $(LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES) |
| 23 | prebuilt_is_host := $(LOCAL_IS_HOST_MODULE) |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 24 | prebuilt_module_tags := $(LOCAL_MODULE_TAGS) |
Doug Zongker | e1a8e3a | 2011-09-02 16:12:56 -0700 | [diff] [blame] | 25 | prebuilt_strip_module := $(LOCAL_STRIP_MODULE) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 26 | |
| 27 | |
| 28 | ifndef multi_prebuilt_once |
| 29 | multi_prebuilt_once := true |
| 30 | |
| 31 | # $(1): file list |
| 32 | # $(2): IS_HOST_MODULE |
| 33 | # $(3): MODULE_CLASS |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 34 | # $(4): MODULE_TAGS |
| 35 | # $(5): OVERRIDE_BUILT_MODULE_PATH |
| 36 | # $(6): UNINSTALLABLE_MODULE |
| 37 | # $(7): BUILT_MODULE_STEM |
Doug Zongker | e1a8e3a | 2011-09-02 16:12:56 -0700 | [diff] [blame] | 38 | # $(8): LOCAL_STRIP_MODULE |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 39 | # |
| 40 | # Elements in the file list may be bare filenames, |
| 41 | # or of the form "<modulename>:<filename>". |
| 42 | # If the module name is not specified, the module |
| 43 | # name will be the filename with the suffix removed. |
| 44 | # |
| 45 | define auto-prebuilt-boilerplate |
| 46 | $(if $(filter %: :%,$(1)), \ |
| 47 | $(error $(LOCAL_PATH): Leading or trailing colons in "$(1)")) \ |
| 48 | $(foreach t,$(1), \ |
| 49 | $(eval include $(CLEAR_VARS)) \ |
| 50 | $(eval LOCAL_IS_HOST_MODULE := $(2)) \ |
| 51 | $(eval LOCAL_MODULE_CLASS := $(3)) \ |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 52 | $(eval LOCAL_MODULE_TAGS := $(4)) \ |
| 53 | $(eval OVERRIDE_BUILT_MODULE_PATH := $(5)) \ |
| 54 | $(eval LOCAL_UNINSTALLABLE_MODULE := $(6)) \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 55 | $(eval tw := $(subst :, ,$(strip $(t)))) \ |
| 56 | $(if $(word 3,$(tw)),$(error $(LOCAL_PATH): Bad prebuilt filename '$(t)')) \ |
| 57 | $(if $(word 2,$(tw)), \ |
| 58 | $(eval LOCAL_MODULE := $(word 1,$(tw))) \ |
| 59 | $(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \ |
| 60 | , \ |
Ravi K Yenduri | 93f4967 | 2009-03-10 15:05:09 -0500 | [diff] [blame] | 61 | $(eval LOCAL_MODULE := $(basename $(notdir $(t)))) \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 62 | $(eval LOCAL_SRC_FILES := $(t)) \ |
| 63 | ) \ |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 64 | $(if $(7), \ |
| 65 | $(eval LOCAL_BUILT_MODULE_STEM := $(7)) \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 66 | , \ |
Ravi K Yenduri | 93f4967 | 2009-03-10 15:05:09 -0500 | [diff] [blame] | 67 | $(eval LOCAL_BUILT_MODULE_STEM := $(notdir $(LOCAL_SRC_FILES))) \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 68 | ) \ |
| 69 | $(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \ |
Doug Zongker | e1a8e3a | 2011-09-02 16:12:56 -0700 | [diff] [blame] | 70 | $(if $(filter user,$(TARGET_BUILD_VARIANT)), \ |
| 71 | $(eval LOCAL_STRIP_MODULE := $(8))) \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 72 | $(eval include $(BUILD_PREBUILT)) \ |
| 73 | ) |
| 74 | endef |
| 75 | |
| 76 | endif # multi_prebuilt_once |
| 77 | |
| 78 | |
| 79 | $(call auto-prebuilt-boilerplate, \ |
| 80 | $(prebuilt_static_libs), \ |
| 81 | $(prebuilt_is_host), \ |
| 82 | STATIC_LIBRARIES, \ |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 83 | $(prebuilt_module_tags), \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 84 | , \ |
| 85 | true) |
| 86 | |
| 87 | $(call auto-prebuilt-boilerplate, \ |
| 88 | $(prebuilt_shared_libs), \ |
| 89 | $(prebuilt_is_host), \ |
| 90 | SHARED_LIBRARIES, \ |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 91 | $(prebuilt_module_tags), \ |
Doug Zongker | e1a8e3a | 2011-09-02 16:12:56 -0700 | [diff] [blame] | 92 | $($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES), \ |
| 93 | , \ |
| 94 | , \ |
| 95 | $(prebuilt_strip_module)) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 96 | |
| 97 | $(call auto-prebuilt-boilerplate, \ |
| 98 | $(prebuilt_executables), \ |
| 99 | $(prebuilt_is_host), \ |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 100 | EXECUTABLES, \ |
| 101 | $(prebuilt_module_tags)) |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 102 | |
| 103 | $(call auto-prebuilt-boilerplate, \ |
| 104 | $(prebuilt_java_libraries), \ |
| 105 | $(prebuilt_is_host), \ |
| 106 | JAVA_LIBRARIES, \ |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 107 | $(prebuilt_module_tags), \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 108 | , \ |
| 109 | , \ |
| 110 | javalib.jar) |
| 111 | |
| 112 | $(call auto-prebuilt-boilerplate, \ |
| 113 | $(prebuilt_static_java_libraries), \ |
| 114 | $(prebuilt_is_host), \ |
| 115 | JAVA_LIBRARIES, \ |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 116 | $(prebuilt_module_tags), \ |
The Android Open Source Project | b6c1cf6 | 2008-10-21 07:00:00 -0700 | [diff] [blame] | 117 | , \ |
| 118 | true, \ |
| 119 | javalib.jar) |
| 120 | |
| 121 | prebuilt_static_libs := |
| 122 | prebuilt_shared_libs := |
| 123 | prebuilt_executables := |
| 124 | prebuilt_java_libraries := |
| 125 | prebuilt_static_java_libraries := |
| 126 | prebuilt_is_host := |
Dima Zavin | d2ebc18 | 2010-09-15 22:03:26 -0700 | [diff] [blame] | 127 | prebuilt_module_tags := |