Mark more common variables and paths as readonly
We've had a report of Android.mk files changing one of these paths,
leading to very strange issues. Nobody should be writing to these
variables after they're set.
Bug: 76424357
Test: diff build-aosp_arm.ninja
Change-Id: I66a9740d89feae342af13341ee3a630a20d62b64
diff --git a/core/config.mk b/core/config.mk
index 075af49..58cf42c 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -45,6 +45,9 @@
backslash := \a
backslash := $(patsubst %a,%,$(backslash))
+# Prevent accidentally changing these variables
+.KATI_READONLY := SHELL empty space comma newline pound backslash
+
# this turns off the suffix rules built into make
.SUFFIXES:
@@ -58,6 +61,10 @@
# If a rule fails, delete $@.
.DELETE_ON_ERROR:
+# Mark variables that should be coming as environment variables from soong_ui
+# as readonly
+.KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE
+
# Mark variables deprecated/obsolete
CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md
$(KATI_obsolete_var PATH,Do not use PATH directly. See $(CHANGES_URL)#PATH)