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