aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSam Ravnborg <sam@neptun.(none)>2007-10-14 16:21:35 -0400
committerSam Ravnborg <sam@neptun.(none)>2007-10-14 16:21:35 -0400
commita0f97e06a43cf524e616f09e6af3398e1e9c1c5b (patch)
tree2503b24bdbc144aea9ea5bde6ead94b3406eaf98 /scripts
parent9a39e273d4df0560c724c5fe71f6314a0583ca2b (diff)
kbuild: enable 'make CFLAGS=...' to add additional options to CC
The variable CFLAGS is a wellknown variable and the usage by kbuild may result in unexpected behaviour. On top of that several people over time has asked for a way to pass in additional flags to gcc. This patch replace use of CFLAGS with KBUILD_CFLAGS all over the tree and enabling one to use: make CFLAGS=... to specify additional gcc commandline options. One usecase is when trying to find gcc bugs but other use cases has been requested too. Patch was tested on following architectures: alpha, arm, i386, x86_64, mips, sparc, sparc64, ia64, m68k Test was simple to do a defconfig build, apply the patch and check that nothing got rebuild. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Kbuild.include6
-rw-r--r--scripts/Makefile.lib2
2 files changed, 4 insertions, 4 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 677bc6c175cb..b1a7c7d42e15 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -75,7 +75,7 @@ try-run = $(shell set -e; \
75# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,) 75# Usage: cflags-y += $(call as-option,-Wa$(comma)-isa=foo,)
76 76
77as-option = $(call try-run,\ 77as-option = $(call try-run,\
78 $(CC) $(CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2)) 78 $(CC) $(KBUILD_CFLAGS) $(1) -c -xassembler /dev/null -o "$$TMP",$(1),$(2))
79 79
80# as-instr 80# as-instr
81# Usage: cflags-y += $(call as-instr,instr,option1,option2) 81# Usage: cflags-y += $(call as-instr,instr,option1,option2)
@@ -87,12 +87,12 @@ as-instr = $(call try-run,\
87# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586) 87# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)
88 88
89cc-option = $(call try-run,\ 89cc-option = $(call try-run,\
90 $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",$(1),$(2)) 90 $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",$(1),$(2))
91 91
92# cc-option-yn 92# cc-option-yn
93# Usage: flag := $(call cc-option-yn,-march=winchip-c6) 93# Usage: flag := $(call cc-option-yn,-march=winchip-c6)
94cc-option-yn = $(call try-run,\ 94cc-option-yn = $(call try-run,\
95 $(CC) $(CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n) 95 $(CC) $(KBUILD_CFLAGS) $(1) -S -xc /dev/null -o "$$TMP",y,n)
96 96
97# cc-option-align 97# cc-option-align
98# Prefix align with either -falign or -malign 98# Prefix align with either -falign or -malign
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e6ce7b107e49..51ae412929a0 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -84,7 +84,7 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))"
84modname_flags = $(if $(filter 1,$(words $(modname))),\ 84modname_flags = $(if $(filter 1,$(words $(modname))),\
85 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 85 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))")
86 86
87_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) 87_c_flags = $(KBUILD_CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o)
88_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 88_a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
89_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) 89_cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F))
90 90