842a985f90
Shared libraries are now installed to different directories depending on their types. * NDK libraries: /system/lib/ndk (with symlink from /system/lib) * VNDK libraries: /system/lib/vndk * VNDK-ext libraries: /system/lib/vndk-ext * Framework-only libraries: /system/lib * Vendor-only libraries: /vendor/lib * Same-process HALs: /vendor/lib/sameprocess However, if LOCAL_MODULE_PATH is explicitly set, then it is respected, with a warning message. Module owners are highly encouraged to investigate the warnings and use alternatives to LOCAL_MODULE_PATH; combination of LOCAL_[PROPRIETARY|OEM|ODM]_MODULE, LOCAL_MODULE_CLASS and LOCAL_RELATIVE_PATH will cover most of the cases. Furthermore, for each shared libraries whose path is changed, a symolic link from the original path to the new path is *temporarily* generated. e.g. /system/lib/libbase.so -> vndk/libbase.so. This is to prevent sudden breakage of the code expecting the lib from the old path. This symbolic links will eventually be removed before O launch (b/34917183). Finally, BOARD_SAME_PROCESS_HAL_DEPS is added. It contains the list of shared libraries implementing the same-process HALs and its internal sub libraries. This is designed to be defined in BoardConfig.mk Bug: 33681361 Test: build & run. Libraries must be in the correct directories. Symlinks from the old path to the new path must exist. Change-Id: I46130aac09ae65400fd4d0abbc2e12dddd154fb1
771 lines
30 KiB
Makefile
771 lines
30 KiB
Makefile
#
|
|
# Copyright (C) 2008 The Android Open Source Project
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
# Catch users that directly include base_rules.mk
|
|
$(call record-module-type,base_rules)
|
|
|
|
# Users can define base-rules-hook in their buildspec.mk to perform
|
|
# arbitrary operations as each module is included.
|
|
ifdef base-rules-hook
|
|
$(if $(base-rules-hook),)
|
|
endif
|
|
|
|
###########################################################
|
|
## Common instructions for a generic module.
|
|
###########################################################
|
|
|
|
LOCAL_MODULE := $(strip $(LOCAL_MODULE))
|
|
ifeq ($(LOCAL_MODULE),)
|
|
$(error $(LOCAL_PATH): LOCAL_MODULE is not defined)
|
|
endif
|
|
|
|
LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
|
|
LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE))
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
ifneq ($(LOCAL_IS_HOST_MODULE),true)
|
|
$(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
|
|
endif
|
|
ifeq ($(LOCAL_HOST_PREFIX),)
|
|
my_prefix := HOST_
|
|
else
|
|
my_prefix := $(LOCAL_HOST_PREFIX)
|
|
endif
|
|
my_host := host-
|
|
my_kind := HOST
|
|
else
|
|
ifdef LOCAL_IS_AUX_MODULE
|
|
ifneq ($(LOCAL_IS_AUX_MODULE),true)
|
|
$(error $(LOCAL_PATH): LOCAL_IS_AUX_MODULE must be "true" or empty, not "$(LOCAL_IS_AUX_MODULE)")
|
|
endif
|
|
my_prefix := AUX_
|
|
my_kind := AUX
|
|
else
|
|
my_prefix := TARGET_
|
|
my_kind :=
|
|
endif
|
|
my_host :=
|
|
endif
|
|
|
|
ifeq ($(my_prefix),HOST_CROSS_)
|
|
my_host_cross := true
|
|
else
|
|
my_host_cross :=
|
|
endif
|
|
|
|
include $(BUILD_SYSTEM)/local_vndk.mk
|
|
|
|
my_module_tags := $(LOCAL_MODULE_TAGS)
|
|
ifeq ($(my_host_cross),true)
|
|
my_module_tags :=
|
|
endif
|
|
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
|
|
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
|
|
# Don't pull in modules by tags if this is for translation TARGET_2ND_ARCH.
|
|
my_module_tags :=
|
|
endif
|
|
endif
|
|
|
|
my_module_is_soong := $(if $(filter $(OUT_DIR)/soong/%,$(LOCAL_MODULE_MAKEFILE)),true,false)
|
|
|
|
# Ninja has an implicit dependency on the command being run, and kati will
|
|
# regenerate the ninja manifest if any read makefile changes, so there is no
|
|
# need to have dependencies on makefiles.
|
|
# This won't catch all the cases where LOCAL_ADDITIONAL_DEPENDENCIES contains
|
|
# a .mk file, because a few users of LOCAL_ADDITIONAL_DEPENDENCIES don't include
|
|
# base_rules.mk, but it will fix the most common ones.
|
|
LOCAL_ADDITIONAL_DEPENDENCIES := $(filter-out %.mk,$(LOCAL_ADDITIONAL_DEPENDENCIES))
|
|
|
|
###########################################################
|
|
## Validate and define fallbacks for input LOCAL_* variables.
|
|
###########################################################
|
|
|
|
## Dump a .csv file of all modules and their tags
|
|
#ifneq ($(tag-list-first-time),false)
|
|
#$(shell rm -f tag-list.csv)
|
|
#tag-list-first-time := false
|
|
#endif
|
|
#$(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)
|
|
|
|
LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
|
|
my_module_tags := $(sort $(my_module_tags))
|
|
ifeq (,$(my_module_tags))
|
|
my_module_tags := optional
|
|
endif
|
|
|
|
# User tags are not allowed anymore. Fail early because it will not be installed
|
|
# like it used to be.
|
|
ifneq ($(filter $(my_module_tags),user),)
|
|
$(warning *** Module name: $(LOCAL_MODULE))
|
|
$(warning *** Makefile location: $(LOCAL_MODULE_MAKEFILE))
|
|
$(warning * )
|
|
$(warning * Module is attempting to use the 'user' tag. This)
|
|
$(warning * used to cause the module to be installed automatically.)
|
|
$(warning * Now, the module must be listed in the PRODUCT_PACKAGES)
|
|
$(warning * section of a product makefile to have it installed.)
|
|
$(warning * )
|
|
$(error user tag detected on module.)
|
|
endif
|
|
|
|
# Only the tags mentioned in this test are expected to be set by module
|
|
# makefiles. Anything else is either a typo or a source of unexpected
|
|
# behaviors.
|
|
ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
|
|
$(warning unusual tags $(my_module_tags) on $(LOCAL_MODULE) at $(LOCAL_PATH))
|
|
endif
|
|
|
|
# Add implicit tags.
|
|
#
|
|
# If the local directory or one of its parents contains a MODULE_LICENSE_GPL
|
|
# file, tag the module as "gnu". Search for "*_GPL*", "*_LGPL*" and "*_MPL*"
|
|
# so that we can also find files like MODULE_LICENSE_GPL_AND_AFL
|
|
#
|
|
license_files := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*)
|
|
gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)
|
|
ifneq ($(gpl_license_file),)
|
|
my_module_tags += gnu
|
|
ALL_GPL_MODULE_LICENSE_FILES := $(sort $(ALL_GPL_MODULE_LICENSE_FILES) $(gpl_license_file))
|
|
endif
|
|
|
|
LOCAL_MODULE_CLASS := $(strip $(LOCAL_MODULE_CLASS))
|
|
ifneq ($(words $(LOCAL_MODULE_CLASS)),1)
|
|
$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must contain exactly one word, not "$(LOCAL_MODULE_CLASS)")
|
|
endif
|
|
|
|
my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32)
|
|
|
|
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
|
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
|
|
# When in TARGET_TRANSLATE_2ND_ARCH both TARGET_ARCH and TARGET_2ND_ARCH are 32-bit,
|
|
# to avoid path conflict we force using LOCAL_MODULE_PATH_64 for the first arch.
|
|
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
|
|
my_multilib_module_path := $(LOCAL_MODULE_PATH_32)
|
|
else # ! LOCAL_2ND_ARCH_VAR_PREFIX
|
|
my_multilib_module_path := $(LOCAL_MODULE_PATH_64)
|
|
endif # ! LOCAL_2ND_ARCH_VAR_PREFIX
|
|
else # ! TARGET_TRANSLATE_2ND_ARCH
|
|
my_multilib_module_path := $(strip $(LOCAL_MODULE_PATH_$(my_32_64_bit_suffix)))
|
|
endif # ! TARGET_TRANSLATE_2ND_ARCH
|
|
ifdef my_multilib_module_path
|
|
my_module_path := $(my_multilib_module_path)
|
|
else
|
|
my_module_path := $(strip $(LOCAL_MODULE_PATH))
|
|
endif
|
|
my_module_path := $(patsubst %/,%,$(my_module_path))
|
|
my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH))
|
|
|
|
# my_module_default_path is the path that is automatically chosen according to the attributes of
|
|
# a module. It is used when the module does not explicitly specify install path using LOCAL_MODULE_PATH.
|
|
# If LOCAL_MODULE_PATH is specified, it is always respected and my_module_default_path is
|
|
# ignored. However, for shared libraries, such conflict generates warning so that module owner
|
|
# can place the library in the correct location (, stop using LOCAL_MODULE_PATH, or migrate to Soong to
|
|
# be better).
|
|
my_module_default_path :=
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
partition_tag :=
|
|
else
|
|
ifeq (true,$(LOCAL_PROPRIETARY_MODULE))
|
|
partition_tag := _VENDOR
|
|
else ifeq (true,$(LOCAL_OEM_MODULE))
|
|
partition_tag := _OEM
|
|
else ifeq (true,$(LOCAL_ODM_MODULE))
|
|
partition_tag := _ODM
|
|
else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
|
|
partition_tag := _DATA
|
|
else
|
|
# The definition of should-install-to-system will be different depending
|
|
# on which goal (e.g., sdk or just droid) is being built.
|
|
partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA)
|
|
endif
|
|
endif
|
|
install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS)
|
|
ifeq (true,$(LOCAL_PRIVILEGED_MODULE))
|
|
install_path_var := $(install_path_var)_PRIVILEGED
|
|
endif
|
|
|
|
my_module_default_path := $($(install_path_var))
|
|
ifeq ($(strip $(my_module_path)$(my_module_default_path)),)
|
|
$(call pretty-error,internal error in base_rules.mk; $(install_path_var) is not defined.)
|
|
endif
|
|
|
|
# Determine lib_type and do some sanity checks.
|
|
ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
|
|
ifneq ($(filter $(LOCAL_MODULE),$(addprefix lib,$(NDK_PREBUILT_SHARED_LIBRARIES))),)
|
|
ifneq ($(partition_tag),)
|
|
$(call pretty-error,"NDK library must be installed at system partition, where other libraries will look for it. It cannot be moved.")
|
|
endif
|
|
lib_type := ndk
|
|
else ifneq ($(filter $(LOCAL_MODULE),$(VNDK_LIBRARIES) $(VNDK_INDIRECT_LIBRARIES)),)
|
|
ifneq ($(partition_tag),)
|
|
$(call pretty-error,"VNDK library must be installed at system partition. DO NOT modify VNDK_LIBRARIES or VNDK_LIBRARIES. \
|
|
If your library needs to be shared between system.img and vendor.img then define it as a VNDK-ext library. Use vndk_ext_library {...} \
|
|
in Android.bp to do so.")
|
|
endif
|
|
lib_type := vndk
|
|
else ifneq ($(filter $(LOCAL_MODULE),$(BOARD_SAME_PROCESS_HAL_DEPS)),)
|
|
# List of libraries implementing same-process HALs (and their internal sub-libraries) is
|
|
# defined by vendors.
|
|
ifeq ($(partition_tag),)
|
|
$(call pretty-error,Sameprocess HAL must not be installed at system partition)
|
|
endif
|
|
lib_type := sameprocess_hal
|
|
else ifeq ($(LOCAL_IS_HOST_MODULE)$(partition_tag),)
|
|
lib_type := framework
|
|
else ifneq ($(partition_tag),_DATA)
|
|
# Here, vendor means vendor/oem/odm
|
|
lib_type := vendor_provided
|
|
else
|
|
# Test lib falls into this. No lib_type required for them.
|
|
ifneq ($(filter tests,$(LOCAL_MODULE_TAGS)),tests)
|
|
$(call pretty-error,Cannot determine the type of this library)
|
|
endif
|
|
lib_type :=
|
|
endif
|
|
else
|
|
lib_type :=
|
|
endif
|
|
|
|
# This is the default path until N. From O, the default path is changed.
|
|
# Let's save the old default path in case we need a symlink to it later.
|
|
my_module_pre_o_default_path := $(my_module_default_path)
|
|
|
|
# Special case for pre_o_default_path of Soong defined modules.
|
|
# For those modules, we guess their pre_o_default_path by removing /ndk, /vndk, etc.
|
|
# from their LOCAL_MODULE_PATH. This is because relative_install_path is already
|
|
# embedded to my_module_path.
|
|
ifeq ($(my_module_is_soong),true)
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
|
|
my_module_pre_o_default_path := $(my_module_path)
|
|
my_module_pre_o_default_path := $(subst /vndk-ext,,$(my_module_pre_o_default_path))
|
|
my_module_pre_o_default_path := $(subst /vndk,,$(my_module_pre_o_default_path))
|
|
my_module_pre_o_default_path := $(subst /ndk,,$(my_module_pre_o_default_path))
|
|
my_module_pre_o_default_path := $(subst /sameprocess,,$(my_module_pre_o_default_path))
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
# Amend the default_path once again depending on lib_type. This is new from O.
|
|
ifeq ($(lib_type),vndk)
|
|
my_module_default_path := $(my_module_default_path)/vndk
|
|
# TODO(b/35020246): before P, we should support installing two snapshots of VNDK
|
|
# libraries. One for framework libs and execs and the other for vendor libs and execs.
|
|
else ifeq ($(lib_type),ndk)
|
|
my_module_default_path := $(my_module_default_path)/ndk
|
|
else ifeq ($(lib_type),sameprocess_hal)
|
|
my_module_default_path := $(my_module_default_path)/sameprocess
|
|
endif
|
|
|
|
# Relative path is appended to path resolved so far
|
|
ifneq ($(my_module_relative_path),)
|
|
my_module_default_path := $(my_module_default_path)/$(my_module_relative_path)
|
|
my_module_pre_o_default_path := $(my_module_pre_o_default_path)/$(my_module_relative_path)
|
|
ifneq ($(my_module_path),)
|
|
my_module_path := $(my_module_path)/$(my_module_relative_path)
|
|
endif
|
|
endif
|
|
|
|
_lib_moved :=
|
|
ifeq ($(my_module_path),)
|
|
# If LOCAL_MODULE_PATH is not specified, use the automatically determined path.
|
|
my_module_path := $(my_module_default_path)
|
|
|
|
# Mark if the lib is installed to a different path than before. With this hint,
|
|
# a symlink is created if BOARD_SYMLINK_FOR_LIBS is true.
|
|
ifneq ($(my_module_path),$(my_module_pre_o_default_path))
|
|
_lib_moved := true
|
|
endif
|
|
else
|
|
# If LOCAL_MODULE_PATH is specified, we respect it.
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
|
|
ifeq ($(filter $(TARGET_OUT_DATA)%,$(my_module_path)),)
|
|
# However, we are kind enough to warn if it seems to be wrong.
|
|
# Warn only for Android.mk defined shared libraries that will be installed
|
|
# to system or vendor partition. For other types of files - especially
|
|
# Soong-defined libs -, we don't warn because Soong always gives us correct
|
|
# paths.
|
|
ifeq ($(my_module_is_soong),false)
|
|
ifneq ($(my_module_path),$(my_module_default_path))
|
|
# TODO(b/35020635): s/warning/error/
|
|
$(call pretty-warning,$(lib_type) library must be installed to \
|
|
$(subst $(PRODUCT_OUT)/,,$(my_module_default_path)) but requested to be installed at \
|
|
$(subst $(PRODUCT_OUT)/,,$(my_module_path)). Please fix.)
|
|
endif
|
|
else
|
|
# For Soong-defined module, symlink is provided if the path has been amended
|
|
# ...except for vndk-ext libraries because there already is a symlink for the
|
|
# vndk (unmodified) version of the vndk-ext library.
|
|
ifneq ($(my_module_path),$(my_module_pre_o_default_path))
|
|
ifeq ($(filter vndk-ext,$(subst /,$(space),$(my_module_path))),)
|
|
_lib_moved := true
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
endif # not LOCAL_UNINSTALLABLE_MODULE
|
|
|
|
ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),)
|
|
$(error $(LOCAL_PATH): LOCAL_BUILT_MODULE and LOCAL_INSTALLED_MODULE must not be defined by component makefiles)
|
|
endif
|
|
|
|
my_register_name := $(LOCAL_MODULE)
|
|
ifeq ($(my_host_cross),true)
|
|
my_register_name := host_cross_$(LOCAL_MODULE)
|
|
endif
|
|
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
|
|
ifndef LOCAL_NO_2ND_ARCH_MODULE_SUFFIX
|
|
my_register_name := $(my_register_name)$($(my_prefix)2ND_ARCH_MODULE_SUFFIX)
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(my_host_cross),true)
|
|
my_all_targets := host_cross_$(my_register_name)_all_targets
|
|
else ifneq ($(LOCAL_IS_HOST_MODULE),)
|
|
my_all_targets := host_$(my_register_name)_all_targets
|
|
else
|
|
my_all_targets := device_$(my_register_name)_all_targets
|
|
endif
|
|
|
|
# variant is enough to make nano class unique; it serves as a key to lookup (OS,ARCH) tuple
|
|
aux_class := $($(my_prefix)OS_VARIANT)
|
|
# Make sure that this IS_HOST/CLASS/MODULE combination is unique.
|
|
module_id := MODULE.$(if \
|
|
$(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),$(if \
|
|
$(LOCAL_IS_AUX_MODULE),$(aux_class),TARGET)).$(LOCAL_MODULE_CLASS).$(my_register_name)
|
|
ifdef $(module_id)
|
|
$(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
|
|
endif
|
|
$(module_id) := $(LOCAL_PATH)
|
|
|
|
intermediates := $(call local-intermediates-dir,,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))
|
|
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
|
|
generated_sources_dir := $(call local-generated-sources-dir)
|
|
|
|
###########################################################
|
|
# Pick a name for the intermediate and final targets
|
|
###########################################################
|
|
include $(BUILD_SYSTEM)/configure_module_stem.mk
|
|
|
|
# OVERRIDE_BUILT_MODULE_PATH is only allowed to be used by the
|
|
# internal SHARED_LIBRARIES build files.
|
|
OVERRIDE_BUILT_MODULE_PATH := $(strip $(OVERRIDE_BUILT_MODULE_PATH))
|
|
ifdef OVERRIDE_BUILT_MODULE_PATH
|
|
ifneq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
|
|
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
|
|
endif
|
|
built_module_path := $(OVERRIDE_BUILT_MODULE_PATH)
|
|
else
|
|
built_module_path := $(intermediates)
|
|
endif
|
|
LOCAL_BUILT_MODULE := $(built_module_path)/$(my_built_module_stem)
|
|
|
|
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
|
# Apk and its attachments reside in its own subdir.
|
|
ifeq ($(LOCAL_MODULE_CLASS),APPS)
|
|
# framework-res.apk doesn't like the additional layer.
|
|
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
|
# Neither do Runtime Resource Overlay apks, which contain just the overlaid resources.
|
|
else ifeq ($(LOCAL_IS_RUNTIME_RESOURCE_OVERLAY),true)
|
|
else
|
|
my_module_path := $(my_module_path)/$(LOCAL_MODULE)
|
|
endif
|
|
endif
|
|
LOCAL_INSTALLED_MODULE := $(my_module_path)/$(my_installed_module_stem)
|
|
endif
|
|
|
|
# Assemble the list of targets to create PRIVATE_ variables for.
|
|
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE)
|
|
|
|
###########################################################
|
|
## Create .toc files from shared objects to reduce unnecessary rebuild
|
|
# .toc files have the list of external dynamic symbols without their addresses.
|
|
# As .KATI_RESTAT is specified to .toc files and commit-change-for-toc is used,
|
|
# dependent binaries of a .toc file will be rebuilt only when the content of
|
|
# the .toc file is changed.
|
|
###########################################################
|
|
ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
|
|
LOCAL_INTERMEDIATE_TARGETS += $(LOCAL_BUILT_MODULE).toc
|
|
$(LOCAL_BUILT_MODULE).toc: $(LOCAL_BUILT_MODULE)
|
|
$(call $(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)transform-shared-lib-to-toc,$<,$@.tmp)
|
|
$(call commit-change-for-toc,$@)
|
|
|
|
# Kati adds restat=1 to ninja. GNU make does nothing for this.
|
|
.KATI_RESTAT: $(LOCAL_BUILT_MODULE).toc
|
|
# Build .toc file when using mm, mma, or make $(my_register_name)
|
|
$(my_all_targets): $(LOCAL_BUILT_MODULE).toc
|
|
endif
|
|
|
|
###########################################################
|
|
## logtags: Add .logtags files to global list
|
|
###########################################################
|
|
|
|
logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES)) $(LOCAL_LOGTAGS_FILES)
|
|
|
|
ifneq ($(strip $(logtags_sources)),)
|
|
event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
|
|
else
|
|
event_log_tags :=
|
|
endif
|
|
|
|
###########################################################
|
|
## make clean- targets
|
|
###########################################################
|
|
cleantarget := clean-$(my_register_name)
|
|
$(cleantarget) : PRIVATE_MODULE := $(my_register_name)
|
|
$(cleantarget) : PRIVATE_CLEAN_FILES := \
|
|
$(LOCAL_BUILT_MODULE) \
|
|
$(LOCAL_INSTALLED_MODULE) \
|
|
$(intermediates)
|
|
$(cleantarget)::
|
|
@echo "Clean: $(PRIVATE_MODULE)"
|
|
$(hide) rm -rf $(PRIVATE_CLEAN_FILES)
|
|
|
|
###########################################################
|
|
## Common definitions for module.
|
|
###########################################################
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_AUX_MODULE := $(LOCAL_IS_AUX_MODULE)
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_INTERMEDIATES_DIR:= $(intermediates)
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
|
|
|
|
# Tell the module and all of its sub-modules who it is.
|
|
$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_MODULE:= $(my_register_name)
|
|
|
|
# Provide a short-hand for building this module.
|
|
# We name both BUILT and INSTALLED in case
|
|
# LOCAL_UNINSTALLABLE_MODULE is set.
|
|
.PHONY: $(my_all_targets)
|
|
$(my_all_targets): $(LOCAL_BUILT_MODULE) $(LOCAL_INSTALLED_MODULE)
|
|
|
|
.PHONY: $(my_register_name)
|
|
$(my_register_name): $(my_all_targets)
|
|
|
|
ifneq ($(my_register_name),$(LOCAL_MODULE))
|
|
# $(LOCAL_MODULE) covers all the multilib targets.
|
|
.PHONY: $(LOCAL_MODULE)
|
|
$(LOCAL_MODULE) : $(my_all_targets)
|
|
endif
|
|
|
|
# Set up phony targets that covers all modules under the given paths.
|
|
# This allows us to build everything in given paths by running mmma/mma.
|
|
my_path_components := $(subst /,$(space),$(LOCAL_PATH))
|
|
my_path_prefix := MODULES-IN
|
|
$(foreach c, $(my_path_components),\
|
|
$(eval my_path_prefix := $(my_path_prefix)-$(c))\
|
|
$(eval .PHONY : $(my_path_prefix))\
|
|
$(eval $(my_path_prefix) : $(my_all_targets)))
|
|
|
|
###########################################################
|
|
## Module installation rule
|
|
###########################################################
|
|
|
|
my_init_rc_installed :=
|
|
my_init_rc_pairs :=
|
|
my_installed_symlinks :=
|
|
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
|
$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD)
|
|
$(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
|
|
@echo "Install: $@"
|
|
$(copy-file-to-new-target)
|
|
$(PRIVATE_POST_INSTALL_CMD)
|
|
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
# Rule to install the module's companion init.rc.
|
|
my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix)) $(LOCAL_INIT_RC)
|
|
ifneq ($(strip $(my_init_rc)),)
|
|
my_init_rc_pairs := $(foreach rc,$(my_init_rc),$(LOCAL_PATH)/$(rc):$(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(rc)))
|
|
my_init_rc_installed := $(foreach rc,$(my_init_rc_pairs),$(call word-colon,2,$(rc)))
|
|
|
|
# Make sure we only set up the copy rules once, even if another arch variant
|
|
# shares a common LOCAL_INIT_RC.
|
|
my_init_rc_new_pairs := $(filter-out $(ALL_INIT_RC_INSTALLED_PAIRS),$(my_init_rc_pairs))
|
|
my_init_rc_new_installed := $(call copy-many-files,$(my_init_rc_new_pairs))
|
|
ALL_INIT_RC_INSTALLED_PAIRS += $(my_init_rc_new_pairs)
|
|
|
|
$(my_all_targets) : $(my_init_rc_installed)
|
|
endif # my_init_rc
|
|
endif # !LOCAL_IS_HOST_MODULE
|
|
|
|
# Rule to install the module's companion symlinks
|
|
my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix)))
|
|
|
|
# If this lib is installed to the different directory than before,
|
|
# make a symlink from the old path to the new path.
|
|
# This symlink is required because there are so many plances that expect the old
|
|
# path (e.g. systemproperty rild.libpath). Until that places are all fixed,
|
|
# we keep this symlink.
|
|
# TODO(b/34917183): remove symlinks after everything migrations to the new paths;
|
|
# this should be done before O launch unless it will be a security hole that
|
|
# we can't restrict access to a certain set of libraries by using the directory
|
|
# path.
|
|
ifneq ($(BOARD_SYMLINK_FOR_LIBS),false)
|
|
ifeq ($(_lib_moved),true)
|
|
my_installed_symlinks += $(my_module_pre_o_default_path)/$(my_installed_module_stem)
|
|
endif
|
|
else
|
|
# Symlinks for ndk libs are permanent.
|
|
ifeq ($(lib_type)$(_lib_moved),ndktrue)
|
|
my_installed_symlinks += $(my_module_pre_o_default_path)/$(my_installed_module_stem)
|
|
endif
|
|
endif
|
|
|
|
# Make a symlink $(symlink) -> $(LOCAL_INSTALLED_MODULE)
|
|
$(foreach symlink,$(my_installed_symlinks),\
|
|
$(call symlink-file,$(LOCAL_INSTALLED_MODULE),$(LOCAL_INSTALLED_MODULE),$(symlink),true))
|
|
|
|
$(my_all_targets) : | $(my_installed_symlinks)
|
|
|
|
endif # !LOCAL_UNINSTALLABLE_MODULE
|
|
|
|
###########################################################
|
|
## CHECK_BUILD goals
|
|
###########################################################
|
|
my_checked_module :=
|
|
# If nobody has defined a more specific module for the
|
|
# checked modules, use LOCAL_BUILT_MODULE.
|
|
ifdef LOCAL_CHECKED_MODULE
|
|
my_checked_module := $(LOCAL_CHECKED_MODULE)
|
|
else
|
|
my_checked_module := $(LOCAL_BUILT_MODULE)
|
|
endif
|
|
|
|
# If they request that this module not be checked, then don't.
|
|
# PLEASE DON'T SET THIS. ANY PLACES THAT SET THIS WITHOUT
|
|
# GOOD REASON WILL HAVE IT REMOVED.
|
|
ifdef LOCAL_DONT_CHECK_MODULE
|
|
my_checked_module :=
|
|
endif
|
|
# Don't check build target module defined for the 2nd arch
|
|
ifndef LOCAL_IS_HOST_MODULE
|
|
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
|
|
my_checked_module :=
|
|
endif
|
|
endif
|
|
|
|
###########################################################
|
|
## Compatibiliy suite files.
|
|
###########################################################
|
|
ifdef LOCAL_COMPATIBILITY_SUITE
|
|
ifneq ($(words $(LOCAL_COMPATIBILITY_SUITE)),1)
|
|
$(error $(LOCAL_PATH):$(LOCAL_MODULE) LOCAL_COMPATIBILITY_SUITE can be only one name)
|
|
endif
|
|
|
|
# Copy this module into its own subdirectory in the common testcases output directory.
|
|
my_testcases_subdir := $($(my_prefix)OUT_TESTCASES)/$(LOCAL_MODULE)
|
|
|
|
# The module itself.
|
|
my_compat_dist := \
|
|
$(LOCAL_BUILT_MODULE):$(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(my_installed_module_stem) \
|
|
$(LOCAL_BUILT_MODULE):$(my_testcases_subdir)/$(my_installed_module_stem)
|
|
|
|
# Make sure we only add the files once for multilib modules.
|
|
ifndef $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
|
$(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files := true
|
|
|
|
# LOCAL_COMPATIBILITY_SUPPORT_FILES is a list of <src>[:<dest>].
|
|
my_compat_dist += $(foreach f, $(LOCAL_COMPATIBILITY_SUPPORT_FILES),\
|
|
$(eval p := $(subst :,$(space),$(f)))\
|
|
$(eval s := $(word 1,$(p)))\
|
|
$(eval n := $(or $(word 2,$(p)),$(notdir $(word 1, $(p))))) \
|
|
$(eval d := $(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(n)) \
|
|
$(s):$(d) $(s):$(my_testcases_subdir)/$(n))
|
|
|
|
ifneq (,$(wildcard $(LOCAL_PATH)/AndroidTest.xml))
|
|
my_compat_dist += \
|
|
$(LOCAL_PATH)/AndroidTest.xml:$(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(LOCAL_MODULE).config
|
|
my_compat_dist += \
|
|
$(LOCAL_PATH)/AndroidTest.xml:$(my_testcases_subdir)/$(LOCAL_MODULE).config
|
|
endif
|
|
|
|
ifneq (,$(wildcard $(LOCAL_PATH)/DynamicConfig.xml))
|
|
my_compat_dist += \
|
|
$(LOCAL_PATH)/DynamicConfig.xml:$(COMPATIBILITY_TESTCASES_OUT_$(LOCAL_COMPATIBILITY_SUITE))/$(LOCAL_MODULE).dynamic
|
|
my_compat_dist += \
|
|
$(LOCAL_PATH)/DynamicConfig.xml:$(my_testcases_subdir)/$(LOCAL_MODULE).dynamic
|
|
endif
|
|
endif # $(my_prefix)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_compat_files
|
|
|
|
my_compat_files := $(call copy-many-files, $(my_compat_dist))
|
|
|
|
COMPATIBILITY.$(LOCAL_COMPATIBILITY_SUITE).FILES := \
|
|
$(COMPATIBILITY.$(LOCAL_COMPATIBILITY_SUITE).FILES) \
|
|
$(my_compat_files)
|
|
|
|
# Copy over the compatibility files when user runs mm/mmm.
|
|
$(my_all_targets) : $(my_compat_files)
|
|
endif # LOCAL_COMPATIBILITY_SUITE
|
|
|
|
###########################################################
|
|
## Test Data
|
|
###########################################################
|
|
my_test_data_pairs :=
|
|
my_installed_test_data :=
|
|
|
|
ifneq ($(filter NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
|
|
ifneq ($(strip $(LOCAL_TEST_DATA)),)
|
|
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
|
|
|
my_test_data_pairs := $(strip $(foreach td,$(LOCAL_TEST_DATA), \
|
|
$(eval _file := $(call word-colon,2,$(td))) \
|
|
$(if $(_file), \
|
|
$(eval _base := $(call word-colon,1,$(td))), \
|
|
$(eval _base := $(LOCAL_PATH)) \
|
|
$(eval _file := $(call word-colon,1,$(td)))) \
|
|
$(if $(findstring ..,$(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include '..': $(_file))) \
|
|
$(if $(filter /%,$(_base) $(_file)),$(error $(LOCAL_MODULE_MAKEFILE): LOCAL_TEST_DATA may not include absolute paths: $(_base) $(_file))) \
|
|
$(call append-path,$(_base),$(_file)):$(call append-path,$(my_module_path),$(_file))))
|
|
|
|
my_installed_test_data := $(call copy-many-files,$(my_test_data_pairs))
|
|
$(LOCAL_INSTALLED_MODULE): $(my_installed_test_data)
|
|
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
###########################################################
|
|
## Register with ALL_MODULES
|
|
###########################################################
|
|
|
|
ALL_MODULES += $(my_register_name)
|
|
|
|
# Don't use += on subvars, or else they'll end up being
|
|
# recursively expanded.
|
|
ALL_MODULES.$(my_register_name).CLASS := \
|
|
$(ALL_MODULES.$(my_register_name).CLASS) $(LOCAL_MODULE_CLASS)
|
|
ALL_MODULES.$(my_register_name).PATH := \
|
|
$(ALL_MODULES.$(my_register_name).PATH) $(LOCAL_PATH)
|
|
ALL_MODULES.$(my_register_name).TAGS := \
|
|
$(ALL_MODULES.$(my_register_name).TAGS) $(my_module_tags)
|
|
ALL_MODULES.$(my_register_name).CHECKED := \
|
|
$(ALL_MODULES.$(my_register_name).CHECKED) $(my_checked_module)
|
|
ALL_MODULES.$(my_register_name).BUILT := \
|
|
$(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
|
|
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
|
|
ALL_MODULES.$(my_register_name).INSTALLED := \
|
|
$(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
|
|
$(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed) $(my_installed_symlinks) \
|
|
$(my_installed_test_data))
|
|
ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
|
|
$(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
|
|
$(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE) \
|
|
$(my_init_rc_pairs) $(my_test_data_pairs))
|
|
endif
|
|
ifdef LOCAL_PICKUP_FILES
|
|
# Files or directories ready to pick up by the build system
|
|
# when $(LOCAL_BUILT_MODULE) is done.
|
|
ALL_MODULES.$(my_register_name).PICKUP_FILES := \
|
|
$(ALL_MODULES.$(my_register_name).PICKUP_FILES) $(LOCAL_PICKUP_FILES)
|
|
endif
|
|
my_required_modules := $(LOCAL_REQUIRED_MODULES) \
|
|
$(LOCAL_REQUIRED_MODULES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
my_required_modules += $(LOCAL_REQUIRED_MODULES_$($(my_prefix)OS))
|
|
endif
|
|
ALL_MODULES.$(my_register_name).REQUIRED := \
|
|
$(strip $(ALL_MODULES.$(my_register_name).REQUIRED) $(my_required_modules))
|
|
ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED := \
|
|
$(strip $(ALL_MODULES.$(my_register_name).EXPLICITLY_REQUIRED)\
|
|
$(my_required_modules))
|
|
ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS := \
|
|
$(ALL_MODULES.$(my_register_name).EVENT_LOG_TAGS) $(event_log_tags)
|
|
ALL_MODULES.$(my_register_name).MAKEFILE := \
|
|
$(ALL_MODULES.$(my_register_name).MAKEFILE) $(LOCAL_MODULE_MAKEFILE)
|
|
ifdef LOCAL_MODULE_OWNER
|
|
ALL_MODULES.$(my_register_name).OWNER := \
|
|
$(sort $(ALL_MODULES.$(my_register_name).OWNER) $(LOCAL_MODULE_OWNER))
|
|
endif
|
|
ifdef LOCAL_2ND_ARCH_VAR_PREFIX
|
|
ALL_MODULES.$(my_register_name).FOR_2ND_ARCH := true
|
|
endif
|
|
ALL_MODULES.$(my_register_name).FOR_HOST_CROSS := $(my_host_cross)
|
|
|
|
INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
|
|
|
|
##########################################################
|
|
# Track module-level dependencies.
|
|
# Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
|
|
ALL_DEPS.MODULES := $(sort $(ALL_DEPS.MODULES) $(LOCAL_MODULE))
|
|
ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
|
|
$(ALL_MODULES.$(LOCAL_MODULE).ALL_DEPS) \
|
|
$(LOCAL_STATIC_LIBRARIES) \
|
|
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
|
|
$(LOCAL_SHARED_LIBRARIES) \
|
|
$(LOCAL_HEADER_LIBRARIES) \
|
|
$(LOCAL_STATIC_JAVA_LIBRARIES) \
|
|
$(LOCAL_JAVA_LIBRARIES)\
|
|
$(LOCAL_JNI_SHARED_LIBRARIES))
|
|
|
|
ALL_DEPS.$(LOCAL_MODULE).LICENSE := $(sort $(ALL_DEPS.$(LOCAL_MODULE).LICENSE) $(license_files))
|
|
|
|
###########################################################
|
|
## Take care of my_module_tags
|
|
###########################################################
|
|
|
|
# Keep track of all the tags we've seen.
|
|
ALL_MODULE_TAGS := $(sort $(ALL_MODULE_TAGS) $(my_module_tags))
|
|
|
|
# Add this module name to the tag list of each specified tag.
|
|
$(foreach tag,$(my_module_tags),\
|
|
$(eval ALL_MODULE_NAME_TAGS.$(tag) += $(my_register_name)))
|
|
|
|
###########################################################
|
|
## umbrella targets used to verify builds
|
|
###########################################################
|
|
j_or_n :=
|
|
ifneq (,$(filter EXECUTABLES SHARED_LIBRARIES STATIC_LIBRARIES HEADER_LIBRARIES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)))
|
|
j_or_n := native
|
|
else
|
|
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
|
|
j_or_n := java
|
|
endif
|
|
endif
|
|
ifdef LOCAL_IS_HOST_MODULE
|
|
h_or_t := host
|
|
ifeq ($(my_host_cross),true)
|
|
h_or_hc_or_t := host-cross
|
|
else
|
|
h_or_hc_or_t := host
|
|
endif
|
|
else
|
|
h_or_hc_or_t := target
|
|
h_or_t := target
|
|
endif
|
|
|
|
|
|
ifdef j_or_n
|
|
$(j_or_n) $(h_or_t) $(j_or_n)-$(h_or_t) : $(my_checked_module)
|
|
ifneq (,$(filter $(my_module_tags),tests))
|
|
$(j_or_n)-$(h_or_t)-tests $(j_or_n)-tests $(h_or_t)-tests : $(my_checked_module)
|
|
endif
|
|
$(LOCAL_MODULE)-$(h_or_hc_or_t) : $(my_all_targets)
|
|
ifeq ($(j_or_n),native)
|
|
$(LOCAL_MODULE)-$(h_or_hc_or_t)$(my_32_64_bit_suffix) : $(my_all_targets)
|
|
endif
|
|
endif
|
|
|
|
###########################################################
|
|
## NOTICE files
|
|
###########################################################
|
|
|
|
include $(BUILD_NOTICE_FILE)
|