2009-03-04 04:28:42 +01:00
|
|
|
#
|
|
|
|
# Copyright (C) 2008 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
###########################################################
|
|
|
|
## Standard rules for building an application package.
|
|
|
|
##
|
|
|
|
## Additional inputs from base_rules.make:
|
|
|
|
## LOCAL_PACKAGE_NAME: The name of the package; the directory
|
2011-03-15 21:19:30 +01:00
|
|
|
## will be called this.
|
2009-03-04 04:28:42 +01:00
|
|
|
##
|
|
|
|
## MODULE, MODULE_PATH, and MODULE_SUFFIX will
|
|
|
|
## be set for you.
|
|
|
|
###########################################################
|
|
|
|
|
Add an inherit-package macro to the build system.
This lets you use the source code from one apk to build a new one
with a new module name, a new android package name and optionally,
a new certificate.
To use this, in a makefile, add this:
$(call inherit-package, \
packages/apps/Music/Android.mk, \
Music, \
MusicFork, \
my_cert, \
com.example.music)
You don't need the LOCAL_PATH and CLEAR_VARS stuff. It will override
only the packages that are defined in the makefile name you give, but
if other modules of other types are defined, you will get an error
saying that it's defined twice. In that case, you need to move the
duplicate library (for example a .so) out into a different makefile.
A LOCAL_OVERRIDES_PACKAGES entry is automatically created for the
forked app.
2010-02-05 02:37:21 +01:00
|
|
|
|
|
|
|
# If this makefile is being read from within an inheritance,
|
|
|
|
# use the new values.
|
|
|
|
skip_definition:=
|
|
|
|
ifdef LOCAL_PACKAGE_OVERRIDES
|
|
|
|
package_overridden := $(call set-inherited-package-variables)
|
|
|
|
ifeq ($(strip $(package_overridden)),)
|
|
|
|
skip_definition := true
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef skip_definition
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
|
|
|
|
ifeq ($(LOCAL_PACKAGE_NAME),)
|
|
|
|
$(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(strip $(LOCAL_MODULE_SUFFIX)),)
|
|
|
|
$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE_SUFFIX)
|
|
|
|
endif
|
|
|
|
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
|
|
|
|
|
|
|
|
ifneq ($(strip $(LOCAL_MODULE)),)
|
|
|
|
$(error $(LOCAL_PATH): Package modules may not define LOCAL_MODULE)
|
|
|
|
endif
|
|
|
|
LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
|
|
|
|
|
2010-07-23 20:03:29 +02:00
|
|
|
ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
|
|
|
|
LOCAL_MANIFEST_FILE := AndroidManifest.xml
|
|
|
|
endif
|
|
|
|
|
2012-04-12 19:20:53 +02:00
|
|
|
# If you need to put the MANIFEST_FILE outside of LOCAL_PATH
|
|
|
|
# you can use FULL_MANIFEST_FILE
|
|
|
|
ifeq ($(strip $(LOCAL_FULL_MANIFEST_FILE)),)
|
|
|
|
LOCAL_FULL_MANIFEST_FILE := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
ifneq ($(strip $(LOCAL_MODULE_CLASS)),)
|
|
|
|
$(error $(LOCAL_PATH): Package modules may not set LOCAL_MODULE_CLASS)
|
|
|
|
endif
|
|
|
|
LOCAL_MODULE_CLASS := APPS
|
|
|
|
|
2009-03-09 19:52:11 +01:00
|
|
|
# Package LOCAL_MODULE_TAGS default to optional
|
|
|
|
LOCAL_MODULE_TAGS := $(strip $(LOCAL_MODULE_TAGS))
|
|
|
|
ifeq ($(LOCAL_MODULE_TAGS),)
|
|
|
|
LOCAL_MODULE_TAGS := optional
|
|
|
|
endif
|
|
|
|
|
2010-03-11 01:02:42 +01:00
|
|
|
ifeq ($(filter tests, $(LOCAL_MODULE_TAGS)),)
|
|
|
|
# Force localization check if it's not tagged as tests.
|
|
|
|
LOCAL_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) -z
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
ifeq (,$(LOCAL_ASSET_DIR))
|
|
|
|
LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq (,$(LOCAL_RESOURCE_DIR))
|
|
|
|
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
|
|
|
|
endif
|
2012-05-25 06:05:19 +02:00
|
|
|
|
|
|
|
package_resource_overlays := $(strip \
|
|
|
|
$(wildcard $(foreach dir, $(PRODUCT_PACKAGE_OVERLAYS), \
|
|
|
|
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))) \
|
|
|
|
$(wildcard $(foreach dir, $(DEVICE_PACKAGE_OVERLAYS), \
|
|
|
|
$(addprefix $(dir)/, $(LOCAL_RESOURCE_DIR)))))
|
|
|
|
|
|
|
|
LOCAL_RESOURCE_DIR := $(package_resource_overlays) $(LOCAL_RESOURCE_DIR)
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
all_assets := $(call find-subdir-assets,$(LOCAL_ASSET_DIR))
|
|
|
|
all_assets := $(addprefix $(LOCAL_ASSET_DIR)/,$(patsubst assets/%,%,$(all_assets)))
|
|
|
|
|
|
|
|
all_resources := $(strip \
|
|
|
|
$(foreach dir, $(LOCAL_RESOURCE_DIR), \
|
|
|
|
$(addprefix $(dir)/, \
|
|
|
|
$(patsubst res/%,%, \
|
|
|
|
$(call find-subdir-assets,$(dir)) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
))
|
|
|
|
|
|
|
|
all_res_assets := $(strip $(all_assets) $(all_resources))
|
|
|
|
|
2009-12-08 03:14:00 +01:00
|
|
|
package_expected_intermediates_COMMON := $(call local-intermediates-dir,COMMON)
|
2009-03-04 04:28:42 +01:00
|
|
|
# If no assets or resources were found, clear the directory variables so
|
|
|
|
# we don't try to build them.
|
|
|
|
ifeq (,$(all_assets))
|
|
|
|
LOCAL_ASSET_DIR:=
|
|
|
|
endif
|
|
|
|
ifeq (,$(all_resources))
|
|
|
|
LOCAL_RESOURCE_DIR:=
|
|
|
|
R_file_stamp :=
|
|
|
|
else
|
|
|
|
# Make sure that R_file_stamp inherits the proper PRIVATE vars.
|
|
|
|
# If R.stamp moves, be sure to update the framework makefile,
|
|
|
|
# which has intimate knowledge of its location.
|
|
|
|
R_file_stamp := $(package_expected_intermediates_COMMON)/src/R.stamp
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += $(R_file_stamp)
|
|
|
|
endif
|
|
|
|
|
|
|
|
LOCAL_BUILT_MODULE_STEM := package.apk
|
|
|
|
|
2010-02-01 18:51:23 +01:00
|
|
|
LOCAL_PROGUARD_ENABLED:=$(strip $(LOCAL_PROGUARD_ENABLED))
|
2010-02-20 03:39:13 +01:00
|
|
|
ifndef LOCAL_PROGUARD_ENABLED
|
2013-05-23 19:26:49 +02:00
|
|
|
ifneq ($(DISABLE_PROGUARD),true)
|
2010-02-20 03:39:13 +01:00
|
|
|
LOCAL_PROGUARD_ENABLED :=full
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(LOCAL_PROGUARD_ENABLED),disabled)
|
|
|
|
# the package explicitly request to disable proguard.
|
|
|
|
LOCAL_PROGUARD_ENABLED :=
|
|
|
|
endif
|
2010-02-01 18:51:23 +01:00
|
|
|
proguard_options_file :=
|
|
|
|
ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
|
|
|
|
ifneq ($(all_resources),)
|
2010-03-03 23:32:06 +01:00
|
|
|
proguard_options_file := $(package_expected_intermediates_COMMON)/proguard_options
|
2010-02-01 18:51:23 +01:00
|
|
|
endif # all_resources
|
|
|
|
endif # !custom
|
2010-03-03 23:32:06 +01:00
|
|
|
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
|
2009-08-30 22:39:24 +02:00
|
|
|
|
2011-10-24 21:17:03 +02:00
|
|
|
ifneq (true,$(WITH_DEXPREOPT))
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
else
|
2011-01-12 20:12:06 +01:00
|
|
|
ifeq (,$(TARGET_BUILD_APPS))
|
2013-03-12 02:04:55 +01:00
|
|
|
ifeq (,$(LOCAL_APK_LIBRARIES))
|
2010-09-18 01:36:06 +02:00
|
|
|
ifneq (,$(LOCAL_SRC_FILES))
|
|
|
|
ifndef LOCAL_DEX_PREOPT
|
2013-09-12 09:22:42 +02:00
|
|
|
LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
|
2010-09-18 01:36:06 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
2011-01-12 20:12:06 +01:00
|
|
|
endif
|
2013-03-12 02:04:55 +01:00
|
|
|
endif
|
2011-10-24 21:17:03 +02:00
|
|
|
ifeq (false,$(LOCAL_DEX_PREOPT))
|
|
|
|
LOCAL_DEX_PREOPT :=
|
|
|
|
endif
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2012-08-22 01:59:01 +02:00
|
|
|
ifeq (true,$(EMMA_INSTRUMENT))
|
|
|
|
ifndef LOCAL_EMMA_INSTRUMENT
|
|
|
|
# No emma for test apks.
|
|
|
|
ifeq (,$(filer tests,$(LOCAL_MODULE_TAGS))$(LOCAL_INSTRUMENTATION_FOR))
|
|
|
|
LOCAL_EMMA_INSTRUMENT := true
|
|
|
|
endif # No test apk
|
|
|
|
endif # LOCAL_EMMA_INSTRUMENT is not set
|
|
|
|
else
|
|
|
|
LOCAL_EMMA_INSTRUMENT := false
|
|
|
|
endif # EMMA_INSTRUMENT is true
|
|
|
|
|
|
|
|
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
|
|
|
|
ifeq (true,$(EMMA_INSTRUMENT_STATIC))
|
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
|
|
|
else
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
|
|
|
ifdef TARGET_BUILD_APPS
|
|
|
|
# In unbundled build merge the emma library into the apk.
|
|
|
|
LOCAL_STATIC_JAVA_LIBRARIES += emma
|
|
|
|
else
|
|
|
|
# If build against the SDK in full build, core.jar is not used,
|
|
|
|
# we have to use prebiult emma.jar to make Proguard happy;
|
|
|
|
# Otherwise emma classes are included in core.jar.
|
|
|
|
LOCAL_PROGUARD_FLAGS += -libraryjars $(EMMA_JAR)
|
|
|
|
endif # full build
|
|
|
|
endif # LOCAL_SDK_VERSION
|
|
|
|
endif # EMMA_INSTRUMENT_STATIC
|
|
|
|
endif # LOCAL_EMMA_INSTRUMENT
|
|
|
|
|
2012-11-29 01:52:41 +01:00
|
|
|
rs_compatibility_jni_libs :=
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
#################################
|
|
|
|
include $(BUILD_SYSTEM)/java.mk
|
|
|
|
#################################
|
|
|
|
|
2011-09-19 02:34:29 +02:00
|
|
|
LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
|
|
|
|
ifeq ($(LOCAL_SDK_RES_VERSION),)
|
|
|
|
LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
|
2012-04-12 19:20:53 +02:00
|
|
|
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2011-04-09 02:27:35 +02:00
|
|
|
PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
|
|
|
|
ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION)))
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
|
|
|
|
else
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
|
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifneq ($(all_resources),)
|
|
|
|
|
|
|
|
# Since we don't know where the real R.java file is going to end up,
|
|
|
|
# we need to use another file to stand in its place. We'll just
|
|
|
|
# copy the generated file to src/R.stamp, which means it will
|
|
|
|
# have the same contents and timestamp as the actual file.
|
|
|
|
#
|
|
|
|
# At the same time, this will copy the R.java file to a central
|
|
|
|
# 'R' directory to make it easier to add the files to an IDE.
|
|
|
|
#
|
|
|
|
#TODO: use PRIVATE_SOURCE_INTERMEDIATES_DIR instead of
|
|
|
|
# $(intermediates.COMMON)/src
|
|
|
|
ifneq ($(package_expected_intermediates_COMMON),$(intermediates.COMMON))
|
|
|
|
$(error $(LOCAL_MODULE): internal error: expected intermediates.COMMON "$(package_expected_intermediates_COMMON)" != intermediates.COMMON "$(intermediates.COMMON)")
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := \
|
|
|
|
$(intermediates.COMMON)/public_resources.xml
|
2009-08-30 22:39:24 +02:00
|
|
|
$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
|
2010-07-16 02:17:52 +02:00
|
|
|
$(R_file_stamp): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT) | $(ACP)
|
2009-03-04 04:28:42 +01:00
|
|
|
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
|
|
|
|
@rm -f $@
|
|
|
|
$(create-resource-java-files)
|
|
|
|
$(hide) for GENERATED_MANIFEST_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
|
|
|
|
-name Manifest.java 2> /dev/null`; do \
|
2010-11-05 20:00:50 +01:00
|
|
|
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
|
2009-03-04 04:28:42 +01:00
|
|
|
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
|
2011-05-26 22:43:57 +02:00
|
|
|
$(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
|
2009-03-04 04:28:42 +01:00
|
|
|
done;
|
|
|
|
$(hide) for GENERATED_R_FILE in `find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) \
|
|
|
|
-name R.java 2> /dev/null`; do \
|
2010-11-05 20:00:50 +01:00
|
|
|
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
|
2009-03-04 04:28:42 +01:00
|
|
|
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
|
2011-05-26 22:43:57 +02:00
|
|
|
$(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|
2009-03-04 04:28:42 +01:00
|
|
|
|| exit 31; \
|
2011-05-26 22:43:57 +02:00
|
|
|
$(ACP) -fp $$GENERATED_R_FILE $@ || exit 32; \
|
2009-03-04 04:28:42 +01:00
|
|
|
done; \
|
|
|
|
|
2009-08-30 22:39:24 +02:00
|
|
|
$(proguard_options_file): $(R_file_stamp)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
ifdef LOCAL_EXPORT_PACKAGE_RESOURCES
|
|
|
|
# Put this module's resources into a PRODUCT-agnositc package that
|
|
|
|
# other packages can use to build their own PRODUCT-agnostic R.java (etc.)
|
|
|
|
# files.
|
|
|
|
resource_export_package := $(intermediates.COMMON)/package-export.apk
|
|
|
|
$(R_file_stamp): $(resource_export_package)
|
|
|
|
|
|
|
|
# add-assets-to-package looks at PRODUCT_AAPT_CONFIG, but this target
|
|
|
|
# can't know anything about PRODUCT. Clear it out just for this target.
|
2011-03-15 21:19:30 +01:00
|
|
|
$(resource_export_package): PRIVATE_PRODUCT_AAPT_CONFIG :=
|
2011-10-15 04:37:57 +02:00
|
|
|
$(resource_export_package): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
|
2010-08-19 05:30:52 +02:00
|
|
|
$(resource_export_package): $(all_res_assets) $(full_android_manifest) $(RenderScript_file_stamp) $(AAPT)
|
2009-03-04 04:28:42 +01:00
|
|
|
@echo "target Export Resources: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(create-empty-package)
|
|
|
|
$(add-assets-to-package)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Other modules should depend on the BUILT module if
|
|
|
|
# they want to use this module's R.java file.
|
|
|
|
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
|
|
|
|
|
|
|
ifneq ($(full_classes_jar),)
|
|
|
|
# If full_classes_jar is non-empty, we're building sources.
|
|
|
|
# If we're building sources, the initial javac step (which
|
|
|
|
# produces full_classes_compiled_jar) needs to ensure the
|
|
|
|
# R.java and Manifest.java files have been generated first.
|
|
|
|
$(full_classes_compiled_jar): $(R_file_stamp)
|
|
|
|
endif
|
|
|
|
|
2011-04-09 02:27:35 +02:00
|
|
|
endif # all_resources
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
|
|
|
# We need to explicitly clear this var so that we don't
|
|
|
|
# inherit the value from whomever caused us to be built.
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_AAPT_INCLUDES :=
|
|
|
|
else
|
|
|
|
# Most packages should link against the resources defined by framework-res.
|
|
|
|
# Even if they don't have their own resources, they may use framework
|
|
|
|
# resources.
|
2012-05-11 02:25:51 +02:00
|
|
|
ifneq ($(filter-out current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current,$(LOCAL_SDK_RES_VERSION))),)
|
2010-06-09 19:26:26 +02:00
|
|
|
# for released sdk versions, the platform resources were built into android.jar.
|
|
|
|
framework_res_package_export := \
|
2011-09-19 02:34:29 +02:00
|
|
|
$(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar
|
2010-06-09 19:26:26 +02:00
|
|
|
framework_res_package_export_deps := $(framework_res_package_export)
|
2011-09-19 02:34:29 +02:00
|
|
|
else # LOCAL_SDK_RES_VERSION
|
2009-03-04 04:28:42 +01:00
|
|
|
framework_res_package_export := \
|
2011-04-09 02:27:35 +02:00
|
|
|
$(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
|
2009-03-04 04:28:42 +01:00
|
|
|
# We can't depend directly on the export.apk file; it won't get its
|
|
|
|
# PRIVATE_ vars set up correctly if we do. Instead, depend on the
|
|
|
|
# corresponding R.stamp file, which lists the export.apk as a dependency.
|
|
|
|
framework_res_package_export_deps := \
|
2011-04-09 02:27:35 +02:00
|
|
|
$(dir $(framework_res_package_export))src/R.stamp
|
2011-09-19 02:34:29 +02:00
|
|
|
endif # LOCAL_SDK_RES_VERSION
|
2009-03-04 04:28:42 +01:00
|
|
|
$(R_file_stamp): $(framework_res_package_export_deps)
|
2010-06-09 19:26:26 +02:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2011-04-09 02:27:35 +02:00
|
|
|
PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
|
2010-06-09 19:26:26 +02:00
|
|
|
endif # LOCAL_NO_STANDARD_LIBRARIES
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
ifneq ($(full_classes_jar),)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_dex)
|
|
|
|
endif # full_classes_jar
|
|
|
|
|
|
|
|
|
|
|
|
# Get the list of jni libraries to be included in the apk file.
|
|
|
|
|
|
|
|
so_suffix := $($(my_prefix)SHLIB_SUFFIX)
|
|
|
|
|
|
|
|
jni_shared_libraries := \
|
|
|
|
$(addprefix $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)/, \
|
|
|
|
$(addsuffix $(so_suffix), \
|
|
|
|
$(LOCAL_JNI_SHARED_LIBRARIES)))
|
|
|
|
|
2012-11-29 01:52:41 +01:00
|
|
|
# Include RS dynamically-generated libraries as well
|
|
|
|
# Keep this ifneq, as the += otherwise adds spaces that need to be stripped.
|
|
|
|
ifneq ($(rs_compatibility_jni_libs),)
|
|
|
|
jni_shared_libraries += $(rs_compatibility_jni_libs)
|
|
|
|
endif
|
|
|
|
|
2011-10-14 02:31:45 +02:00
|
|
|
# App explicitly requires the prebuilt NDK libstlport_shared.so.
|
|
|
|
# libstlport_shared.so should never go to the system image.
|
|
|
|
# Instead it should be packaged into the apk.
|
|
|
|
ifeq (stlport_shared,$(LOCAL_NDK_STL_VARIANT))
|
2012-08-14 19:13:16 +02:00
|
|
|
ifndef LOCAL_SDK_VERSION
|
|
|
|
$(error LOCAL_SDK_VERSION has to be defined together with LOCAL_NDK_STL_VARIANT, \
|
2011-10-14 02:31:45 +02:00
|
|
|
LOCAL_PACKAGE_NAME=$(LOCAL_PACKAGE_NAME))
|
|
|
|
endif
|
|
|
|
jni_shared_libraries += \
|
2012-08-14 19:13:16 +02:00
|
|
|
$(HISTORICAL_NDK_VERSIONS_ROOT)/current/sources/cxx-stl/stlport/libs/$(TARGET_CPU_ABI)/libstlport_shared.so
|
2011-10-14 02:31:45 +02:00
|
|
|
endif
|
|
|
|
|
2010-06-18 09:38:07 +02:00
|
|
|
# Set the abi directory used by the local JNI shared libraries.
|
|
|
|
# (Doesn't change how the local shared libraries are compiled, just
|
|
|
|
# sets where they are stored in the apk.)
|
|
|
|
|
|
|
|
ifeq ($(LOCAL_JNI_SHARED_LIBRARIES_ABI),)
|
|
|
|
jni_shared_libraries_abi := $(TARGET_CPU_ABI)
|
|
|
|
else
|
|
|
|
jni_shared_libraries_abi := $(LOCAL_JNI_SHARED_LIBRARIES_ABI)
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# Pick a key to sign the package with. If this package hasn't specified
|
|
|
|
# an explicit certificate, use the default.
|
|
|
|
# Secure release builds will have their packages signed after the fact,
|
|
|
|
# so it's ok for these private keys to be in the clear.
|
|
|
|
ifeq ($(LOCAL_CERTIFICATE),)
|
2011-10-04 19:50:08 +02:00
|
|
|
LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
2009-12-16 00:06:55 +01:00
|
|
|
|
|
|
|
ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
|
|
|
|
# The special value "EXTERNAL" means that we will sign it with the
|
2011-10-04 19:50:08 +02:00
|
|
|
# default devkey, apply predexopt, but then expect the final .apk
|
2009-12-16 00:06:55 +01:00
|
|
|
# (after dexopting) to be signed by an outside tool.
|
2011-10-04 19:50:08 +02:00
|
|
|
LOCAL_CERTIFICATE := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
|
2009-12-16 00:06:55 +01:00
|
|
|
PACKAGES.$(LOCAL_PACKAGE_NAME).EXTERNAL_KEY := 1
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# If this is not an absolute certificate, assign it to a generic one.
|
|
|
|
ifeq ($(dir $(strip $(LOCAL_CERTIFICATE))),./)
|
2011-10-04 19:50:08 +02:00
|
|
|
LOCAL_CERTIFICATE := $(dir $(DEFAULT_SYSTEM_DEV_CERTIFICATE))$(LOCAL_CERTIFICATE)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
private_key := $(LOCAL_CERTIFICATE).pk8
|
|
|
|
certificate := $(LOCAL_CERTIFICATE).x509.pem
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): $(private_key) $(certificate) $(SIGNAPK_JAR)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_PRIVATE_KEY := $(private_key)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE := $(certificate)
|
|
|
|
|
|
|
|
PACKAGES.$(LOCAL_PACKAGE_NAME).PRIVATE_KEY := $(private_key)
|
|
|
|
PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate)
|
|
|
|
|
2012-11-13 19:55:28 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(foreach c,\
|
|
|
|
$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# Define the rule to build the actual package.
|
|
|
|
$(LOCAL_BUILT_MODULE): $(AAPT) | $(ZIPALIGN)
|
2011-10-24 21:17:03 +02:00
|
|
|
ifdef LOCAL_DEX_PREOPT
|
2010-09-18 01:36:06 +02:00
|
|
|
# Make sure the boot jars get dexpreopt-ed first
|
|
|
|
$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT)
|
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries)
|
2010-06-18 09:38:07 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES_ABI := $(jni_shared_libraries_abi)
|
2010-06-10 01:35:58 +02:00
|
|
|
ifneq ($(TARGET_BUILD_APPS),)
|
2010-05-26 22:13:56 +02:00
|
|
|
# Include all resources for unbundled apps.
|
2010-12-28 22:14:29 +01:00
|
|
|
LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
|
|
|
|
endif
|
|
|
|
ifeq ($(LOCAL_AAPT_INCLUDE_ALL_RESOURCES),true)
|
2011-03-15 21:19:30 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG :=
|
2011-10-15 04:37:57 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
|
2011-03-15 21:19:30 +01:00
|
|
|
else
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG)
|
2011-10-15 04:37:57 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
|
2010-05-26 22:13:56 +02:00
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
|
|
|
|
@echo "target Package: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(create-empty-package)
|
|
|
|
$(add-assets-to-package)
|
|
|
|
ifneq ($(jni_shared_libraries),)
|
|
|
|
$(add-jni-shared-libs-to-package)
|
|
|
|
endif
|
|
|
|
ifneq ($(full_classes_jar),)
|
|
|
|
$(add-dex-to-package)
|
2012-07-31 18:40:00 +02:00
|
|
|
endif
|
2012-08-10 00:20:50 +02:00
|
|
|
$(add-carried-java-resources)
|
2012-07-31 18:40:00 +02:00
|
|
|
ifneq ($(extra_jar_args),)
|
|
|
|
$(add-java-resources-to-package)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
$(sign-package)
|
2011-10-24 21:17:03 +02:00
|
|
|
ifdef LOCAL_DEX_PREOPT
|
2010-09-18 01:36:06 +02:00
|
|
|
$(hide) rm -f $(patsubst %.apk,%.odex,$@)
|
|
|
|
$(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
|
2011-10-24 21:17:03 +02:00
|
|
|
ifneq (nostripping,$(LOCAL_DEX_PREOPT))
|
2010-09-18 01:36:06 +02:00
|
|
|
$(call dexpreopt-remove-classes.dex,$@)
|
2011-10-24 21:17:03 +02:00
|
|
|
endif
|
2013-02-26 01:02:42 +01:00
|
|
|
endif
|
|
|
|
@# Alignment must happen after all other zip operations.
|
|
|
|
$(align-package)
|
2010-09-18 01:36:06 +02:00
|
|
|
|
2013-02-26 01:02:42 +01:00
|
|
|
ifdef LOCAL_DEX_PREOPT
|
2010-09-18 01:36:06 +02:00
|
|
|
built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
|
|
|
|
$(built_odex): $(LOCAL_BUILT_MODULE)
|
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
# Save information about this package
|
|
|
|
PACKAGES.$(LOCAL_PACKAGE_NAME).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
|
|
|
|
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_FILES := $(all_resources)
|
2012-05-25 06:05:19 +02:00
|
|
|
ifdef package_resource_overlays
|
|
|
|
PACKAGES.$(LOCAL_PACKAGE_NAME).RESOURCE_OVERLAYS := $(package_resource_overlays)
|
|
|
|
endif
|
2009-03-04 04:28:42 +01:00
|
|
|
|
|
|
|
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
|
Add an inherit-package macro to the build system.
This lets you use the source code from one apk to build a new one
with a new module name, a new android package name and optionally,
a new certificate.
To use this, in a makefile, add this:
$(call inherit-package, \
packages/apps/Music/Android.mk, \
Music, \
MusicFork, \
my_cert, \
com.example.music)
You don't need the LOCAL_PATH and CLEAR_VARS stuff. It will override
only the packages that are defined in the makefile name you give, but
if other modules of other types are defined, you will get an error
saying that it's defined twice. In that case, you need to move the
duplicate library (for example a .so) out into a different makefile.
A LOCAL_OVERRIDES_PACKAGES entry is automatically created for the
forked app.
2010-02-05 02:37:21 +01:00
|
|
|
|
2013-04-11 04:17:41 +02:00
|
|
|
# Dist the files that can be bundled in system.img.
|
|
|
|
# They include the jni shared libraries and the apk with jni libraries stripped.
|
|
|
|
ifeq ($(LOCAL_DIST_BUNDLED_BINARIES),true)
|
|
|
|
ifneq ($(filter $(LOCAL_PACKAGE_NAME),$(TARGET_BUILD_APPS)),)
|
|
|
|
ifneq ($(strip $(jni_shared_libraries)),)
|
|
|
|
dist_subdir := bundled_$(LOCAL_PACKAGE_NAME)
|
|
|
|
$(foreach f, $(jni_shared_libraries), \
|
|
|
|
$(call dist-for-goals, apps_only, $(f):$(dist_subdir)/$(notdir $(f))))
|
|
|
|
|
|
|
|
apk_jni_stripped := $(intermediates)/jni_stripped/package.apk
|
|
|
|
$(apk_jni_stripped): PRIVATE_JNI_SHARED_LIBRARIES := $(notdir $(jni_shared_libraries))
|
|
|
|
$(apk_jni_stripped) : $(LOCAL_BUILT_MODULE) | $(ZIPALIGN)
|
|
|
|
@rm -rf $(dir $@) && mkdir -p $(dir $@)
|
|
|
|
$(hide) cp $< $@
|
|
|
|
$(hide) zip -d $@ $(foreach f,$(PRIVATE_JNI_SHARED_LIBRARIES),\*/$(f))
|
|
|
|
$(call align-package)
|
|
|
|
|
|
|
|
$(call dist-for-goals, apps_only, $(apk_jni_stripped):$(dist_subdir)/$(LOCAL_PACKAGE_NAME).apk)
|
|
|
|
|
|
|
|
endif # jni_shared_libraries
|
|
|
|
endif # apps_only build
|
|
|
|
endif # LOCAL_DIST_BUNDLED_BINARIES
|
|
|
|
|
2012-06-19 03:45:40 +02:00
|
|
|
# Lint phony targets
|
|
|
|
.PHONY: lint-$(LOCAL_PACKAGE_NAME)
|
|
|
|
lint-$(LOCAL_PACKAGE_NAME): PRIVATE_PATH := $(LOCAL_PATH)
|
|
|
|
lint-$(LOCAL_PACKAGE_NAME): PRIVATE_LINT_FLAGS := $(LOCAL_LINT_FLAGS)
|
|
|
|
lint-$(LOCAL_PACKAGE_NAME) :
|
|
|
|
@echo lint $(PRIVATE_PATH)
|
|
|
|
$(LINT) $(PRIVATE_LINT_FLAGS) $(PRIVATE_PATH)
|
|
|
|
|
|
|
|
lintall : lint-$(LOCAL_PACKAGE_NAME)
|
|
|
|
|
Add an inherit-package macro to the build system.
This lets you use the source code from one apk to build a new one
with a new module name, a new android package name and optionally,
a new certificate.
To use this, in a makefile, add this:
$(call inherit-package, \
packages/apps/Music/Android.mk, \
Music, \
MusicFork, \
my_cert, \
com.example.music)
You don't need the LOCAL_PATH and CLEAR_VARS stuff. It will override
only the packages that are defined in the makefile name you give, but
if other modules of other types are defined, you will get an error
saying that it's defined twice. In that case, you need to move the
duplicate library (for example a .so) out into a different makefile.
A LOCAL_OVERRIDES_PACKAGES entry is automatically created for the
forked app.
2010-02-05 02:37:21 +01:00
|
|
|
endif # skip_definition
|
2013-08-28 22:04:46 +02:00
|
|
|
|
|
|
|
# Reset internal variables.
|
|
|
|
all_res_assets :=
|