1 ###########################################################
3 ###########################################################
5 notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE))
7 ifeq ($(LOCAL_MODULE_CLASS),NONE)
8 # We ignore NOTICE files for modules of type NONE.
14 # This relies on the name of the directory in PRODUCT_OUT matching where
15 # it's installed on the target - i.e. system, data, etc. This does
16 # not work for root and isn't exact, but it's probably good enough for
18 # Includes the leading slash
19 ifdef LOCAL_INSTALLED_MODULE
20 module_installed_filename := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
22 # This module isn't installable
23 ifeq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
24 # Stick the static libraries with the dynamic libraries.
25 # We can't use xxx_OUT_STATIC_LIBRARIES because it points into
26 # device-obj or host-obj.
27 module_installed_filename := \
28 $(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
30 ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
31 # Stick the static java libraries with the regular java libraries.
32 module_leaf := $(notdir $(LOCAL_BUILT_MODULE))
33 # javalib.jar is the default name for the build module (and isn't meaningful)
34 # If that's what we have, substitute the module name instead. These files
35 # aren't included on the device, so this name is synthetic anyway.
36 ifeq ($(module_leaf),javalib.jar)
37 module_leaf := $(LOCAL_MODULE).jar
39 module_installed_filename := \
40 $(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf)
42 $(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE))
43 endif # JAVA_LIBRARIES
44 endif # STATIC_LIBRARIES
47 # In case it's actually a host file
48 module_installed_filename := $(patsubst $(HOST_OUT)%,%,$(module_installed_filename))
50 installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
52 $(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)
54 $(installed_notice_file): $(notice_file)
55 @echo Notice file: $< -- $@
56 $(hide) mkdir -p $(dir $@)
59 ifdef LOCAL_INSTALLED_MODULE
60 # Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
61 # libraries so they get installed along with it. Make it an order-only
62 # dependency so we don't re-install a module when the NOTICE changes.
63 $(LOCAL_INSTALLED_MODULE): | $(installed_notice_file)
67 # NOTICE file does not exist
68 installed_notice_file :=
71 # Create a predictable, phony target to build this notice file.
72 # Define it even if the notice file doesn't exist so that other
73 # modules can depend on it.
74 notice_target := NOTICE-$(if \
75 $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
76 .PHONY: $(notice_target)
77 $(notice_target): $(installed_notice_file)