diff --git a/core/config.mk b/core/config.mk index 0f19dea83..0034c4324 100644 --- a/core/config.mk +++ b/core/config.mk @@ -390,6 +390,55 @@ endif endif endif +# Set up PDK so we can use TARGET_BUILD_PDK to select prebuilt tools below +.PHONY: pdk fusion +pdk fusion: $(DEFAULT_GOAL) + +# What to build: +# pdk fusion if: +# 1) PDK_FUSION_PLATFORM_ZIP is passed in from the environment +# or +# 2) the platform.zip exists in the default location +# 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 + +# if PDK_FUSION_PLATFORM_ZIP is specified, do not override. +ifndef PDK_FUSION_PLATFORM_ZIP +# Most PDK project paths should be using vendor/pdk/TARGET_DEVICE +# but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup +# with vendor/pdk/TARGET_PRODUCT. +_pdk_fusion_default_platform_zip = $(strip \ + $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \ + $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \ + $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \ + $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip)) +ifneq (,$(_pdk_fusion_default_platform_zip)) +PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip)) +TARGET_BUILD_PDK := true +endif # _pdk_fusion_default_platform_zip +endif # !PDK_FUSION_PLATFORM_ZIP + +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 +endif + # # Tools that are prebuilts for TARGET_BUILD_APPS # diff --git a/core/dumpvar.mk b/core/dumpvar.mk index c7fb8dbc6..797fdce89 100644 --- a/core/dumpvar.mk +++ b/core/dumpvar.mk @@ -84,5 +84,10 @@ $(info HOST_CROSS_OS=$(HOST_CROSS_OS)) $(info HOST_BUILD_TYPE=$(HOST_BUILD_TYPE)) $(info BUILD_ID=$(BUILD_ID)) $(info OUT_DIR=$(OUT_DIR)) +ifeq ($(TARGET_BUILD_PDK),true) +$(info TARGET_BUILD_PDK=$(TARGET_BUILD_PDK)) +$(info PDK_FUSION_PLATFORM_ZIP=$(PDK_FUSION_PLATFORM_ZIP)) +endif + $(info ============================================) endif diff --git a/core/pdk_config.mk b/core/pdk_config.mk index 95eb0cc55..bd72a0636 100644 --- a/core/pdk_config.mk +++ b/core/pdk_config.mk @@ -1,47 +1,4 @@ # 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) PDK_FUSION_PLATFORM_ZIP is passed in from the environment -# or -# 2) the platform.zip exists in the default location -# 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 - -# if PDK_FUSION_PLATFORM_ZIP is specified, do not override. -ifndef PDK_FUSION_PLATFORM_ZIP -# Most PDK project paths should be using vendor/pdk/TARGET_DEVICE -# but some legacy ones (e.g. mini_armv7a_neon generic PDK) were setup -# with vendor/pdk/TARGET_PRODUCT. -_pdk_fusion_default_platform_zip = $(strip \ - $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \ - $(wildcard vendor/pdk/$(TARGET_DEVICE)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \ - $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)/platform/platform.zip) \ - $(wildcard vendor/pdk/$(TARGET_PRODUCT)/$(patsubst aosp_%,full_%,$(TARGET_PRODUCT))-$(TARGET_BUILD_VARIANT)/platform/platform.zip)) -ifneq (,$(_pdk_fusion_default_platform_zip)) -PDK_FUSION_PLATFORM_ZIP := $(word 1, $(_pdk_fusion_default_platform_zip)) -TARGET_BUILD_PDK := true -$(info $(PDK_FUSION_PLATFORM_ZIP) found, do a PDK fusion build.) -endif # _pdk_fusion_default_platform_zip -endif # !PDK_FUSION_PLATFORM_ZIP - -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 - PDK_PLATFORM_JAVA_ZIP_JAVA_TARGET_LIB_DIR := PDK_PLATFORM_JAVA_ZIP_JAVA_HOST_LIB_DIR := \ host/common/obj/JAVA_LIBRARIES/bouncycastle-host_intermediates @@ -92,11 +49,6 @@ endif endif # PDK 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