Home | History | Annotate | Download | only in core
      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 # Catch users that directly include base_rules.mk
     18 $(call record-module-type,base_rules)
     19 
     20 # Users can define base-rules-hook in their buildspec.mk to perform
     21 # arbitrary operations as each module is included.
     22 ifdef base-rules-hook
     23 $(if $(base-rules-hook),)
     24 endif
     25 
     26 ###########################################################
     27 ## Common instructions for a generic module.
     28 ###########################################################
     29 
     30 LOCAL_MODULE := $(strip $(LOCAL_MODULE))
     31 ifeq ($(LOCAL_MODULE),)
     32   $(error $(LOCAL_PATH): LOCAL_MODULE is not defined)
     33 endif
     34 
     35 LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
     36 LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE))
     37 ifdef LOCAL_IS_HOST_MODULE
     38   ifneq ($(LOCAL_IS_HOST_MODULE),true)
     39     $(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
     40   endif
     41   ifeq ($(LOCAL_HOST_PREFIX),)
     42     my_prefix := HOST_
     43   else
     44     my_prefix := $(LOCAL_HOST_PREFIX)
     45   endif
     46   my_host := host-
     47   my_kind := HOST
     48 else
     49   ifdef LOCAL_IS_AUX_MODULE
     50     ifneq ($(LOCAL_IS_AUX_MODULE),true)
     51       $(error $(LOCAL_PATH): LOCAL_IS_AUX_MODULE must be "true" or empty, not "$(LOCAL_IS_AUX_MODULE)")
     52     endif
     53     my_prefix := AUX_
     54     my_kind := AUX
     55   else
     56     my_prefix := TARGET_
     57     my_kind :=
     58   endif
     59   my_host :=
     60 endif
     61 
     62 ifeq ($(my_prefix),HOST_CROSS_)
     63   my_host_cross := true
     64 else
     65   my_host_cross :=
     66 endif
     67 
     68 ifndef LOCAL_PROPRIETARY_MODULE
     69   LOCAL_PROPRIETARY_MODULE := $(LOCAL_VENDOR_MODULE)
     70 endif
     71 ifndef LOCAL_VENDOR_MODULE
     72   LOCAL_VENDOR_MODULE := $(LOCAL_PROPRIETARY_MODULE)
     73 endif
     74 ifneq ($(filter-out $(LOCAL_PROPRIETARY_MODULE),$(LOCAL_VENDOR_MODULE))$(filter-out $(LOCAL_VENDOR_MODULE),$(LOCAL_PROPRIETARY_MODULE)),)
     75 $(call pretty-error,Only one of LOCAL_PROPRIETARY_MODULE[$(LOCAL_PROPRIETARY_MODULE)] and LOCAL_VENDOR_MODULE[$(LOCAL_VENDOR_MODULE)] may be set, or they must be equal)
     76 endif
     77 
     78 include $(BUILD_SYSTEM)/local_vndk.mk
     79 
     80 my_module_tags := $(LOCAL_MODULE_TAGS)
     81 ifeq ($(my_host_cross),true)
     82   my_module_tags :=
     83 endif
     84 ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
     85 ifdef LOCAL_2ND_ARCH_VAR_PREFIX
     86 # Don't pull in modules by tags if this is for translation TARGET_2ND_ARCH.
     87   my_module_tags :=
     88 endif
     89 endif
     90 
     91 # Ninja has an implicit dependency on the command being run, and kati will
     92 # regenerate the ninja manifest if any read makefile changes, so there is no
     93 # need to have dependencies on makefiles.
     94 # This won't catch all the cases where LOCAL_ADDITIONAL_DEPENDENCIES contains
     95 # a .mk file, because a few users of LOCAL_ADDITIONAL_DEPENDENCIES don't include
     96 # base_rules.mk, but it will fix the most common ones.
     97 LOCAL_ADDITIONAL_DEPENDENCIES := $(filter-out %.mk,$(LOCAL_ADDITIONAL_DEPENDENCIES))
     98 
     99 ###########################################################
    100 ## Validate and define fallbacks for input LOCAL_* variables.
    101 ###########################################################
    102 
    103 ## Dump a .csv file of all modules and their tags
    104 #ifneq ($(tag-list-first-time),false)
    105 #$(shell rm -f tag-list.csv)
    106 #tag-list-first-time := false
    107 #endif
    108 #$(shell echo $(lastword $(filter-out config/% out/%,$(MAKEFILE_LIST))),$(LOCAL_MODULE),$(strip $(LOCAL_MODULE_CLASS)),$(subst $(space),$(comma),$(sort $(my_module_tags))) >> tag-list.csv)
    109 
    110 LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
    111 my_module_tags := $(sort $(my_module_tags))
    112 ifeq (,$(my_module_tags))
    113   my_module_tags := optional
    114 endif
    115 
    116 # User tags are not allowed anymore.  Fail early because it will not be installed
    117 # like it used to be.
    118 ifneq ($(filter $(my_module_tags),user),)
    119   $(warning *** Module name: $(LOCAL_MODULE))
    120   $(warning *** Makefile location: $(LOCAL_MODULE_MAKEFILE))
    121   $(warning * )
    122   $(warning * Module is attempting to use the 'user' tag.  This)
    123   $(warning * used to cause the module to be installed automatically.)
    124   $(warning * Now, the module must be listed in the PRODUCT_PACKAGES)
    125   $(warning * section of a product makefile to have it installed.)
    126   $(warning * )
    127   $(error user tag detected on module.)
    128 endif
    129 
    130 # Only the tags mentioned in this test are expected to be set by module
    131 # makefiles. Anything else is either a typo or a source of unexpected
    132 # behaviors.
    133 ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
    134 $(call pretty-warning,unusual tags $(my_module_tags))
    135 endif
    136 
    137 # Add implicit tags.
    138 #
    139 # If the local directory or one of its parents contains a MODULE_LICENSE_GPL
    140 # file, tag the module as "gnu".  Search for "*_GPL*", "*_LGPL*" and "*_MPL*"
    141 # so that we can also find files like MODULE_LICENSE_GPL_AND_AFL
    142 #
    143 license_files := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*)
    144 gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)
    145 ifneq ($(gpl_license_file),)
    146   my_module_tags += gnu
    147   ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
    148 endif
    149 
    150 LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
    151 ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
    152   $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
    153 endif
    154 
    155 my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32)
    156 
    157 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
    158 ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
    159 # When in TARGET_TRANSLATE_2ND_ARCH both TARGET_ARCH and TARGET_2ND_ARCH are 32-bit,
    160 # to avoid path conflict we force using LOCAL_MODULE_PATH_64 for the first arch.
    161 ifdef LOCAL_2ND_ARCH_VAR_PREFIX
    162 my_multilib_module_path := $(LOCAL_MODULE_PATH_32)
    163 else  # ! LOCAL_2ND_ARCH_VAR_PREFIX
    164 my_multilib_module_path := $(LOCAL_MODULE_PATH_64)
    165 endif  # ! LOCAL_2ND_ARCH_VAR_PREFIX
    166 else  # ! TARGET_TRANSLATE_2ND_ARCH
    167 my_multilib_module_path := $(strip $(LOCAL_MODULE_PATH_$(my_32_64_bit_suffix)))
    168 endif # ! TARGET_TRANSLATE_2ND_ARCH
    169 ifdef my_multilib_module_path
    170 my_module_path := $(my_multilib_module_path)
    171 else
    172 my_module_path := $(strip $(LOCAL_MODULE_PATH))
    173 endif
    174 my_module_path := $(patsubst %/,%,$(my_module_path))
    175 my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH))
    176 ifdef LOCAL_IS_HOST_MODULE
    177   partition_tag :=
    178 else
    179 ifeq (true,$(LOCAL_VENDOR_MODULE))
    180   partition_tag := _VENDOR
    181 else ifeq (true,$(LOCAL_OEM_MODULE))
    182   partition_tag := _OEM
    183 else ifeq (true,$(LOCAL_ODM_MODULE))
    184   partition_tag := _ODM
    185 else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
    186   partition_tag := _DATA
    187 else
    188   # The definition of should-install-to-system will be different depending
    189   # on which goal (e.g., sdk or just droid) is being built.
    190   partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
    191 endif
    192 endif
    193 ifeq ($(my_module_path),)
    194   install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
    195   ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
    196     install_path_var := $(install_path_var)_PRIVILEGED
    197   endif
    198 
    199   my_module_path := $($(install_path_var))
    200   ifeq ($(strip $(my_module_path)),)
    201     $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)")
    202   endif
    203 endif
    204 ifneq ($(my_module_relative_path),)
    205   my_module_path := $(my_module_path)/$(my_module_relative_path)
    206 endif
    207 endif # not LOCAL_UNINSTALLABLE_MODULE
    208 
    209 ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
    210   $(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
    211 endif
    212 
    213 my_register_name := $(LOCAL_MODULE)
    214 ifeq ($(my_host_cross),true)
    215   my_register_name := host_cross_$(LOCAL_MODULE)
    216 endif
    217 ifdef LOCAL_2ND_ARCH_VAR_PREFIX
    218 ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX
    219 my_register_name := $(my_register_name)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX)
    220 endif
    221 endif
    222 
    223 ifeq ($(my_host_cross),true)
    224   my_all_targets := host_cross_$(my_register_name)_all_targets
    225 else ifneq ($(LOCAL_IS_HOST_MODULE),)
    226   my_all_targets := host_$(my_register_name)_all_targets
    227 else
    228   my_all_targets := device_$(my_register_name)_all_targets
    229 endif
    230 
    231 # variant is enough to make nano class unique; it serves as a key to lookup (OS,ARCH) tuple
    232 aux_class := $($(my_prefix)OS_VARIANT)
    233 # Make sure that this IS_HOST/CLASS/MODULE combination is unique.
    234 module_id := MODULE.$(if \
    235     $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),$(if \
    236     $(LOCAL_IS_AUX_MODULE),$(aux_class),TARGET)).$(LOCAL_MODULE_CLASS).$(my_register_name)
    237 ifdef $(module_id)
    238 $(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
    239 endif
    240 $(module_id) := $(LOCAL_PATH)
    241 
    242 intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
    243 intermediates.COMMON := $(call local-intermediates-dir,COMMON)
    244 generated_sources_dir := $(call local-generated-sources-dir)
    245 
    246 ###########################################################
    247 # Pick a name for the intermediate and final targets
    248 ###########################################################
    249 include $(BUILD_SYSTEM)/configure_module_stem.mk
    250 
    251 # OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
    252 # internal SHARED_LIBRARIES build files.
    253 OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
    254 ifdef OVERRIDE_BUILT_MODULE_PATH
    255   ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
    256     $(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
    257   endif
    258   built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
    259 else
    260   built_module_path := $(intermediates)
    261 endif
    262 LOCAL_BUILT_MODULE := $(built_module_path)/$(my_built_module_stem)
    263 
    264 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
    265   # Apk and its attachments reside in its own subdir.
    266   ifeq ($(LOCAL_MODULE_CLASS),APPS)
    267   # framework-res.apk doesn't like the additional layer.
    268   ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
    269   # Neither do Runtime Resource Overlay apks, which contain just the overlaid resources.
    270   else ifeq ($(LOCAL_IS_RUNTIME_RESOURCE_OVERLAY),true)
    271   else
    272     my_module_path := $(my_module_path)/$(LOCAL_MODULE)
    273   endif
    274   endif
    275   LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem)
    276 endif
    277 
    278 # Assemble the list of targets to create PRIVATE_ variables for.
    279 LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
    280 
    281 ###########################################################
    282 ## Create .toc files from shared objects to reduce unnecessary rebuild
    283 # .toc files have the list of external dynamic symbols without their addresses.
    284 # As .KATI_RESTAT is specified to .toc files and commit-change-for-toc is used,
    285 # dependent binaries of a .toc file will be rebuilt only when the content of
    286 # the .toc file is changed.
    287 ###########################################################
    288 ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
    289 LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE).toc
    290 $(LOCAL_BUILT_MODULE).toc: $(LOCAL_BUILT_MODULE)
    291 	$(call $(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)transform-shared-lib-to-toc,$<,$@.tmp)
    292 	$(call commit-change-for-toc,$@)
    293 
    294 # Kati adds restat=1 to ninja. GNU make does nothing for this.
    295 .KATI_RESTAT: $(LOCAL_BUILT_MODULE).toc
    296 # Build .toc file when using mm, mma, or make $(my_register_name)
    297 $(my_all_targets): $(LOCAL_BUILT_MODULE).toc
    298 endif
    299 
    300 ###########################################################
    301 ## logtags: Add .logtags files to global list
    302 ###########################################################
    303 
    304 logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES)) $(LOCAL_LOGTAGS_FILES)
    305 
    306 ifneq ($(strip $(logtags_sources)),)
    307 event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
    308 else
    309 event_log_tags :=
    310 endif
    311 
    312 ###########################################################
    313 ## make clean- targets
    314 ###########################################################
    315 cleantarget := clean-$(my_register_name)
    316 $(cleantarget) : PRIVATE_MODULE := $(my_register_name)
    317 $(cleantarget) : PRIVATE_CLEAN_FILES := \
    318     $(LOCAL_BUILT_MODULE) \
    319     $(LOCAL_INSTALLED_MODULE) \
    320     $(intermediates)
    321 $(cleantarget)::
    322 	@echo "Clean: $(PRIVATE_MODULE)"
    323 	$(hide) rm -rf $(PRIVATE_CLEAN_FILES)
    324 
    325 ###########################################################
    326 ## Common definitions for module.
    327 ###########################################################
    328 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
    329 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
    330 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_AUX_MODULE := $(LOCAL_IS_AUX_MODULE)
    331 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
    332 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix)
    333 
    334 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
    335 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
    336 
    337 # Tell the module and all of its sub-modules who it is.
    338 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name)
    339 
    340 # Provide a short-hand for building this module.
    341 # We name both BUILT and INSTALLED in case
    342 # LOCAL_UNINSTALLABLE_MODULE is set.
    343 .PHONY: $(my_all_targets)
    344 $(my_all_targets): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
    345 
    346 .PHONY: $(my_register_name)
    347 $(my_register_name): $(my_all_targets)
    348 
    349 ifneq ($(my_register_name),$(LOCAL_MODULE))
    350 # $(LOCAL_MODULE) covers all the multilib targets.
    351 .PHONY: $(LOCAL_MODULE)
    352 $(LOCAL_MODULE) : $(my_all_targets)
    353 endif
    354 
    355 # Set up phony targets that covers all modules under the given paths.
    356 # This allows us to build everything in given paths by running mmma/mma.
    357 my_path_components := $(subst /,$(space),$(LOCAL_PATH))
    358 my_path_prefix := MODULES-IN
    359 $(foreach c, $(my_path_components),\
    360   $(eval my_path_prefix := $(my_path_prefix)-$(c))\
    361   $(eval .PHONY : $(my_path_prefix))\
    362   $(eval $(my_path_prefix) : $(my_all_targets)))
    363 
    364 ###########################################################
    365 ## Module installation rule
    366 ###########################################################
    367 
    368 my_init_rc_installed :=
    369 my_init_rc_pairs :=
    370 my_installed_symlinks :=
    371 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
    372 $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
    373 $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
    374 	@echo "Install: $@"
    375 	$(copy-file-to-new-target)
    376 	$(PRIVATE_POST_INSTALL_CMD)
    377 
    378 ifndef LOCAL_IS_HOST_MODULE
    379 # Rule to install the module's companion init.rc.
    380 my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix)) $(LOCAL_INIT_RC)
    381 ifneq ($(strip $(my_init_rc)),)
    382 my_init_rc_pairs := $(foreach rc,$(my_init_rc),$(LOCAL_PATH)/$(rc):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(rc)))
    383 my_init_rc_installed := $(foreach rc,$(my_init_rc_pairs),$(call word-colon,2,$(rc)))
    384 
    385 # Make sure we only set up the copy rules once, even if another arch variant
    386 # shares a common LOCAL_INIT_RC.
    387 my_init_rc_new_pairs := $(filter-out $(ALL_INIT_RC_INSTALLED_PAIRS),$(my_init_rc_pairs))
    388 my_init_rc_new_installed := $(call copy-many-files,$(my_init_rc_new_pairs))
    389 ALL_INIT_RC_INSTALLED_PAIRS += $(my_init_rc_new_pairs)
    390 
    391 $(my_all_targets) : $(my_init_rc_installed)
    392 endif # my_init_rc
    393 endif # !LOCAL_IS_HOST_MODULE
    394 
    395 # Rule to install the module's companion symlinks
    396 my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix)))
    397 $(foreach symlink,$(my_installed_symlinks),\
    398     $(call symlink-file,$(LOCAL_INSTALLED_MODULE),$(my_installed_module_stem),$(symlink)))
    399 
    400 $(my_all_targets) : | $(my_installed_symlinks)
    401 
    402 endif # !LOCAL_UNINSTALLABLE_MODULE
    403 
    404 ###########################################################
    405 ## CHECK_BUILD goals
    406 ###########################################################
    407 my_checked_module :=
    408 # If nobody has defined a more specific module for the
    409 # checked modules, use LOCAL_BUILT_MODULE.
    410 ifdef LOCAL_CHECKED_MODULE
    411   my_checked_module := $(LOCAL_CHECKED_MODULE)
    412 else
    413   my_checked_module := $(LOCAL_BUILT_MODULE)
    414 endif
    415 
    416 # If they request that this module not be checked, then don't.
    417 # PLEASE DON'T SET THIS.  ANY PLACES THAT SET THIS WITHOUT
    418 # GOOD REASON WILL HAVE IT REMOVED.
    419 ifdef LOCAL_DONT_CHECK_MODULE
    420   my_checked_module :=
    421 endif
    422 # Don't check build target module defined for the 2nd arch
    423 ifndef LOCAL_IS_HOST_MODULE
    424 ifdef LOCAL_2ND_ARCH_VAR_PREFIX
    425   my_checked_module :=
    426 endif
    427 endif
    428 
    429 ###########################################################
    430 ## Compatibility suite files.
    431 ###########################################################
    432 ifdef LOCAL_COMPATIBILITY_SUITE
    433 
    434 # The module itself.
    435 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
    436   $(eval my_compat_dist_$(suite) := $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
    437     $(LOCAL_BUILT_MODULE):$(dir)/$(my_installed_module_stem))))
    438 
    439 # Make sure we only add the files once for multilib modules.
    440 ifndef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
    441 $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files := true
    442 
    443 # LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>[:<dest>].
    444 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
    445   $(eval my_compat_dist_$(suite) += $(foreach f, $(LOCAL_COMPATIBILITY_SUPPORT_FILES), \
    446     $(eval p := $(subst :,$(space),$(f))) \
    447     $(eval s := $(word 1,$(p))) \
    448     $(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
    449     $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
    450       $(s):$(dir)/$(n)))))
    451 
    452 
    453 ifneq (,$(wildcard $(LOCAL_PATH)/AndroidTest.xml))
    454 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
    455   $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
    456     $(LOCAL_PATH)/AndroidTest.xml:$(dir)/$(LOCAL_MODULE).config)))
    457 endif
    458 
    459 ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
    460 $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
    461   $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite)), \
    462     $(LOCAL_PATH)/DynamicConfig.xml:$(dir)/$(LOCAL_MODULE).dynamic)))
    463 endif
    464 endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
    465 
    466 $(call create-suite-dependencies)
    467 
    468 endif  # LOCAL_COMPATIBILITY_SUITE
    469 
    470 ###########################################################
    471 ## Test Data
    472 ###########################################################
    473 my_test_data_pairs :=
    474 my_installed_test_data :=
    475 
    476 ifneq ($(filter NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
    477 ifneq ($(strip $(LOCAL_TEST_DATA)),)
    478 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
    479 
    480 my_test_data_pairs := $(strip $(foreach td,$(LOCAL_TEST_DATA), \
    481     $(eval _file := $(call word-colon,2,$(td))) \
    482     $(if $(_file), \
    483       $(eval _base := $(call word-colon,1,$(td))), \
    484       $(eval _base := $(LOCAL_PATH)) \
    485         $(eval _file := $(call word-colon,1,$(td)))) \
    486     $(if $(findstring ..,$(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include '..': $(_file))) \
    487     $(if $(filter /%,$(_base) $(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include absolute paths: $(_base) $(_file))) \
    488     $(call append-path,$(_base),$(_file)):$(call append-path,$(my_module_path),$(_file))))
    489 
    490 my_installed_test_data := $(call copy-many-files,$(my_test_data_pairs))
    491 $(LOCAL_INSTALLED_MODULE): $(my_installed_test_data)
    492 
    493 endif
    494 endif
    495 endif
    496 
    497 ###########################################################
    498 ## Register with ALL_MODULES
    499 ###########################################################
    500 
    501 ALL_MODULES += $(my_register_name)
    502 
    503 # Don't use += on subvars, or else they'll end up being
    504 # recursively expanded.
    505 ALL_MODULES.$(my_register_name).CLASS := \
    506     $(ALL_MODULES.$(my_register_name).CLASS) $(LOCAL_MODULE_CLASS)
    507 ALL_MODULES.$(my_register_name).PATH := \
    508     $(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH)
    509 ALL_MODULES.$(my_register_name).TAGS := \
    510     $(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags)
    511 ALL_MODULES.$(my_register_name).CHECKED := \
    512     $(ALL_MODULES.$(my_register_name).CHECKED) $(my_checked_module)
    513 ALL_MODULES.$(my_register_name).BUILT := \
    514     $(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
    515 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
    516 ALL_MODULES.$(my_register_name).INSTALLED := \
    517     $(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
    518     $(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed) $(my_installed_symlinks) \
    519     $(my_installed_test_data))
    520 ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
    521     $(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
    522     $(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE) \
    523     $(my_init_rc_pairs) $(my_test_data_pairs))
    524 endif
    525 ifdef LOCAL_PICKUP_FILES
    526 # Files or directories ready to pick up by the build system
    527 # when $(LOCAL_BUILT_MODULE) is done.
    528 ALL_MODULES.$(my_register_name).PICKUP_FILES := \
    529     $(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
    530 endif
    531 my_required_modules := $(LOCAL_REQUIRED_MODULES) \
    532     $(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
    533 ifdef LOCAL_IS_HOST_MODULE
    534 my_required_modules += $(LOCAL_REQUIRED_MODULES_$($(my_prefix)OS))
    535 endif
    536 ALL_MODULES.$(my_register_name).REQUIRED := \
    537     $(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(my_required_modules))
    538 ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED := \
    539     $(strip $(ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED)\
    540         $(my_required_modules))
    541 ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
    542     $(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
    543 ALL_MODULES.$(my_register_name).MAKEFILE := \
    544     $(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
    545 ifdef LOCAL_MODULE_OWNER
    546 ALL_MODULES.$(my_register_name).OWNER := \
    547     $(sort $(ALL_MODULES.$(my_register_name).OWNER) $(LOCAL_MODULE_OWNER))
    548 endif
    549 ifdef LOCAL_2ND_ARCH_VAR_PREFIX
    550 ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
    551 endif
    552 ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
    553 
    554 INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
    555 
    556 ##########################################################
    557 # Track module-level dependencies.
    558 # Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
    559 ALL_DEPS.MODULES := $(sort $(ALL_DEPS.MODULES) $(LOCAL_MODULE))
    560 ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
    561   $(ALL_MODULES.$(LOCAL_MODULE).ALL_DEPS) \
    562   $(LOCAL_STATIC_LIBRARIES) \
    563   $(LOCAL_WHOLE_STATIC_LIBRARIES) \
    564   $(LOCAL_SHARED_LIBRARIES) \
    565   $(LOCAL_HEADER_LIBRARIES) \
    566   $(LOCAL_STATIC_JAVA_LIBRARIES) \
    567   $(LOCAL_JAVA_LIBRARIES)\
    568   $(LOCAL_JNI_SHARED_LIBRARIES))
    569 
    570 ALL_DEPS.$(LOCAL_MODULE).LICENSE := $(sort $(ALL_DEPS.$(LOCAL_MODULE).LICENSE) $(license_files))
    571 
    572 ###########################################################
    573 ## Take care of my_module_tags
    574 ###########################################################
    575 
    576 # Keep track of all the tags we've seen.
    577 ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
    578 
    579 # Add this module name to the tag list of each specified tag.
    580 $(foreach tag,$(my_module_tags),\
    581     $(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
    582 
    583 ###########################################################
    584 ## umbrella targets used to verify builds
    585 ###########################################################
    586 j_or_n :=
    587 ifneq (,$(filter EXECUTABLES SHARED_LIBRARIES STATIC_LIBRARIES HEADER_LIBRARIES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)))
    588 j_or_n := native
    589 else
    590 ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
    591 j_or_n := java
    592 endif
    593 endif
    594 ifdef LOCAL_IS_HOST_MODULE
    595 h_or_t := host
    596 ifeq ($(my_host_cross),true)
    597 h_or_hc_or_t := host-cross
    598 else
    599 h_or_hc_or_t := host
    600 endif
    601 else
    602 h_or_hc_or_t := target
    603 h_or_t := target
    604 endif
    605 
    606 
    607 ifdef j_or_n
    608 $(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(my_checked_module)
    609 ifneq (,$(filter $(my_module_tags),tests))
    610 $(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(my_checked_module)
    611 endif
    612 $(LOCAL_MODULE)-$(h_or_hc_or_t) : $(my_all_targets)
    613 ifeq ($(j_or_n),native)
    614 $(LOCAL_MODULE)-$(h_or_hc_or_t)$(my_32_64_bit_suffix) : $(my_all_targets)
    615 endif
    616 endif
    617 
    618 ###########################################################
    619 ## NOTICE files
    620 ###########################################################
    621 
    622 include $(BUILD_NOTICE_FILE)
    623