2009-03-04 11:28:42 +08:00
|
|
|
###########################################################
|
|
|
|
## Track NOTICE files
|
|
|
|
###########################################################
|
2016-07-26 07:03:53 +08:00
|
|
|
$(call record-module-type,NOTICE_FILE)
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2015-12-22 22:34:09 +08:00
|
|
|
ifneq ($(LOCAL_NOTICE_FILE),)
|
|
|
|
notice_file:=$(strip $(LOCAL_NOTICE_FILE))
|
|
|
|
else
|
2020-02-14 04:37:33 +08:00
|
|
|
notice_file:=$(strip $(wildcard $(LOCAL_PATH)/LICENSE $(LOCAL_PATH)/LICENCE $(LOCAL_PATH)/NOTICE))
|
2015-12-22 22:34:09 +08:00
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2012-10-25 22:49:39 +08:00
|
|
|
ifeq ($(LOCAL_MODULE_CLASS),GYP)
|
|
|
|
# We ignore NOTICE files for modules of type GYP.
|
2012-06-27 08:07:19 +08:00
|
|
|
notice_file :=
|
|
|
|
endif
|
|
|
|
|
2018-04-12 02:42:26 +08:00
|
|
|
ifeq ($(LOCAL_MODULE_CLASS),FAKE)
|
|
|
|
# We ignore NOTICE files for modules of type FAKE.
|
|
|
|
notice_file :=
|
|
|
|
endif
|
|
|
|
|
2017-04-04 07:06:00 +08:00
|
|
|
# Soong generates stub libraries that don't need NOTICE files
|
|
|
|
ifdef LOCAL_NO_NOTICE_FILE
|
|
|
|
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
|
|
|
|
$(call pretty-error,LOCAL_NO_NOTICE_FILE should not be used by Android.mk files)
|
|
|
|
endif
|
|
|
|
notice_file :=
|
|
|
|
endif
|
|
|
|
|
2012-11-02 08:22:33 +08:00
|
|
|
ifeq ($(LOCAL_MODULE_CLASS),NOTICE_FILES)
|
|
|
|
# If this is a NOTICE-only module, we don't include base_rule.mk,
|
|
|
|
# so my_prefix is not set at this point.
|
|
|
|
ifeq ($(LOCAL_IS_HOST_MODULE),true)
|
|
|
|
my_prefix := HOST_
|
2015-08-15 03:59:50 +08:00
|
|
|
LOCAL_HOST_PREFIX :=
|
2012-11-02 08:22:33 +08:00
|
|
|
else
|
|
|
|
my_prefix := TARGET_
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2019-04-03 23:59:49 +08:00
|
|
|
installed_notice_file :=
|
|
|
|
|
2011-03-29 20:27:27 +08:00
|
|
|
ifdef notice_file
|
2009-03-04 11:28:42 +08:00
|
|
|
|
2018-06-18 12:47:18 +08:00
|
|
|
ifdef my_register_name
|
|
|
|
ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file)
|
|
|
|
endif
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# This relies on the name of the directory in PRODUCT_OUT matching where
|
|
|
|
# it's installed on the target - i.e. system, data, etc. This does
|
|
|
|
# not work for root and isn't exact, but it's probably good enough for
|
|
|
|
# compliance.
|
|
|
|
# Includes the leading slash
|
|
|
|
ifdef LOCAL_INSTALLED_MODULE
|
Fix PDK dupbuild issues
The PDK uses pattern rules in order to install files from the PDK. When
those files already have build rules, the explicit rules override the
pattern rules, and everything works. But because Make (and Kati) doesn't
attempt to clean the file paths, if one of the rules has a redundant /,
we'll export two ninja rules, and ninja will error out with a dupbuild
error.
The PDK pattern rules are clean, but the explicit notice file creation
was not, it was always adding a double // in between NOTICE_FILES/src
and the module path.
Some modules were also setting a LOCAL_MODULE_PATH with a trailing /,
which is redundant, and also hits the above problem. Instead of fixing
all of the modules, just strip a trailing / from my_module_path.
Bug: 33451638
Test: Build with a PDK
Change-Id: Iff3e98fd191ea90626b9b89f179537e8a75f5ef2
2016-12-10 13:15:41 +08:00
|
|
|
module_installed_filename := $(patsubst $(PRODUCT_OUT)/%,%,$(LOCAL_INSTALLED_MODULE))
|
2009-03-04 11:28:42 +08:00
|
|
|
else
|
|
|
|
# This module isn't installable
|
2019-08-28 02:23:35 +08:00
|
|
|
ifneq ($(filter STATIC_LIBRARIES RLIB_LIBRARIES PROC_MACRO_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
|
2009-03-04 11:28:42 +08:00
|
|
|
# Stick the static libraries with the dynamic libraries.
|
|
|
|
# We can't use xxx_OUT_STATIC_LIBRARIES because it points into
|
|
|
|
# device-obj or host-obj.
|
|
|
|
module_installed_filename := \
|
Fix PDK dupbuild issues
The PDK uses pattern rules in order to install files from the PDK. When
those files already have build rules, the explicit rules override the
pattern rules, and everything works. But because Make (and Kati) doesn't
attempt to clean the file paths, if one of the rules has a redundant /,
we'll export two ninja rules, and ninja will error out with a dupbuild
error.
The PDK pattern rules are clean, but the explicit notice file creation
was not, it was always adding a double // in between NOTICE_FILES/src
and the module path.
Some modules were also setting a LOCAL_MODULE_PATH with a trailing /,
which is redundant, and also hits the above problem. Instead of fixing
all of the modules, just strip a trailing / from my_module_path.
Bug: 33451638
Test: Build with a PDK
Change-Id: Iff3e98fd191ea90626b9b89f179537e8a75f5ef2
2016-12-10 13:15:41 +08:00
|
|
|
$(patsubst $(PRODUCT_OUT)/%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
|
2019-05-14 15:44:52 +08:00
|
|
|
else ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
|
|
|
|
# Shared modules may be uninstallable(e.g. TARGET_SKIP_CURRENT_VNDK=true)
|
|
|
|
module_installed_filename :=
|
2009-03-04 11:28:42 +08:00
|
|
|
else
|
|
|
|
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
|
|
|
|
# Stick the static java libraries with the regular java libraries.
|
2009-04-14 00:51:43 +08:00
|
|
|
module_leaf := $(notdir $(LOCAL_BUILT_MODULE))
|
|
|
|
# javalib.jar is the default name for the build module (and isn't meaningful)
|
|
|
|
# If that's what we have, substitute the module name instead. These files
|
|
|
|
# aren't included on the device, so this name is synthetic anyway.
|
2019-10-29 17:25:22 +08:00
|
|
|
# Extra path "static" is added to try to avoid name conflict between the notice file of
|
|
|
|
# this 'uninstallable' Java module and the notice file for another 'installable' Java module
|
|
|
|
# whose stem is the same as this module's name.
|
2017-09-28 05:28:41 +08:00
|
|
|
ifneq ($(filter javalib.jar,$(module_leaf)),)
|
2019-10-29 17:25:22 +08:00
|
|
|
module_leaf := static/$(LOCAL_MODULE).jar
|
2009-04-14 00:51:43 +08:00
|
|
|
endif
|
2009-03-04 11:28:42 +08:00
|
|
|
module_installed_filename := \
|
Fix PDK dupbuild issues
The PDK uses pattern rules in order to install files from the PDK. When
those files already have build rules, the explicit rules override the
pattern rules, and everything works. But because Make (and Kati) doesn't
attempt to clean the file paths, if one of the rules has a redundant /,
we'll export two ninja rules, and ninja will error out with a dupbuild
error.
The PDK pattern rules are clean, but the explicit notice file creation
was not, it was always adding a double // in between NOTICE_FILES/src
and the module path.
Some modules were also setting a LOCAL_MODULE_PATH with a trailing /,
which is redundant, and also hits the above problem. Instead of fixing
all of the modules, just strip a trailing / from my_module_path.
Bug: 33451638
Test: Build with a PDK
Change-Id: Iff3e98fd191ea90626b9b89f179537e8a75f5ef2
2016-12-10 13:15:41 +08:00
|
|
|
$(patsubst $(PRODUCT_OUT)/%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf)
|
2019-04-03 23:59:49 +08:00
|
|
|
else ifeq ($(LOCAL_MODULE_CLASS),ETC)
|
|
|
|
# ETC modules may be uninstallable, yet still have a NOTICE file. e.g. apex components
|
|
|
|
module_installed_filename :=
|
2020-04-08 00:50:32 +08:00
|
|
|
else ifneq (,$(and $(filter %.sdk,$(LOCAL_MODULE)),$(filter $(patsubst %.sdk,%,$(LOCAL_MODULE)),$(SOONG_SDK_VARIANT_MODULES))))
|
|
|
|
# Soong produces uninstallable *.sdk shared libraries for embedding in APKs.
|
|
|
|
module_installed_filename := \
|
|
|
|
$(patsubst $(PRODUCT_OUT)/%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
|
2009-03-04 11:28:42 +08:00
|
|
|
else
|
|
|
|
$(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE))
|
|
|
|
endif # JAVA_LIBRARIES
|
|
|
|
endif # STATIC_LIBRARIES
|
|
|
|
endif
|
|
|
|
|
2019-04-03 23:59:49 +08:00
|
|
|
ifdef module_installed_filename
|
|
|
|
|
2009-03-04 11:28:42 +08:00
|
|
|
# In case it's actually a host file
|
Fix PDK dupbuild issues
The PDK uses pattern rules in order to install files from the PDK. When
those files already have build rules, the explicit rules override the
pattern rules, and everything works. But because Make (and Kati) doesn't
attempt to clean the file paths, if one of the rules has a redundant /,
we'll export two ninja rules, and ninja will error out with a dupbuild
error.
The PDK pattern rules are clean, but the explicit notice file creation
was not, it was always adding a double // in between NOTICE_FILES/src
and the module path.
Some modules were also setting a LOCAL_MODULE_PATH with a trailing /,
which is redundant, and also hits the above problem. Instead of fixing
all of the modules, just strip a trailing / from my_module_path.
Bug: 33451638
Test: Build with a PDK
Change-Id: Iff3e98fd191ea90626b9b89f179537e8a75f5ef2
2016-12-10 13:15:41 +08:00
|
|
|
module_installed_filename := $(patsubst $(HOST_OUT)/%,%,$(module_installed_filename))
|
|
|
|
module_installed_filename := $(patsubst $(HOST_CROSS_OUT)/%,%,$(module_installed_filename))
|
2009-03-04 11:28:42 +08:00
|
|
|
|
|
|
|
installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
|
|
|
|
|
|
|
|
$(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)
|
|
|
|
|
|
|
|
$(installed_notice_file): $(notice_file)
|
|
|
|
@echo Notice file: $< -- $@
|
|
|
|
$(hide) mkdir -p $(dir $@)
|
2020-02-14 04:37:33 +08:00
|
|
|
$(hide) awk 'FNR==1 && NR > 1 {print "\n"} {print}' $^ > $@
|
2009-03-04 11:28:42 +08:00
|
|
|
|
|
|
|
ifdef LOCAL_INSTALLED_MODULE
|
|
|
|
# Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
|
|
|
|
# libraries so they get installed along with it. Make it an order-only
|
|
|
|
# dependency so we don't re-install a module when the NOTICE changes.
|
|
|
|
$(LOCAL_INSTALLED_MODULE): | $(installed_notice_file)
|
|
|
|
endif
|
|
|
|
|
2013-08-23 11:02:03 +08:00
|
|
|
# To facilitate collecting NOTICE files for apps_only build,
|
|
|
|
# we install the NOTICE file even if a module gets built but not installed,
|
|
|
|
# because shared jni libraries won't be installed to the system image.
|
|
|
|
ifdef TARGET_BUILD_APPS
|
|
|
|
# for static Java libraries, we don't need to even build LOCAL_BUILT_MODULE,
|
|
|
|
# but just javalib.jar in the common intermediate dir.
|
|
|
|
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
|
|
|
|
$(intermediates.COMMON)/javalib.jar : | $(installed_notice_file)
|
|
|
|
else
|
|
|
|
$(LOCAL_BUILT_MODULE): | $(installed_notice_file)
|
|
|
|
endif # JAVA_LIBRARIES
|
|
|
|
endif # TARGET_BUILD_APPS
|
|
|
|
|
2019-04-03 23:59:49 +08:00
|
|
|
endif # module_installed_filename
|
|
|
|
endif # notice_file
|
2009-03-04 11:28:42 +08:00
|
|
|
|
|
|
|
# Create a predictable, phony target to build this notice file.
|
|
|
|
# Define it even if the notice file doesn't exist so that other
|
|
|
|
# modules can depend on it.
|
|
|
|
notice_target := NOTICE-$(if \
|
2018-11-09 08:53:02 +08:00
|
|
|
$(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
|
2009-03-04 11:28:42 +08:00
|
|
|
.PHONY: $(notice_target)
|
|
|
|
$(notice_target): $(installed_notice_file)
|