multi_prebuilt.mk revision d2ebc1869885d91a8196929cfc1e90c1f60fbc96
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. 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) 24prebuilt_module_tags := $(LOCAL_MODULE_TAGS) 25 26 27ifndef multi_prebuilt_once 28multi_prebuilt_once := true 29 30# $(1): file list 31# $(2): IS_HOST_MODULE 32# $(3): MODULE_CLASS 33# $(4): MODULE_TAGS 34# $(5): OVERRIDE_BUILT_MODULE_PATH 35# $(6): UNINSTALLABLE_MODULE 36# $(7): BUILT_MODULE_STEM 37# 38# Elements in the file list may be bare filenames, 39# or of the form "<modulename>:<filename>". 40# If the module name is not specified, the module 41# name will be the filename with the suffix removed. 42# 43define auto-prebuilt-boilerplate 44$(if $(filter %: :%,$(1)), \ 45 $(error $(LOCAL_PATH): Leading or trailing colons in "$(1)")) \ 46$(foreach t,$(1), \ 47 $(eval include $(CLEAR_VARS)) \ 48 $(eval LOCAL_IS_HOST_MODULE := $(2)) \ 49 $(eval LOCAL_MODULE_CLASS := $(3)) \ 50 $(eval LOCAL_MODULE_TAGS := $(4)) \ 51 $(eval OVERRIDE_BUILT_MODULE_PATH := $(5)) \ 52 $(eval LOCAL_UNINSTALLABLE_MODULE := $(6)) \ 53 $(eval tw := $(subst :, ,$(strip $(t)))) \ 54 $(if $(word 3,$(tw)),$(error $(LOCAL_PATH): Bad prebuilt filename '$(t)')) \ 55 $(if $(word 2,$(tw)), \ 56 $(eval LOCAL_MODULE := $(word 1,$(tw))) \ 57 $(eval LOCAL_SRC_FILES := $(word 2,$(tw))) \ 58 , \ 59 $(eval LOCAL_MODULE := $(basename $(notdir $(t)))) \ 60 $(eval LOCAL_SRC_FILES := $(t)) \ 61 ) \ 62 $(if $(7), \ 63 $(eval LOCAL_BUILT_MODULE_STEM := $(7)) \ 64 , \ 65 $(eval LOCAL_BUILT_MODULE_STEM := $(notdir $(LOCAL_SRC_FILES))) \ 66 ) \ 67 $(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \ 68 $(eval include $(BUILD_PREBUILT)) \ 69 ) 70endef 71 72endif # multi_prebuilt_once 73 74 75$(call auto-prebuilt-boilerplate, \ 76 $(prebuilt_static_libs), \ 77 $(prebuilt_is_host), \ 78 STATIC_LIBRARIES, \ 79 $(prebuilt_module_tags), \ 80 , \ 81 true) 82 83$(call auto-prebuilt-boilerplate, \ 84 $(prebuilt_shared_libs), \ 85 $(prebuilt_is_host), \ 86 SHARED_LIBRARIES, \ 87 $(prebuilt_module_tags), \ 88 $($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES)) 89 90$(call auto-prebuilt-boilerplate, \ 91 $(prebuilt_executables), \ 92 $(prebuilt_is_host), \ 93 EXECUTABLES, \ 94 $(prebuilt_module_tags)) 95 96$(call auto-prebuilt-boilerplate, \ 97 $(prebuilt_java_libraries), \ 98 $(prebuilt_is_host), \ 99 JAVA_LIBRARIES, \ 100 $(prebuilt_module_tags), \ 101 , \ 102 , \ 103 javalib.jar) 104 105$(call auto-prebuilt-boilerplate, \ 106 $(prebuilt_static_java_libraries), \ 107 $(prebuilt_is_host), \ 108 JAVA_LIBRARIES, \ 109 $(prebuilt_module_tags), \ 110 , \ 111 true, \ 112 javalib.jar) 113 114prebuilt_static_libs := 115prebuilt_shared_libs := 116prebuilt_executables := 117prebuilt_java_libraries := 118prebuilt_static_java_libraries := 119prebuilt_is_host := 120prebuilt_module_tags := 121