2012-03-31 09:08:07 +08:00
|
|
|
# This file defines the rule to fuse the platform.zip into the current PDK build.
|
|
|
|
|
|
|
|
.PHONY: pdk fusion
|
|
|
|
pdk fusion: $(DEFAULT_GOAL)
|
|
|
|
|
|
|
|
# What to build:
|
|
|
|
# pdk fusion if:
|
2012-08-03 03:51:59 +08:00
|
|
|
# 1) PDK_FUSION_PLATFORM_ZIP is passed in from the environment
|
2012-03-31 09:08:07 +08:00
|
|
|
# or
|
2012-08-03 03:51:59 +08:00
|
|
|
# 2) the platform.zip exists in the default location
|
2012-03-31 09:08:07 +08:00
|
|
|
# or
|
|
|
|
# 3) fusion is a command line build goal,
|
|
|
|
# PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal?
|
|
|
|
# otherwise pdk only if:
|
|
|
|
# 1) pdk is a command line build goal
|
|
|
|
# or
|
|
|
|
# 2) TARGET_BUILD_PDK is passed in from the environment
|
|
|
|
|
2012-08-03 03:51:59 +08:00
|
|
|
# if PDK_FUSION_PLATFORM_ZIP is specified, do not override.
|
|
|
|
ifndef PDK_FUSION_PLATFORM_ZIP
|
2013-03-29 05:08:31 +08:00
|
|
|
_pdk_fusion_default_platform_zip = $(wildcard \
|
|
|
|
vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip \
|
|
|
|
vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip)
|
|
|
|
ifneq (,$(_pdk_fusion_default_platform_zip))
|
|
|
|
PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip))
|
2012-03-31 09:08:07 +08:00
|
|
|
TARGET_BUILD_PDK := true
|
2013-03-29 05:08:31 +08:00
|
|
|
$(info $(PDK_FUSION_PLATFORM_ZIP) found, do a PDK fusion build.)
|
|
|
|
endif # _pdk_fusion_default_platform_zip
|
2012-08-03 03:51:59 +08:00
|
|
|
endif # !PDK_FUSION_PLATFORM_ZIP
|
2012-03-31 09:08:07 +08:00
|
|
|
|
|
|
|
ifneq (,$(filter pdk fusion, $(MAKECMDGOALS)))
|
|
|
|
TARGET_BUILD_PDK := true
|
|
|
|
ifneq (,$(filter fusion, $(MAKECMDGOALS)))
|
|
|
|
ifndef PDK_FUSION_PLATFORM_ZIP
|
|
|
|
$(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.)
|
|
|
|
endif
|
|
|
|
endif # fusion
|
|
|
|
endif # pdk or fusion
|
|
|
|
|
2012-06-19 03:46:46 +08:00
|
|
|
ifneq (,$(filter platform-java, $(MAKECMDGOALS))$(PDK_FUSION_PLATFORM_ZIP))
|
2012-05-17 01:32:41 +08:00
|
|
|
# additional items to add to platform.zip for platform-java build
|
|
|
|
# For these dirs, add classes.jar and javalib.jar from the dir to platform.zip
|
|
|
|
# all paths under out dir
|
|
|
|
PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR := \
|
|
|
|
target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \
|
|
|
|
target/common/obj/JAVA_LIBRARIES/core_intermediates \
|
|
|
|
target/common/obj/JAVA_LIBRARIES/core-junit_intermediates \
|
|
|
|
target/common/obj/JAVA_LIBRARIES/ext_intermediates \
|
|
|
|
target/common/obj/JAVA_LIBRARIES/framework_intermediates \
|
2013-07-20 05:37:25 +08:00
|
|
|
target/common/obj/JAVA_LIBRARIES/framework2_intermediates \
|
2012-07-19 07:00:48 +08:00
|
|
|
target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates \
|
|
|
|
target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \
|
2013-01-29 07:30:58 +08:00
|
|
|
target/common/obj/JAVA_LIBRARIES/voip-common_intermediates \
|
2013-09-25 07:57:28 +08:00
|
|
|
target/common/obj/JAVA_LIBRARIES/mms-common_intermediates \
|
|
|
|
target/common/obj/JAVA_LIBRARIES/android-ex-camera2_intermediates
|
2012-05-17 01:32:41 +08:00
|
|
|
# not java libraries
|
|
|
|
PDK_PLATFORM_JAVA_ZIP_CONTENTS := \
|
|
|
|
target/common/obj/APPS/framework-res_intermediates/package-export.apk \
|
|
|
|
target/common/obj/APPS/framework-res_intermediates/src/R.stamp
|
|
|
|
PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
|
|
|
|
$(lib_dir)/classes.jar $(lib_dir)/javalib.jar)
|
2012-06-19 03:46:46 +08:00
|
|
|
endif # platform-java or FUSION build
|
2012-05-17 01:32:41 +08:00
|
|
|
|
2012-06-07 08:19:29 +08:00
|
|
|
# check and override java support level
|
2012-06-19 03:46:46 +08:00
|
|
|
ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP),)
|
2012-06-07 08:19:29 +08:00
|
|
|
ifneq ($(wildcard external/proguard),)
|
|
|
|
TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk
|
|
|
|
else # no proguard
|
|
|
|
TARGET_BUILD_JAVA_SUPPORT_LEVEL :=
|
|
|
|
endif
|
|
|
|
# platform supprot is set after checking platform.zip
|
|
|
|
endif # PDK
|
2012-05-17 01:32:41 +08:00
|
|
|
|
2012-03-31 09:08:07 +08:00
|
|
|
ifdef PDK_FUSION_PLATFORM_ZIP
|
|
|
|
TARGET_BUILD_PDK := true
|
|
|
|
ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP)))
|
|
|
|
$(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).)
|
|
|
|
endif
|
|
|
|
|
|
|
|
_pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
|
|
|
|
_pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
|
|
|
|
|
2012-05-17 01:32:41 +08:00
|
|
|
_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \
|
|
|
|
'*[^/]' -x 'target/common/*' 2>/dev/null)
|
|
|
|
_pdk_fusion_java_file_list := \
|
|
|
|
$(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null)
|
|
|
|
_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\
|
|
|
|
$(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list))
|
2012-06-07 08:19:29 +08:00
|
|
|
|
2012-05-17 01:32:41 +08:00
|
|
|
ifneq ($(_pdk_fusion_java_file_list),)
|
2012-06-07 08:19:29 +08:00
|
|
|
# This represents whether java build can use platform API or not
|
|
|
|
# This should not be used in Android.mk
|
|
|
|
TARGET_BUILD_PDK_JAVA_PLATFORM := true
|
|
|
|
ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),)
|
|
|
|
TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform
|
|
|
|
endif
|
2012-05-17 01:32:41 +08:00
|
|
|
endif
|
|
|
|
|
2012-03-31 09:08:07 +08:00
|
|
|
$(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
|
|
|
|
@echo "Unzip $(dir $@) <- $<"
|
|
|
|
$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
|
|
|
|
$(hide) unzip -qo $< -d $(dir $@)
|
2012-05-26 01:52:44 +08:00
|
|
|
$(call split-long-arguments,-touch,$(_pdk_fusion_files))
|
2012-05-17 01:32:41 +08:00
|
|
|
$(hide) touch $@
|
|
|
|
|
2012-03-31 09:08:07 +08:00
|
|
|
|
|
|
|
$(_pdk_fusion_files) : $(_pdk_fusion_stamp)
|
|
|
|
|
2012-05-17 01:32:41 +08:00
|
|
|
|
2012-03-31 09:08:07 +08:00
|
|
|
# Implicit pattern rules to copy the fusion files to the system image directory.
|
|
|
|
# Note that if there is already explicit rule in the build system to generate a file,
|
|
|
|
# the pattern rule will be just ignored by make.
|
|
|
|
# That's desired by us: we want only absent files from the platform zip package.
|
|
|
|
# Copy with the last-modified time preserved, never follow symbolic links.
|
2012-04-24 09:49:04 +08:00
|
|
|
$(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% $(_pdk_fusion_stamp)
|
2012-03-31 09:08:07 +08:00
|
|
|
@mkdir -p $(dir $@)
|
2013-02-03 23:54:03 +08:00
|
|
|
$(hide) rm -rf $@
|
2012-03-31 09:08:07 +08:00
|
|
|
$(hide) cp -fpPR $< $@
|
|
|
|
|
2012-06-07 08:19:29 +08:00
|
|
|
ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM))
|
2012-05-17 01:32:41 +08:00
|
|
|
|
2013-07-26 09:20:09 +08:00
|
|
|
PDK_FUSION_OUT_DIR := $(OUT_DIR)
|
2012-06-15 08:33:38 +08:00
|
|
|
ifeq (debug,$(TARGET_BUILD_TYPE))
|
|
|
|
PDK_FUSION_OUT_DIR := $(DEBUG_OUT_DIR)
|
|
|
|
endif
|
2013-07-26 09:20:09 +08:00
|
|
|
|
|
|
|
define JAVA_dependency_template
|
2012-06-15 08:33:38 +08:00
|
|
|
$(PDK_FUSION_OUT_DIR)/$(strip $(1)): $(_pdk_fusion_intermediates)/$(strip $(1)) \
|
2013-07-26 09:20:09 +08:00
|
|
|
$(PDK_FUSION_OUT_DIR)/$(strip $(2)) $(_pdk_fusion_stamp)
|
2012-05-17 01:32:41 +08:00
|
|
|
@mkdir -p $$(dir $$@)
|
|
|
|
$(hide) cp -fpPR $$< $$@
|
|
|
|
endef
|
2012-03-31 09:08:07 +08:00
|
|
|
|
2012-05-17 01:32:41 +08:00
|
|
|
# needs explicit dependency as package-export.apk is not explicitly pulled
|
|
|
|
$(eval $(call JAVA_dependency_template,\
|
|
|
|
target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\
|
|
|
|
target/common/obj/APPS/framework-res_intermediates/package-export.apk))
|
|
|
|
|
|
|
|
# javalib.jar should pull classes.jar as classes.jar is not explicitly pulled.
|
|
|
|
$(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\
|
|
|
|
$(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\
|
|
|
|
$(lib_dir)/classes.jar)))
|
|
|
|
|
|
|
|
# implicit rules for all others
|
|
|
|
$(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
$(hide) cp -fpPR $< $@
|
2012-03-31 09:08:07 +08:00
|
|
|
endif
|
2012-04-20 06:36:18 +08:00
|
|
|
|
2012-05-17 01:32:41 +08:00
|
|
|
ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
|
|
|
|
|
|
|
|
endif # PDK_FUSION_PLATFORM_ZIP
|
|
|
|
|
2012-04-20 06:36:18 +08:00
|
|
|
ifeq ($(TARGET_BUILD_PDK),true)
|
2012-06-19 03:46:46 +08:00
|
|
|
$(info PDK TARGET_BUILD_JAVA_SUPPORT_LEVEL $(TARGET_BUILD_JAVA_SUPPORT_LEVEL))
|
2012-06-07 08:19:29 +08:00
|
|
|
ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),)
|
2012-05-17 01:32:41 +08:00
|
|
|
|
2012-04-20 06:36:18 +08:00
|
|
|
# SDK used for Java build under PDK
|
|
|
|
PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
|
|
|
|
$(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION))
|
|
|
|
|
2012-05-17 01:32:41 +08:00
|
|
|
else # PDK_JAVA
|
|
|
|
|
|
|
|
$(info PDK Build uses the current platform API)
|
|
|
|
|
|
|
|
endif # PDK_JAVA
|
|
|
|
|
2012-04-20 06:36:18 +08:00
|
|
|
endif # BUILD_PDK
|
2012-08-01 08:13:20 +08:00
|
|
|
|
|
|
|
ifneq (,$(filter platform platform-java, $(MAKECMDGOALS))$(filter true,$(TARGET_BUILD_PDK)))
|
|
|
|
# files under $(PRODUCT_OUT)/symbols to help debugging.
|
|
|
|
# Source not included to PDK due to dependency issue, so provide symbols instead.
|
|
|
|
PDK_SYMBOL_FILES_LIST := \
|
|
|
|
system/bin/app_process
|
|
|
|
|
|
|
|
ifdef PDK_FUSION_PLATFORM_ZIP
|
|
|
|
# symbols should be explicitly pulled for fusion build
|
|
|
|
$(foreach f,$(PDK_SYMBOL_FILES_LIST),\
|
|
|
|
$(eval $(call add-dependency,$(PRODUCT_OUT)/$(f),$(PRODUCT_OUT)/symbols/$(f))))
|
|
|
|
endif # PLATFORM_ZIP
|
|
|
|
endif # platform.zip build or PDK
|