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