Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2008 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | ########################################################### |
| 18 | ## Standard rules for building an application package. |
| 19 | ## |
| 20 | ## Additional inputs from base_rules.make: |
| 21 | ## LOCAL_PACKAGE_NAME: The name of the package; the directory |
| 22 | ## will be called this. |
| 23 | ## |
| 24 | ## MODULE, MODULE_PATH, and MODULE_SUFFIX will |
| 25 | ## be set for you. |
| 26 | ########################################################### |
| 27 | |
| 28 | # If this makefile is being read from within an inheritance, |
| 29 | # use the new values. |
| 30 | skip_definition:= |
| 31 | ifdef LOCAL_PACKAGE_OVERRIDES |
| 32 | package_overridden := $(call set-inherited-package-variables) |
| 33 | ifeq ($(strip $(package_overridden)),) |
| 34 | skip_definition := true |
| 35 | endif |
| 36 | endif |
| 37 | |
| 38 | ifndef skip_definition |
| 39 | |
| 40 | LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME)) |
| 41 | ifeq ($(LOCAL_PACKAGE_NAME),) |
| 42 | $(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME) |
| 43 | endif |
| 44 | |
| 45 | ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),) |
| 46 | $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX) |
| 47 | endif |
| 48 | LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX) |
| 49 | |
| 50 | ifneq ($(strip $(LOCAL_MODULE)),) |
| 51 | $(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE) |
| 52 | endif |
| 53 | LOCAL_MODULE := $(LOCAL_PACKAGE_NAME) |
| 54 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 55 | ifneq ($(strip $(LOCAL_MODULE_CLASS)),) |
| 56 | $(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS) |
| 57 | endif |
| 58 | LOCAL_MODULE_CLASS := APPS |
| 59 | |
| 60 | # Package LOCAL_MODULE_TAGS default to optional |
| 61 | LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS)) |
| 62 | ifeq ($(LOCAL_MODULE_TAGS),) |
| 63 | LOCAL_MODULE_TAGS := optional |
| 64 | endif |
| 65 | |
| 66 | ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),) |
| 67 | # Force localization check if it's not tagged as tests. |
| 68 | LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z |
| 69 | endif |
| 70 | |
| 71 | ifeq (,$(LOCAL_ASSET_DIR)) |
| 72 | LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets |
| 73 | endif |
| 74 | |
| 75 | ifeq (,$(LOCAL_RESOURCE_DIR)) |
| 76 | LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res |
| 77 | endif |
| 78 | |
| 79 | package_resource_overlays := $(strip \ |
| 80 | $(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \ |
| 81 | $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \ |
| 82 | $(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \ |
| 83 | $(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR))))) |
| 84 | |
| 85 | LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR) |
| 86 | |
Colin Cross | 2c32144 | 2014-02-12 13:06:30 -0800 | [diff] [blame] | 87 | all_assets := $(strip \ |
| 88 | $(foreach dir, $(LOCAL_ASSET_DIR), \ |
| 89 | $(addprefix $(dir)/, \ |
| 90 | $(patsubst assets/%,%, \ |
| 91 | $(call find-subdir-assets, $(dir)) \ |
| 92 | ) \ |
| 93 | ) \ |
| 94 | )) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 95 | |
| 96 | all_resources := $(strip \ |
| 97 | $(foreach dir, $(LOCAL_RESOURCE_DIR), \ |
| 98 | $(addprefix $(dir)/, \ |
| 99 | $(patsubst res/%,%, \ |
| 100 | $(call find-subdir-assets,$(dir)) \ |
| 101 | ) \ |
| 102 | ) \ |
| 103 | )) |
| 104 | |
| 105 | all_res_assets := $(strip $(all_assets) $(all_resources)) |
| 106 | |
| 107 | package_expected_intermediates_COMMON := $(call local-intermediates-dir,COMMON) |
| 108 | # If no assets or resources were found, clear the directory variables so |
| 109 | # we don't try to build them. |
| 110 | ifeq (,$(all_assets)) |
| 111 | LOCAL_ASSET_DIR:= |
| 112 | endif |
| 113 | ifeq (,$(all_resources)) |
| 114 | LOCAL_RESOURCE_DIR:= |
| 115 | R_file_stamp := |
| 116 | else |
| 117 | # Make sure that R_file_stamp inherits the proper PRIVATE vars. |
| 118 | # If R.stamp moves, be sure to update the framework makefile, |
| 119 | # which has intimate knowledge of its location. |
| 120 | R_file_stamp := $(package_expected_intermediates_COMMON)/src/R.stamp |
| 121 | LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp) |
| 122 | endif |
| 123 | |
| 124 | LOCAL_BUILT_MODULE_STEM := package.apk |
| 125 | |
| 126 | LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED)) |
| 127 | ifndef LOCAL_PROGUARD_ENABLED |
| 128 | ifneq ($(DISABLE_PROGUARD),true) |
| 129 | LOCAL_PROGUARD_ENABLED :=full |
| 130 | endif |
| 131 | endif |
| 132 | ifeq ($(LOCAL_PROGUARD_ENABLED),disabled) |
| 133 | # the package explicitly request to disable proguard. |
| 134 | LOCAL_PROGUARD_ENABLED := |
| 135 | endif |
| 136 | proguard_options_file := |
| 137 | ifneq ($(LOCAL_PROGUARD_ENABLED),custom) |
| 138 | ifneq ($(all_resources),) |
| 139 | proguard_options_file := $(package_expected_intermediates_COMMON)/proguard_options |
| 140 | endif # all_resources |
| 141 | endif # !custom |
| 142 | LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS) |
| 143 | |
| 144 | ifeq (true,$(EMMA_INSTRUMENT)) |
| 145 | ifndef LOCAL_EMMA_INSTRUMENT |
| 146 | # No emma for test apks. |
| 147 | ifeq (,$(filer tests,$(LOCAL_MODULE_TAGS))$(LOCAL_INSTRUMENTATION_FOR)) |
| 148 | LOCAL_EMMA_INSTRUMENT := true |
| 149 | endif # No test apk |
| 150 | endif # LOCAL_EMMA_INSTRUMENT is not set |
| 151 | else |
| 152 | LOCAL_EMMA_INSTRUMENT := false |
| 153 | endif # EMMA_INSTRUMENT is true |
| 154 | |
| 155 | ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) |
| 156 | ifeq (true,$(EMMA_INSTRUMENT_STATIC)) |
| 157 | LOCAL_STATIC_JAVA_LIBRARIES += emma |
| 158 | else |
| 159 | ifdef LOCAL_SDK_VERSION |
| 160 | ifdef TARGET_BUILD_APPS |
| 161 | # In unbundled build merge the emma library into the apk. |
| 162 | LOCAL_STATIC_JAVA_LIBRARIES += emma |
| 163 | else |
| 164 | # If build against the SDK in full build, core.jar is not used, |
| 165 | # we have to use prebiult emma.jar to make Proguard happy; |
| 166 | # Otherwise emma classes are included in core.jar. |
| 167 | LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR) |
| 168 | endif # full build |
| 169 | endif # LOCAL_SDK_VERSION |
| 170 | endif # EMMA_INSTRUMENT_STATIC |
| 171 | endif # LOCAL_EMMA_INSTRUMENT |
| 172 | |
| 173 | rs_compatibility_jni_libs := |
| 174 | |
| 175 | ################################# |
| 176 | include $(BUILD_SYSTEM)/java.mk |
| 177 | ################################# |
| 178 | |
| 179 | LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION)) |
| 180 | ifeq ($(LOCAL_SDK_RES_VERSION),) |
| 181 | LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION) |
| 182 | endif |
| 183 | |
Colin Cross | 2c32144 | 2014-02-12 13:06:30 -0800 | [diff] [blame] | 184 | include $(BUILD_SYSTEM)/android_manifest.mk |
| 185 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 186 | $(LOCAL_INTERMEDIATE_TARGETS): \ |
| 187 | PRIVATE_ANDROID_MANIFEST := $(full_android_manifest) |
| 188 | ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION))) |
| 189 | $(LOCAL_INTERMEDIATE_TARGETS): \ |
| 190 | PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION) |
| 191 | else |
| 192 | $(LOCAL_INTERMEDIATE_TARGETS): \ |
| 193 | PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK) |
| 194 | endif |
| 195 | |
| 196 | ifneq ($(all_resources),) |
| 197 | |
| 198 | # Since we don't know where the real R.java file is going to end up, |
| 199 | # we need to use another file to stand in its place. We'll just |
| 200 | # copy the generated file to src/R.stamp, which means it will |
| 201 | # have the same contents and timestamp as the actual file. |
| 202 | # |
| 203 | # At the same time, this will copy the R.java file to a central |
| 204 | # 'R' directory to make it easier to add the files to an IDE. |
| 205 | # |
| 206 | #TODO: use PRIVATE_SOURCE_INTERMEDIATES_DIR instead of |
| 207 | # $(intermediates.COMMON)/src |
| 208 | ifneq ($(package_expected_intermediates_COMMON),$(intermediates.COMMON)) |
| 209 | $(error $(LOCAL_MODULE): internal error: expected intermediates.COMMON "$(package_expected_intermediates_COMMON)" != intermediates.COMMON "$(intermediates.COMMON)") |
| 210 | endif |
| 211 | |
| 212 | $(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \ |
| 213 | $(intermediates.COMMON)/public_resources.xml |
| 214 | $(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file) |
| 215 | $(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP) |
| 216 | @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)" |
| 217 | @rm -f $@ |
| 218 | $(create-resource-java-files) |
| 219 | $(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \ |
| 220 | -name Manifest.java 2> /dev/null`; do \ |
| 221 | dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \ |
| 222 | mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \ |
| 223 | $(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \ |
| 224 | done; |
| 225 | $(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \ |
| 226 | -name R.java 2> /dev/null`; do \ |
| 227 | dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \ |
| 228 | mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \ |
| 229 | $(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \ |
| 230 | || exit 31; \ |
| 231 | $(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \ |
| 232 | done; \ |
| 233 | |
| 234 | $(proguard_options_file): $(R_file_stamp) |
| 235 | |
| 236 | ifdef LOCAL_EXPORT_PACKAGE_RESOURCES |
| 237 | # Put this module's resources into a PRODUCT-agnositc package that |
| 238 | # other packages can use to build their own PRODUCT-agnostic R.java (etc.) |
| 239 | # files. |
| 240 | resource_export_package := $(intermediates.COMMON)/package-export.apk |
| 241 | $(R_file_stamp): $(resource_export_package) |
| 242 | |
| 243 | # add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target |
| 244 | # can't know anything about PRODUCT. Clear it out just for this target. |
| 245 | $(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG := |
| 246 | $(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := |
| 247 | $(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) |
| 248 | @echo "target Export Resources: $(PRIVATE_MODULE) ($@)" |
| 249 | $(create-empty-package) |
| 250 | $(add-assets-to-package) |
| 251 | endif |
| 252 | |
| 253 | # Other modules should depend on the BUILT module if |
| 254 | # they want to use this module's R.java file. |
| 255 | $(LOCAL_BUILT_MODULE): $(R_file_stamp) |
| 256 | |
| 257 | ifneq ($(full_classes_jar),) |
| 258 | # If full_classes_jar is non-empty, we're building sources. |
| 259 | # If we're building sources, the initial javac step (which |
| 260 | # produces full_classes_compiled_jar) needs to ensure the |
| 261 | # R.java and Manifest.java files have been generated first. |
| 262 | $(full_classes_compiled_jar): $(R_file_stamp) |
| 263 | endif |
| 264 | |
| 265 | endif # all_resources |
| 266 | |
| 267 | ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true) |
| 268 | # We need to explicitly clear this var so that we don't |
| 269 | # inherit the value from whomever caused us to be built. |
| 270 | $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES := |
| 271 | else |
| 272 | # Most packages should link against the resources defined by framework-res. |
| 273 | # Even if they don't have their own resources, they may use framework |
| 274 | # resources. |
| 275 | ifneq ($(filter-out current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current,$(LOCAL_SDK_RES_VERSION))),) |
| 276 | # for released sdk versions, the platform resources were built into android.jar. |
| 277 | framework_res_package_export := \ |
| 278 | $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar |
| 279 | framework_res_package_export_deps := $(framework_res_package_export) |
| 280 | else # LOCAL_SDK_RES_VERSION |
| 281 | framework_res_package_export := \ |
| 282 | $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk |
| 283 | # We can't depend directly on the export.apk file; it won't get its |
| 284 | # PRIVATE_ vars set up correctly if we do. Instead, depend on the |
| 285 | # corresponding R.stamp file, which lists the export.apk as a dependency. |
| 286 | framework_res_package_export_deps := \ |
| 287 | $(dir $(framework_res_package_export))src/R.stamp |
| 288 | endif # LOCAL_SDK_RES_VERSION |
| 289 | $(R_file_stamp): $(framework_res_package_export_deps) |
| 290 | $(LOCAL_INTERMEDIATE_TARGETS): \ |
| 291 | PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) |
| 292 | endif # LOCAL_NO_STANDARD_LIBRARIES |
| 293 | |
| 294 | ifneq ($(full_classes_jar),) |
| 295 | $(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex) |
| 296 | $(LOCAL_BUILT_MODULE): $(built_dex) |
| 297 | endif # full_classes_jar |
| 298 | |
Ying Wang | 695e826 | 2014-04-17 13:38:04 -0700 | [diff] [blame] | 299 | include $(BUILD_SYSTEM)/install_jni_libs.mk |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 300 | |
| 301 | # Pick a key to sign the package with. If this package hasn't specified |
| 302 | # an explicit certificate, use the default. |
| 303 | # Secure release builds will have their packages signed after the fact, |
| 304 | # so it's ok for these private keys to be in the clear. |
| 305 | ifeq ($(LOCAL_CERTIFICATE),) |
| 306 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 307 | endif |
| 308 | |
| 309 | ifeq ($(LOCAL_CERTIFICATE),EXTERNAL) |
| 310 | # The special value "EXTERNAL" means that we will sign it with the |
| 311 | # default devkey, apply predexopt, but then expect the final .apk |
| 312 | # (after dexopting) to be signed by an outside tool. |
| 313 | LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE) |
| 314 | PACKAGES.$(LOCAL_PACKAGE_NAME).EXTERNAL_KEY := 1 |
| 315 | endif |
| 316 | |
| 317 | # If this is not an absolute certificate, assign it to a generic one. |
| 318 | ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./) |
| 319 | LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE) |
| 320 | endif |
| 321 | private_key := $(LOCAL_CERTIFICATE).pk8 |
| 322 | certificate := $(LOCAL_CERTIFICATE).x509.pem |
| 323 | |
| 324 | $(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR) |
| 325 | $(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key) |
| 326 | $(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate) |
| 327 | |
| 328 | PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key) |
| 329 | PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate) |
| 330 | |
| 331 | $(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\ |
| 332 | $(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) |
| 333 | |
| 334 | # Define the rule to build the actual package. |
| 335 | $(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN) |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 336 | $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries) |
| 337 | $(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi) |
| 338 | ifneq ($(TARGET_BUILD_APPS),) |
| 339 | # Include all resources for unbundled apps. |
| 340 | LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true |
| 341 | endif |
| 342 | ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true) |
| 343 | $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := |
| 344 | $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := |
| 345 | else |
| 346 | $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG) |
| 347 | $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG) |
| 348 | endif |
| 349 | $(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest) |
| 350 | @echo "target Package: $(PRIVATE_MODULE) ($@)" |
| 351 | $(create-empty-package) |
| 352 | $(add-assets-to-package) |
| 353 | ifneq ($(jni_shared_libraries),) |
| 354 | $(add-jni-shared-libs-to-package) |
| 355 | endif |
| 356 | ifneq ($(full_classes_jar),) |
| 357 | $(add-dex-to-package) |
| 358 | endif |
| 359 | $(add-carried-java-resources) |
| 360 | ifneq ($(extra_jar_args),) |
| 361 | $(add-java-resources-to-package) |
| 362 | endif |
| 363 | $(sign-package) |
| 364 | ifdef LOCAL_DEX_PREOPT |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 365 | ifneq (nostripping,$(LOCAL_DEX_PREOPT)) |
| 366 | $(call dexpreopt-remove-classes.dex,$@) |
| 367 | endif |
| 368 | endif |
| 369 | @# Alignment must happen after all other zip operations. |
| 370 | $(align-package) |
| 371 | |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 372 | ############################### |
| 373 | ## Rule to build the odex file |
| 374 | ifdef LOCAL_DEX_PREOPT |
| 375 | $(built_odex): PRIVATE_DEX_FILE := $(built_dex) |
| 376 | $(built_odex) : $(built_dex) |
Ying Wang | 994c226 | 2014-05-28 13:34:59 -0700 | [diff] [blame] | 377 | $(hide) mkdir -p $(dir $@) && rm -f $@ |
Ying Wang | 36142f6 | 2014-05-21 16:13:33 -0700 | [diff] [blame] | 378 | $(add-dex-to-package) |
| 379 | $(hide) mv $@ $@.input |
| 380 | $(call dexpreopt-one-file,$@.input,$@) |
| 381 | $(hide) rm $@.input |
| 382 | endif |
| 383 | |
Colin Cross | 8e40412 | 2014-02-06 14:45:37 -0800 | [diff] [blame] | 384 | # Save information about this package |
| 385 | PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES)) |
| 386 | PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources) |
| 387 | ifdef package_resource_overlays |
| 388 | PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_OVERLAYS := $(package_resource_overlays) |
| 389 | endif |
| 390 | |
| 391 | PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME) |
| 392 | |
| 393 | # Dist the files that can be bundled in system.img. |
| 394 | # They include the jni shared libraries and the apk with jni libraries stripped. |
| 395 | ifeq ($(LOCAL_DIST_BUNDLED_BINARIES),true) |
| 396 | ifneq ($(filter $(LOCAL_PACKAGE_NAME),$(TARGET_BUILD_APPS)),) |
| 397 | ifneq ($(strip $(jni_shared_libraries)),) |
| 398 | dist_subdir := bundled_$(LOCAL_PACKAGE_NAME) |
| 399 | $(foreach f, $(jni_shared_libraries), \ |
| 400 | $(call dist-for-goals, apps_only, $(f):$(dist_subdir)/$(notdir $(f)))) |
| 401 | |
| 402 | apk_jni_stripped := $(intermediates)/jni_stripped/package.apk |
| 403 | $(apk_jni_stripped): PRIVATE_JNI_SHARED_LIBRARIES := $(notdir $(jni_shared_libraries)) |
| 404 | $(apk_jni_stripped) : $(LOCAL_BUILT_MODULE) | $(ZIPALIGN) |
| 405 | @rm -rf $(dir $@) && mkdir -p $(dir $@) |
| 406 | $(hide) cp $< $@ |
| 407 | $(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f)) |
| 408 | $(call align-package) |
| 409 | |
| 410 | $(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk) |
| 411 | |
| 412 | endif # jni_shared_libraries |
| 413 | endif # apps_only build |
| 414 | endif # LOCAL_DIST_BUNDLED_BINARIES |
| 415 | |
| 416 | # Lint phony targets |
| 417 | .PHONY: lint-$(LOCAL_PACKAGE_NAME) |
| 418 | lint-$(LOCAL_PACKAGE_NAME): PRIVATE_PATH := $(LOCAL_PATH) |
| 419 | lint-$(LOCAL_PACKAGE_NAME): PRIVATE_LINT_FLAGS := $(LOCAL_LINT_FLAGS) |
| 420 | lint-$(LOCAL_PACKAGE_NAME) : |
| 421 | @echo lint $(PRIVATE_PATH) |
| 422 | $(LINT) $(PRIVATE_LINT_FLAGS) $(PRIVATE_PATH) |
| 423 | |
| 424 | lintall : lint-$(LOCAL_PACKAGE_NAME) |
| 425 | |
| 426 | endif # skip_definition |
| 427 | |
| 428 | # Reset internal variables. |
| 429 | all_res_assets := |