Prevent using config.mk from make, clean up unused code

Print a large warning and stop unless we're using ckati. Then remove a
bunch of code that soong_ui doesn't use.

Test: command make -f build/core/config.mk
Test: . build/envsetup.sh; lunch aosp_arm-eng; m nothing
Test: cs/CALLED_FROM_SETUP
Change-Id: Ib823d5ef8955fb68dbc9a035cfa8d5ac4903534a
diff --git a/core/config.mk b/core/config.mk
index 2ce064f..669306d 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -3,6 +3,23 @@
 # current configuration and platform, which
 # are not specific to what is being built.
 
+ifndef KATI
+$(warning Directly using config.mk from make is no longer supported.)
+$(info )
+# Repeat the warning so that it's in both the stdout and stderr streams
+$(info Directly using config.mk from make is no longer supported.)
+$(info )
+$(info If you are just attempting to build, you probably need to re-source envsetup.sh:)
+$(info )
+$(info $$ source build/envsetup.sh)
+$(info )
+$(info If you are attempting to emulate get_build_var, use one of the following:)
+$(info $$ build/soong/soong_ui.bash --dumpvar-mode)
+$(info $$ build/soong/soong_ui.bash --dumpvars-mode)
+$(info )
+$(error done)
+endif
+
 # Only use ANDROID_BUILD_SHELL to wrap around bash.
 # DO NOT use other shells such as zsh.
 ifdef ANDROID_BUILD_SHELL