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