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