Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 1 | ########################################################### |
| 2 | ## Standard rules for copying files that are prebuilt |
| 3 | ## |
| 4 | ## Additional inputs from base_rules.make: |
| 5 | ## None. |
| 6 | ## |
| 7 | ########################################################### |
| 8 | |
| 9 | ifneq ($(LOCAL_PREBUILT_LIBS),) |
| 10 | $(error dont use LOCAL_PREBUILT_LIBS anymore LOCAL_PATH=$(LOCAL_PATH)) |
| 11 | endif |
| 12 | ifneq ($(LOCAL_PREBUILT_EXECUTABLES),) |
| 13 | $(error dont use LOCAL_PREBUILT_EXECUTABLES anymore LOCAL_PATH=$(LOCAL_PATH)) |
| 14 | endif |
| 15 | ifneq ($(LOCAL_PREBUILT_JAVA_LIBRARIES),) |
| 16 | $(error dont use LOCAL_PREBUILT_JAVA_LIBRARIES anymore LOCAL_PATH=$(LOCAL_PATH)) |
| 17 | endif |
| 18 | |
| 19 | # Not much sense to check build prebuilts |
| 20 | LOCAL_DONT_CHECK_MODULE := true |
| 21 | |
Ying Wang | 34d5f1b | 2014-05-16 10:38:43 -0700 | [diff] [blame] | 22 | my_32_64_bit_suffix := $(if $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)IS_64_BIT),64,32) |
| 23 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 24 | ifdef LOCAL_PREBUILT_MODULE_FILE |
Ying Wang | c0adfb7 | 2014-02-27 14:10:53 -0800 | [diff] [blame] | 25 | my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 26 | else |
Ying Wang | 6feb6d5 | 2014-04-17 10:03:35 -0700 | [diff] [blame] | 27 | ifdef LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) |
| 28 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) |
Ying Wang | c0adfb7 | 2014-02-27 14:10:53 -0800 | [diff] [blame] | 29 | else |
Ying Wang | 34d5f1b | 2014-05-16 10:38:43 -0700 | [diff] [blame] | 30 | ifdef LOCAL_SRC_FILES_$(my_32_64_bit_suffix) |
| 31 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)) |
| 32 | else |
| 33 | my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES) |
| 34 | endif |
Ying Wang | c0adfb7 | 2014-02-27 14:10:53 -0800 | [diff] [blame] | 35 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 36 | endif |
| 37 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 38 | ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 39 | # Put the built targets of all shared libraries in a common directory |
| 40 | # to simplify the link line. |
| 41 | OVERRIDE_BUILT_MODULE_PATH := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES) |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 42 | ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_STRIP_MODULE),) |
| 43 | # Strip but not try to add debuglink |
| 44 | LOCAL_STRIP_MODULE := no_debuglink |
| 45 | endif |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 46 | |
| 47 | ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_PACK_MODULE_RELOCATIONS),) |
| 48 | # Do not pack relocations by default |
| 49 | LOCAL_PACK_MODULE_RELOCATIONS := false |
| 50 | endif |
Dan Albert | 52831d1 | 2015-11-12 15:27:49 -0800 | [diff] [blame] | 51 | |
| 52 | ifeq ($(DISABLE_RELOCATION_PACKER),true) |
| 53 | LOCAL_PACK_MODULE_RELOCATIONS := false |
| 54 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 55 | endif |
| 56 | |
| 57 | ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),) |
| 58 | prebuilt_module_is_a_library := true |
| 59 | else |
| 60 | prebuilt_module_is_a_library := |
| 61 | endif |
| 62 | |
| 63 | # Don't install static libraries by default. |
| 64 | ifndef LOCAL_UNINSTALLABLE_MODULE |
| 65 | ifeq (STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)) |
| 66 | LOCAL_UNINSTALLABLE_MODULE := true |
| 67 | endif |
| 68 | endif |
| 69 | |
Ying Wang | af9757e | 2014-07-17 21:24:42 -0700 | [diff] [blame] | 70 | ifeq ($(LOCAL_MODULE_CLASS),APPS) |
| 71 | LOCAL_BUILT_MODULE_STEM := package.apk |
| 72 | LOCAL_INSTALLED_MODULE_STEM := $(LOCAL_MODULE).apk |
| 73 | endif |
| 74 | |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 75 | ifneq ($(filter true no_debuglink,$(LOCAL_STRIP_MODULE) $(LOCAL_PACK_MODULE_RELOCATIONS)),) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 76 | ifdef LOCAL_IS_HOST_MODULE |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 77 | $(error Cannot strip/pack host module LOCAL_PATH=$(LOCAL_PATH)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 78 | endif |
| 79 | ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),) |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 80 | $(error Can strip/pack only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 81 | endif |
| 82 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 83 | $(error Cannot strip/pack scripts LOCAL_PATH=$(LOCAL_PATH)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 84 | endif |
| 85 | include $(BUILD_SYSTEM)/dynamic_binary.mk |
| 86 | built_module := $(linked_module) |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 87 | |
Dmitriy Ivanov | 64762c3 | 2015-04-24 15:33:14 -0700 | [diff] [blame] | 88 | else # LOCAL_STRIP_MODULE and LOCAL_PACK_MODULE_RELOCATIONS not true |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 89 | include $(BUILD_SYSTEM)/base_rules.mk |
| 90 | built_module := $(LOCAL_BUILT_MODULE) |
| 91 | |
| 92 | ifdef prebuilt_module_is_a_library |
| 93 | export_includes := $(intermediates)/export_includes |
| 94 | $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) |
Colin Cross | a4447e8 | 2015-09-28 16:26:00 -0700 | [diff] [blame] | 95 | $(export_includes) : $(LOCAL_MODULE_MAKEFILE_DEP) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 96 | @echo Export includes file: $< -- $@ |
| 97 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
| 98 | ifdef LOCAL_EXPORT_C_INCLUDE_DIRS |
| 99 | $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ |
| 100 | echo "-I $$d" >> $@; \ |
| 101 | done |
| 102 | else |
| 103 | $(hide) touch $@ |
| 104 | endif |
| 105 | |
| 106 | $(LOCAL_BUILT_MODULE) : | $(intermediates)/export_includes |
| 107 | endif # prebuilt_module_is_a_library |
| 108 | |
| 109 | # The real dependency will be added after all Android.mks are loaded and the install paths |
| 110 | # of the shared libraries are determined. |
| 111 | ifdef LOCAL_INSTALLED_MODULE |
| 112 | ifdef LOCAL_SHARED_LIBRARIES |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 113 | my_shared_libraries := $(LOCAL_SHARED_LIBRARIES) |
| 114 | # Extra shared libraries introduced by LOCAL_CXX_STL. |
| 115 | include $(BUILD_SYSTEM)/cxx_stl_setup.mk |
Ying Wang | 58f462f | 2014-02-25 18:26:29 -0800 | [diff] [blame] | 116 | $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \ |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 117 | $(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries)) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 118 | |
| 119 | # We also need the LOCAL_BUILT_MODULE dependency, |
| 120 | # since we use -rpath-link which points to the built module's path. |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 121 | my_built_shared_libraries := \ |
Ying Wang | 58f462f | 2014-02-25 18:26:29 -0800 | [diff] [blame] | 122 | $(addprefix $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \ |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 123 | $(addsuffix $($(my_prefix)SHLIB_SUFFIX), \ |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 124 | $(my_shared_libraries))) |
| 125 | $(LOCAL_BUILT_MODULE) : $(my_built_shared_libraries) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 126 | endif |
| 127 | endif |
| 128 | |
Ying Wang | 7c87739 | 2014-10-07 13:03:29 -0700 | [diff] [blame] | 129 | # We need to enclose the above export_includes and my_built_shared_libraries in |
Ying Wang | bfb52a2 | 2014-08-20 17:12:32 -0700 | [diff] [blame] | 130 | # "LOCAL_STRIP_MODULE not true" because otherwise the rules are defined in dynamic_binary.mk. |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 131 | endif # LOCAL_STRIP_MODULE not true |
| 132 | |
Ying Wang | f0534c2 | 2014-04-15 11:12:21 -0700 | [diff] [blame] | 133 | ifeq ($(LOCAL_MODULE_CLASS),APPS) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 134 | PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) |
| 135 | |
Ying Wang | 43f7a32 | 2014-11-17 16:56:04 -0800 | [diff] [blame] | 136 | # Select dpi-specific source |
| 137 | ifdef LOCAL_DPI_VARIANTS |
Ying Wang | 6068658 | 2014-12-10 12:40:09 -0800 | [diff] [blame] | 138 | my_dpi := $(firstword $(filter $(LOCAL_DPI_VARIANTS),$(PRODUCT_AAPT_PREF_CONFIG) $(PRODUCT_AAPT_PREBUILT_DPI))) |
Ying Wang | 43f7a32 | 2014-11-17 16:56:04 -0800 | [diff] [blame] | 139 | ifdef my_dpi |
| 140 | ifdef LOCAL_DPI_FILE_STEM |
| 141 | my_prebuilt_dpi_file_stem := $(LOCAL_DPI_FILE_STEM) |
| 142 | else |
| 143 | my_prebuilt_dpi_file_stem := $(LOCAL_MODULE)_%.apk |
| 144 | endif |
| 145 | my_prebuilt_src_file := $(dir $(my_prebuilt_src_file))$(subst %,$(my_dpi),$(my_prebuilt_dpi_file_stem)) |
| 146 | endif # my_dpi |
| 147 | endif # LOCAL_DPI_VARIANTS |
| 148 | |
Ying Wang | 96bcad4 | 2014-04-17 13:38:04 -0700 | [diff] [blame] | 149 | rs_compatibility_jni_libs := |
| 150 | include $(BUILD_SYSTEM)/install_jni_libs.mk |
| 151 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 152 | ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) |
| 153 | # The magic string "EXTERNAL" means this package will be signed with |
| 154 | # the default dev key throughout the build process, but we expect |
| 155 | # the final package to be signed with a different key. |
| 156 | # |
| 157 | # This can be used for packages where we don't have access to the |
| 158 | # keys, but want the package to be predexopt'ed. |
| 159 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 160 | PACKAGES.$(LOCAL_MODULE).EXTERNAL_KEY := 1 |
| 161 | |
| 162 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 163 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 164 | endif |
| 165 | ifeq ($(LOCAL_CERTIFICATE),) |
Ying Wang | f0534c2 | 2014-04-15 11:12:21 -0700 | [diff] [blame] | 166 | # It is now a build error to add a prebuilt .apk without |
| 167 | # specifying a key for it. |
| 168 | $(error No LOCAL_CERTIFICATE specified for prebuilt "$(my_prebuilt_src_file)") |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 169 | else ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 170 | # The magic string "PRESIGNED" means this package is already checked |
| 171 | # signed with its release key. |
| 172 | # |
| 173 | # By setting .CERTIFICATE but not .PRIVATE_KEY, this package will be |
| 174 | # mentioned in apkcerts.txt (with certificate set to "PRESIGNED") |
| 175 | # but the dexpreopt process will not try to re-sign the app. |
| 176 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := PRESIGNED |
| 177 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 178 | else |
| 179 | # If this is not an absolute certificate, assign it to a generic one. |
| 180 | ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) |
| 181 | LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) |
| 182 | endif |
| 183 | |
| 184 | PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 185 | PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 186 | PACKAGES := $(PACKAGES) $(LOCAL_MODULE) |
| 187 | |
| 188 | $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 189 | $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 190 | endif |
| 191 | |
Andreas Gampe | 5e0dbe0 | 2014-10-01 22:01:16 -0700 | [diff] [blame] | 192 | # Disable dex-preopt of prebuilts to save space, if requested. |
| 193 | ifeq ($(DONT_DEXPREOPT_PREBUILTS),true) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 194 | LOCAL_DEX_PREOPT := false |
Andreas Gampe | 5e0dbe0 | 2014-10-01 22:01:16 -0700 | [diff] [blame] | 195 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 196 | |
| 197 | ####################################### |
| 198 | # defines built_odex along with rule to install odex |
| 199 | include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk |
| 200 | ####################################### |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 201 | # Sign and align non-presigned .apks. |
Ying Wang | 1fb0152 | 2015-05-01 14:02:26 -0700 | [diff] [blame] | 202 | |
| 203 | # The embedded prebuilt jni to uncompress. |
Ying Wang | 226eb92 | 2015-06-01 19:19:57 -0700 | [diff] [blame] | 204 | ifeq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 205 | # For PRESIGNED apks we must uncompress every .so file: |
| 206 | # even if the .so file isn't for the current TARGET_ARCH, |
| 207 | # we can't strip the file. |
| 208 | embedded_prebuilt_jni_libs := 'lib/*.so' |
| 209 | endif |
Ying Wang | 1fb0152 | 2015-05-01 14:02:26 -0700 | [diff] [blame] | 210 | ifndef embedded_prebuilt_jni_libs |
| 211 | # No LOCAL_PREBUILT_JNI_LIBS, uncompress all. |
| 212 | embedded_prebuilt_jni_libs := 'lib/*.so' |
| 213 | endif |
| 214 | $(built_module): PRIVATE_EMBEDDED_JNI_LIBS := $(embedded_prebuilt_jni_libs) |
| 215 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 216 | $(built_module) : $(my_prebuilt_src_file) | $(ACP) $(ZIPALIGN) $(SIGNAPK_JAR) |
| 217 | $(transform-prebuilt-to-target) |
Ying Wang | 226eb92 | 2015-06-01 19:19:57 -0700 | [diff] [blame] | 218 | $(uncompress-shared-libs) |
Kenny Root | dff3755 | 2015-04-15 12:09:32 -0700 | [diff] [blame] | 219 | ifneq ($(LOCAL_CERTIFICATE),PRESIGNED) |
| 220 | @# Only strip out files if we can re-sign the package. |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 221 | ifdef LOCAL_DEX_PREOPT |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 222 | ifneq (nostripping,$(LOCAL_DEX_PREOPT)) |
| 223 | $(call dexpreopt-remove-classes.dex,$@) |
| 224 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 225 | endif |
Kenny Root | dff3755 | 2015-04-15 12:09:32 -0700 | [diff] [blame] | 226 | $(sign-package) |
Alex Klyubin | 5b826ac | 2015-12-04 10:07:41 -0800 | [diff] [blame] | 227 | # No need for align-package because sign-package takes care of alignment |
| 228 | else |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 229 | $(align-package) |
Alex Klyubin | 5b826ac | 2015-12-04 10:07:41 -0800 | [diff] [blame] | 230 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 231 | |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 232 | ############################### |
| 233 | ## Rule to build the odex file |
| 234 | ifdef LOCAL_DEX_PREOPT |
| 235 | $(built_odex) : $(my_prebuilt_src_file) |
| 236 | $(call dexpreopt-one-file,$<,$@) |
| 237 | endif |
| 238 | |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 239 | ############################### |
| 240 | ## Install split apks. |
| 241 | ifdef LOCAL_PACKAGE_SPLITS |
| 242 | # LOCAL_PACKAGE_SPLITS is a list of apks to be installed. |
| 243 | built_apk_splits := $(addprefix $(built_module_path)/,$(notdir $(LOCAL_PACKAGE_SPLITS))) |
| 244 | installed_apk_splits := $(addprefix $(my_module_path)/,$(notdir $(LOCAL_PACKAGE_SPLITS))) |
| 245 | |
Alex Klyubin | 5b826ac | 2015-12-04 10:07:41 -0800 | [diff] [blame] | 246 | # Rules to sign the split apks. |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 247 | my_src_dir := $(sort $(dir $(LOCAL_PACKAGE_SPLITS))) |
| 248 | ifneq (1,$(words $(my_src_dir))) |
| 249 | $(error You must put all the split source apks in the same folder: $(LOCAL_PACKAGE_SPLITS)) |
| 250 | endif |
| 251 | my_src_dir := $(LOCAL_PATH)/$(my_src_dir) |
| 252 | |
| 253 | $(built_apk_splits) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 |
| 254 | $(built_apk_splits) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem |
| 255 | $(built_apk_splits) : $(built_module_path)/%.apk : $(my_src_dir)/%.apk | $(ACP) |
| 256 | $(copy-file-to-new-target) |
| 257 | $(sign-package) |
Ying Wang | 00fe587 | 2014-07-23 14:35:40 -0700 | [diff] [blame] | 258 | |
| 259 | # Rules to install the split apks. |
| 260 | $(installed_apk_splits) : $(my_module_path)/%.apk : $(built_module_path)/%.apk | $(ACP) |
| 261 | @echo "Install: $@" |
| 262 | $(copy-file-to-new-target) |
| 263 | |
| 264 | # Register the additional built and installed files. |
| 265 | ALL_MODULES.$(my_register_name).INSTALLED += $(installed_apk_splits) |
| 266 | ALL_MODULES.$(my_register_name).BUILT_INSTALLED += \ |
| 267 | $(foreach s,$(LOCAL_PACKAGE_SPLITS),$(built_module_path)/$(notdir $(s)):$(my_module_path)/$(notdir $(s))) |
| 268 | |
| 269 | # Make sure to install the splits when you run "make <module_name>". |
| 270 | $(my_register_name): $(installed_apk_splits) |
| 271 | |
| 272 | endif # LOCAL_PACKAGE_SPLITS |
| 273 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 274 | else # LOCAL_MODULE_CLASS != APPS |
| 275 | ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) |
| 276 | $(built_module) : $(my_prebuilt_src_file) |
| 277 | $(transform-prebuilt-to-target-strip-comments) |
| 278 | else |
Colin Cross | d6f3892 | 2015-11-16 17:43:11 -0800 | [diff] [blame] | 279 | ifneq ($(LOCAL_ACP_UNAVAILABLE),true) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 280 | $(built_module) : $(my_prebuilt_src_file) | $(ACP) |
| 281 | $(transform-prebuilt-to-target) |
Colin Cross | d6f3892 | 2015-11-16 17:43:11 -0800 | [diff] [blame] | 282 | else |
| 283 | $(built_module) : $(my_prebuilt_src_file) |
| 284 | $(copy-file-to-target-with-cp) |
| 285 | endif |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 286 | endif |
| 287 | endif # LOCAL_MODULE_CLASS != APPS |
| 288 | |
| 289 | ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) |
| 290 | # for target java libraries, the LOCAL_BUILT_MODULE is in a product-specific dir, |
| 291 | # while the deps should be in the common dir, so we make a copy in the common dir. |
| 292 | # For nonstatic library, $(common_javalib_jar) is the dependency file, |
| 293 | # while $(common_classes_jar) is used to link. |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 294 | common_classes_jar := $(intermediates.COMMON)/classes.jar |
| 295 | common_javalib_jar := $(intermediates.COMMON)/javalib.jar |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 296 | |
Ying Wang | e9dd9f2 | 2014-10-29 15:48:32 -0700 | [diff] [blame] | 297 | $(common_classes_jar) $(common_javalib_jar): PRIVATE_MODULE := $(LOCAL_MODULE) |
| 298 | |
| 299 | ifneq ($(filter %.aar, $(my_prebuilt_src_file)),) |
| 300 | # This is .aar file, archive of classes.jar and Android resources. |
| 301 | my_src_jar := $(intermediates.COMMON)/aar/classes.jar |
| 302 | |
| 303 | $(my_src_jar) : $(my_prebuilt_src_file) |
| 304 | $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) |
| 305 | $(hide) unzip -qo -d $(dir $@) $< |
| 306 | # Make sure the extracted classes.jar has a new timestamp. |
| 307 | $(hide) touch $@ |
| 308 | |
| 309 | else |
| 310 | # This is jar file. |
| 311 | my_src_jar := $(my_prebuilt_src_file) |
| 312 | endif |
| 313 | $(common_classes_jar) : $(my_src_jar) | $(ACP) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 314 | $(transform-prebuilt-to-target) |
| 315 | |
| 316 | $(common_javalib_jar) : $(common_classes_jar) | $(ACP) |
| 317 | $(transform-prebuilt-to-target) |
| 318 | |
Shinichiro Hamaji | 89b255a | 2015-11-09 16:47:42 +0900 | [diff] [blame] | 319 | $(call define-jar-to-toc-rule, $(common_classes_jar)) |
| 320 | |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 321 | # make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE) |
| 322 | $(built_module) : $(common_javalib_jar) |
| 323 | endif # TARGET JAVA_LIBRARIES |
| 324 | |
Yohann Roussel | b4c49cb | 2014-09-08 14:45:14 +0200 | [diff] [blame] | 325 | ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES) |
Yohann Roussel | 801f2c4 | 2015-03-03 17:14:09 +0100 | [diff] [blame] | 326 | $(intermediates.COMMON)/classes.jack : PRIVATE_JILL_FLAGS:=$(LOCAL_JILL_FLAGS) |
Colin Cross | 7ee3b85 | 2015-09-28 18:45:23 -0700 | [diff] [blame] | 327 | $(intermediates.COMMON)/classes.jack : $(my_src_jar) $(LOCAL_MODULE_MAKEFILE_DEP) \ |
Yohann Roussel | b2c5558 | 2015-07-02 12:10:17 +0200 | [diff] [blame] | 328 | $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JILL_JAR) $(JACK) |
Yohann Roussel | b4c49cb | 2014-09-08 14:45:14 +0200 | [diff] [blame] | 329 | $(transform-jar-to-jack) |
| 330 | |
Shinichiro Hamaji | f972a4a | 2015-12-09 18:06:20 +0900 | [diff] [blame] | 331 | # Update timestamps of .toc files for prebuilts so dependents will be |
| 332 | # always rebuilt. |
| 333 | $(intermediates.COMMON)/classes.dex.toc: $(intermediates.COMMON)/classes.jack |
| 334 | touch $@ |
| 335 | |
Yohann Roussel | b4c49cb | 2014-09-08 14:45:14 +0200 | [diff] [blame] | 336 | endif # JAVA_LIBRARIES |
| 337 | |
Colin Cross | a4447e8 | 2015-09-28 16:26:00 -0700 | [diff] [blame] | 338 | $(built_module) : $(LOCAL_MODULE_MAKEFILE_DEP) $(LOCAL_ADDITIONAL_DEPENDENCIES) |
Colin Cross | e18cb93 | 2014-02-13 15:04:18 -0800 | [diff] [blame] | 339 | |
| 340 | my_prebuilt_src_file := |