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 |
| 37 | my_prefix:=HOST_ |
| 38 | my_host:=host- |
| 39 | else |
| 40 | my_prefix:=TARGET_ |
| 41 | my_host:= |
| 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 |
| 53 | #comma := , |
| 54 | #empty := |
| 55 | #space := $(empty) $(empty) |
| 56 | #$(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) |
| 57 | |
| 58 | LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS)) |
| 59 | ifeq (,$(LOCAL_MODULE_TAGS)) |
| 60 | # Modules without tags fall back to user (which is changed to user eng below) |
| 61 | LOCAL_MODULE_TAGS := user |
| 62 | #$(warning default tags: $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST)))) |
| 63 | endif |
| 64 | |
Jean-Baptiste Queru | a831cbd | 2010-01-07 11:06:50 -0800 | [diff] [blame] | 65 | # Only the tags mentioned in this test are expected to be set by module |
| 66 | # makefiles. Anything else is either a typo or a source of unexpected |
| 67 | # behaviors. |
| 68 | ifneq ($(filter-out user debug eng tests optional samples,$(LOCAL_MODULE_TAGS)),) |
| 69 | $(warning unusual tags $(LOCAL_MODULE_TAGS) on $(LOCAL_MODULE) at $(LOCAL_PATH)) |
| 70 | endif |
| 71 | |
Jean-Baptiste Queru | 39de432 | 2010-09-03 16:32:58 -0700 | [diff] [blame] | 72 | ifneq ($(filter $(LOCAL_MODULE_TAGS),user),) |
| 73 | ifeq ($(filter $(GRANDFATHERED_USER_MODULES),$(LOCAL_MODULE)),) |
| 74 | $(warning using user tag on $(LOCAL_MODULE) at $(LOCAL_PATH)) |
| 75 | endif |
| 76 | endif |
| 77 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 78 | # Add implicit tags. |
| 79 | # |
| 80 | # If the local directory or one of its parents contains a MODULE_LICENSE_GPL |
| 81 | # file, tag the module as "gnu". Search for "*_GNU*" so that we can also |
| 82 | # find files like MODULE_LICENSE_GPL_AND_AFL but exclude files like |
| 83 | # MODULE_LICENSE_LGPL. |
| 84 | # |
| 85 | ifneq ($(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL*),) |
| 86 | LOCAL_MODULE_TAGS += gnu |
| 87 | endif |
| 88 | |
| 89 | # |
| 90 | # If this module is listed on CUSTOM_MODULES, promote it to "user" |
| 91 | # so that it will be installed in $(TARGET_OUT). |
| 92 | # |
| 93 | ifneq (,$(filter $(LOCAL_MODULE),$(CUSTOM_MODULES))) |
| 94 | LOCAL_MODULE_TAGS := $(sort $(LOCAL_MODULE_TAGS) user) |
| 95 | endif |
| 96 | |
| 97 | # The definition of should-install-to-system will be different depending |
The Android Open Source Project | 2f31293 | 2009-03-09 11:52:11 -0700 | [diff] [blame] | 98 | # on which goal (e.g., sdk or just droid) is being built. |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 99 | ifdef LOCAL_IS_HOST_MODULE |
| 100 | use_data := |
| 101 | else |
| 102 | use_data := $(if $(call should-install-to-system,$(LOCAL_MODULE_TAGS)),,_DATA) |
| 103 | endif |
| 104 | |
| 105 | LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS)) |
| 106 | ifneq ($(words $(LOCAL_MODULE_CLASS)),1) |
| 107 | $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)") |
| 108 | endif |
| 109 | |
Jean-Baptiste Queru | 6907cfe | 2010-01-07 11:19:39 -0800 | [diff] [blame] | 110 | # Those used to be implicitly ignored, but aren't any more. |
| 111 | # As of 20100110 there are no apps with the user tag. |
| 112 | ifeq ($(LOCAL_MODULE_CLASS),APPS) |
| 113 | ifneq ($(filter $(LOCAL_MODULE_TAGS),user),) |
| 114 | $(warning user tag on app $(LOCAL_MODULE) at $(LOCAL_PATH) - add your app to core.mk instead) |
| 115 | endif |
| 116 | endif |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 117 | |
| 118 | LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH)) |
| 119 | ifeq ($(LOCAL_MODULE_PATH),) |
| 120 | LOCAL_MODULE_PATH := $($(my_prefix)OUT$(use_data)_$(LOCAL_MODULE_CLASS)) |
| 121 | ifeq ($(strip $(LOCAL_MODULE_PATH)),) |
| 122 | $(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)") |
| 123 | endif |
| 124 | endif |
| 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 | ########################################################### |
| 144 | LOCAL_MODULE_STEM := $(strip $(LOCAL_MODULE_STEM)) |
| 145 | ifeq ($(LOCAL_MODULE_STEM),) |
| 146 | LOCAL_MODULE_STEM := $(LOCAL_MODULE) |
| 147 | endif |
| 148 | LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE_STEM)$(LOCAL_MODULE_SUFFIX) |
| 149 | |
| 150 | LOCAL_BUILT_MODULE_STEM := $(strip $(LOCAL_BUILT_MODULE_STEM)) |
| 151 | ifeq ($(LOCAL_BUILT_MODULE_STEM),) |
| 152 | LOCAL_BUILT_MODULE_STEM := $(LOCAL_INSTALLED_MODULE_STEM) |
| 153 | endif |
| 154 | |
| 155 | # OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the |
| 156 | # internal SHARED_LIBRARIES build files. |
| 157 | OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH)) |
| 158 | ifdef OVERRIDE_BUILT_MODULE_PATH |
| 159 | ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) |
| 160 | $(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH) |
| 161 | endif |
| 162 | built_module_path := $(OVERRIDE_BUILT_MODULE_PATH) |
| 163 | else |
| 164 | built_module_path := $(intermediates) |
| 165 | endif |
| 166 | LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM) |
| 167 | built_module_path := |
| 168 | |
| 169 | # LOCAL_UNINSTALLABLE_MODULE is only allowed to be used by the |
| 170 | # internal STATIC_LIBRARIES build files. |
| 171 | LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE)) |
| 172 | ifdef LOCAL_UNINSTALLABLE_MODULE |
| 173 | ifeq (,$(filter $(LOCAL_MODULE_CLASS),JAVA_LIBRARIES STATIC_LIBRARIES)) |
| 174 | $(error $(LOCAL_PATH): Illegal use of LOCAL_UNINSTALLABLE_MODULE) |
| 175 | endif |
| 176 | else |
| 177 | LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE_SUBDIR)$(LOCAL_INSTALLED_MODULE_STEM) |
| 178 | endif |
| 179 | |
| 180 | # Assemble the list of targets to create PRIVATE_ variables for. |
| 181 | LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE) |
| 182 | |
| 183 | |
| 184 | ########################################################### |
| 185 | ## AIDL: Compile .aidl files to .java |
| 186 | ########################################################### |
| 187 | |
| 188 | aidl_sources := $(filter %.aidl,$(LOCAL_SRC_FILES)) |
| 189 | |
| 190 | ifneq ($(strip $(aidl_sources)),) |
| 191 | |
| 192 | aidl_java_sources := $(patsubst %.aidl,%.java,$(addprefix $(intermediates.COMMON)/src/, $(aidl_sources))) |
| 193 | aidl_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(aidl_sources)) |
| 194 | |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 195 | aidl_preprocess_import := |
| 196 | LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION)) |
| 197 | ifdef LOCAL_SDK_VERSION |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 198 | ifeq ($(LOCAL_SDK_VERSION),current) |
| 199 | aidl_preprocess_import := $(TARGET_OUT_COMMON_INTERMEDIATES)/framework.aidl |
| 200 | else |
| 201 | aidl_preprocess_import := $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 202 | endif # !current |
| 203 | endif # LOCAL_SDK_VERSION |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 204 | $(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] | 205 | |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 206 | $(aidl_java_sources): $(intermediates.COMMON)/src/%.java: $(TOPDIR)$(LOCAL_PATH)/%.aidl $(PRIVATE_ADDITIONAL_DEPENDENCIES) $(AIDL) $(aidl_preprocess_import) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 207 | $(transform-aidl-to-java) |
| 208 | -include $(aidl_java_sources:%.java=%.P) |
| 209 | |
| 210 | else |
| 211 | aidl_java_sources := |
| 212 | endif |
| 213 | |
| 214 | ########################################################### |
Doug Zongker | 9bd4962 | 2009-11-30 14:28:59 -0800 | [diff] [blame] | 215 | ## logtags: Add .logtags files to global list, emit java source |
| 216 | ########################################################### |
| 217 | |
| 218 | logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES)) |
| 219 | |
| 220 | ifneq ($(strip $(logtags_sources)),) |
| 221 | |
| 222 | event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources)) |
| 223 | |
| 224 | # Emit a java source file with constants for the tags, if |
| 225 | # LOCAL_MODULE_CLASS is "APPS" or "JAVA_LIBRARIES". |
| 226 | ifneq ($(strip $(filter $(LOCAL_MODULE_CLASS),APPS JAVA_LIBRARIES)),) |
| 227 | |
| 228 | logtags_java_sources := $(patsubst %.logtags,%.java,$(addprefix $(intermediates.COMMON)/src/, $(logtags_sources))) |
| 229 | logtags_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(logtags_sources)) |
| 230 | |
Joe Onorato | b751053 | 2010-07-14 10:22:54 -0700 | [diff] [blame] | 231 | $(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] | 232 | $(transform-logtags-to-java) |
| 233 | |
| 234 | endif |
| 235 | |
| 236 | else |
| 237 | logtags_java_sources := |
| 238 | event_log_tags := |
| 239 | endif |
| 240 | |
| 241 | ########################################################### |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 242 | ## Java: Compile .java files to .class |
| 243 | ########################################################### |
| 244 | #TODO: pull this into java.make once host and target are combined |
| 245 | |
Ying Wang | 5291130 | 2010-05-26 13:13:56 -0700 | [diff] [blame] | 246 | java_sources := $(addprefix $(TOP_DIR)$(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) $(aidl_java_sources) $(logtags_java_sources) \ |
| 247 | $(filter %.java,$(LOCAL_GENERATED_SOURCES)) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 248 | all_java_sources := $(java_sources) $(addprefix $($(my_prefix)OUT_COMMON_INTERMEDIATES)/, $(filter %.java,$(LOCAL_INTERMEDIATE_SOURCES))) |
| 249 | |
| 250 | ## Java resources ######################################### |
| 251 | |
| 252 | # Look for resource files in any specified directories. |
| 253 | # Non-java and non-doc files will be picked up as resources |
| 254 | # and included in the output jar file. |
| 255 | java_resource_file_groups := |
| 256 | |
| 257 | LOCAL_JAVA_RESOURCE_DIRS := $(strip $(LOCAL_JAVA_RESOURCE_DIRS)) |
| 258 | ifneq ($(LOCAL_JAVA_RESOURCE_DIRS),) |
| 259 | # This makes a list of words like |
| 260 | # <dir1>::<file1>:<file2> <dir2>::<file1> <dir3>: |
| 261 | # where each of the files is relative to the directory it's grouped with. |
| 262 | # Directories that don't contain any resource files will result in groups |
| 263 | # that end with a colon, and they are stripped out in the next step. |
| 264 | java_resource_file_groups += \ |
| 265 | $(foreach dir,$(LOCAL_JAVA_RESOURCE_DIRS), \ |
| 266 | $(subst $(space),:,$(strip \ |
| 267 | $(TOP_DIR)$(LOCAL_PATH)/$(dir): \ |
| 268 | $(patsubst ./%,%,$(shell cd $(TOP_DIR)$(LOCAL_PATH)/$(dir) && \ |
| 269 | find . \ |
| 270 | -type d -a -name ".svn" -prune -o \ |
| 271 | -type f \ |
| 272 | -a \! -name "*.java" \ |
| 273 | -a \! -name "package.html" \ |
| 274 | -a \! -name "overview.html" \ |
| 275 | -a \! -name ".*.swp" \ |
| 276 | -a \! -name ".DS_Store" \ |
| 277 | -a \! -name "*~" \ |
| 278 | -print \ |
| 279 | )) \ |
| 280 | )) \ |
| 281 | ) |
| 282 | java_resource_file_groups := $(filter-out %:,$(java_resource_file_groups)) |
| 283 | endif # LOCAL_JAVA_RESOURCE_DIRS |
| 284 | |
| 285 | LOCAL_JAVA_RESOURCE_FILES := $(strip $(LOCAL_JAVA_RESOURCE_FILES)) |
| 286 | ifneq ($(LOCAL_JAVA_RESOURCE_FILES),) |
| 287 | java_resource_file_groups += \ |
| 288 | $(foreach f,$(LOCAL_JAVA_RESOURCE_FILES), \ |
| 289 | $(patsubst %/,%,$(dir $(f)))::$(notdir $(f)) \ |
| 290 | ) |
| 291 | endif # LOCAL_JAVA_RESOURCE_FILES |
| 292 | |
| 293 | ifdef java_resource_file_groups |
| 294 | # The full paths to all resources, used for dependencies. |
| 295 | java_resource_sources := \ |
| 296 | $(foreach group,$(java_resource_file_groups), \ |
| 297 | $(addprefix $(word 1,$(subst :,$(space),$(group)))/, \ |
| 298 | $(wordlist 2,9999,$(subst :,$(space),$(group))) \ |
| 299 | ) \ |
| 300 | ) |
| 301 | # The arguments to jar that will include these files in a jar file. |
| 302 | extra_jar_args := \ |
| 303 | $(foreach group,$(java_resource_file_groups), \ |
| 304 | $(addprefix -C $(word 1,$(subst :,$(space),$(group))) , \ |
| 305 | $(wordlist 2,9999,$(subst :,$(space),$(group))) \ |
| 306 | ) \ |
| 307 | ) |
| 308 | java_resource_file_groups := |
| 309 | else |
| 310 | java_resource_sources := |
| 311 | extra_jar_args := |
| 312 | endif # java_resource_file_groups |
| 313 | |
| 314 | ## PRIVATE java vars ###################################### |
| 315 | |
| 316 | ifneq ($(strip $(all_java_sources)$(all_res_assets)),) |
| 317 | |
| 318 | full_static_java_libs := \ |
| 319 | $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ |
| 320 | $(call intermediates-dir-for, \ |
| 321 | JAVA_LIBRARIES,$(lib),$(LOCAL_IS_HOST_MODULE))/javalib.jar) |
| 322 | |
| 323 | $(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] | 324 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates)/classes |
| 325 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates)/src |
| 326 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources) |
| 327 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES)) |
| 328 | ifeq ($(my_prefix),TARGET_) |
Joe Onorato | e62902c | 2009-09-23 15:28:12 -0700 | [diff] [blame] | 329 | ifeq ($(LOCAL_SDK_VERSION),) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 330 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core) |
Ying Wang | a07d37b | 2010-06-09 11:43:33 -0700 | [diff] [blame] | 331 | else |
| 332 | ifeq ($(LOCAL_SDK_VERSION),current) |
| 333 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,android_stubs_current) |
| 334 | else |
| 335 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION)) |
| 336 | endif # current |
| 337 | endif # LOCAL_SDK_VERSION |
| 338 | endif # TARGET_ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 339 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR) |
| 340 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) |
| 341 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR) |
| 342 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_STATIC_JAVA_LIBRARIES := $(full_static_java_libs) |
| 343 | |
| 344 | # full_java_libs: The list of files that should be used as the classpath. |
| 345 | # Using this list as a dependency list WILL NOT WORK. |
| 346 | # full_java_lib_deps: Should be specified as a prerequisite of this module |
| 347 | # to guarantee that the files in full_java_libs will |
| 348 | # be up-to-date. |
| 349 | ifdef LOCAL_IS_HOST_MODULE |
| 350 | # TODO: make prebuilt java libraries use the same |
| 351 | # intermediates path pattern as target java libraries. |
| 352 | full_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES))) |
| 353 | full_java_lib_deps := $(full_java_libs) |
| 354 | else |
Ying Wang | e3265fb | 2010-01-25 09:56:41 -0800 | [diff] [blame] | 355 | ifdef LOCAL_SDK_VERSION |
| 356 | ifneq ($(LOCAL_SDK_VERSION),current) |
| 357 | full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 358 | # For prebuilt sdk versions, we can't depend on the javalib.jar but classes.jar. |
| 359 | full_java_lib_deps := $(call java-lib-deps,$(filter-out sdk_v$(LOCAL_SDK_VERSION),$(LOCAL_JAVA_LIBRARIES)),$(LOCAL_IS_HOST_MODULE)) |
| 360 | full_java_lib_deps += $(call java-lib-files,sdk_v$(LOCAL_SDK_VERSION),$(LOCAL_IS_HOST_MODULE)) |
| 361 | else |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 362 | full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 363 | 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] | 364 | endif # !current |
| 365 | else |
| 366 | full_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 367 | full_java_lib_deps := $(call java-lib-deps,$(LOCAL_JAVA_LIBRARIES),$(LOCAL_IS_HOST_MODULE)) |
| 368 | endif # LOCAL_SDK_VERSION |
| 369 | endif # !LOCAL_IS_HOST_MODULE |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 370 | full_java_libs += $(full_static_java_libs) $(LOCAL_CLASSPATH) |
| 371 | full_java_lib_deps += $(full_static_java_libs) $(LOCAL_CLASSPATH) |
| 372 | |
| 373 | # This is set by packages that contain instrumentation, allowing them to |
| 374 | # link against the package they are instrumenting. Currently only one such |
| 375 | # package is allowed. |
| 376 | LOCAL_INSTRUMENTATION_FOR := $(strip $(LOCAL_INSTRUMENTATION_FOR)) |
| 377 | ifdef LOCAL_INSTRUMENTATION_FOR |
| 378 | ifneq ($(words $(LOCAL_INSTRUMENTATION_FOR)),1) |
| 379 | $(error \ |
| 380 | $(LOCAL_PATH): Multiple LOCAL_INSTRUMENTATION_FOR members defined) |
| 381 | endif |
| 382 | |
| 383 | link_instr_intermediates_dir := $(call intermediates-dir-for, \ |
| 384 | APPS,$(LOCAL_INSTRUMENTATION_FOR)) |
| 385 | link_instr_intermediates_dir.COMMON := $(call intermediates-dir-for, \ |
| 386 | APPS,$(LOCAL_INSTRUMENTATION_FOR),,COMMON) |
| 387 | |
Ying Wang | 3b2bdf1 | 2010-02-01 09:51:23 -0800 | [diff] [blame] | 388 | # link against the jar with full original names (before proguard processing). |
| 389 | full_java_libs += $(link_instr_intermediates_dir.COMMON)/classes-full-names.jar |
Joe Onorato | 14d9515 | 2010-07-14 19:49:05 -0700 | [diff] [blame] | 390 | full_java_lib_deps += $(link_instr_intermediates_dir.COMMON)/classes-full-names.jar |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 391 | endif |
| 392 | |
| 393 | ifneq ($(strip $(LOCAL_JAR_MANIFEST)),) |
| 394 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := $(LOCAL_PATH)/$(LOCAL_JAR_MANIFEST) |
| 395 | else |
| 396 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAR_MANIFEST := |
| 397 | endif |
| 398 | |
| 399 | endif |
| 400 | |
| 401 | |
| 402 | ########################################################### |
| 403 | ## make clean- targets |
| 404 | ########################################################### |
| 405 | cleantarget := clean-$(LOCAL_MODULE) |
| 406 | $(cleantarget) : PRIVATE_MODULE := $(LOCAL_MODULE) |
| 407 | $(cleantarget) : PRIVATE_CLEAN_FILES := \ |
| 408 | $(PRIVATE_CLEAN_FILES) \ |
| 409 | $(LOCAL_BUILT_MODULE) \ |
| 410 | $(LOCAL_INSTALLED_MODULE) \ |
| 411 | $(intermediates) |
| 412 | $(cleantarget):: |
| 413 | @echo "Clean: $(PRIVATE_MODULE)" |
| 414 | $(hide) rm -rf $(PRIVATE_CLEAN_FILES) |
| 415 | |
| 416 | ########################################################### |
| 417 | ## Common definitions for module. |
| 418 | ########################################################### |
| 419 | |
| 420 | # Propagate local configuration options to this target. |
| 421 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH) |
| 422 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_POST_PROCESS_COMMAND:= $(LOCAL_POST_PROCESS_COMMAND) |
| 423 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_AAPT_FLAGS:= $(LOCAL_AAPT_FLAGS) |
| 424 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_JAVA_LIBRARIES:= $(LOCAL_JAVA_LIBRARIES) |
Jeff Hamilton | bb67d21 | 2010-02-05 22:36:42 -0600 | [diff] [blame] | 425 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MANIFEST_PACKAGE_NAME:= $(LOCAL_MANIFEST_PACKAGE_NAME) |
Ying Wang | 3dae0ee | 2010-09-02 15:41:01 -0700 | [diff] [blame] | 426 | $(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] | 427 | |
| 428 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_ALL_JAVA_LIBRARIES:= $(full_java_libs) |
| 429 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE) |
| 430 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host) |
| 431 | |
Dima Zavin | 46e9bec | 2009-05-27 19:41:07 -0700 | [diff] [blame] | 432 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates) |
| 433 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 434 | # Tell the module and all of its sub-modules who it is. |
| 435 | $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(LOCAL_MODULE) |
| 436 | |
| 437 | # Provide a short-hand for building this module. |
| 438 | # We name both BUILT and INSTALLED in case |
| 439 | # LOCAL_UNINSTALLABLE_MODULE is set. |
| 440 | .PHONY: $(LOCAL_MODULE) |
| 441 | $(LOCAL_MODULE): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE) |
| 442 | |
| 443 | ########################################################### |
| 444 | ## Module installation rule |
| 445 | ########################################################### |
| 446 | |
| 447 | # Some hosts do not have ACP; override the LOCAL version if that's the case. |
| 448 | ifneq ($(strip $(HOST_ACP_UNAVAILABLE)),) |
| 449 | LOCAL_ACP_UNAVAILABLE := $(strip $(HOST_ACP_UNAVAILABLE)) |
| 450 | endif |
| 451 | |
| 452 | ifndef LOCAL_UNINSTALLABLE_MODULE |
| 453 | # Define a copy rule to install the module. |
| 454 | # acp and libraries that it uses can't use acp for |
| 455 | # installation; hence, LOCAL_ACP_UNAVAILABLE. |
| 456 | ifneq ($(LOCAL_ACP_UNAVAILABLE),true) |
| 457 | $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP) |
| 458 | @echo "Install: $@" |
| 459 | $(copy-file-to-target) |
| 460 | else |
| 461 | $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) |
| 462 | @echo "Install: $@" |
| 463 | $(copy-file-to-target-with-cp) |
| 464 | endif |
| 465 | |
| 466 | endif # !LOCAL_UNINSTALLABLE_MODULE |
| 467 | |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 468 | |
| 469 | ########################################################### |
| 470 | ## CHECK_BUILD goals |
| 471 | ########################################################### |
| 472 | |
| 473 | # If nobody has defined a more specific module for the |
| 474 | # checked modules, use LOCAL_BUILT_MODULE. This was old |
| 475 | # behavior, so it should be a safe default. |
| 476 | ifndef LOCAL_CHECKED_MODULE |
Joe Onorato | 05c7f61 | 2010-01-05 12:47:14 -0800 | [diff] [blame] | 477 | ifndef LOCAL_SDK_VERSION |
| 478 | LOCAL_CHECKED_MODULE := $(LOCAL_BUILT_MODULE) |
| 479 | endif |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 480 | endif |
| 481 | |
| 482 | # If they request that this module not be checked, then don't. |
| 483 | # PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT |
| 484 | # GOOD REASON WILL HAVE IT REMOVED. |
| 485 | ifdef LOCAL_DONT_CHECK_MODULE |
| 486 | LOCAL_CHECKED_MODULE := |
| 487 | endif |
| 488 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 489 | ########################################################### |
| 490 | ## Register with ALL_MODULES |
| 491 | ########################################################### |
| 492 | |
| 493 | ALL_MODULES += $(LOCAL_MODULE) |
| 494 | |
| 495 | # Don't use += on subvars, or else they'll end up being |
| 496 | # recursively expanded. |
Joe Onorato | 8a06bac | 2010-05-21 14:29:29 -0700 | [diff] [blame] | 497 | ALL_MODULES.$(LOCAL_MODULE).CLASS := \ |
| 498 | $(ALL_MODULES.$(LOCAL_MODULE).CLASS) $(LOCAL_MODULE_CLASS) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 499 | ALL_MODULES.$(LOCAL_MODULE).PATH := \ |
| 500 | $(ALL_MODULES.$(LOCAL_MODULE).PATH) $(LOCAL_PATH) |
| 501 | ALL_MODULES.$(LOCAL_MODULE).TAGS := \ |
| 502 | $(ALL_MODULES.$(LOCAL_MODULE).TAGS) $(LOCAL_MODULE_TAGS) |
Joe Onorato | e334d25 | 2009-07-17 15:33:40 -0400 | [diff] [blame] | 503 | ALL_MODULES.$(LOCAL_MODULE).CHECKED := \ |
| 504 | $(ALL_MODULES.$(LOCAL_MODULE).CHECKED) $(LOCAL_CHECKED_MODULE) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 505 | ALL_MODULES.$(LOCAL_MODULE).BUILT := \ |
| 506 | $(ALL_MODULES.$(LOCAL_MODULE).BUILT) $(LOCAL_BUILT_MODULE) |
| 507 | ALL_MODULES.$(LOCAL_MODULE).INSTALLED := \ |
| 508 | $(ALL_MODULES.$(LOCAL_MODULE).INSTALLED) $(LOCAL_INSTALLED_MODULE) |
| 509 | ALL_MODULES.$(LOCAL_MODULE).REQUIRED := \ |
| 510 | $(ALL_MODULES.$(LOCAL_MODULE).REQUIRED) $(LOCAL_REQUIRED_MODULES) |
Doug Zongker | 9bd4962 | 2009-11-30 14:28:59 -0800 | [diff] [blame] | 511 | ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \ |
| 512 | $(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags) |
Joe Onorato | 77dc0a5 | 2010-05-17 18:16:11 -0700 | [diff] [blame] | 513 | ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \ |
Ying Wang | 01c3517 | 2010-05-17 19:07:21 -0700 | [diff] [blame] | 514 | $(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 515 | |
Joe Onorato | 8a06bac | 2010-05-21 14:29:29 -0700 | [diff] [blame] | 516 | INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE) |
| 517 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 518 | ########################################################### |
| 519 | ## Take care of LOCAL_MODULE_TAGS |
| 520 | ########################################################### |
| 521 | |
| 522 | # Keep track of all the tags we've seen. |
| 523 | ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(LOCAL_MODULE_TAGS)) |
| 524 | |
| 525 | # Add this module to the tag list of each specified tag. |
| 526 | # Don't use "+=". If the variable hasn't been set with ":=", |
| 527 | # it will default to recursive expansion. |
| 528 | $(foreach tag,$(LOCAL_MODULE_TAGS),\ |
| 529 | $(eval ALL_MODULE_TAGS.$(tag) := \ |
| 530 | $(ALL_MODULE_TAGS.$(tag)) \ |
| 531 | $(LOCAL_INSTALLED_MODULE))) |
| 532 | |
| 533 | # Add this module name to the tag list of each specified tag. |
| 534 | $(foreach tag,$(LOCAL_MODULE_TAGS),\ |
| 535 | $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(LOCAL_MODULE))) |
| 536 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 537 | ########################################################### |
| 538 | ## NOTICE files |
| 539 | ########################################################### |
| 540 | |
| 541 | include $(BUILD_SYSTEM)/notice_files.mk |
| 542 | |
| 543 | #:vi noexpandtab |