aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@neptun.(none)>2007-10-14 16:26:53 -0400
committerSam Ravnborg <sam@neptun.(none)>2007-10-14 16:26:53 -0400
commit0c53c8e6eb456cde30f2305421c605713856abc8 (patch)
tree6050c25f7aa7625d0b6b65df701e3e601d69a24d /scripts
parenta0f97e06a43cf524e616f09e6af3398e1e9c1c5b (diff)
kbuild: check for wrong use of CFLAGS
External modules have in a few cases modifed gcc option by modifying CFLAGS. This has never been documented and was a bad practice. With the check to use KBUILD_CFLAGS it will no longer work so we better error out and tell what was wrong as a service to the external module users. This check can be overruled if KBUILD_NOPEDANTIC is set to something. Addid this possibility may allow older external module to build without any code modifications but potentially only loosing some un-important gcc options. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-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 :=
28 28
29include scripts/Kbuild.include 29include scripts/Kbuild.include
30 30
31# For backward compatibility check that these variables does not change
32save-cflags := $(CFLAGS)
33
31# The filename Kbuild has precedence over Makefile 34# The filename Kbuild has precedence over Makefile
32kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) 35kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
33include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) 36kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
34 37include $(kbuild-file)
38
39# If the save-* variables changed error out
40ifeq ($(KBUILD_NOPEDANTIC),)
41 ifneq ("$(save-cflags)","$(CFLAGS)")
42 $(error CFLAGS was changed in "$(kbuild-file)". Fix it to use EXTRA_CFLAGS)
43 endif
44endif
35include scripts/Makefile.lib 45include scripts/Makefile.lib
36 46
37ifdef host-progs 47ifdef host-progs