diff options
author | Ying Wang <wangying@google.com> | 2012-03-30 18:08:07 -0700 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2012-03-30 18:57:52 -0700 |
commit | 82b836fda6894ebfccccfbddc2ce3ee2718d862e (patch) | |
tree | 1f9d5cc887944edc8f42c4453c20de5ef3b7616c /core/pdk_config.mk | |
parent | 06e758a9664deed8cc865a58441a9a6279cc66de (diff) | |
download | build-82b836fda6894ebfccccfbddc2ce3ee2718d862e.zip build-82b836fda6894ebfccccfbddc2ce3ee2718d862e.tar.gz build-82b836fda6894ebfccccfbddc2ce3ee2718d862e.tar.bz2 |
Support to build pdk and pdk fusion.
Bug: 6241618
Change-Id: I08f74019631e9e132c15cdb2916bbafb052f9aa6
Diffstat (limited to 'core/pdk_config.mk')
-rw-r--r-- | core/pdk_config.mk | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/core/pdk_config.mk b/core/pdk_config.mk new file mode 100644 index 0000000..98f34a5 --- /dev/null +++ b/core/pdk_config.mk @@ -0,0 +1,66 @@ +# This file defines the rule to fuse the platform.zip into the current PDK build. + +.PHONY: pdk fusion +pdk fusion: $(DEFAULT_GOAL) + +# What to build: +# pdk fusion if: +# 1) the platform.zip exists in the default location +# or +# 2) PDK_FUSION_PLATFORM_ZIP is passed in from the environment +# or +# 3) fusion is a command line build goal, +# PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal? +# otherwise pdk only if: +# 1) pdk is a command line build goal +# or +# 2) TARGET_BUILD_PDK is passed in from the environment + +# TODO: what's the best default location? +_pdk_fusion_default_platform_zip := $(OUT_DIR)/platform.zip +ifneq (,$(wildcard $(_pdk_fusion_default_platform_zip))) +$(info $(_pdk_fusion_default_platform_zip) found, do a PDK fusion build.) +PDK_FUSION_PLATFORM_ZIP := $(_pdk_fusion_default_platform_zip) +TARGET_BUILD_PDK := true +endif + +ifneq (,$(filter pdk fusion, $(MAKECMDGOALS))) +TARGET_BUILD_PDK := true +ifneq (,$(filter fusion, $(MAKECMDGOALS))) +ifndef PDK_FUSION_PLATFORM_ZIP + $(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.) +endif +endif # fusion +endif # pdk or fusion + +ifdef PDK_FUSION_PLATFORM_ZIP +TARGET_BUILD_PDK := true +ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP))) + $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).) +endif + +_pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion) +_pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp + +$(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP) + @echo "Unzip $(dir $@) <- $<" + $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) + $(hide) unzip -qo $< -d $(dir $@) + $(hide) touch $@ + +_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) '*[^/]' 2>/dev/null) +_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/, $(_pdk_fusion_file_list)) +$(_pdk_fusion_files) : $(_pdk_fusion_stamp) + +# Implicit pattern rules to copy the fusion files to the system image directory. +# Note that if there is already explicit rule in the build system to generate a file, +# the pattern rule will be just ignored by make. +# That's desired by us: we want only absent files from the platform zip package. +# Copy with the last-modified time preserved, never follow symbolic links. +$(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/% + @mkdir -p $(dir $@) + $(hide) cp -fpPR $< $@ + +ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list)) + +endif |