pdk_config.mk revision 21adee01841c3254506d729bc6d99df8d4c48d92
1# This file defines the rule to fuse the platform.zip into the current PDK build. 2 3.PHONY: pdk fusion 4pdk 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? 20_pdk_fusion_default_platform_zip := vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip 21ifneq (,$(wildcard $(_pdk_fusion_default_platform_zip))) 22$(info $(_pdk_fusion_default_platform_zip) found, do a PDK fusion build.) 23PDK_FUSION_PLATFORM_ZIP := $(_pdk_fusion_default_platform_zip) 24TARGET_BUILD_PDK := true 25endif 26 27ifneq (,$(filter pdk fusion, $(MAKECMDGOALS))) 28TARGET_BUILD_PDK := true 29ifneq (,$(filter fusion, $(MAKECMDGOALS))) 30ifndef PDK_FUSION_PLATFORM_ZIP 31 $(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.) 32endif 33endif # fusion 34endif # pdk or fusion 35 36ifdef PDK_FUSION_PLATFORM_ZIP 37TARGET_BUILD_PDK := true 38ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP))) 39 $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).) 40endif 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 64ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list)) 65 66endif 67