Replace product variable stashing with .KATI_READONLY
Instead of using rot13 / rot26, use the Kati extension to mark these
variables as readonly.
Move $(strip) for a few variables to before they're marked readonly. Use
a different variable for modifications to BOARD_KERNEL_CMDLINE in
build/core/Makefile.
Test: build/tools/kati_all_products.mk on AOSP and internal master
Test: build-aosp_bullhead.ninja the same before / after
Change-Id: If98b24af763831a9c5c2de38037a69ab1bf9e023
diff --git a/core/product.mk b/core/product.mk
index 7193cf7..d4790d5 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -296,33 +296,15 @@
GLOBAL_CLANG_CFLAGS_NO_OVERRIDE \
#
-# Stash values of the variables in _product_stash_var_list.
-# $(1): Renamed prefix
+# Mark the variables in _product_stash_var_list as readonly
#
-define stash-product-vars
+define readonly-product-vars
$(foreach v,$(_product_stash_var_list), \
- $(eval $(strip $(1))_rot26_$(v):=$$($$(v))) \
+ $(eval $(v) ?=) \
+ $(eval .KATI_READONLY := $(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_stash_var_list), \
- $(if $(call streq,$($(v)),$($(strip $(1))_rot26_$(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
-
define add-to-product-copy-files-if-exists
$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
endef