diff options
| author | Sam Ravnborg <sam@neptun.(none)> | 2007-10-14 16:21:35 -0400 |
|---|---|---|
| committer | Sam Ravnborg <sam@neptun.(none)> | 2007-10-14 16:21:35 -0400 |
| commit | a0f97e06a43cf524e616f09e6af3398e1e9c1c5b (patch) | |
| tree | 2503b24bdbc144aea9ea5bde6ead94b3406eaf98 /scripts | |
| parent | 9a39e273d4df0560c724c5fe71f6314a0583ca2b (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.include | 6 | ||||
| -rw-r--r-- | scripts/Makefile.lib | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 677bc6c175..b1a7c7d42e 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 | ||
| 77 | as-option = $(call try-run,\ | 77 | as-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 | ||
| 89 | cc-option = $(call try-run,\ | 89 | cc-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) |
| 94 | cc-option-yn = $(call try-run,\ | 94 | cc-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 e6ce7b107e..51ae412929 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -84,7 +84,7 @@ basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" | |||
| 84 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 84 | modname_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 | ||
