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