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