OSDN Git Service

Build 64-bit kernel with gcc 4.6
[android-x86/build.git] / core / notice_files.mk
1 ###########################################################
2 ## Track NOTICE files
3 ###########################################################
4
5 notice_file:=$(strip $(wildcard $(LOCAL_PATH)/NOTICE))
6
7 ifeq ($(LOCAL_MODULE_CLASS),GYP)
8   # We ignore NOTICE files for modules of type GYP.
9   notice_file :=
10 endif
11
12 ifeq ($(LOCAL_MODULE_CLASS),NOTICE_FILES)
13 # If this is a NOTICE-only module, we don't include base_rule.mk,
14 # so my_prefix is not set at this point.
15 ifeq ($(LOCAL_IS_HOST_MODULE),true)
16   my_prefix := HOST_
17 else
18   my_prefix := TARGET_
19 endif
20 endif
21
22 ifdef notice_file
23
24 # This relies on the name of the directory in PRODUCT_OUT matching where
25 # it's installed on the target - i.e. system, data, etc.  This does
26 # not work for root and isn't exact, but it's probably good enough for
27 # compliance.
28 # Includes the leading slash
29 ifdef LOCAL_INSTALLED_MODULE
30   module_installed_filename := $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE))
31 else
32   # This module isn't installable
33   ifeq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
34     # Stick the static libraries with the dynamic libraries.
35     # We can't use xxx_OUT_STATIC_LIBRARIES because it points into
36     # device-obj or host-obj.
37     module_installed_filename := \
38         $(patsubst $(PRODUCT_OUT)%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
39   else
40     ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
41       # Stick the static java libraries with the regular java libraries.
42       module_leaf := $(notdir $(LOCAL_BUILT_MODULE))
43       # javalib.jar is the default name for the build module (and isn't meaningful)
44       # If that's what we have, substitute the module name instead.  These files
45       # aren't included on the device, so this name is synthetic anyway.
46       ifneq ($(filter javalib.jar classes.jack,$(module_leaf)),)
47         module_leaf := $(LOCAL_MODULE).jar
48       endif
49       module_installed_filename := \
50           $(patsubst $(PRODUCT_OUT)%,%,$($(my_prefix)OUT_JAVA_LIBRARIES))/$(module_leaf)
51     else
52       $(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE))
53     endif # JAVA_LIBRARIES
54   endif # STATIC_LIBRARIES
55 endif
56
57 # In case it's actually a host file
58 module_installed_filename := $(patsubst $(HOST_OUT)%,%,$(module_installed_filename))
59
60 installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_filename).txt
61
62 $(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename)
63
64 $(installed_notice_file): $(notice_file)
65         @echo Notice file: $< -- $@
66         $(hide) mkdir -p $(dir $@)
67         $(hide) cat $< > $@
68
69 ifdef LOCAL_INSTALLED_MODULE
70 # Make LOCAL_INSTALLED_MODULE depend on NOTICE files if they exist
71 # libraries so they get installed along with it.  Make it an order-only
72 # dependency so we don't re-install a module when the NOTICE changes.
73 $(LOCAL_INSTALLED_MODULE): | $(installed_notice_file)
74 endif
75
76 # To facilitate collecting NOTICE files for apps_only build,
77 # we install the NOTICE file even if a module gets built but not installed,
78 # because shared jni libraries won't be installed to the system image.
79 ifdef TARGET_BUILD_APPS
80 # for static Java libraries, we don't need to even build LOCAL_BUILT_MODULE,
81 # but just javalib.jar in the common intermediate dir.
82 ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
83 $(intermediates.COMMON)/javalib.jar : | $(installed_notice_file)
84 else
85 $(LOCAL_BUILT_MODULE): | $(installed_notice_file)
86 endif  # JAVA_LIBRARIES
87 endif  # TARGET_BUILD_APPS
88
89 else
90 # NOTICE file does not exist
91 installed_notice_file :=
92 endif
93
94 # Create a predictable, phony target to build this notice file.
95 # Define it even if the notice file doesn't exist so that other
96 # modules can depend on it.
97 notice_target := NOTICE-$(if \
98     $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
99 .PHONY: $(notice_target)
100 $(notice_target): $(installed_notice_file)