1 ###########################################################
2 ## Standard rules for copying files that are prebuilt
4 ## Additional inputs from base_rules.make:
7 ###########################################################
9 ifneq ($(LOCAL_PREBUILT_LIBS),)
10 $(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH))
12 ifneq ($(LOCAL_PREBUILT_EXECUTABLES),)
13 $(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH))
15 ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),)
16 $(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH))
19 ifdef LOCAL_PREBUILT_MODULE_FILE
20 my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE)
22 my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
25 ifdef LOCAL_IS_HOST_MODULE
30 ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
31 # Put the built targets of all shared libraries in a common directory
32 # to simplify the link line.
33 OVERRIDE_BUILT_MODULE_PATH := $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
36 ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
37 prebuilt_module_is_a_library := true
39 prebuilt_module_is_a_library :=
42 # Don't install static libraries by default.
43 ifndef LOCAL_UNINSTALLABLE_MODULE
44 ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS))
45 LOCAL_UNINSTALLABLE_MODULE := true
49 ifeq ($(LOCAL_STRIP_MODULE),true)
50 ifdef LOCAL_IS_HOST_MODULE
51 $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
53 ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
54 $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
56 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
57 $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
59 include $(BUILD_SYSTEM)/dynamic_binary.mk
60 built_module := $(linked_module)
61 else # LOCAL_STRIP_MODULE not true
62 include $(BUILD_SYSTEM)/base_rules.mk
63 built_module := $(LOCAL_BUILT_MODULE)
65 ifdef prebuilt_module_is_a_library
66 export_includes := $(intermediates)/export_includes
67 $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
68 $(export_includes) : $(LOCAL_MODULE_MAKEFILE)
69 @echo Export includes file: $< -- $@
70 $(hide) mkdir -p $(dir $@) && rm -f $@
71 ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
72 $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
73 echo "-I $$d" >> $@; \
79 $(LOCAL_BUILT_MODULE) : | $(intermediates)/export_includes
80 endif # prebuilt_module_is_a_library
82 # The real dependency will be added after all Android.mks are loaded and the install paths
83 # of the shared libraries are determined.
84 ifdef LOCAL_INSTALLED_MODULE
85 ifdef LOCAL_SHARED_LIBRARIES
86 $(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += $(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(LOCAL_SHARED_LIBRARIES))
90 endif # LOCAL_STRIP_MODULE not true
92 PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
94 ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
95 # The magic string "EXTERNAL" means this package will be signed with
96 # the default dev key throughout the build process, but we expect
97 # the final package to be signed with a different key.
99 # This can be used for packages where we don't have access to the
100 # keys, but want the package to be predexopt'ed.
101 LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
102 PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1
104 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
105 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
107 ifeq ($(LOCAL_CERTIFICATE),)
108 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
109 # It is now a build error to add a prebuilt .apk without
110 # specifying a key for it.
111 $(error No LOCAL_CERTIFICATE specified for prebuilt "$(my_prebuilt_src_file)")
113 else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
114 # The magic string "PRESIGNED" means this package is already checked
115 # signed with its release key.
117 # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be
118 # mentioned in apkcerts.txt (with certificate set to "PRESIGNED")
119 # but the dexpreopt process will not try to re-sign the app.
120 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED
121 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
123 # If this is not an absolute certificate, assign it to a generic one.
124 ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
125 LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
128 PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
129 PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
130 PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
132 $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8
133 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem
136 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
137 ifeq ($(LOCAL_CERTIFICATE),PRESIGNED)
138 # Ensure that presigned .apks have been aligned.
139 $(built_module) : $(my_prebuilt_src_file) | $(ZIPALIGN)
140 $(transform-prebuilt-to-target-with-zipalign)
142 # Sign and align non-presigned .apks.
143 $(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR)
144 $(transform-prebuilt-to-target)
149 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
150 $(built_module) : $(my_prebuilt_src_file)
151 $(transform-prebuilt-to-target-strip-comments)
153 $(built_module) : $(my_prebuilt_src_file) | $(ACP)
154 $(transform-prebuilt-to-target)
155 ifneq ($(prebuilt_module_is_a_library),)
156 ifneq ($(LOCAL_IS_HOST_MODULE),)
157 $(transform-host-ranlib-copy-hack)
159 $(transform-ranlib-copy-hack)
165 ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
166 # for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir,
167 # while the deps should be in the common dir, so we make a copy in the common dir.
168 # For nonstatic library, $(common_javalib_jar) is the dependency file,
169 # while $(common_classes_jar) is used to link.
170 common_classes_jar := $(call intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
171 common_javalib_jar := $(dir $(common_classes_jar))javalib.jar
173 $(common_classes_jar) : $(my_prebuilt_src_file) | $(ACP)
174 $(transform-prebuilt-to-target)
176 $(common_javalib_jar) : $(common_classes_jar) | $(ACP)
177 $(transform-prebuilt-to-target)
179 # make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
180 $(built_module) : $(common_javalib_jar)
181 endif # TARGET JAVA_LIBRARIES