Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 1 | # This file defines the rule to fuse the platform.zip into the current PDK build. |
| 2 | |
| 3 | .PHONY: pdk fusion |
| 4 | pdk fusion: $(DEFAULT_GOAL) |
| 5 | |
| 6 | # What to build: |
| 7 | # pdk fusion if: |
Keun young Park | 4da8e12 | 2012-08-02 12:51:59 -0700 | [diff] [blame] | 8 | # 1) PDK_FUSION_PLATFORM_ZIP is passed in from the environment |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 9 | # or |
Keun young Park | 4da8e12 | 2012-08-02 12:51:59 -0700 | [diff] [blame] | 10 | # 2) the platform.zip exists in the default location |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 11 | # or |
| 12 | # 3) fusion is a command line build goal, |
| 13 | # PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal? |
| 14 | # otherwise pdk only if: |
| 15 | # 1) pdk is a command line build goal |
| 16 | # or |
| 17 | # 2) TARGET_BUILD_PDK is passed in from the environment |
| 18 | |
Keun young Park | 4da8e12 | 2012-08-02 12:51:59 -0700 | [diff] [blame] | 19 | # if PDK_FUSION_PLATFORM_ZIP is specified, do not override. |
| 20 | ifndef PDK_FUSION_PLATFORM_ZIP |
keunyoung | 3b4856e | 2013-03-28 14:08:31 -0700 | [diff] [blame] | 21 | _pdk_fusion_default_platform_zip = $(wildcard \ |
| 22 | vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip \ |
| 23 | vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip) |
| 24 | ifneq (,$(_pdk_fusion_default_platform_zip)) |
| 25 | PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip)) |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 26 | TARGET_BUILD_PDK := true |
keunyoung | 3b4856e | 2013-03-28 14:08:31 -0700 | [diff] [blame] | 27 | $(info $(PDK_FUSION_PLATFORM_ZIP) found, do a PDK fusion build.) |
| 28 | endif # _pdk_fusion_default_platform_zip |
Keun young Park | 4da8e12 | 2012-08-02 12:51:59 -0700 | [diff] [blame] | 29 | endif # !PDK_FUSION_PLATFORM_ZIP |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 30 | |
| 31 | ifneq (,$(filter pdk fusion, $(MAKECMDGOALS))) |
| 32 | TARGET_BUILD_PDK := true |
| 33 | ifneq (,$(filter fusion, $(MAKECMDGOALS))) |
| 34 | ifndef PDK_FUSION_PLATFORM_ZIP |
| 35 | $(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.) |
| 36 | endif |
| 37 | endif # fusion |
| 38 | endif # pdk or fusion |
| 39 | |
Keun young Park | f4d1438 | 2012-06-18 12:46:46 -0700 | [diff] [blame] | 40 | ifneq (,$(filter platform-java, $(MAKECMDGOALS))$(PDK_FUSION_PLATFORM_ZIP)) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 41 | # additional items to add to platform.zip for platform-java build |
| 42 | # For these dirs, add classes.jar and javalib.jar from the dir to platform.zip |
| 43 | # all paths under out dir |
| 44 | PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR := \ |
| 45 | target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates \ |
| 46 | target/common/obj/JAVA_LIBRARIES/core_intermediates \ |
| 47 | target/common/obj/JAVA_LIBRARIES/core-junit_intermediates \ |
| 48 | target/common/obj/JAVA_LIBRARIES/ext_intermediates \ |
| 49 | target/common/obj/JAVA_LIBRARIES/framework_intermediates \ |
Ying Wang | 15cbe8e | 2013-07-19 14:37:25 -0700 | [diff] [blame^] | 50 | target/common/obj/JAVA_LIBRARIES/framework2_intermediates \ |
Colin Cross | 6fe6c3c | 2012-07-18 16:00:48 -0700 | [diff] [blame] | 51 | target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates \ |
| 52 | target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates \ |
Wink Saville | 554a0ad | 2013-01-28 15:30:58 -0800 | [diff] [blame] | 53 | target/common/obj/JAVA_LIBRARIES/voip-common_intermediates \ |
Colin Cross | 6fe6c3c | 2012-07-18 16:00:48 -0700 | [diff] [blame] | 54 | target/common/obj/JAVA_LIBRARIES/mms-common_intermediates |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 55 | # not java libraries |
| 56 | PDK_PLATFORM_JAVA_ZIP_CONTENTS := \ |
| 57 | target/common/obj/APPS/framework-res_intermediates/package-export.apk \ |
| 58 | target/common/obj/APPS/framework-res_intermediates/src/R.stamp |
| 59 | PDK_PLATFORM_JAVA_ZIP_CONTENTS += $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\ |
| 60 | $(lib_dir)/classes.jar $(lib_dir)/javalib.jar) |
Keun young Park | f4d1438 | 2012-06-18 12:46:46 -0700 | [diff] [blame] | 61 | endif # platform-java or FUSION build |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 62 | |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 63 | # check and override java support level |
Keun young Park | f4d1438 | 2012-06-18 12:46:46 -0700 | [diff] [blame] | 64 | ifneq ($(TARGET_BUILD_PDK)$(PDK_FUSION_PLATFORM_ZIP),) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 65 | ifneq ($(wildcard external/proguard),) |
| 66 | TARGET_BUILD_JAVA_SUPPORT_LEVEL := sdk |
| 67 | else # no proguard |
| 68 | TARGET_BUILD_JAVA_SUPPORT_LEVEL := |
| 69 | endif |
| 70 | # platform supprot is set after checking platform.zip |
| 71 | endif # PDK |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 72 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 73 | ifdef PDK_FUSION_PLATFORM_ZIP |
| 74 | TARGET_BUILD_PDK := true |
| 75 | ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP))) |
| 76 | $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).) |
| 77 | endif |
| 78 | |
| 79 | _pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion) |
| 80 | _pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp |
| 81 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 82 | _pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) \ |
| 83 | '*[^/]' -x 'target/common/*' 2>/dev/null) |
| 84 | _pdk_fusion_java_file_list := \ |
| 85 | $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) 'target/common/*' 2>/dev/null) |
| 86 | _pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/,\ |
| 87 | $(_pdk_fusion_file_list) $(_pdk_fusion_java_file_list)) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 88 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 89 | ifneq ($(_pdk_fusion_java_file_list),) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 90 | # This represents whether java build can use platform API or not |
| 91 | # This should not be used in Android.mk |
| 92 | TARGET_BUILD_PDK_JAVA_PLATFORM := true |
| 93 | ifneq ($(TARGET_BUILD_JAVA_SUPPORT_LEVEL),) |
| 94 | TARGET_BUILD_JAVA_SUPPORT_LEVEL := platform |
| 95 | endif |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 96 | endif |
| 97 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 98 | $(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP) |
| 99 | @echo "Unzip $(dir $@) <- $<" |
| 100 | $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) |
| 101 | $(hide) unzip -qo $< -d $(dir $@) |
Keun young Park | d8de82f | 2012-05-25 10:52:44 -0700 | [diff] [blame] | 102 | $(call split-long-arguments,-touch,$(_pdk_fusion_files)) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 103 | $(hide) touch $@ |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 104 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 105 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 106 | $(_pdk_fusion_files) : $(_pdk_fusion_stamp) |
| 107 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 108 | |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 109 | # Implicit pattern rules to copy the fusion files to the system image directory. |
| 110 | # Note that if there is already explicit rule in the build system to generate a file, |
| 111 | # the pattern rule will be just ignored by make. |
| 112 | # That's desired by us: we want only absent files from the platform zip package. |
| 113 | # Copy with the last-modified time preserved, never follow symbolic links. |
Colin Cross | 2bea2e6 | 2012-04-23 18:49:04 -0700 | [diff] [blame] | 114 | $(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% $(_pdk_fusion_stamp) |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 115 | @mkdir -p $(dir $@) |
Sungmin Choi | 79d5109 | 2013-02-04 00:54:03 +0900 | [diff] [blame] | 116 | $(hide) rm -rf $@ |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 117 | $(hide) cp -fpPR $< $@ |
| 118 | |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 119 | ifeq (true,$(TARGET_BUILD_PDK_JAVA_PLATFORM)) |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 120 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 121 | define JAVA_dependency_template |
| 122 | $(OUT_DIR)/$(strip $(1)): $(_pdk_fusion_intermediates)/$(strip $(1)) $(OUT_DIR)/$(strip $(2)) \ |
| 123 | $(_pdk_fusion_stamp) |
| 124 | @mkdir -p $$(dir $$@) |
| 125 | $(hide) cp -fpPR $$< $$@ |
| 126 | endef |
| 127 | |
| 128 | # needs explicit dependency as package-export.apk is not explicitly pulled |
| 129 | $(eval $(call JAVA_dependency_template,\ |
| 130 | target/common/obj/APPS/framework-res_intermediates/src/R.stamp,\ |
| 131 | target/common/obj/APPS/framework-res_intermediates/package-export.apk)) |
| 132 | |
| 133 | # javalib.jar should pull classes.jar as classes.jar is not explicitly pulled. |
| 134 | $(foreach lib_dir,$(PDK_PLATFORM_JAVA_ZIP_JAVA_LIB_DIR),\ |
| 135 | $(eval $(call JAVA_dependency_template,$(lib_dir)/javalib.jar,\ |
| 136 | $(lib_dir)/classes.jar))) |
| 137 | |
| 138 | # implicit rules for all others |
| 139 | $(TARGET_COMMON_OUT_ROOT)/% : $(_pdk_fusion_intermediates)/target/common/% $(_pdk_fusion_stamp) |
| 140 | @mkdir -p $(dir $@) |
| 141 | $(hide) cp -fpPR $< $@ |
Ying Wang | 82b836f | 2012-03-30 18:08:07 -0700 | [diff] [blame] | 142 | endif |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 143 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 144 | ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list)) |
| 145 | |
| 146 | endif # PDK_FUSION_PLATFORM_ZIP |
| 147 | |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 148 | ifeq ($(TARGET_BUILD_PDK),true) |
Keun young Park | f4d1438 | 2012-06-18 12:46:46 -0700 | [diff] [blame] | 149 | $(info PDK TARGET_BUILD_JAVA_SUPPORT_LEVEL $(TARGET_BUILD_JAVA_SUPPORT_LEVEL)) |
Keun young Park | efe02ce | 2012-06-06 17:19:29 -0700 | [diff] [blame] | 150 | ifeq ($(TARGET_BUILD_PDK_JAVA_PLATFORM),) |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 151 | |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 152 | # SDK used for Java build under PDK |
| 153 | PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS)) |
| 154 | $(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION)) |
| 155 | |
Keun young Park | 816b9fd | 2012-05-16 10:32:41 -0700 | [diff] [blame] | 156 | else # PDK_JAVA |
| 157 | |
| 158 | $(info PDK Build uses the current platform API) |
| 159 | |
| 160 | endif # PDK_JAVA |
| 161 | |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame] | 162 | endif # BUILD_PDK |
Keun young Park | 7222669 | 2012-07-31 17:13:20 -0700 | [diff] [blame] | 163 | |
| 164 | ifneq (,$(filter platform platform-java, $(MAKECMDGOALS))$(filter true,$(TARGET_BUILD_PDK))) |
| 165 | # files under $(PRODUCT_OUT)/symbols to help debugging. |
| 166 | # Source not included to PDK due to dependency issue, so provide symbols instead. |
| 167 | PDK_SYMBOL_FILES_LIST := \ |
| 168 | system/bin/app_process |
| 169 | |
| 170 | ifdef PDK_FUSION_PLATFORM_ZIP |
| 171 | # symbols should be explicitly pulled for fusion build |
| 172 | $(foreach f,$(PDK_SYMBOL_FILES_LIST),\ |
| 173 | $(eval $(call add-dependency,$(PRODUCT_OUT)/$(f),$(PRODUCT_OUT)/symbols/$(f)))) |
| 174 | endif # PLATFORM_ZIP |
| 175 | endif # platform.zip build or PDK |