aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--Documentation/kbuild/makefiles.txt15
-rw-r--r--Makefile20
-rw-r--r--arch/alpha/Makefile2
-rw-r--r--arch/alpha/kernel/Makefile2
-rw-r--r--arch/alpha/lib/Makefile2
-rw-r--r--arch/arm/Makefile8
-rw-r--r--arch/arm/boot/compressed/Makefile2
-rw-r--r--arch/avr32/Makefile4
-rw-r--r--arch/blackfin/Makefile2
-rw-r--r--arch/cris/Makefile8
-rw-r--r--arch/frv/Makefile22
-rw-r--r--arch/h8300/Makefile12
-rw-r--r--arch/i386/Makefile10
-rw-r--r--arch/ia64/Makefile2
-rw-r--r--arch/m32r/Makefile6
-rw-r--r--arch/m68k/Makefile8
-rw-r--r--arch/m68knommu/Makefile6
-rw-r--r--arch/mips/Makefile6
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/parisc/Makefile2
-rw-r--r--arch/powerpc/Makefile24
-rw-r--r--arch/ppc/Makefile10
-rw-r--r--arch/s390/Makefile8
-rw-r--r--arch/sh/Makefile4
-rw-r--r--arch/sh/boot/compressed/Makefile2
-rw-r--r--arch/sh64/Makefile4
-rw-r--r--arch/sparc/Makefile6
-rw-r--r--arch/sparc64/Makefile6
-rw-r--r--arch/um/Makefile10
-rw-r--r--arch/um/Makefile-i3864
-rw-r--r--arch/um/Makefile-os-Linux2
-rw-r--r--arch/um/Makefile-x86_642
-rw-r--r--arch/um/drivers/Makefile2
-rw-r--r--arch/um/sys-i386/Makefile2
-rw-r--r--arch/um/sys-x86_64/Makefile2
-rw-r--r--arch/v850/Makefile8
-rw-r--r--arch/x86/boot/Makefile4
-rw-r--r--arch/x86/boot/compressed/Makefile_322
-rw-r--r--arch/x86/boot/compressed/Makefile_644
-rw-r--r--arch/x86/vdso/Makefile4
-rw-r--r--arch/x86_64/Makefile2
-rw-r--r--arch/xtensa/Makefile8
-rw-r--r--arch/xtensa/boot/boot-redboot/Makefile2
-rw-r--r--init/Makefile2
-rw-r--r--scripts/Kbuild.include6
-rw-r--r--scripts/Makefile.lib2
46 files changed, 137 insertions, 136 deletions
diff --git a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
index 54bbfd37f157..1ca535bcc8c7 100644
--- a/Documentation/kbuild/makefiles.txt
+++ b/Documentation/kbuild/makefiles.txt
@@ -294,7 +294,7 @@ more details, with real examples.
294 294
295 295
296 This variable is necessary because the top Makefile owns the 296 This variable is necessary because the top Makefile owns the
297 variable $(CFLAGS) and uses it for compilation flags for the 297 variable $(KBUILD_CFLAGS) and uses it for compilation flags for the
298 entire tree. 298 entire tree.
299 299
300 $(EXTRA_AFLAGS) is a similar string for per-directory options 300 $(EXTRA_AFLAGS) is a similar string for per-directory options
@@ -437,6 +437,7 @@ more details, with real examples.
437 -march=pentium-mmx if supported by $(CC), otherwise -march=i586. 437 -march=pentium-mmx if supported by $(CC), otherwise -march=i586.
438 The second argument to cc-option is optional, and if omitted, 438 The second argument to cc-option is optional, and if omitted,
439 cflags-y will be assigned no value if first option is not supported. 439 cflags-y will be assigned no value if first option is not supported.
440 Note: cc-option uses KBUILD_CFLAGS for $(CC) options
440 441
441 cc-option-yn 442 cc-option-yn
442 cc-option-yn is used to check if gcc supports a given option 443 cc-option-yn is used to check if gcc supports a given option
@@ -452,6 +453,7 @@ more details, with real examples.
452 option. When $(biarch) equals 'y', the expanded variables $(aflags-y) 453 option. When $(biarch) equals 'y', the expanded variables $(aflags-y)
453 and $(cflags-y) will be assigned the values -a32 and -m32, 454 and $(cflags-y) will be assigned the values -a32 and -m32,
454 respectively. 455 respectively.
456 Note: cc-option-yn uses KBUILD_CFLAGS for $(CC) options
455 457
456 cc-option-align 458 cc-option-align
457 gcc versions >= 3.0 changed the type of options used to specify 459 gcc versions >= 3.0 changed the type of options used to specify
@@ -463,10 +465,11 @@ more details, with real examples.
463 cc-option-align = -falign 465 cc-option-align = -falign
464 466
465 Example: 467 Example:
466 CFLAGS += $(cc-option-align)-functions=4 468 KBUILD_CFLAGS += $(cc-option-align)-functions=4
467 469
468 In the above example, the option -falign-functions=4 is used for 470 In the above example, the option -falign-functions=4 is used for
469 gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used. 471 gcc >= 3.00. For gcc < 3.00, -malign-functions=4 is used.
472 Note: cc-option-align uses KBUILD_CFLAGS for $(CC) options
470 473
471 cc-version 474 cc-version
472 cc-version returns a numerical version of the $(CC) compiler version. 475 cc-version returns a numerical version of the $(CC) compiler version.
@@ -825,17 +828,17 @@ When kbuild executes, the following steps are followed (roughly):
825 #arch/sparc64/Makefile 828 #arch/sparc64/Makefile
826 AFLAGS += -m64 -mcpu=ultrasparc 829 AFLAGS += -m64 -mcpu=ultrasparc
827 830
828 CFLAGS $(CC) compiler flags 831 KBUILD_CFLAGS $(CC) compiler flags
829 832
830 Default value - see top level Makefile 833 Default value - see top level Makefile
831 Append or modify as required per architecture. 834 Append or modify as required per architecture.
832 835
833 Often, the CFLAGS variable depends on the configuration. 836 Often, the KBUILD_CFLAGS variable depends on the configuration.
834 837
835 Example: 838 Example:
836 #arch/i386/Makefile 839 #arch/i386/Makefile
837 cflags-$(CONFIG_M386) += -march=i386 840 cflags-$(CONFIG_M386) += -march=i386
838 CFLAGS += $(cflags-y) 841 KBUILD_CFLAGS += $(cflags-y)
839 842
840 Many arch Makefiles dynamically run the target C compiler to 843 Many arch Makefiles dynamically run the target C compiler to
841 probe supported options: 844 probe supported options:
@@ -847,7 +850,7 @@ When kbuild executes, the following steps are followed (roughly):
847 -march=pentium2,-march=i686) 850 -march=pentium2,-march=i686)
848 ... 851 ...
849 # Disable unit-at-a-time mode ... 852 # Disable unit-at-a-time mode ...
850 CFLAGS += $(call cc-option,-fno-unit-at-a-time) 853 KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time)
851 ... 854 ...
852 855
853 856
diff --git a/Makefile b/Makefile
index 4e474fa40737..3bc86c698a4e 100644
--- a/Makefile
+++ b/Makefile
@@ -320,7 +320,7 @@ LINUXINCLUDE := -Iinclude \
320 320
321CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) 321CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)
322 322
323CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ 323KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
324 -fno-strict-aliasing -fno-common \ 324 -fno-strict-aliasing -fno-common \
325 -Werror-implicit-function-declaration 325 -Werror-implicit-function-declaration
326AFLAGS := -D__ASSEMBLY__ 326AFLAGS := -D__ASSEMBLY__
@@ -335,7 +335,7 @@ export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
335export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS 335export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
336 336
337export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS 337export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
338export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE 338export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
339export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE 339export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
340 340
341# When compiling out-of-tree modules, put MODVERDIR in the module 341# When compiling out-of-tree modules, put MODVERDIR in the module
@@ -492,36 +492,36 @@ endif # $(dot-config)
492all: vmlinux 492all: vmlinux
493 493
494ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE 494ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
495CFLAGS += -Os 495KBUILD_CFLAGS += -Os
496else 496else
497CFLAGS += -O2 497KBUILD_CFLAGS += -O2
498endif 498endif
499 499
500include $(srctree)/arch/$(ARCH)/Makefile 500include $(srctree)/arch/$(ARCH)/Makefile
501 501
502ifdef CONFIG_FRAME_POINTER 502ifdef CONFIG_FRAME_POINTER
503CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls 503KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
504else 504else
505CFLAGS += -fomit-frame-pointer 505KBUILD_CFLAGS += -fomit-frame-pointer
506endif 506endif
507 507
508ifdef CONFIG_DEBUG_INFO 508ifdef CONFIG_DEBUG_INFO
509CFLAGS += -g 509KBUILD_CFLAGS += -g
510AFLAGS += -gdwarf-2 510AFLAGS += -gdwarf-2
511endif 511endif
512 512
513# Force gcc to behave correct even for buggy distributions 513# Force gcc to behave correct even for buggy distributions
514CFLAGS += $(call cc-option, -fno-stack-protector) 514KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
515 515
516# arch Makefile may override CC so keep this after arch Makefile is included 516# arch Makefile may override CC so keep this after arch Makefile is included
517NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) 517NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
518CHECKFLAGS += $(NOSTDINC_FLAGS) 518CHECKFLAGS += $(NOSTDINC_FLAGS)
519 519
520# warn about C99 declaration after statement 520# warn about C99 declaration after statement
521CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) 521KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
522 522
523# disable pointer signed / unsigned warnings in gcc 4.0 523# disable pointer signed / unsigned warnings in gcc 4.0
524CFLAGS += $(call cc-option,-Wno-pointer-sign,) 524KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,)
525 525
526# Use --build-id when available. 526# Use --build-id when available.
527LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ 527LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
diff --git a/arch/alpha/Makefile b/arch/alpha/Makefile
index 1b704ee54bf3..2f283b2fb164 100644
--- a/arch/alpha/Makefile
+++ b/arch/alpha/Makefile
@@ -84,7 +84,7 @@ endif
84# For TSUNAMI, we must have the assembler not emulate our instructions. 84# For TSUNAMI, we must have the assembler not emulate our instructions.
85# The same is true for IRONGATE, POLARIS, PYXIS. 85# The same is true for IRONGATE, POLARIS, PYXIS.
86# BWX is most important, but we don't really want any emulation ever. 86# BWX is most important, but we don't really want any emulation ever.
87CFLAGS += $(cflags-y) -Wa,-mev6 87KBUILD_CFLAGS += $(cflags-y) -Wa,-mev6
88 88
89head-y := arch/alpha/kernel/head.o 89head-y := arch/alpha/kernel/head.o
90 90
diff --git a/arch/alpha/kernel/Makefile b/arch/alpha/kernel/Makefile
index ab6fa54b3860..dccf05245d4d 100644
--- a/arch/alpha/kernel/Makefile
+++ b/arch/alpha/kernel/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5extra-y := head.o vmlinux.lds 5extra-y := head.o vmlinux.lds
6EXTRA_AFLAGS := $(CFLAGS) 6EXTRA_AFLAGS := $(KBUILD_CFLAGS)
7EXTRA_CFLAGS := -Werror -Wno-sign-compare 7EXTRA_CFLAGS := -Werror -Wno-sign-compare
8 8
9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ 9obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \
diff --git a/arch/alpha/lib/Makefile b/arch/alpha/lib/Makefile
index 266f78e13076..9b72c59c95be 100644
--- a/arch/alpha/lib/Makefile
+++ b/arch/alpha/lib/Makefile
@@ -2,7 +2,7 @@
2# Makefile for alpha-specific library files.. 2# Makefile for alpha-specific library files..
3# 3#
4 4
5EXTRA_AFLAGS := $(CFLAGS) 5EXTRA_AFLAGS := $(KBUILD_CFLAGS)
6EXTRA_CFLAGS := -Werror 6EXTRA_CFLAGS := -Werror
7 7
8# Many of these routines have implementations tuned for ev6. 8# Many of these routines have implementations tuned for ev6.
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index fa4ea9ff0797..0b82865ab506 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -14,9 +14,9 @@ LDFLAGS_vmlinux :=-p --no-undefined -X
14CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) 14CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
15OBJCOPYFLAGS :=-O binary -R .note -R .comment -S 15OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
16GZFLAGS :=-9 16GZFLAGS :=-9
17#CFLAGS +=-pipe 17#KBUILD_CFLAGS +=-pipe
18# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: 18# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
19CFLAGS +=$(call cc-option,-marm,) 19KBUILD_CFLAGS +=$(call cc-option,-marm,)
20 20
21# Do not use arch/arm/defconfig - it's always outdated. 21# Do not use arch/arm/defconfig - it's always outdated.
22# Select a platform tht is kept up-to-date 22# Select a platform tht is kept up-to-date
@@ -28,7 +28,7 @@ MMUEXT := -nommu
28endif 28endif
29 29
30ifeq ($(CONFIG_FRAME_POINTER),y) 30ifeq ($(CONFIG_FRAME_POINTER),y)
31CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog 31KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog
32endif 32endif
33 33
34ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) 34ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
@@ -85,7 +85,7 @@ CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-th
85endif 85endif
86 86
87# Need -Uarm for gcc < 3.x 87# Need -Uarm for gcc < 3.x
88CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm 88KBUILD_CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
89AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float 89AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float
90 90
91CHECKFLAGS += -D__arm__ 91CHECKFLAGS += -D__arm__
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 6b8cbd69f249..5fde99f9d9f9 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -87,7 +87,7 @@ ifneq ($(PARAMS_PHYS),)
87LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) 87LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS)
88endif 88endif
89LDFLAGS_vmlinux += -p --no-undefined -X \ 89LDFLAGS_vmlinux += -p --no-undefined -X \
90 $(shell $(CC) $(CFLAGS) --print-libgcc-file-name) -T 90 $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name) -T
91 91
92# Don't allow any static data in misc.o, which 92# Don't allow any static data in misc.o, which
93# would otherwise mess up our GOT table 93# would otherwise mess up our GOT table
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
index dc6bc01f232c..9883c8b55e1b 100644
--- a/arch/avr32/Makefile
+++ b/arch/avr32/Makefile
@@ -11,14 +11,14 @@ all: uImage vmlinux.elf
11 11
12KBUILD_DEFCONFIG := atstk1002_defconfig 12KBUILD_DEFCONFIG := atstk1002_defconfig
13 13
14CFLAGS += -pipe -fno-builtin -mno-pic 14KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic
15AFLAGS += -mrelax -mno-pic 15AFLAGS += -mrelax -mno-pic
16CFLAGS_MODULE += -mno-relax 16CFLAGS_MODULE += -mno-relax
17LDFLAGS_vmlinux += --relax 17LDFLAGS_vmlinux += --relax
18 18
19cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000 19cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000
20 20
21CFLAGS += $(cpuflags-y) 21KBUILD_CFLAGS += $(cpuflags-y)
22AFLAGS += $(cpuflags-y) 22AFLAGS += $(cpuflags-y)
23 23
24CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN 24CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 20841663270f..52a6ac072851 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -53,7 +53,7 @@ rev-$(CONFIG_BF_REV_0_5) := 0.5
53rev-$(CONFIG_BF_REV_NONE) := none 53rev-$(CONFIG_BF_REV_NONE) := none
54rev-$(CONFIG_BF_REV_ANY) := any 54rev-$(CONFIG_BF_REV_ANY) := any
55 55
56CFLAGS += -mcpu=$(cpu-y)-$(rev-y) 56KBUILD_CFLAGS += -mcpu=$(cpu-y)-$(rev-y)
57AFLAGS += -mcpu=$(cpu-y)-$(rev-y) 57AFLAGS += -mcpu=$(cpu-y)-$(rev-y)
58 58
59head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o 59head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index ee114699ef8e..32ef6f3cce06 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -31,16 +31,16 @@ OBJCOPYFLAGS := -O binary -R .note -R .comment -S
31CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) 31CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE)
32AFLAGS += -mlinux 32AFLAGS += -mlinux
33 33
34CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe 34KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe
35 35
36ifdef CONFIG_FRAME_POINTER 36ifdef CONFIG_FRAME_POINTER
37CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g 37KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
38CFLAGS += -fno-omit-frame-pointer 38KBUILD_CFLAGS += -fno-omit-frame-pointer
39endif 39endif
40 40
41head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o 41head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o
42 42
43LIBGCC = $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a) 43LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a)
44 44
45core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ 45core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
46core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/ 46core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 9bf7345c5cc9..ec89886ed455 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -39,13 +39,13 @@ endif
39ARCHMODFLAGS += -G0 -mlong-calls 39ARCHMODFLAGS += -G0 -mlong-calls
40 40
41ifdef CONFIG_GPREL_DATA_8 41ifdef CONFIG_GPREL_DATA_8
42CFLAGS += -G8 42KBUILD_CFLAGS += -G8
43else 43else
44ifdef CONFIG_GPREL_DATA_4 44ifdef CONFIG_GPREL_DATA_4
45CFLAGS += -G4 45KBUILD_CFLAGS += -G4
46else 46else
47ifdef CONFIG_GPREL_DATA_NONE 47ifdef CONFIG_GPREL_DATA_NONE
48CFLAGS += -G0 48KBUILD_CFLAGS += -G0
49endif 49endif
50endif 50endif
51endif 51endif
@@ -53,25 +53,25 @@ endif
53#LDFLAGS_vmlinux := -Map linkmap.txt 53#LDFLAGS_vmlinux := -Map linkmap.txt
54 54
55ifdef CONFIG_GC_SECTIONS 55ifdef CONFIG_GC_SECTIONS
56CFLAGS += -ffunction-sections -fdata-sections 56KBUILD_CFLAGS += -ffunction-sections -fdata-sections
57LINKFLAGS += --gc-sections 57LINKFLAGS += --gc-sections
58endif 58endif
59 59
60ifndef CONFIG_FRAME_POINTER 60ifndef CONFIG_FRAME_POINTER
61CFLAGS += -mno-linked-fp 61KBUILD_CFLAGS += -mno-linked-fp
62endif 62endif
63 63
64ifdef CONFIG_CPU_FR451_COMPILE 64ifdef CONFIG_CPU_FR451_COMPILE
65CFLAGS += -mcpu=fr450 65KBUILD_CFLAGS += -mcpu=fr450
66AFLAGS += -mcpu=fr450 66AFLAGS += -mcpu=fr450
67ASFLAGS += -mcpu=fr450 67ASFLAGS += -mcpu=fr450
68else 68else
69ifdef CONFIG_CPU_FR551_COMPILE 69ifdef CONFIG_CPU_FR551_COMPILE
70CFLAGS += -mcpu=fr550 70KBUILD_CFLAGS += -mcpu=fr550
71AFLAGS += -mcpu=fr550 71AFLAGS += -mcpu=fr550
72ASFLAGS += -mcpu=fr550 72ASFLAGS += -mcpu=fr550
73else 73else
74CFLAGS += -mcpu=fr400 74KBUILD_CFLAGS += -mcpu=fr400
75AFLAGS += -mcpu=fr400 75AFLAGS += -mcpu=fr400
76ASFLAGS += -mcpu=fr400 76ASFLAGS += -mcpu=fr400
77endif 77endif
@@ -80,15 +80,15 @@ endif
80# pretend the kernel is going to run on an FR400 with no media-fp unit 80# pretend the kernel is going to run on an FR400 with no media-fp unit
81# - reserve CC3 for use with atomic ops 81# - reserve CC3 for use with atomic ops
82# - all the extra registers are dealt with only at context switch time 82# - all the extra registers are dealt with only at context switch time
83CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media 83KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media
84CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2 84KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
85AFLAGS += -mno-fdpic 85AFLAGS += -mno-fdpic
86ASFLAGS += -mno-fdpic 86ASFLAGS += -mno-fdpic
87 87
88# make sure the .S files get compiled with debug info 88# make sure the .S files get compiled with debug info
89# and disable optimisations that are unhelpful whilst debugging 89# and disable optimisations that are unhelpful whilst debugging
90ifdef CONFIG_DEBUG_INFO 90ifdef CONFIG_DEBUG_INFO
91#CFLAGS += -O1 91#KBUILD_CFLAGS += -O1
92AFLAGS += -Wa,--gdwarf2 92AFLAGS += -Wa,--gdwarf2
93ASFLAGS += -Wa,--gdwarf2 93ASFLAGS += -Wa,--gdwarf2
94endif 94endif
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index 53b5c1edf596..330e05f28f90 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -30,16 +30,16 @@ ldflags-$(CONFIG_CPU_H8300H) := -mh8300helf
30cflags-$(CONFIG_CPU_H8S) := -ms 30cflags-$(CONFIG_CPU_H8S) := -ms
31ldflags-$(CONFIG_CPU_H8S) := -mh8300self 31ldflags-$(CONFIG_CPU_H8S) := -mh8300self
32 32
33CFLAGS += $(cflags-y) 33KBUILD_CFLAGS += $(cflags-y)
34CFLAGS += -mint32 -fno-builtin 34KBUILD_CFLAGS += -mint32 -fno-builtin
35CFLAGS += -g 35KBUILD_CFLAGS += -g
36CFLAGS += -D__linux__ 36KBUILD_CFLAGS += -D__linux__
37CFLAGS += -DUTS_SYSNAME=\"uClinux\" 37KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
38AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y) 38AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y)
39LDFLAGS += $(ldflags-y) 39LDFLAGS += $(ldflags-y)
40 40
41CROSS_COMPILE = h8300-elf- 41CROSS_COMPILE = h8300-elf-
42LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(CFLAGS) -print-libgcc-file-name) 42LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
43 43
44head-y := arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/crt0_$(MODEL).o 44head-y := arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/crt0_$(MODEL).o
45 45
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index 5e50dbf00f3e..fc3c8e88b744 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -34,10 +34,10 @@ LDFLAGS_vmlinux := --emit-relocs
34endif 34endif
35CHECKFLAGS += -D__i386__ 35CHECKFLAGS += -D__i386__
36 36
37CFLAGS += -pipe -msoft-float -mregparm=3 -freg-struct-return 37KBUILD_CFLAGS += -pipe -msoft-float -mregparm=3 -freg-struct-return
38 38
39# prevent gcc from keeping the stack 16 byte aligned 39# prevent gcc from keeping the stack 16 byte aligned
40CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) 40KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
41 41
42# CPU-specific tuning. Anything which can be shared with UML should go here. 42# CPU-specific tuning. Anything which can be shared with UML should go here.
43include $(srctree)/arch/i386/Makefile.cpu 43include $(srctree)/arch/i386/Makefile.cpu
@@ -51,7 +51,7 @@ cflags-y += -maccumulate-outgoing-args
51 51
52# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use 52# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
53# a lot more stack due to the lack of sharing of stacklots: 53# a lot more stack due to the lack of sharing of stacklots:
54CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) 54KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;)
55 55
56# do binutils support CFI? 56# do binutils support CFI?
57cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) 57cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
@@ -61,7 +61,7 @@ AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_end
61cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 61cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
62AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) 62AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
63 63
64CFLAGS += $(cflags-y) 64KBUILD_CFLAGS += $(cflags-y)
65 65
66# Default subarch .c files 66# Default subarch .c files
67mcore-y := arch/x86/mach-default 67mcore-y := arch/x86/mach-default
@@ -116,7 +116,7 @@ drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/
116drivers-$(CONFIG_PM) += arch/x86/power/ 116drivers-$(CONFIG_PM) += arch/x86/power/
117drivers-$(CONFIG_FB) += arch/x86/video/ 117drivers-$(CONFIG_FB) += arch/x86/video/
118 118
119CFLAGS += $(mflags-y) 119KBUILD_CFLAGS += $(mflags-y)
120AFLAGS += $(mflags-y) 120AFLAGS += $(mflags-y)
121 121
122boot := arch/x86/boot 122boot := arch/x86/boot
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index 21033ed83307..9708a29c70b5 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -44,7 +44,7 @@ ifeq ($(call cc-version),0304)
44 cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley 44 cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley
45endif 45endif
46 46
47CFLAGS += $(cflags-y) 47KBUILD_CFLAGS += $(cflags-y)
48head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o 48head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o
49 49
50libs-y += arch/ia64/lib/ 50libs-y += arch/ia64/lib/
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 60e12f312654..c80618ab60ea 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -9,7 +9,7 @@ LDFLAGS :=
9OBJCOPYFLAGS := -O binary -R .note -R .comment -S 9OBJCOPYFLAGS := -O binary -R .note -R .comment -S
10LDFLAGS_vmlinux := 10LDFLAGS_vmlinux :=
11 11
12CFLAGS += -pipe -fno-schedule-insns 12KBUILD_CFLAGS += -pipe -fno-schedule-insns
13CFLAGS_KERNEL += -mmodel=medium 13CFLAGS_KERNEL += -mmodel=medium
14CFLAGS_MODULE += -mmodel=large 14CFLAGS_MODULE += -mmodel=large
15 15
@@ -24,14 +24,14 @@ endif
24cflags-$(CONFIG_ISA_M32R) += -DNO_FPU 24cflags-$(CONFIG_ISA_M32R) += -DNO_FPU
25aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst 25aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst
26 26
27CFLAGS += $(cflags-y) 27KBUILD_CFLAGS += $(cflags-y)
28AFLAGS += $(aflags-y) 28AFLAGS += $(aflags-y)
29 29
30CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 30CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1
31 31
32head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o 32head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o
33 33
34LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 34LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
35 35
36libs-y += arch/m32r/lib/ $(LIBGCC) 36libs-y += arch/m32r/lib/ $(LIBGCC)
37core-y += arch/m32r/kernel/ \ 37core-y += arch/m32r/kernel/ \
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index aa383a5ea7ac..4a1bd44ff162 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -32,18 +32,18 @@ endif
32CHECKFLAGS += -D__mc68000__ 32CHECKFLAGS += -D__mc68000__
33 33
34# without -fno-strength-reduce the 53c7xx.c driver fails ;-( 34# without -fno-strength-reduce the 53c7xx.c driver fails ;-(
35CFLAGS += -pipe -fno-strength-reduce -ffixed-a2 35KBUILD_CFLAGS += -pipe -fno-strength-reduce -ffixed-a2
36 36
37# enable processor switch if compiled only for a single cpu 37# enable processor switch if compiled only for a single cpu
38ifndef CONFIG_M68020 38ifndef CONFIG_M68020
39ifndef CONFIG_M68030 39ifndef CONFIG_M68030
40 40
41ifndef CONFIG_M68060 41ifndef CONFIG_M68060
42CFLAGS := $(CFLAGS) -m68040 42KBUILD_CFLAGS += -m68040
43endif 43endif
44 44
45ifndef CONFIG_M68040 45ifndef CONFIG_M68040
46CFLAGS := $(CFLAGS) -m68060 46KBUILD_CFLAGS += -m68060
47endif 47endif
48 48
49endif 49endif
@@ -52,7 +52,7 @@ endif
52ifdef CONFIG_KGDB 52ifdef CONFIG_KGDB
53# If configured for kgdb support, include debugging infos and keep the 53# If configured for kgdb support, include debugging infos and keep the
54# frame pointer 54# frame pointer
55CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g 55KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
56endif 56endif
57 57
58ifndef CONFIG_SUN3 58ifndef CONFIG_SUN3
diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index 1305cc980023..1c1fbb69ff26 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -104,9 +104,9 @@ cflags-$(CONFIG_M68360) := -m68332
104 104
105AFLAGS += $(cflags-y) 105AFLAGS += $(cflags-y)
106 106
107CFLAGS += $(cflags-y) 107KBUILD_CFLAGS += $(cflags-y)
108CFLAGS += -D__linux__ 108KBUILD_CFLAGS += -D__linux__
109CFLAGS += -DUTS_SYSNAME=\"uClinux\" 109KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
110 110
111head-y := arch/m68knommu/platform/$(cpuclass-y)/head.o 111head-y := arch/m68knommu/platform/$(cpuclass-y)/head.o
112 112
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index ebd5d02a7d78..64512abef61d 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -609,13 +609,13 @@ ifdef CONFIG_64BIT
609endif 609endif
610 610
611AFLAGS += $(cflags-y) 611AFLAGS += $(cflags-y)
612CFLAGS += $(cflags-y) \ 612KBUILD_CFLAGS += $(cflags-y) \
613 -D"VMLINUX_LOAD_ADDRESS=$(load-y)" 613 -D"VMLINUX_LOAD_ADDRESS=$(load-y)"
614 614
615LDFLAGS += -m $(ld-emul) 615LDFLAGS += -m $(ld-emul)
616 616
617ifdef CONFIG_MIPS 617ifdef CONFIG_MIPS
618CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \ 618CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -xc /dev/null | \
619 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \ 619 egrep -vw '__GNUC_(|MINOR_|PATCHLEVEL_)_' | \
620 sed -e 's/^\#define /-D/' -e "s/ /='/" -e "s/$$/'/") 620 sed -e 's/^\#define /-D/' -e "s/ /='/" -e "s/$$/'/")
621ifdef CONFIG_64BIT 621ifdef CONFIG_64BIT
@@ -632,7 +632,7 @@ OBJCOPYFLAGS += --remove-section=.reginfo
632# 632#
633 633
634CPPFLAGS_vmlinux.lds := \ 634CPPFLAGS_vmlinux.lds := \
635 $(CFLAGS) \ 635 $(KBUILD_CFLAGS) \
636 -D"LOADADDR=$(load-y)" \ 636 -D"LOADADDR=$(load-y)" \
637 -D"JIFFIES=$(JIFFIES)" \ 637 -D"JIFFIES=$(JIFFIES)" \
638 -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)" 638 -D"DATAOFFSET=$(if $(dataoffset-y),$(dataoffset-y),0)"
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index a2689f93c160..95a356ef3910 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -71,7 +71,7 @@ obj-$(CONFIG_PCSPEAKER) += pcspeaker.o
71obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 71obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
72obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 72obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
73 73
74CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 74CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(KBUILD_CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
75 75
76obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o 76obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
77 77
diff --git a/arch/parisc/Makefile b/arch/parisc/Makefile
index 760567a9ba16..f3d0d7c70977 100644
--- a/arch/parisc/Makefile
+++ b/arch/parisc/Makefile
@@ -63,7 +63,7 @@ cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000
63 63
64head-y := arch/parisc/kernel/head.o 64head-y := arch/parisc/kernel/head.o
65 65
66CFLAGS += $(cflags-y) 66KBUILD_CFLAGS += $(cflags-y)
67 67
68kernel-y := mm/ kernel/ math-emu/ kernel/init_task.o 68kernel-y := mm/ kernel/ math-emu/ kernel/init_task.o
69kernel-$(CONFIG_HPUX) += hpux/ 69kernel-$(CONFIG_HPUX) += hpux/
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 643839a3f5d8..51309848c11d 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -77,8 +77,8 @@ CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc
77CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple 77CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple
78CPPFLAGS += $(CPPFLAGS-y) 78CPPFLAGS += $(CPPFLAGS-y)
79AFLAGS += $(AFLAGS-y) 79AFLAGS += $(AFLAGS-y)
80CFLAGS += -msoft-float -pipe $(CFLAGS-y) 80KBUILD_CFLAGS += -msoft-float -pipe $(CFLAGS-y)
81CPP = $(CC) -E $(CFLAGS) 81CPP = $(CC) -E $(KBUILD_CFLAGS)
82 82
83CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ 83CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
84 84
@@ -88,35 +88,35 @@ GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi
88ifeq ($(CONFIG_POWER4_ONLY),y) 88ifeq ($(CONFIG_POWER4_ONLY),y)
89ifeq ($(CONFIG_ALTIVEC),y) 89ifeq ($(CONFIG_ALTIVEC),y)
90ifeq ($(GCC_BROKEN_VEC),y) 90ifeq ($(GCC_BROKEN_VEC),y)
91 CFLAGS += $(call cc-option,-mcpu=970) 91 KBUILD_CFLAGS += $(call cc-option,-mcpu=970)
92else 92else
93 CFLAGS += $(call cc-option,-mcpu=power4) 93 KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
94endif 94endif
95else 95else
96 CFLAGS += $(call cc-option,-mcpu=power4) 96 KBUILD_CFLAGS += $(call cc-option,-mcpu=power4)
97endif 97endif
98else 98else
99 CFLAGS += $(call cc-option,-mtune=power4) 99 KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
100endif 100endif
101endif 101endif
102 102
103ifeq ($(CONFIG_TUNE_CELL),y) 103ifeq ($(CONFIG_TUNE_CELL),y)
104 CFLAGS += $(call cc-option,-mtune=cell) 104 KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
105endif 105endif
106 106
107# No AltiVec instruction when building kernel 107# No AltiVec instruction when building kernel
108CFLAGS += $(call cc-option,-mno-altivec) 108KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
109 109
110# Enable unit-at-a-time mode when possible. It shrinks the 110# Enable unit-at-a-time mode when possible. It shrinks the
111# kernel considerably. 111# kernel considerably.
112CFLAGS += $(call cc-option,-funit-at-a-time) 112KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
113 113
114# Never use string load/store instructions as they are 114# Never use string load/store instructions as they are
115# often slow when they are implemented at all 115# often slow when they are implemented at all
116CFLAGS += -mno-string 116KBUILD_CFLAGS += -mno-string
117 117
118ifeq ($(CONFIG_6xx),y) 118ifeq ($(CONFIG_6xx),y)
119CFLAGS += -mcpu=powerpc 119KBUILD_CFLAGS += -mcpu=powerpc
120endif 120endif
121 121
122cpu-as-$(CONFIG_4xx) += -Wa,-m405 122cpu-as-$(CONFIG_4xx) += -Wa,-m405
@@ -126,7 +126,7 @@ cpu-as-$(CONFIG_E500) += -Wa,-me500
126cpu-as-$(CONFIG_E200) += -Wa,-me200 126cpu-as-$(CONFIG_E200) += -Wa,-me200
127 127
128AFLAGS += $(cpu-as-y) 128AFLAGS += $(cpu-as-y)
129CFLAGS += $(cpu-as-y) 129KBUILD_CFLAGS += $(cpu-as-y)
130 130
131head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o 131head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o
132head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o 132head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index eee6264e8a04..43802e95c892 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -24,20 +24,20 @@ LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
24# The -Iarch/$(ARCH)/include is temporary while we are merging 24# The -Iarch/$(ARCH)/include is temporary while we are merging
25CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include 25CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
26AFLAGS += -Iarch/$(ARCH) 26AFLAGS += -Iarch/$(ARCH)
27CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ 27KBUILD_CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \
28 -ffixed-r2 -mmultiple 28 -ffixed-r2 -mmultiple
29 29
30# No AltiVec instruction when building kernel 30# No AltiVec instruction when building kernel
31CFLAGS += $(call cc-option, -mno-altivec) 31KBUILD_CFLAGS += $(call cc-option, -mno-altivec)
32 32
33CPP = $(CC) -E $(CFLAGS) 33CPP = $(CC) -E $(KBUILD_CFLAGS)
34# Temporary hack until we have migrated to asm-powerpc 34# Temporary hack until we have migrated to asm-powerpc
35LINUXINCLUDE += -Iarch/$(ARCH)/include 35LINUXINCLUDE += -Iarch/$(ARCH)/include
36 36
37CHECKFLAGS += -D__powerpc__ 37CHECKFLAGS += -D__powerpc__
38 38
39ifndef CONFIG_FSL_BOOKE 39ifndef CONFIG_FSL_BOOKE
40CFLAGS += -mstring 40KBUILD_CFLAGS += -mstring
41endif 41endif
42 42
43cpu-as-$(CONFIG_4xx) += -Wa,-m405 43cpu-as-$(CONFIG_4xx) += -Wa,-m405
@@ -46,7 +46,7 @@ cpu-as-$(CONFIG_E500) += -Wa,-me500
46cpu-as-$(CONFIG_E200) += -Wa,-me200 46cpu-as-$(CONFIG_E200) += -Wa,-me200
47 47
48AFLAGS += $(cpu-as-y) 48AFLAGS += $(cpu-as-y)
49CFLAGS += $(cpu-as-y) 49KBUILD_CFLAGS += $(cpu-as-y)
50 50
51# Default to the common case. 51# Default to the common case.
52KBUILD_DEFCONFIG := common_defconfig 52KBUILD_DEFCONFIG := common_defconfig
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 143ed8e154af..62a0da42c7fd 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -15,7 +15,7 @@
15 15
16ifndef CONFIG_64BIT 16ifndef CONFIG_64BIT
17LDFLAGS := -m elf_s390 17LDFLAGS := -m elf_s390
18CFLAGS += -m31 18KBUILD_CFLAGS += -m31
19AFLAGS += -m31 19AFLAGS += -m31
20UTS_MACHINE := s390 20UTS_MACHINE := s390
21STACK_SIZE := 8192 21STACK_SIZE := 8192
@@ -23,7 +23,7 @@ CHECKFLAGS += -D__s390__ -msize-long
23else 23else
24LDFLAGS := -m elf64_s390 24LDFLAGS := -m elf64_s390
25MODFLAGS += -fpic -D__PIC__ 25MODFLAGS += -fpic -D__PIC__
26CFLAGS += -m64 26KBUILD_CFLAGS += -m64
27AFLAGS += -m64 27AFLAGS += -m64
28UTS_MACHINE := s390x 28UTS_MACHINE := s390x
29STACK_SIZE := 16384 29STACK_SIZE := 16384
@@ -77,8 +77,8 @@ cflags-$(CONFIG_WARN_STACK) += -mwarn-dynamicstack
77cflags-$(CONFIG_WARN_STACK) += -mwarn-framesize=$(CONFIG_WARN_STACK_SIZE) 77cflags-$(CONFIG_WARN_STACK) += -mwarn-framesize=$(CONFIG_WARN_STACK_SIZE)
78endif 78endif
79 79
80CFLAGS += -mbackchain -msoft-float $(cflags-y) 80KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
81CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare 81KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
82AFLAGS += $(aflags-y) 82AFLAGS += $(aflags-y)
83 83
84OBJCOPYFLAGS := -O binary 84OBJCOPYFLAGS := -O binary
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 97ac58682d0f..cd8a411acc95 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -91,12 +91,12 @@ LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4'
91LDFLAGS += -EB 91LDFLAGS += -EB
92endif 92endif
93 93
94CFLAGS += -pipe $(cflags-y) 94KBUILD_CFLAGS += -pipe $(cflags-y)
95AFLAGS += $(cflags-y) 95AFLAGS += $(cflags-y)
96 96
97head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o 97head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o
98 98
99LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 99LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
100 100
101core-y += arch/sh/kernel/ arch/sh/mm/ 101core-y += arch/sh/kernel/ arch/sh/mm/
102core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ 102core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
index 013504ae1122..906a13f82fe0 100644
--- a/arch/sh/boot/compressed/Makefile
+++ b/arch/sh/boot/compressed/Makefile
@@ -21,7 +21,7 @@ IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
21 $(CONFIG_MEMORY_START) + \ 21 $(CONFIG_MEMORY_START) + \
22 $(CONFIG_BOOT_LINK_OFFSET)]') 22 $(CONFIG_BOOT_LINK_OFFSET)]')
23 23
24LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 24LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
25 25
26LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds 26LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds
27 27
diff --git a/arch/sh64/Makefile b/arch/sh64/Makefile
index ebf20043991c..9e874de0a096 100644
--- a/arch/sh64/Makefile
+++ b/arch/sh64/Makefile
@@ -26,7 +26,7 @@ LDFLAGS += -EB -mshelf32_linux
26endif 26endif
27 27
28# No requirements for endianess support from AFLAGS, 'as' always run through gcc 28# No requirements for endianess support from AFLAGS, 'as' always run through gcc
29CFLAGS += $(cpu-y) 29KBUILD_CFLAGS += $(cpu-y)
30 30
31LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \ 31LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \
32 --defsym phys_stext_shmedia=phys_stext+1 \ 32 --defsym phys_stext_shmedia=phys_stext+1 \
@@ -57,7 +57,7 @@ ifneq ($(machine-y),)
57core-y += arch/sh64/mach-$(machine-y)/ 57core-y += arch/sh64/mach-$(machine-y)/
58endif 58endif
59 59
60LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 60LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
61libs-y += arch/$(ARCH)/lib/ $(LIBGCC) 61libs-y += arch/$(ARCH)/lib/ $(LIBGCC)
62 62
63drivers-$(CONFIG_OPROFILE) += arch/sh64/oprofile/ 63drivers-$(CONFIG_OPROFILE) += arch/sh64/oprofile/
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index f33c3817f014..2ce781a7cbf0 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -8,15 +8,15 @@
8# 8#
9 9
10# 10#
11# Uncomment the first CFLAGS if you are doing kgdb source level 11# Uncomment the first KBUILD_CFLAGS if you are doing kgdb source level
12# debugging of the kernel to get the proper debugging information. 12# debugging of the kernel to get the proper debugging information.
13 13
14AS := $(AS) -32 14AS := $(AS) -32
15LDFLAGS := -m elf32_sparc 15LDFLAGS := -m elf32_sparc
16CHECKFLAGS += -D__sparc__ 16CHECKFLAGS += -D__sparc__
17 17
18#CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7 18#KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
19CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 19KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
20AFLAGS := $(AFLAGS) -m32 20AFLAGS := $(AFLAGS) -m32
21 21
22#LDFLAGS_vmlinux = -N -Ttext 0xf0004000 22#LDFLAGS_vmlinux = -N -Ttext 0xf0004000
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
index cad10c5b83d3..b083dc458ce9 100644
--- a/arch/sparc64/Makefile
+++ b/arch/sparc64/Makefile
@@ -39,17 +39,17 @@ AS := $(AS) --undeclared-regs
39endif 39endif
40 40
41ifneq ($(NEW_GCC),y) 41ifneq ($(NEW_GCC),y)
42 CFLAGS := $(CFLAGS) -pipe -mno-fpu -mtune=ultrasparc -mmedlow \ 42 KBUILD_CFLAGS += -pipe -mno-fpu -mtune=ultrasparc -mmedlow \
43 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare 43 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
44else 44else
45 CFLAGS := $(CFLAGS) -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \ 45 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
46 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \ 46 -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
47 $(CC_UNDECL) 47 $(CC_UNDECL)
48 AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL) 48 AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL)
49endif 49endif
50 50
51ifeq ($(CONFIG_MCOUNT),y) 51ifeq ($(CONFIG_MCOUNT),y)
52 CFLAGS := $(CFLAGS) -pg 52 KBUILD_CFLAGS += -pg
53endif 53endif
54 54
55head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o 55head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 989224f21346..18123bf7b649 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -58,14 +58,14 @@ SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
58# 58#
59# These apply to USER_CFLAGS to. 59# These apply to USER_CFLAGS to.
60 60
61CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ 61KBUILD_CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
62 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ 62 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
63 -Din6addr_loopback=kernel_in6addr_loopback 63 -Din6addr_loopback=kernel_in6addr_loopback
64 64
65AFLAGS += $(ARCH_INCLUDE) 65AFLAGS += $(ARCH_INCLUDE)
66 66
67USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ 67USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
68 $(patsubst -I%,,$(CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \ 68 $(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \
69 -D_FILE_OFFSET_BITS=64 69 -D_FILE_OFFSET_BITS=64
70 70
71include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) 71include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH)
@@ -75,14 +75,14 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
75 75
76# -Derrno=kernel_errno - This turns all kernel references to errno into 76# -Derrno=kernel_errno - This turns all kernel references to errno into
77# kernel_errno to separate them from the libc errno. This allows -fno-common 77# kernel_errno to separate them from the libc errno. This allows -fno-common
78# in CFLAGS. Otherwise, it would cause ld to complain about the two different 78# in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different
79# errnos. 79# errnos.
80# These apply to kernelspace only. 80# These apply to kernelspace only.
81 81
82KERNEL_DEFINES = -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ 82KERNEL_DEFINES = -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
83 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES) 83 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)
84CFLAGS += $(KERNEL_DEFINES) 84KBUILD_CFLAGS += $(KERNEL_DEFINES)
85CFLAGS += $(call cc-option,-fno-unit-at-a-time,) 85KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
86 86
87# These are needed for clean and mrproper, since in that case .config is not 87# These are needed for clean and mrproper, since in that case .config is not
88# included; the values here are meaningless 88# included; the values here are meaningless
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index c9f1c5b24c9a..26bc786fc614 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -15,7 +15,7 @@ OBJCOPYFLAGS := -O binary -R .note -R .comment -S
15 15
16ifeq ("$(origin SUBARCH)", "command line") 16ifeq ("$(origin SUBARCH)", "command line")
17ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") 17ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
18CFLAGS += $(call cc-option,-m32) 18KBUILD_CFLAGS += $(call cc-option,-m32)
19AFLAGS += $(call cc-option,-m32) 19AFLAGS += $(call cc-option,-m32)
20LINK-y += $(call cc-option,-m32) 20LINK-y += $(call cc-option,-m32)
21UML_OBJCOPYFLAGS += -F $(ELF_FORMAT) 21UML_OBJCOPYFLAGS += -F $(ELF_FORMAT)
@@ -36,4 +36,4 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
36# an unresolved reference. 36# an unresolved reference.
37cflags-y += -ffreestanding 37cflags-y += -ffreestanding
38 38
39CFLAGS += $(cflags-y) 39KBUILD_CFLAGS += $(cflags-y)
diff --git a/arch/um/Makefile-os-Linux b/arch/um/Makefile-os-Linux
index 0c0f9a1cbbad..52859487c95d 100644
--- a/arch/um/Makefile-os-Linux
+++ b/arch/um/Makefile-os-Linux
@@ -5,4 +5,4 @@
5 5
6# To get a definition of F_SETSIG 6# To get a definition of F_SETSIG
7USER_CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE 7USER_CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE
8CFLAGS += -D_LARGEFILE64_SOURCE 8KBUILD_CFLAGS += -D_LARGEFILE64_SOURCE
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index 69ecea63fdae..36d2bb5e4192 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -9,7 +9,7 @@ _extra_flags_ = -fno-builtin -m64
9#We #undef __x86_64__ for kernelspace, not for userspace where 9#We #undef __x86_64__ for kernelspace, not for userspace where
10#it's needed for headers to work! 10#it's needed for headers to work!
11ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__ 11ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__
12CFLAGS += $(_extra_flags_) 12KBUILD_CFLAGS += $(_extra_flags_)
13 13
14CHECKFLAGS += -m64 14CHECKFLAGS += -m64
15AFLAGS += -m64 15AFLAGS += -m64
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index de17d4c6e02d..0f780dd0d4c4 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -17,7 +17,7 @@ ubd-objs := ubd_kern.o ubd_user.o
17port-objs := port_kern.o port_user.o 17port-objs := port_kern.o port_user.o
18harddog-objs := harddog_kern.o harddog_user.o 18harddog-objs := harddog_kern.o harddog_user.o
19 19
20LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) 20LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a)
21 21
22targets := pcap_kern.o pcap_user.o 22targets := pcap_kern.o pcap_user.o
23 23
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index d6b3ecd4b77e..8909b07d9ee7 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -20,4 +20,4 @@ CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
20 20
21include arch/um/scripts/Makefile.rules 21include arch/um/scripts/Makefile.rules
22 22
23$(obj)/unmap.%: _c_flags = $(call unprofile,$(CFLAGS)) 23$(obj)/unmap.%: _c_flags = $(call unprofile,$(KBUILD_CFLAGS))
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 4d9e5efa6fb9..e446a9916fd7 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -28,4 +28,4 @@ CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
28 28
29include arch/um/scripts/Makefile.rules 29include arch/um/scripts/Makefile.rules
30 30
31$(obj)/unmap.%: _c_flags = $(call unprofile,$(CFLAGS)) 31$(obj)/unmap.%: _c_flags = $(call unprofile,$(KBUILD_CFLAGS))
diff --git a/arch/v850/Makefile b/arch/v850/Makefile
index 8be9aacb20a7..8b629df0029a 100644
--- a/arch/v850/Makefile
+++ b/arch/v850/Makefile
@@ -16,11 +16,11 @@
16 16
17arch_dir = arch/v850 17arch_dir = arch/v850
18 18
19CFLAGS += -mv850e 19KBUILD_CFLAGS += -mv850e
20# r16 is a fixed pointer to the current task 20# r16 is a fixed pointer to the current task
21CFLAGS += -ffixed-r16 -mno-prolog-function 21KBUILD_CFLAGS += -ffixed-r16 -mno-prolog-function
22CFLAGS += -fno-builtin 22KBUILD_CFLAGS += -fno-builtin
23CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\" 23KBUILD_CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\"
24 24
25# By default, build a kernel that runs on the gdb v850 simulator. 25# By default, build a kernel that runs on the gdb v850 simulator.
26KBUILD_DEFCONFIG := sim_defconfig 26KBUILD_DEFCONFIG := sim_defconfig
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index cb1035f2b7e9..646292aaf1fc 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -50,7 +50,7 @@ HOSTCFLAGS_build.o := $(LINUXINCLUDE)
50# that way we can complain to the user if the CPU is insufficient. 50# that way we can complain to the user if the CPU is insufficient.
51cflags-i386 := 51cflags-i386 :=
52cflags-x86_64 := -m32 52cflags-x86_64 := -m32
53CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ 53KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
54 $(cflags-$(ARCH)) \ 54 $(cflags-$(ARCH)) \
55 -Wall -Wstrict-prototypes \ 55 -Wall -Wstrict-prototypes \
56 -march=i386 -mregparm=3 \ 56 -march=i386 -mregparm=3 \
@@ -61,7 +61,7 @@ CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
61 $(call cc-option, -fno-unit-at-a-time)) \ 61 $(call cc-option, -fno-unit-at-a-time)) \
62 $(call cc-option, -fno-stack-protector) \ 62 $(call cc-option, -fno-stack-protector) \
63 $(call cc-option, -mpreferred-stack-boundary=2) 63 $(call cc-option, -mpreferred-stack-boundary=2)
64AFLAGS := $(CFLAGS) -D__ASSEMBLY__ 64AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
65 65
66$(obj)/zImage: IMAGE_OFFSET := 0x1000 66$(obj)/zImage: IMAGE_OFFSET := 0x1000
67$(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK) 67$(obj)/zImage: EXTRA_AFLAGS := $(SVGA_MODE) $(RAMDISK)
diff --git a/arch/x86/boot/compressed/Makefile_32 b/arch/x86/boot/compressed/Makefile_32
index 22613c652d22..e43ff7c56e6e 100644
--- a/arch/x86/boot/compressed/Makefile_32
+++ b/arch/x86/boot/compressed/Makefile_32
@@ -11,7 +11,7 @@ EXTRA_AFLAGS := -traditional
11LDFLAGS_vmlinux := -T 11LDFLAGS_vmlinux := -T
12hostprogs-y := relocs 12hostprogs-y := relocs
13 13
14CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \ 14KBUILD_CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \
15 -fno-strict-aliasing -fPIC \ 15 -fno-strict-aliasing -fPIC \
16 $(call cc-option,-ffreestanding) \ 16 $(call cc-option,-ffreestanding) \
17 $(call cc-option,-fno-stack-protector) 17 $(call cc-option,-fno-stack-protector)
diff --git a/arch/x86/boot/compressed/Makefile_64 b/arch/x86/boot/compressed/Makefile_64
index dc6b3380cc45..3013ad01fe69 100644
--- a/arch/x86/boot/compressed/Makefile_64
+++ b/arch/x86/boot/compressed/Makefile_64
@@ -6,11 +6,11 @@
6 6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz head_64.o misc_64.o piggy.o 7targets := vmlinux vmlinux.bin vmlinux.bin.gz head_64.o misc_64.o piggy.o
8 8
9CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \ 9KBUILD_CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \
10 -fno-strict-aliasing -fPIC -mcmodel=small \ 10 -fno-strict-aliasing -fPIC -mcmodel=small \
11 $(call cc-option, -ffreestanding) \ 11 $(call cc-option, -ffreestanding) \
12 $(call cc-option, -fno-stack-protector) 12 $(call cc-option, -fno-stack-protector)
13AFLAGS := $(CFLAGS) -D__ASSEMBLY__ 13AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
14LDFLAGS := -m elf_x86_64 14LDFLAGS := -m elf_x86_64
15 15
16LDFLAGS_vmlinux := -T 16LDFLAGS_vmlinux := -T
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 8d03de029d9b..dcd6bb9e0bb3 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -34,8 +34,8 @@ $(obj)/vdso.so: $(src)/vdso.lds $(vobjs) FORCE
34 34
35CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64 35CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64
36 36
37$(obj)/vclock_gettime.o: CFLAGS = $(CFL) 37$(obj)/vclock_gettime.o: KBUILD_CFLAGS = $(CFL)
38$(obj)/vgetcpu.o: CFLAGS = $(CFL) 38$(obj)/vgetcpu.o: KBUILD_CFLAGS = $(CFL)
39 39
40# We also create a special relocatable object that should mirror the symbol 40# We also create a special relocatable object that should mirror the symbol
41# table and layout of the linked DSO. With ld -R we can then refer to 41# table and layout of the linked DSO. With ld -R we can then refer to
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 8bffb94c71b5..3fc33004e8c6 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -70,7 +70,7 @@ AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONF
70cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector ) 70cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector )
71cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all ) 71cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all )
72 72
73CFLAGS += $(cflags-y) 73KBUILD_CFLAGS += $(cflags-y)
74CFLAGS_KERNEL += $(cflags-kernel-y) 74CFLAGS_KERNEL += $(cflags-kernel-y)
75AFLAGS += -m64 75AFLAGS += -m64
76 76
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index acf05be24929..56685a883347 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -28,11 +28,9 @@ PLATFORM = $(platform-y)
28export PLATFORM 28export PLATFORM
29 29
30# temporarily until string.h is fixed 30# temporarily until string.h is fixed
31cflags-y += -ffreestanding 31KBUILD_CFLAGS += -ffreestanding
32 32
33cflags-y += -pipe -mlongcalls 33KBUILD_CFLAGS += -pipe -mlongcalls
34
35CFLAGS += $(cflags-y)
36 34
37KBUILD_DEFCONFIG := iss_defconfig 35KBUILD_DEFCONFIG := iss_defconfig
38 36
@@ -56,7 +54,7 @@ endif
56 54
57# 55#
58 56
59LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 57LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
60 58
61head-y := arch/xtensa/kernel/head.o 59head-y := arch/xtensa/kernel/head.o
62core-y += arch/xtensa/kernel/ arch/xtensa/mm/ 60core-y += arch/xtensa/kernel/ arch/xtensa/mm/
diff --git a/arch/xtensa/boot/boot-redboot/Makefile b/arch/xtensa/boot/boot-redboot/Makefile
index f53262c2e1f3..74d15d08077b 100644
--- a/arch/xtensa/boot/boot-redboot/Makefile
+++ b/arch/xtensa/boot/boot-redboot/Makefile
@@ -19,7 +19,7 @@ boot-y := bootstrap.o
19OBJS := $(addprefix $(obj)/,$(boot-y)) 19OBJS := $(addprefix $(obj)/,$(boot-y))
20LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a 20LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
21 21
22LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 22LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
23 23
24zImage: vmlinux $(OBJS) $(LIBS) 24zImage: vmlinux $(OBJS) $(LIBS)
25 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \ 25 $(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
diff --git a/init/Makefile b/init/Makefile
index 0154aea1e52d..633392f5cdee 100644
--- a/init/Makefile
+++ b/init/Makefile
@@ -30,4 +30,4 @@ $(obj)/version.o: include/linux/compile.h
30include/linux/compile.h: FORCE 30include/linux/compile.h: FORCE
31 @echo ' CHK $@' 31 @echo ' CHK $@'
32 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ 32 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
33 "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)" 33 "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)"
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