The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [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 | # Users can define base-rules-hook in their buildspec.mk to perform |
| 18 | # arbitrary operations as each module is included. |
| 19 | ifdef base-rules-hook |
| 20 | $(if $(base-rules-hook),) |
| 21 | endif |
| 22 | |
| 23 | ########################################################### |
| 24 | ## Common instructions for a generic module. |
| 25 | ########################################################### |
| 26 | |
| 27 | LOCAL_MODULE := $(strip $(LOCAL_MODULE)) |
| 28 | ifeq ($(LOCAL_MODULE),) |
| 29 | $(error $(LOCAL_PATH): LOCAL_MODULE is not defined) |
| 30 | endif |
| 31 | |
| 32 | LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE)) |
| 33 | ifdef LOCAL_IS_HOST_MODULE |
| 34 | ifneq ($(LOCAL_IS_HOST_MODULE),true) |
| 35 | $(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)") |
| 36 | endif |
Ying Wang | 13d6950 | 2012-11-01 17:22:33 -0700 | [diff] [blame] | 37 | my_prefix := HOST_ |
| 38 | my_host := host- |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 39 | else |
Ying Wang | 13d6950 | 2012-11-01 17:22:33 -0700 | [diff] [blame] | 40 | my_prefix := TARGET_ |
| 41 | my_host := |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 42 | endif |
| 43 | |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 44 | my_module_tags := $(LOCAL_MODULE_TAGS) |
| 45 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 46 | ########################################################### |
| 47 | ## Validate and define fallbacks for input LOCAL_* variables. |
| 48 | ########################################################### |
| 49 | |
| 50 | ## Dump a .csv file of all modules and their tags |
| 51 | #ifneq ($(tag-list-first-time),false) |
| 52 | #$(shell rm -f tag-list.csv) |
| 53 | #tag-list-first-time := false |
| 54 | #endif |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 55 | #$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(my_module_tags))) >> tag-list.csv) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 56 | |
Ying Wang | 6e371e4 | 2012-05-15 14:31:26 -0700 | [diff] [blame] | 57 | LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE)) |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 58 | my_module_tags := $(sort $(my_module_tags)) |
| 59 | ifeq (,$(my_module_tags)) |
| 60 | my_module_tags := optional |
Ying Wang | 2fd81cf | 2010-12-10 11:17:28 -0800 | [diff] [blame] | 61 | endif |
Joe Onorato | 918ee31 | 2012-05-18 20:43:14 -0700 | [diff] [blame] | 62 | |
Joe Onorato | 6a185e4 | 2012-05-22 14:08:50 -0700 | [diff] [blame] | 63 | # User tags are not allowed anymore. Fail early because it will not be installed |
| 64 | # like it used to be. |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 65 | ifneq ($(filter $(my_module_tags),user),) |
Joe Onorato | 6a185e4 | 2012-05-22 14:08:50 -0700 | [diff] [blame] | 66 | $(warning *** Module name: $(LOCAL_MODULE)) |
| 67 | $(warning *** Makefile location: $(LOCAL_MODULE_MAKEFILE)) |
| 68 | $(warning * ) |
| 69 | $(warning * Module is attempting to use the 'user' tag. This) |
| 70 | $(warning * used to cause the module to be installed automatically.) |
| 71 | $(warning * Now, the module must be listed in the PRODUCT_PACKAGES) |
| 72 | $(warning * section of a product makefile to have it installed.) |
| 73 | $(warning * ) |
| 74 | $(error user tag detected on module.) |
| 75 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 76 | |
Jean-Baptiste Queru | a831cbd | 2010-01-07 11:06:50 -0800 | [diff] [blame] | 77 | # Only the tags mentioned in this test are expected to be set by module |
| 78 | # makefiles. Anything else is either a typo or a source of unexpected |
| 79 | # behaviors. |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 80 | ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),) |
| 81 | $(warning unusual tags $(my_module_tags) on $(LOCAL_MODULE) at $(LOCAL_PATH)) |
Jean-Baptiste Queru | a831cbd | 2010-01-07 11:06:50 -0800 | [diff] [blame] | 82 | endif |
| 83 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 84 | # Add implicit tags. |
| 85 | # |
| 86 | # If the local directory or one of its parents contains a MODULE_LICENSE_GPL |
Andrew Boie | 08a943b | 2013-12-10 13:52:00 -0800 | [diff] [blame] | 87 | # file, tag the module as "gnu". Search for "*_GPL*", "*_LGPL*" and "*_MPL*" |
| 88 | # so that we can also find files like MODULE_LICENSE_GPL_AND_AFL |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 89 | # |
Andrew Boie | 08a943b | 2013-12-10 13:52:00 -0800 | [diff] [blame] | 90 | gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*) |
Ying Wang | fd626f2 | 2011-12-12 12:57:38 -0800 | [diff] [blame] | 91 | ifneq ($(gpl_license_file),) |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 92 | my_module_tags += gnu |
Ying Wang | fd626f2 | 2011-12-12 12:57:38 -0800 | [diff] [blame] | 93 | ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 94 | endif |
| 95 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 96 | LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS)) |
| 97 | ifneq ($(words $(LOCAL_MODULE_CLASS)),1) |
| 98 | $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)") |
| 99 | endif |
| 100 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 101 | my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32) |
Colin Cross | 8797405 | 2014-03-21 12:25:44 -0700 | [diff] [blame] | 102 | |
Ying Wang | 6e371e4 | 2012-05-15 14:31:26 -0700 | [diff] [blame] | 103 | ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) |
Colin Cross | 8797405 | 2014-03-21 12:25:44 -0700 | [diff] [blame] | 104 | my_multilib_module_path := $(strip $(LOCAL_MODULE_PATH_$(my_32_64_bit_suffix))) |
Colin Cross | 8797405 | 2014-03-21 12:25:44 -0700 | [diff] [blame] | 105 | ifdef my_multilib_module_path |
| 106 | my_module_path := $(my_multilib_module_path) |
| 107 | else |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 108 | my_module_path := $(strip $(LOCAL_MODULE_PATH)) |
Colin Cross | 8797405 | 2014-03-21 12:25:44 -0700 | [diff] [blame] | 109 | endif |
Colin Cross | 639c336 | 2014-01-24 19:23:40 -0800 | [diff] [blame] | 110 | my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 111 | ifeq ($(my_module_path),) |
Ying Wang | 5338fbf | 2013-05-08 15:49:08 -0700 | [diff] [blame] | 112 | ifdef LOCAL_IS_HOST_MODULE |
| 113 | partition_tag := |
| 114 | else |
| 115 | ifeq (true,$(LOCAL_PROPRIETARY_MODULE)) |
| 116 | partition_tag := _VENDOR |
| 117 | else |
| 118 | # The definition of should-install-to-system will be different depending |
| 119 | # on which goal (e.g., sdk or just droid) is being built. |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 120 | partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA) |
Ying Wang | 5338fbf | 2013-05-08 15:49:08 -0700 | [diff] [blame] | 121 | endif |
| 122 | endif |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 123 | install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS) |
Ying Wang | 5338fbf | 2013-05-08 15:49:08 -0700 | [diff] [blame] | 124 | ifeq (true,$(LOCAL_PRIVILEGED_MODULE)) |
| 125 | install_path_var := $(install_path_var)_PRIVILEGED |
| 126 | endif |
| 127 | |
Colin Cross | b34911c | 2014-01-22 17:34:28 -0800 | [diff] [blame] | 128 | my_module_path := $($(install_path_var)) |
Ying Wang | b8e0185 | 2014-01-23 15:09:04 -0800 | [diff] [blame] | 129 | ifeq ($(strip $(my_module_path)),) |
| 130 | $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)") |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 131 | endif |
| 132 | endif |
Colin Cross | 639c336 | 2014-01-24 19:23:40 -0800 | [diff] [blame] | 133 | ifneq ($(my_module_relative_path),) |
| 134 | my_module_path := $(my_module_path)/$(my_module_relative_path) |
| 135 | endif |
Ying Wang | 6e371e4 | 2012-05-15 14:31:26 -0700 | [diff] [blame] | 136 | endif # not LOCAL_UNINSTALLABLE_MODULE |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 137 | |
| 138 | ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),) |
| 139 | $(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles) |
| 140 | endif |
| 141 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 142 | my_register_name := $(LOCAL_MODULE) |
| 143 | ifdef LOCAL_2ND_ARCH_VAR_PREFIX |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 144 | ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 145 | my_register_name := $(LOCAL_MODULE)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 146 | endif |
Colin Cross | aee1e77 | 2014-02-04 11:16:16 -0800 | [diff] [blame] | 147 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 148 | # Make sure that this IS_HOST/CLASS/MODULE combination is unique. |
| 149 | module_id := MODULE.$(if \ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 150 | $(LOCAL_IS_HOST_MODULE),HOST,TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 151 | ifdef $(module_id) |
| 152 | $(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id))) |
| 153 | endif |
| 154 | $(module_id) := $(LOCAL_PATH) |
| 155 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 156 | intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 157 | intermediates.COMMON := $(call local-intermediates-dir,COMMON) |
Colin Cross | d826264 | 2014-01-24 23:17:21 -0800 | [diff] [blame] | 158 | generated_sources_dir := $(call local-generated-sources-dir) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 159 | |
| 160 | ########################################################### |
| 161 | # Pick a name for the intermediate and final targets |
| 162 | ########################################################### |
Colin Cross | 5a9db90 | 2014-03-21 12:27:37 -0700 | [diff] [blame] | 163 | include $(BUILD_SYSTEM)/configure_module_stem.mk |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 164 | |
| 165 | # OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the |
| 166 | # internal SHARED_LIBRARIES build files. |
| 167 | OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH)) |
| 168 | ifdef OVERRIDE_BUILT_MODULE_PATH |
| 169 | ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) |
| 170 | $(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH) |
| 171 | endif |
| 172 | built_module_path := $(OVERRIDE_BUILT_MODULE_PATH) |
| 173 | else |
| 174 | built_module_path := $(intermediates) |
| 175 | endif |
Ying Wang | 966c1e0 | 2014-05-20 14:43:51 -0700 | [diff] [blame] | 176 | LOCAL_BUILT_MODULE := $(built_module_path)/$(my_built_module_stem) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 177 | built_module_path := |
| 178 | |
Ying Wang | 162991b | 2011-09-07 10:21:42 -0700 | [diff] [blame] | 179 | ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) |
Ying Wang | 966c1e0 | 2014-05-20 14:43:51 -0700 | [diff] [blame] | 180 | LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 181 | endif |
| 182 | |
| 183 | # Assemble the list of targets to create PRIVATE_ variables for. |
| 184 | LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE) |
| 185 | |
| 186 | |
| 187 | ########################################################### |
| 188 | ## AIDL: Compile .aidl files to .java |
| 189 | ########################################################### |
| 190 | |
| 191 | aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES)) |
| 192 | |
| 193 | ifneq ($(strip $(aidl_sources)),) |
| 194 | |
| 195 | aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources))) |
| 196 | aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources)) |
| 197 | |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 198 | aidl_preprocess_import := |
| 199 | LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION)) |
| 200 | ifdef LOCAL_SDK_VERSION |
Ying Wang | 0ec188f | 2012-05-10 17:25:51 -0700 | [diff] [blame] | 201 | ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) |
| 202 | # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 203 | aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl |
| 204 | else |
| 205 | aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 206 | endif # !current |
Ying Wang | d74b538 | 2013-10-01 18:16:45 -0700 | [diff] [blame] | 207 | else |
| 208 | # build against the platform. |
| 209 | LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS) |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 210 | endif # LOCAL_SDK_VERSION |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 211 | $(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(addprefix -p,$(aidl_preprocess_import)) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 212 | |
Ying Wang | a7d9ca3 | 2011-07-13 14:29:33 -0700 | [diff] [blame] | 213 | $(aidl_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.aidl $(LOCAL_ADDITIONAL_DEPENDENCIES) $(AIDL) $(aidl_preprocess_import) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 214 | $(transform-aidl-to-java) |
| 215 | -include $(aidl_java_sources:%.java=%.P) |
| 216 | |
| 217 | else |
| 218 | aidl_java_sources := |
| 219 | endif |
| 220 | |
| 221 | ########################################################### |
Doug Zongker | 9bd4962 | 2009-11-30 14:28:59 -0800 | [diff] [blame] | 222 | ## logtags: Add .logtags files to global list, emit java source |
| 223 | ########################################################### |
| 224 | |
| 225 | logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES)) |
| 226 | |
| 227 | ifneq ($(strip $(logtags_sources)),) |
| 228 | |
| 229 | event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources)) |
| 230 | |
| 231 | # Emit a java source file with constants for the tags, if |
| 232 | # LOCAL_MODULE_CLASS is "APPS" or "JAVA_LIBRARIES". |
| 233 | ifneq ($(strip $(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES)),) |
| 234 | |
| 235 | logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources))) |
| 236 | logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources)) |
| 237 | |
Joe Onorato | b751053 | 2010-07-14 10:22:54 -0700 | [diff] [blame] | 238 | $(logtags_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.logtags $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt |
Doug Zongker | 9bd4962 | 2009-11-30 14:28:59 -0800 | [diff] [blame] | 239 | $(transform-logtags-to-java) |
| 240 | |
| 241 | endif |
| 242 | |
| 243 | else |
| 244 | logtags_java_sources := |
| 245 | event_log_tags := |
| 246 | endif |
| 247 | |
| 248 | ########################################################### |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 249 | ## .proto files: Compile proto files to .java |
| 250 | ########################################################### |
| 251 | proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES)) |
| 252 | # Because names of the .java files compiled from .proto files are unknown until the |
| 253 | # .proto files are compiled, we use a timestamp file as depedency. |
| 254 | proto_java_sources_file_stamp := |
| 255 | ifneq ($(proto_sources),) |
| 256 | proto_sources_fullpath := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(proto_sources)) |
| 257 | # By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be |
| 258 | # automatically found by the java compiling function transform-java-to-classes.jar. |
Ying Wang | 6029391 | 2010-11-05 11:20:03 -0700 | [diff] [blame] | 259 | ifneq ($(LOCAL_INTERMEDIATE_SOURCE_DIR),) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 260 | proto_java_intemediate_dir := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/proto |
Ying Wang | 6029391 | 2010-11-05 11:20:03 -0700 | [diff] [blame] | 261 | else |
| 262 | # LOCAL_INTERMEDIATE_SOURCE_DIR may be not defined in non-java modules. |
| 263 | proto_java_intemediate_dir := $(intermediates)/proto |
| 264 | endif |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 265 | proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp |
| 266 | proto_java_sources_dir := $(proto_java_intemediate_dir)/src |
| 267 | |
| 268 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP) |
| 269 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath) |
| 270 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir) |
| 271 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro) |
| 272 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out |
| 273 | else |
Ulas Kirazci | 76e3a39 | 2013-03-28 14:02:14 -0700 | [diff] [blame] | 274 | ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano) |
| 275 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out |
| 276 | else |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 277 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out |
Ulas Kirazci | 76e3a39 | 2013-03-28 14:02:14 -0700 | [diff] [blame] | 278 | endif |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 279 | endif |
Ying Wang | 33c0d95 | 2010-11-05 11:30:58 -0700 | [diff] [blame] | 280 | $(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) |
Ulas Kirazci | 6e485b5 | 2013-07-25 12:28:19 -0700 | [diff] [blame] | 281 | $(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS) |
Ying Wang | a5fc87a | 2010-11-02 18:43:16 -0700 | [diff] [blame] | 282 | $(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC) |
| 283 | $(call transform-proto-to-java) |
| 284 | |
| 285 | #TODO: protoc should output the dependencies introduced by imports. |
| 286 | |
| 287 | LOCAL_INTERMEDIATE_TARGETS += $(proto_java_sources_file_stamp) |
| 288 | endif # proto_sources |
| 289 | |
| 290 | |
| 291 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 292 | ## Java: Compile .java files to .class |
| 293 | ########################################################### |
| 294 | #TODO: pull this into java.make once host and target are combined |
| 295 | |
Ying Wang | 5291130 | 2010-05-26 13:13:56 -0700 | [diff] [blame] | 296 | java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \ |
| 297 | $(filter %.java,$(LOCAL_GENERATED_SOURCES)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 298 | all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES))) |
| 299 | |
| 300 | ## Java resources ######################################### |
| 301 | |
| 302 | # Look for resource files in any specified directories. |
| 303 | # Non-java and non-doc files will be picked up as resources |
| 304 | # and included in the output jar file. |
| 305 | java_resource_file_groups := |
| 306 | |
| 307 | LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS)) |
| 308 | ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),) |
| 309 | # This makes a list of words like |
| 310 | # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>: |
| 311 | # where each of the files is relative to the directory it's grouped with. |
| 312 | # Directories that don't contain any resource files will result in groups |
| 313 | # that end with a colon, and they are stripped out in the next step. |
| 314 | java_resource_file_groups += \ |
| 315 | $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \ |
| 316 | $(subst $(space),:,$(strip \ |
| 317 | $(TOP_DIR)$(LOCAL_PATH)/$(dir): \ |
| 318 | $(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \ |
| 319 | find . \ |
| 320 | -type d -a -name ".svn" -prune -o \ |
| 321 | -type f \ |
| 322 | -a \! -name "*.java" \ |
| 323 | -a \! -name "package.html" \ |
| 324 | -a \! -name "overview.html" \ |
| 325 | -a \! -name ".*.swp" \ |
| 326 | -a \! -name ".DS_Store" \ |
| 327 | -a \! -name "*~" \ |
| 328 | -print \ |
| 329 | )) \ |
| 330 | )) \ |
| 331 | ) |
| 332 | java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups)) |
| 333 | endif # LOCAL_JAVA_RESOURCE_DIRS |
| 334 | |
| 335 | LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES)) |
| 336 | ifneq ($(LOCAL_JAVA_RESOURCE_FILES),) |
| 337 | java_resource_file_groups += \ |
| 338 | $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \ |
| 339 | $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \ |
| 340 | ) |
| 341 | endif # LOCAL_JAVA_RESOURCE_FILES |
| 342 | |
| 343 | ifdef java_resource_file_groups |
| 344 | # The full paths to all resources, used for dependencies. |
| 345 | java_resource_sources := \ |
| 346 | $(foreach group,$(java_resource_file_groups), \ |
| 347 | $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \ |
| 348 | $(wordlist 2,9999,$(subst :,$(space),$(group))) \ |
| 349 | ) \ |
| 350 | ) |
| 351 | # The arguments to jar that will include these files in a jar file. |
Ying Wang | 194a8ec | 2011-06-06 14:34:52 -0700 | [diff] [blame] | 352 | # Quote the file name to handle special characters (such as #) correctly. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 353 | extra_jar_args := \ |
| 354 | $(foreach group,$(java_resource_file_groups), \ |
Ying Wang | 194a8ec | 2011-06-06 14:34:52 -0700 | [diff] [blame] | 355 | $(addprefix -C "$(word 1,$(subst :,$(space),$(group)))" , \ |
| 356 | $(foreach w, $(wordlist 2,9999,$(subst :,$(space),$(group))), "$(w)" ) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 357 | ) \ |
| 358 | ) |
| 359 | java_resource_file_groups := |
| 360 | else |
| 361 | java_resource_sources := |
| 362 | extra_jar_args := |
| 363 | endif # java_resource_file_groups |
| 364 | |
| 365 | ## PRIVATE java vars ###################################### |
Ying Wang | 990cf5e | 2013-08-28 13:04:46 -0700 | [diff] [blame] | 366 | # LOCAL_SOURCE_FILES_ALL_GENERATED is set only if the module does not have static source files, |
| 367 | # but generated source files in its LOCAL_INTERMEDIATE_SOURCE_DIR. |
| 368 | # You have to set up the dependency in some other way. |
| 369 | need_compile_java := $(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED)) |
| 370 | ifdef need_compile_java |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 371 | |
| 372 | full_static_java_libs := \ |
| 373 | $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ |
| 374 | $(call intermediates-dir-for, \ |
Ying Wang | a83940f | 2010-09-24 18:09:04 -0700 | [diff] [blame] | 375 | JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE),COMMON)/javalib.jar) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 376 | |
| 377 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_INSTALL_DIR := $(dir $(LOCAL_INSTALLED_MODULE)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 378 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes |
| 379 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src |
| 380 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources) |
| 381 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES)) |
| 382 | ifeq ($(my_prefix),TARGET_) |
Joe Onorato | e62902c | 2009-09-23 15:28:12 -0700 | [diff] [blame] | 383 | ifeq ($(LOCAL_SDK_VERSION),) |
Brian Carlstrom | 074151b | 2014-06-23 15:34:17 -0700 | [diff] [blame^] | 384 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core-libart) |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 385 | else |
Ying Wang | 0ec188f | 2012-05-10 17:25:51 -0700 | [diff] [blame] | 386 | ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current) |
| 387 | # LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS. |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 388 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current) |
| 389 | else |
| 390 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION)) |
| 391 | endif # current |
| 392 | endif # LOCAL_SDK_VERSION |
| 393 | endif # TARGET_ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 394 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) |
| 395 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) |
| 396 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR) |
| 397 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs) |
| 398 | |
| 399 | # full_java_libs: The list of files that should be used as the classpath. |
| 400 | # Using this list as a dependency list WILL NOT WORK. |
| 401 | # full_java_lib_deps: Should be specified as a prerequisite of this module |
| 402 | # to guarantee that the files in full_java_libs will |
| 403 | # be up-to-date. |
| 404 | ifdef LOCAL_IS_HOST_MODULE |
Narayan Kamath | 40dae1f | 2013-10-28 13:20:52 +0000 | [diff] [blame] | 405 | ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true) |
Brian Carlstrom | b1dafb1 | 2014-06-18 15:11:01 -0700 | [diff] [blame] | 406 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-deps,core-libart-hostdex,$(LOCAL_IS_HOST_MODULE)) |
Ying Wang | 015edd2 | 2011-01-20 15:01:56 -0800 | [diff] [blame] | 407 | |
Ying Wang | 7311a34 | 2013-08-21 18:32:49 -0700 | [diff] [blame] | 408 | full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
Ying Wang | 73ca57f | 2010-09-10 18:38:10 -0700 | [diff] [blame] | 409 | full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 410 | else |
Ying Wang | 015edd2 | 2011-01-20 15:01:56 -0800 | [diff] [blame] | 411 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := |
| 412 | |
Ying Wang | 7311a34 | 2013-08-21 18:32:49 -0700 | [diff] [blame] | 413 | full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\ |
| 414 | $(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES))) |
| 415 | full_java_lib_deps := $(full_shared_java_libs) |
Ying Wang | 73ca57f | 2010-09-10 18:38:10 -0700 | [diff] [blame] | 416 | endif # LOCAL_BUILD_HOST_DEX |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 417 | else |
Ying Wang | 7311a34 | 2013-08-21 18:32:49 -0700 | [diff] [blame] | 418 | full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 419 | full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 420 | endif # !LOCAL_IS_HOST_MODULE |
Ying Wang | 7311a34 | 2013-08-21 18:32:49 -0700 | [diff] [blame] | 421 | full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 422 | full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH) |
| 423 | |
Dianne Hackborn | a1fece0 | 2013-03-11 18:04:55 -0700 | [diff] [blame] | 424 | # This is set by packages that are linking to other packages that export |
| 425 | # shared libraries, allowing them to make use of the code in the linked apk. |
| 426 | LOCAL_APK_LIBRARIES := $(strip $(LOCAL_APK_LIBRARIES)) |
| 427 | ifdef LOCAL_APK_LIBRARIES |
| 428 | link_apk_libraries := \ |
| 429 | $(foreach lib,$(LOCAL_APK_LIBRARIES), \ |
| 430 | $(call intermediates-dir-for, \ |
| 431 | APPS,$(lib),,COMMON)/classes.jar) |
| 432 | |
| 433 | # link against the jar with full original names (before proguard processing). |
Ying Wang | 638ce57 | 2013-08-23 11:59:49 -0700 | [diff] [blame] | 434 | full_shared_java_libs += $(link_apk_libraries) |
Dianne Hackborn | a1fece0 | 2013-03-11 18:04:55 -0700 | [diff] [blame] | 435 | full_java_libs += $(link_apk_libraries) |
| 436 | full_java_lib_deps += $(link_apk_libraries) |
| 437 | endif |
| 438 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 439 | # This is set by packages that contain instrumentation, allowing them to |
| 440 | # link against the package they are instrumenting. Currently only one such |
| 441 | # package is allowed. |
| 442 | LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR)) |
| 443 | ifdef LOCAL_INSTRUMENTATION_FOR |
| 444 | ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1) |
| 445 | $(error \ |
| 446 | $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined) |
| 447 | endif |
| 448 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 449 | link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \ |
| 450 | APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON) |
Ying Wang | 3b2bdf1 | 2010-02-01 09:51:23 -0800 | [diff] [blame] | 451 | # link against the jar with full original names (before proguard processing). |
Ying Wang | 7311a34 | 2013-08-21 18:32:49 -0700 | [diff] [blame] | 452 | link_instr_classes_jar := $(link_instr_intermediates_dir.COMMON)/classes.jar |
| 453 | full_java_libs += $(link_instr_classes_jar) |
| 454 | full_java_lib_deps += $(link_instr_classes_jar) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 455 | endif |
| 456 | |
Ying Wang | c06243d | 2010-04-26 20:09:56 -0700 | [diff] [blame] | 457 | jar_manifest_file := |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 458 | ifneq ($(strip $(LOCAL_JAR_MANIFEST)),) |
Ying Wang | c06243d | 2010-04-26 20:09:56 -0700 | [diff] [blame] | 459 | jar_manifest_file := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST) |
| 460 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(jar_manifest_file) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 461 | else |
| 462 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := |
| 463 | endif |
| 464 | |
Ying Wang | 990cf5e | 2013-08-28 13:04:46 -0700 | [diff] [blame] | 465 | endif # need_compile_java |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 466 | |
| 467 | |
| 468 | ########################################################### |
| 469 | ## make clean- targets |
| 470 | ########################################################### |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 471 | cleantarget := clean-$(my_register_name) |
| 472 | $(cleantarget) : PRIVATE_MODULE := $(my_register_name) |
Ying Wang | 4d06341 | 2013-03-22 18:52:57 -0700 | [diff] [blame] | 473 | $(cleantarget) : PRIVATE_CLEAN_FILES := \ |
Ying Wang | 95221ca | 2012-11-07 14:07:34 -0800 | [diff] [blame] | 474 | $(LOCAL_BUILT_MODULE) \ |
| 475 | $(LOCAL_INSTALLED_MODULE) \ |
| 476 | $(intermediates) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 477 | $(cleantarget):: |
| 478 | @echo "Clean: $(PRIVATE_MODULE)" |
| 479 | $(hide) rm -rf $(PRIVATE_CLEAN_FILES) |
| 480 | |
| 481 | ########################################################### |
| 482 | ## Common definitions for module. |
| 483 | ########################################################### |
| 484 | |
Ying Wang | 95221ca | 2012-11-07 14:07:34 -0800 | [diff] [blame] | 485 | # aapt doesn't accept multiple --extra-packages flags. |
| 486 | # We have to collapse them into a single --extra-packages flag here. |
| 487 | LOCAL_AAPT_FLAGS := $(strip $(LOCAL_AAPT_FLAGS)) |
| 488 | ifdef LOCAL_AAPT_FLAGS |
| 489 | ifeq ($(filter 0 1,$(words $(filter --extra-packages,$(LOCAL_AAPT_FLAGS)))),) |
| 490 | aapt_flags := $(subst --extra-packages$(space),--extra-packages@,$(LOCAL_AAPT_FLAGS)) |
| 491 | aapt_flags_extra_packages := $(patsubst --extra-packages@%,%,$(filter --extra-packages@%,$(aapt_flags))) |
| 492 | aapt_flags_extra_packages := $(sort $(subst :,$(space),$(aapt_flags_extra_packages))) |
| 493 | LOCAL_AAPT_FLAGS := $(filter-out --extra-packages@%,$(aapt_flags)) \ |
| 494 | --extra-packages $(subst $(space),:,$(aapt_flags_extra_packages)) |
| 495 | aapt_flags_extra_packages := |
| 496 | aapt_flags := |
| 497 | endif |
| 498 | endif |
| 499 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 500 | # Propagate local configuration options to this target. |
| 501 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 502 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS) |
| 503 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES) |
Jeff Hamilton | bb67d21 | 2010-02-05 22:36:42 -0600 | [diff] [blame] | 504 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME) |
Ying Wang | 3dae0ee | 2010-09-02 15:41:01 -0700 | [diff] [blame] | 505 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_INSTRUMENTATION_FOR:= $(LOCAL_MANIFEST_INSTRUMENTATION_FOR) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 506 | |
| 507 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs) |
| 508 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE) |
| 509 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host) |
| 510 | |
Dima Zavin | 46e9bec | 2009-05-27 19:41:07 -0700 | [diff] [blame] | 511 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates) |
| 512 | |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 513 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX) |
| 514 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 515 | # Tell the module and all of its sub-modules who it is. |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 516 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 517 | |
| 518 | # Provide a short-hand for building this module. |
| 519 | # We name both BUILT and INSTALLED in case |
| 520 | # LOCAL_UNINSTALLABLE_MODULE is set. |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 521 | .PHONY: $(my_register_name) |
| 522 | $(my_register_name): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 523 | |
| 524 | ########################################################### |
| 525 | ## Module installation rule |
| 526 | ########################################################### |
| 527 | |
| 528 | # Some hosts do not have ACP; override the LOCAL version if that's the case. |
| 529 | ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),) |
| 530 | LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE)) |
| 531 | endif |
| 532 | |
| 533 | ifndef LOCAL_UNINSTALLABLE_MODULE |
| 534 | # Define a copy rule to install the module. |
| 535 | # acp and libraries that it uses can't use acp for |
| 536 | # installation; hence, LOCAL_ACP_UNAVAILABLE. |
Ying Wang | e56605a | 2013-02-06 11:44:41 -0800 | [diff] [blame] | 537 | $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 538 | ifneq ($(LOCAL_ACP_UNAVAILABLE),true) |
| 539 | $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP) |
| 540 | @echo "Install: $@" |
Ying Wang | 84ed6fa | 2011-01-18 17:21:20 -0800 | [diff] [blame] | 541 | $(copy-file-to-new-target) |
Ying Wang | e56605a | 2013-02-06 11:44:41 -0800 | [diff] [blame] | 542 | $(PRIVATE_POST_INSTALL_CMD) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 543 | else |
| 544 | $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) |
| 545 | @echo "Install: $@" |
| 546 | $(copy-file-to-target-with-cp) |
| 547 | endif |
| 548 | |
| 549 | endif # !LOCAL_UNINSTALLABLE_MODULE |
| 550 | |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 551 | |
| 552 | ########################################################### |
| 553 | ## CHECK_BUILD goals |
| 554 | ########################################################### |
| 555 | |
Ying Wang | 990cf5e | 2013-08-28 13:04:46 -0700 | [diff] [blame] | 556 | ifdef java_alternative_checked_module |
| 557 | LOCAL_CHECKED_MODULE := $(java_alternative_checked_module) |
| 558 | endif |
| 559 | |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 560 | # If nobody has defined a more specific module for the |
Ying Wang | 5a8d345 | 2013-01-30 14:43:05 -0800 | [diff] [blame] | 561 | # checked modules, use LOCAL_BUILT_MODULE. |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 562 | ifndef LOCAL_CHECKED_MODULE |
Ying Wang | 5a8d345 | 2013-01-30 14:43:05 -0800 | [diff] [blame] | 563 | LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE) |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 564 | endif |
| 565 | |
| 566 | # If they request that this module not be checked, then don't. |
| 567 | # PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT |
| 568 | # GOOD REASON WILL HAVE IT REMOVED. |
| 569 | ifdef LOCAL_DONT_CHECK_MODULE |
| 570 | LOCAL_CHECKED_MODULE := |
| 571 | endif |
Ying Wang | 966c1e0 | 2014-05-20 14:43:51 -0700 | [diff] [blame] | 572 | # Don't check build target module defined for the 2nd arch |
| 573 | ifndef LOCAL_IS_HOST_MODULE |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 574 | ifdef LOCAL_2ND_ARCH_VAR_PREFIX |
| 575 | LOCAL_CHECKED_MODULE := |
| 576 | endif |
Ying Wang | 966c1e0 | 2014-05-20 14:43:51 -0700 | [diff] [blame] | 577 | endif |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 578 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 579 | ########################################################### |
| 580 | ## Register with ALL_MODULES |
| 581 | ########################################################### |
| 582 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 583 | ALL_MODULES += $(my_register_name) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 584 | |
| 585 | # Don't use += on subvars, or else they'll end up being |
| 586 | # recursively expanded. |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 587 | ALL_MODULES.$(my_register_name).CLASS := \ |
| 588 | $(ALL_MODULES.$(my_register_name).CLASS) $(LOCAL_MODULE_CLASS) |
| 589 | ALL_MODULES.$(my_register_name).PATH := \ |
| 590 | $(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH) |
| 591 | ALL_MODULES.$(my_register_name).TAGS := \ |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 592 | $(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 593 | ALL_MODULES.$(my_register_name).CHECKED := \ |
| 594 | $(ALL_MODULES.$(my_register_name).CHECKED) $(LOCAL_CHECKED_MODULE) |
| 595 | ALL_MODULES.$(my_register_name).BUILT := \ |
| 596 | $(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE) |
Ying Wang | 74c9850 | 2014-05-19 13:03:36 -0700 | [diff] [blame] | 597 | ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 598 | ALL_MODULES.$(my_register_name).INSTALLED := \ |
| 599 | $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) $(LOCAL_INSTALLED_MODULE)) |
Ying Wang | 74c9850 | 2014-05-19 13:03:36 -0700 | [diff] [blame] | 600 | ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \ |
| 601 | $(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED)$(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE)) |
| 602 | endif |
Ying Wang | 989ac38 | 2014-05-05 16:46:52 -0700 | [diff] [blame] | 603 | ifdef LOCAL_PICKUP_FILES |
| 604 | # Files or directories ready to pick up by the build system |
| 605 | # when $(LOCAL_BUILT_MODULE) is done. |
| 606 | ALL_MODULES.$(my_register_name).PICKUP_FILES := \ |
| 607 | $(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES) |
| 608 | endif |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 609 | ALL_MODULES.$(my_register_name).REQUIRED := \ |
Ying Wang | 14a6cbd | 2014-02-10 22:26:23 -0800 | [diff] [blame] | 610 | $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(LOCAL_REQUIRED_MODULES) \ |
| 611 | $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))) |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 612 | ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \ |
| 613 | $(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags) |
| 614 | ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR := \ |
| 615 | $(ALL_MODULES.$(my_register_name).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR) |
| 616 | ALL_MODULES.$(my_register_name).MAKEFILE := \ |
| 617 | $(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE) |
Ying Wang | dbb31be | 2011-12-09 15:11:57 -0800 | [diff] [blame] | 618 | ifdef LOCAL_MODULE_OWNER |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 619 | ALL_MODULES.$(my_register_name).OWNER := \ |
| 620 | $(sort $(ALL_MODULES.$(my_register_name).OWNER) $(LOCAL_MODULE_OWNER)) |
Ying Wang | dbb31be | 2011-12-09 15:11:57 -0800 | [diff] [blame] | 621 | endif |
Ying Wang | 14a6cbd | 2014-02-10 22:26:23 -0800 | [diff] [blame] | 622 | ifdef LOCAL_2ND_ARCH_VAR_PREFIX |
| 623 | ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true |
| 624 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 625 | |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 626 | INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name) |
Joe Onorato | 8a06bac | 2010-05-21 14:29:29 -0700 | [diff] [blame] | 627 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 628 | ########################################################### |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 629 | ## Take care of my_module_tags |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 630 | ########################################################### |
| 631 | |
| 632 | # Keep track of all the tags we've seen. |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 633 | ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 634 | |
| 635 | # Add this module to the tag list of each specified tag. |
| 636 | # Don't use "+=". If the variable hasn't been set with ":=", |
| 637 | # it will default to recursive expansion. |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 638 | $(foreach tag,$(my_module_tags),\ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 639 | $(eval ALL_MODULE_TAGS.$(tag) := \ |
Ying Wang | 1d977e3 | 2013-01-30 11:22:06 -0800 | [diff] [blame] | 640 | $(ALL_MODULE_TAGS.$(tag)) \ |
| 641 | $(LOCAL_INSTALLED_MODULE))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 642 | |
| 643 | # Add this module name to the tag list of each specified tag. |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 644 | $(foreach tag,$(my_module_tags),\ |
Ying Wang | 6ef6519 | 2014-01-15 16:02:16 -0800 | [diff] [blame] | 645 | $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 646 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 647 | ########################################################### |
Ying Wang | ef4d82f | 2013-01-29 16:59:18 -0800 | [diff] [blame] | 648 | ## umbrella targets used to verify builds |
| 649 | ########################################################### |
Ying Wang | ef4d82f | 2013-01-29 16:59:18 -0800 | [diff] [blame] | 650 | j_or_n := |
| 651 | ifneq (,$(filter EXECUTABLES SHARED_LIBRARIES STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS))) |
| 652 | j_or_n := native |
| 653 | else |
| 654 | ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS))) |
| 655 | j_or_n := java |
Ying Wang | ef4d82f | 2013-01-29 16:59:18 -0800 | [diff] [blame] | 656 | endif |
| 657 | endif |
| 658 | ifdef LOCAL_IS_HOST_MODULE |
| 659 | h_or_t := host |
| 660 | else |
| 661 | h_or_t := target |
| 662 | endif |
| 663 | |
| 664 | ifdef j_or_n |
Ying Wang | 1d977e3 | 2013-01-30 11:22:06 -0800 | [diff] [blame] | 665 | $(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(LOCAL_CHECKED_MODULE) |
Ying Wang | 37bd1f2 | 2014-01-27 15:19:09 -0800 | [diff] [blame] | 666 | ifneq (,$(filter $(my_module_tags),tests)) |
Ying Wang | 1d977e3 | 2013-01-30 11:22:06 -0800 | [diff] [blame] | 667 | $(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(LOCAL_CHECKED_MODULE) |
Ying Wang | ef4d82f | 2013-01-29 16:59:18 -0800 | [diff] [blame] | 668 | endif |
| 669 | endif |
| 670 | |
| 671 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 672 | ## NOTICE files |
| 673 | ########################################################### |
| 674 | |
Ying Wang | 13d6950 | 2012-11-01 17:22:33 -0700 | [diff] [blame] | 675 | include $(BUILD_NOTICE_FILE) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 676 | |
| 677 | #:vi noexpandtab |