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 | |
| 36 | ifdef PDK_FUSION_PLATFORM_ZIP |
| 37 | TARGET_BUILD_PDK := true |
| 38 | ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP))) |
| 39 | $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).) |
| 40 | endif |
| 41 | |
| 42 | _pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion) |
| 43 | _pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp |
| 44 | |
| 45 | $(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP) |
| 46 | @echo "Unzip $(dir $@) <- $<" |
| 47 | $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) |
| 48 | $(hide) unzip -qo $< -d $(dir $@) |
| 49 | $(hide) touch $@ |
| 50 | |
| 51 | _pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) '*[^/]' 2>/dev/null) |
| 52 | _pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/, $(_pdk_fusion_file_list)) |
| 53 | $(_pdk_fusion_files) : $(_pdk_fusion_stamp) |
| 54 | |
| 55 | # Implicit pattern rules to copy the fusion files to the system image directory. |
| 56 | # Note that if there is already explicit rule in the build system to generate a file, |
| 57 | # the pattern rule will be just ignored by make. |
| 58 | # That's desired by us: we want only absent files from the platform zip package. |
| 59 | # Copy with the last-modified time preserved, never follow symbolic links. |
| 60 | $(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% |
| 61 | @mkdir -p $(dir $@) |
| 62 | $(hide) cp -fpPR $< $@ |
| 63 | |
| 64 | ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list)) |
| 65 | |
| 66 | endif |
Keun young Park | ebb351e | 2012-04-19 15:36:18 -0700 | [diff] [blame^] | 67 | |
| 68 | ifeq ($(TARGET_BUILD_PDK),true) |
| 69 | |
| 70 | # SDK used for Java build under PDK |
| 71 | PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS)) |
| 72 | $(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION)) |
| 73 | |
| 74 | endif # BUILD_PDK |