From: Colin Cross Date: Fri, 17 Feb 2017 00:41:26 +0000 (-0800) Subject: Set IS_AT_LEAST_* variables based on TARGET_PLATFORM_VERSION X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=d3183bdf40305dcd6da501d3eb3db0f550705fc2;p=android-x86%2Fbuild.git Set IS_AT_LEAST_* variables based on TARGET_PLATFORM_VERSION Create a default list of minor versions (v, vDR1, vDR2, vMR1, vMR2) for O and P, and propagate TARGET_PLATFORM_VERSION to IS_AT_LEAST_* variables. Test: manual Bug: 34610721 Change-Id: I575caa099d85ee6fbc79538e67dc8d621e81790f --- diff --git a/core/version_defaults.mk b/core/version_defaults.mk index 2449ea91e..86d77bb44 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -38,6 +38,44 @@ ifneq "" "$(INTERNAL_BUILD_ID_MAKEFILE)" include $(INTERNAL_BUILD_ID_MAKEFILE) endif +# Returns all words in $1 up to and including $2 +define find_and_earlier + $(strip $(if $(1), + $(firstword $(1)) + $(if $(filter $(firstword $(1)),$(2)),, + $(call find_and_earlier,$(wordlist 2,$(words $(1)),$(1)),$(2))))) +endef + +#$(warning $(call find_and_earlier,A B C,A)) +#$(warning $(call find_and_earlier,A B C,B)) +#$(warning $(call find_and_earlier,A B C,C)) +#$(warning $(call find_and_earlier,A B C,D)) + +define version-list +$(1) $(1)DR1 $(1)DR2 $(1)MR1 $(1)MR2 +endef + +ALL_VERSIONS := O P +ALL_VERSIONS := $(foreach v,$(ALL_VERSIONS),$(call version-list,$(v))) + +ifeq (,$(TARGET_PLATFORM_VERSION)) + # Default targeted platform version + # TODO: PLATFORM_VERSION, PLATFORM_SDK_VERSION, etc. should be conditional + # on this + TARGET_PLATFORM_VERSION := O +endif + +ifeq (,$(filter $(ALL_VERSIONS), $(TARGET_PLATFORM_VERSION))) +$(warning Invalid TARGET_PLATFORM_VERSION '$(TARGET_PLATFORM_VERSION)', must be one of) +$(warning $(ALL_VERSIONS)) +$(error Stopping...) +endif + +ENABLED_VERSIONS := $(call find_and_earlier,$(ALL_VERSIONS),$(TARGET_PLATFORM_VERSION)) + +$(foreach v,$(ENABLED_VERSIONS), \ + $(eval IS_AT_LEAST_$(v) := true)) + ifeq "" "$(PLATFORM_VERSION)" # This is the canonical definition of the platform version, # which is the version that we reveal to the end user.