summaryrefslogtreecommitdiffstats
path: root/core/product.mk
diff options
context:
space:
mode:
Diffstat (limited to 'core/product.mk')
-rw-r--r--core/product.mk29
1 files changed, 29 insertions, 0 deletions
diff --git a/core/product.mk b/core/product.mk
index 4a0ee01..cea3d1c 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -187,3 +187,32 @@ endef
define resolve-short-product-name
$(strip $(call _resolve-short-product-name,$(1)))
endef
+
+
+#
+# Stash vaues of the variables in _product_var_list.
+# $(1): Renamed prefix
+#
+define stash-product-vars
+$(foreach v,$(_product_var_list), \
+ $(eval $(strip $(1))_$(call rot13,$(v)):=$$($$(v))) \
+ )
+endef
+
+#
+# Assert that the the variable stashed by stash-product-vars remains untouched.
+# $(1): The prefix as supplied to stash-product-vars
+#
+define assert-product-vars
+$(strip \
+ $(eval changed_variables:=)
+ $(foreach v,$(_product_var_list), \
+ $(if $(call streq,$($(v)),$($(strip $(1))_$(call rot13,$(v)))),, \
+ $(eval $(warning $(v) has been modified: $($(v)))) \
+ $(eval $(warning previous value: $($(strip $(1))_$(call rot13,$(v))))) \
+ $(eval changed_variables := $(changed_variables) $(v))) \
+ ) \
+ $(if $(changed_variables),\
+ $(eval $(error The following variables have been changed: $(changed_variables))),)
+)
+endef