summaryrefslogtreecommitdiff
path: root/scripts/Makefile.build
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Makefile.build')
-rw-r--r--scripts/Makefile.build14
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 8ef1d61ec228..d32b40048f1f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -28,10 +28,20 @@ EXTRA_LDFLAGS :=
include scripts/Kbuild.include
+# For backward compatibility check that these variables does not change
+save-cflags := $(CFLAGS)
+
# The filename Kbuild has precedence over Makefile
kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
-include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)
-
+kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
+include $(kbuild-file)
+
+# If the save-* variables changed error out
+ifeq ($(KBUILD_NOPEDANTIC),)
+ ifneq ("$(save-cflags)","$(CFLAGS)")
+ $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
+ endif
+endif
include scripts/Makefile.lib
ifdef host-progs