diff options
-rw-r--r-- | scripts/Makefile.build | 14 |
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 := | |||
28 | 28 | ||
29 | include scripts/Kbuild.include | 29 | include scripts/Kbuild.include |
30 | 30 | ||
31 | # For backward compatibility check that these variables does not change | ||
32 | save-cflags := $(CFLAGS) | ||
33 | |||
31 | # The filename Kbuild has precedence over Makefile | 34 | # The filename Kbuild has precedence over Makefile |
32 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) | 35 | kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) |
33 | include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) | 36 | kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile) |
34 | 37 | include $(kbuild-file) | |
38 | |||
39 | # If the save-* variables changed error out | ||
40 | ifeq ($(KBUILD_NOPEDANTIC),) | ||
41 | ifneq ("$(save-cflags)","$(CFLAGS)") | ||
42 | $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS) | ||
43 | endif | ||
44 | endif | ||
35 | include scripts/Makefile.lib | 45 | include scripts/Makefile.lib |
36 | 46 | ||
37 | ifdef host-progs | 47 | ifdef host-progs |