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