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 | |
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>
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 | ||
@@ -320,7 +320,7 @@ LINUXINCLUDE := -Iinclude \ | |||
320 | 320 | ||
321 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) | 321 | CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE) |
322 | 322 | ||
323 | CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 323 | KBUILD_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 |
326 | AFLAGS := -D__ASSEMBLY__ | 326 | AFLAGS := -D__ASSEMBLY__ |
@@ -335,7 +335,7 @@ export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE | |||
335 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 335 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
336 | 336 | ||
337 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | 337 | export CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS |
338 | export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE | 338 | export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE |
339 | export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE | 339 | export 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) | |||
492 | all: vmlinux | 492 | all: vmlinux |
493 | 493 | ||
494 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE | 494 | ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE |
495 | CFLAGS += -Os | 495 | KBUILD_CFLAGS += -Os |
496 | else | 496 | else |
497 | CFLAGS += -O2 | 497 | KBUILD_CFLAGS += -O2 |
498 | endif | 498 | endif |
499 | 499 | ||
500 | include $(srctree)/arch/$(ARCH)/Makefile | 500 | include $(srctree)/arch/$(ARCH)/Makefile |
501 | 501 | ||
502 | ifdef CONFIG_FRAME_POINTER | 502 | ifdef CONFIG_FRAME_POINTER |
503 | CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls | 503 | KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls |
504 | else | 504 | else |
505 | CFLAGS += -fomit-frame-pointer | 505 | KBUILD_CFLAGS += -fomit-frame-pointer |
506 | endif | 506 | endif |
507 | 507 | ||
508 | ifdef CONFIG_DEBUG_INFO | 508 | ifdef CONFIG_DEBUG_INFO |
509 | CFLAGS += -g | 509 | KBUILD_CFLAGS += -g |
510 | AFLAGS += -gdwarf-2 | 510 | AFLAGS += -gdwarf-2 |
511 | endif | 511 | endif |
512 | 512 | ||
513 | # Force gcc to behave correct even for buggy distributions | 513 | # Force gcc to behave correct even for buggy distributions |
514 | CFLAGS += $(call cc-option, -fno-stack-protector) | 514 | KBUILD_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 |
517 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) | 517 | NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) |
518 | CHECKFLAGS += $(NOSTDINC_FLAGS) | 518 | CHECKFLAGS += $(NOSTDINC_FLAGS) |
519 | 519 | ||
520 | # warn about C99 declaration after statement | 520 | # warn about C99 declaration after statement |
521 | CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) | 521 | KBUILD_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 |
524 | CFLAGS += $(call cc-option,-Wno-pointer-sign,) | 524 | KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) |
525 | 525 | ||
526 | # Use --build-id when available. | 526 | # Use --build-id when available. |
527 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ | 527 | LDFLAGS_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. |
87 | CFLAGS += $(cflags-y) -Wa,-mev6 | 87 | KBUILD_CFLAGS += $(cflags-y) -Wa,-mev6 |
88 | 88 | ||
89 | head-y := arch/alpha/kernel/head.o | 89 | head-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 | ||
5 | extra-y := head.o vmlinux.lds | 5 | extra-y := head.o vmlinux.lds |
6 | EXTRA_AFLAGS := $(CFLAGS) | 6 | EXTRA_AFLAGS := $(KBUILD_CFLAGS) |
7 | EXTRA_CFLAGS := -Werror -Wno-sign-compare | 7 | EXTRA_CFLAGS := -Werror -Wno-sign-compare |
8 | 8 | ||
9 | obj-y := entry.o traps.o process.o init_task.o osf_sys.o irq.o \ | 9 | obj-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 | ||
5 | EXTRA_AFLAGS := $(CFLAGS) | 5 | EXTRA_AFLAGS := $(KBUILD_CFLAGS) |
6 | EXTRA_CFLAGS := -Werror | 6 | EXTRA_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 | |||
14 | CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) | 14 | CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) |
15 | OBJCOPYFLAGS :=-O binary -R .note -R .comment -S | 15 | OBJCOPYFLAGS :=-O binary -R .note -R .comment -S |
16 | GZFLAGS :=-9 | 16 | GZFLAGS :=-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: |
19 | CFLAGS +=$(call cc-option,-marm,) | 19 | KBUILD_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 | |||
28 | endif | 28 | endif |
29 | 29 | ||
30 | ifeq ($(CONFIG_FRAME_POINTER),y) | 30 | ifeq ($(CONFIG_FRAME_POINTER),y) |
31 | CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog | 31 | KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog |
32 | endif | 32 | endif |
33 | 33 | ||
34 | ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) | 34 | ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) |
@@ -85,7 +85,7 @@ CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-th | |||
85 | endif | 85 | endif |
86 | 86 | ||
87 | # Need -Uarm for gcc < 3.x | 87 | # Need -Uarm for gcc < 3.x |
88 | CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm | 88 | KBUILD_CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm |
89 | AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float | 89 | AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float |
90 | 90 | ||
91 | CHECKFLAGS += -D__arm__ | 91 | CHECKFLAGS += -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),) | |||
87 | LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) | 87 | LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS) |
88 | endif | 88 | endif |
89 | LDFLAGS_vmlinux += -p --no-undefined -X \ | 89 | LDFLAGS_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 | ||
12 | KBUILD_DEFCONFIG := atstk1002_defconfig | 12 | KBUILD_DEFCONFIG := atstk1002_defconfig |
13 | 13 | ||
14 | CFLAGS += -pipe -fno-builtin -mno-pic | 14 | KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic |
15 | AFLAGS += -mrelax -mno-pic | 15 | AFLAGS += -mrelax -mno-pic |
16 | CFLAGS_MODULE += -mno-relax | 16 | CFLAGS_MODULE += -mno-relax |
17 | LDFLAGS_vmlinux += --relax | 17 | LDFLAGS_vmlinux += --relax |
18 | 18 | ||
19 | cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000 | 19 | cpuflags-$(CONFIG_CPU_AT32AP7000) += -mcpu=ap7000 |
20 | 20 | ||
21 | CFLAGS += $(cpuflags-y) | 21 | KBUILD_CFLAGS += $(cpuflags-y) |
22 | AFLAGS += $(cpuflags-y) | 22 | AFLAGS += $(cpuflags-y) |
23 | 23 | ||
24 | CHECKFLAGS += -D__avr32__ -D__BIG_ENDIAN | 24 | CHECKFLAGS += -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 | |||
53 | rev-$(CONFIG_BF_REV_NONE) := none | 53 | rev-$(CONFIG_BF_REV_NONE) := none |
54 | rev-$(CONFIG_BF_REV_ANY) := any | 54 | rev-$(CONFIG_BF_REV_ANY) := any |
55 | 55 | ||
56 | CFLAGS += -mcpu=$(cpu-y)-$(rev-y) | 56 | KBUILD_CFLAGS += -mcpu=$(cpu-y)-$(rev-y) |
57 | AFLAGS += -mcpu=$(cpu-y)-$(rev-y) | 57 | AFLAGS += -mcpu=$(cpu-y)-$(rev-y) |
58 | 58 | ||
59 | head-y := arch/$(ARCH)/mach-$(MACHINE)/head.o arch/$(ARCH)/kernel/init_task.o | 59 | head-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 | |||
31 | CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) | 31 | CPPFLAGS_vmlinux.lds = -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) |
32 | AFLAGS += -mlinux | 32 | AFLAGS += -mlinux |
33 | 33 | ||
34 | CFLAGS := $(CFLAGS) -mlinux -march=$(arch-y) -pipe | 34 | KBUILD_CFLAGS += -mlinux -march=$(arch-y) -pipe |
35 | 35 | ||
36 | ifdef CONFIG_FRAME_POINTER | 36 | ifdef CONFIG_FRAME_POINTER |
37 | CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g | 37 | KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g |
38 | CFLAGS += -fno-omit-frame-pointer | 38 | KBUILD_CFLAGS += -fno-omit-frame-pointer |
39 | endif | 39 | endif |
40 | 40 | ||
41 | head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o | 41 | head-y := arch/$(ARCH)/$(SARCH)/kernel/head.o |
42 | 42 | ||
43 | LIBGCC = $(shell $(CC) $(CFLAGS) -print-file-name=libgcc.a) | 43 | LIBGCC = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libgcc.a) |
44 | 44 | ||
45 | core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ | 45 | core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ |
46 | core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/ | 46 | core-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 | |||
39 | ARCHMODFLAGS += -G0 -mlong-calls | 39 | ARCHMODFLAGS += -G0 -mlong-calls |
40 | 40 | ||
41 | ifdef CONFIG_GPREL_DATA_8 | 41 | ifdef CONFIG_GPREL_DATA_8 |
42 | CFLAGS += -G8 | 42 | KBUILD_CFLAGS += -G8 |
43 | else | 43 | else |
44 | ifdef CONFIG_GPREL_DATA_4 | 44 | ifdef CONFIG_GPREL_DATA_4 |
45 | CFLAGS += -G4 | 45 | KBUILD_CFLAGS += -G4 |
46 | else | 46 | else |
47 | ifdef CONFIG_GPREL_DATA_NONE | 47 | ifdef CONFIG_GPREL_DATA_NONE |
48 | CFLAGS += -G0 | 48 | KBUILD_CFLAGS += -G0 |
49 | endif | 49 | endif |
50 | endif | 50 | endif |
51 | endif | 51 | endif |
@@ -53,25 +53,25 @@ endif | |||
53 | #LDFLAGS_vmlinux := -Map linkmap.txt | 53 | #LDFLAGS_vmlinux := -Map linkmap.txt |
54 | 54 | ||
55 | ifdef CONFIG_GC_SECTIONS | 55 | ifdef CONFIG_GC_SECTIONS |
56 | CFLAGS += -ffunction-sections -fdata-sections | 56 | KBUILD_CFLAGS += -ffunction-sections -fdata-sections |
57 | LINKFLAGS += --gc-sections | 57 | LINKFLAGS += --gc-sections |
58 | endif | 58 | endif |
59 | 59 | ||
60 | ifndef CONFIG_FRAME_POINTER | 60 | ifndef CONFIG_FRAME_POINTER |
61 | CFLAGS += -mno-linked-fp | 61 | KBUILD_CFLAGS += -mno-linked-fp |
62 | endif | 62 | endif |
63 | 63 | ||
64 | ifdef CONFIG_CPU_FR451_COMPILE | 64 | ifdef CONFIG_CPU_FR451_COMPILE |
65 | CFLAGS += -mcpu=fr450 | 65 | KBUILD_CFLAGS += -mcpu=fr450 |
66 | AFLAGS += -mcpu=fr450 | 66 | AFLAGS += -mcpu=fr450 |
67 | ASFLAGS += -mcpu=fr450 | 67 | ASFLAGS += -mcpu=fr450 |
68 | else | 68 | else |
69 | ifdef CONFIG_CPU_FR551_COMPILE | 69 | ifdef CONFIG_CPU_FR551_COMPILE |
70 | CFLAGS += -mcpu=fr550 | 70 | KBUILD_CFLAGS += -mcpu=fr550 |
71 | AFLAGS += -mcpu=fr550 | 71 | AFLAGS += -mcpu=fr550 |
72 | ASFLAGS += -mcpu=fr550 | 72 | ASFLAGS += -mcpu=fr550 |
73 | else | 73 | else |
74 | CFLAGS += -mcpu=fr400 | 74 | KBUILD_CFLAGS += -mcpu=fr400 |
75 | AFLAGS += -mcpu=fr400 | 75 | AFLAGS += -mcpu=fr400 |
76 | ASFLAGS += -mcpu=fr400 | 76 | ASFLAGS += -mcpu=fr400 |
77 | endif | 77 | endif |
@@ -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 |
83 | CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media | 83 | KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media |
84 | CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2 | 84 | KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2 |
85 | AFLAGS += -mno-fdpic | 85 | AFLAGS += -mno-fdpic |
86 | ASFLAGS += -mno-fdpic | 86 | ASFLAGS += -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 |
90 | ifdef CONFIG_DEBUG_INFO | 90 | ifdef CONFIG_DEBUG_INFO |
91 | #CFLAGS += -O1 | 91 | #KBUILD_CFLAGS += -O1 |
92 | AFLAGS += -Wa,--gdwarf2 | 92 | AFLAGS += -Wa,--gdwarf2 |
93 | ASFLAGS += -Wa,--gdwarf2 | 93 | ASFLAGS += -Wa,--gdwarf2 |
94 | endif | 94 | endif |
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 | |||
30 | cflags-$(CONFIG_CPU_H8S) := -ms | 30 | cflags-$(CONFIG_CPU_H8S) := -ms |
31 | ldflags-$(CONFIG_CPU_H8S) := -mh8300self | 31 | ldflags-$(CONFIG_CPU_H8S) := -mh8300self |
32 | 32 | ||
33 | CFLAGS += $(cflags-y) | 33 | KBUILD_CFLAGS += $(cflags-y) |
34 | CFLAGS += -mint32 -fno-builtin | 34 | KBUILD_CFLAGS += -mint32 -fno-builtin |
35 | CFLAGS += -g | 35 | KBUILD_CFLAGS += -g |
36 | CFLAGS += -D__linux__ | 36 | KBUILD_CFLAGS += -D__linux__ |
37 | CFLAGS += -DUTS_SYSNAME=\"uClinux\" | 37 | KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\" |
38 | AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y) | 38 | AFLAGS += -DPLATFORM=$(PLATFORM) -DMODEL=$(MODEL) $(cflags-y) |
39 | LDFLAGS += $(ldflags-y) | 39 | LDFLAGS += $(ldflags-y) |
40 | 40 | ||
41 | CROSS_COMPILE = h8300-elf- | 41 | CROSS_COMPILE = h8300-elf- |
42 | LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(CFLAGS) -print-libgcc-file-name) | 42 | LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
43 | 43 | ||
44 | head-y := arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/crt0_$(MODEL).o | 44 | head-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 | |||
34 | endif | 34 | endif |
35 | CHECKFLAGS += -D__i386__ | 35 | CHECKFLAGS += -D__i386__ |
36 | 36 | ||
37 | CFLAGS += -pipe -msoft-float -mregparm=3 -freg-struct-return | 37 | KBUILD_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 |
40 | CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2) | 40 | KBUILD_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. |
43 | include $(srctree)/arch/i386/Makefile.cpu | 43 | include $(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: |
54 | CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;) | 54 | KBUILD_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? |
57 | cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset esp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,) | 57 | cflags-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 | |||
61 | cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) | 61 | cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) |
62 | AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) | 62 | AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,) |
63 | 63 | ||
64 | CFLAGS += $(cflags-y) | 64 | KBUILD_CFLAGS += $(cflags-y) |
65 | 65 | ||
66 | # Default subarch .c files | 66 | # Default subarch .c files |
67 | mcore-y := arch/x86/mach-default | 67 | mcore-y := arch/x86/mach-default |
@@ -116,7 +116,7 @@ drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/ | |||
116 | drivers-$(CONFIG_PM) += arch/x86/power/ | 116 | drivers-$(CONFIG_PM) += arch/x86/power/ |
117 | drivers-$(CONFIG_FB) += arch/x86/video/ | 117 | drivers-$(CONFIG_FB) += arch/x86/video/ |
118 | 118 | ||
119 | CFLAGS += $(mflags-y) | 119 | KBUILD_CFLAGS += $(mflags-y) |
120 | AFLAGS += $(mflags-y) | 120 | AFLAGS += $(mflags-y) |
121 | 121 | ||
122 | boot := arch/x86/boot | 122 | boot := 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 |
45 | endif | 45 | endif |
46 | 46 | ||
47 | CFLAGS += $(cflags-y) | 47 | KBUILD_CFLAGS += $(cflags-y) |
48 | head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o | 48 | head-y := arch/ia64/kernel/head.o arch/ia64/kernel/init_task.o |
49 | 49 | ||
50 | libs-y += arch/ia64/lib/ | 50 | libs-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 := | |||
9 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | 9 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
10 | LDFLAGS_vmlinux := | 10 | LDFLAGS_vmlinux := |
11 | 11 | ||
12 | CFLAGS += -pipe -fno-schedule-insns | 12 | KBUILD_CFLAGS += -pipe -fno-schedule-insns |
13 | CFLAGS_KERNEL += -mmodel=medium | 13 | CFLAGS_KERNEL += -mmodel=medium |
14 | CFLAGS_MODULE += -mmodel=large | 14 | CFLAGS_MODULE += -mmodel=large |
15 | 15 | ||
@@ -24,14 +24,14 @@ endif | |||
24 | cflags-$(CONFIG_ISA_M32R) += -DNO_FPU | 24 | cflags-$(CONFIG_ISA_M32R) += -DNO_FPU |
25 | aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst | 25 | aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst |
26 | 26 | ||
27 | CFLAGS += $(cflags-y) | 27 | KBUILD_CFLAGS += $(cflags-y) |
28 | AFLAGS += $(aflags-y) | 28 | AFLAGS += $(aflags-y) |
29 | 29 | ||
30 | CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 | 30 | CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 |
31 | 31 | ||
32 | head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o | 32 | head-y := arch/m32r/kernel/head.o arch/m32r/kernel/init_task.o |
33 | 33 | ||
34 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 34 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
35 | 35 | ||
36 | libs-y += arch/m32r/lib/ $(LIBGCC) | 36 | libs-y += arch/m32r/lib/ $(LIBGCC) |
37 | core-y += arch/m32r/kernel/ \ | 37 | core-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 | |||
32 | CHECKFLAGS += -D__mc68000__ | 32 | CHECKFLAGS += -D__mc68000__ |
33 | 33 | ||
34 | # without -fno-strength-reduce the 53c7xx.c driver fails ;-( | 34 | # without -fno-strength-reduce the 53c7xx.c driver fails ;-( |
35 | CFLAGS += -pipe -fno-strength-reduce -ffixed-a2 | 35 | KBUILD_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 |
38 | ifndef CONFIG_M68020 | 38 | ifndef CONFIG_M68020 |
39 | ifndef CONFIG_M68030 | 39 | ifndef CONFIG_M68030 |
40 | 40 | ||
41 | ifndef CONFIG_M68060 | 41 | ifndef CONFIG_M68060 |
42 | CFLAGS := $(CFLAGS) -m68040 | 42 | KBUILD_CFLAGS += -m68040 |
43 | endif | 43 | endif |
44 | 44 | ||
45 | ifndef CONFIG_M68040 | 45 | ifndef CONFIG_M68040 |
46 | CFLAGS := $(CFLAGS) -m68060 | 46 | KBUILD_CFLAGS += -m68060 |
47 | endif | 47 | endif |
48 | 48 | ||
49 | endif | 49 | endif |
@@ -52,7 +52,7 @@ endif | |||
52 | ifdef CONFIG_KGDB | 52 | ifdef 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 |
55 | CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -g | 55 | KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g |
56 | endif | 56 | endif |
57 | 57 | ||
58 | ifndef CONFIG_SUN3 | 58 | ifndef 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 | ||
105 | AFLAGS += $(cflags-y) | 105 | AFLAGS += $(cflags-y) |
106 | 106 | ||
107 | CFLAGS += $(cflags-y) | 107 | KBUILD_CFLAGS += $(cflags-y) |
108 | CFLAGS += -D__linux__ | 108 | KBUILD_CFLAGS += -D__linux__ |
109 | CFLAGS += -DUTS_SYSNAME=\"uClinux\" | 109 | KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\" |
110 | 110 | ||
111 | head-y := arch/m68knommu/platform/$(cpuclass-y)/head.o | 111 | head-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 | |||
609 | endif | 609 | endif |
610 | 610 | ||
611 | AFLAGS += $(cflags-y) | 611 | AFLAGS += $(cflags-y) |
612 | CFLAGS += $(cflags-y) \ | 612 | KBUILD_CFLAGS += $(cflags-y) \ |
613 | -D"VMLINUX_LOAD_ADDRESS=$(load-y)" | 613 | -D"VMLINUX_LOAD_ADDRESS=$(load-y)" |
614 | 614 | ||
615 | LDFLAGS += -m $(ld-emul) | 615 | LDFLAGS += -m $(ld-emul) |
616 | 616 | ||
617 | ifdef CONFIG_MIPS | 617 | ifdef CONFIG_MIPS |
618 | CHECKFLAGS += $(shell $(CC) $(CFLAGS) -dM -E -xc /dev/null | \ | 618 | CHECKFLAGS += $(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/$$/'/") |
621 | ifdef CONFIG_64BIT | 621 | ifdef CONFIG_64BIT |
@@ -632,7 +632,7 @@ OBJCOPYFLAGS += --remove-section=.reginfo | |||
632 | # | 632 | # |
633 | 633 | ||
634 | CPPFLAGS_vmlinux.lds := \ | 634 | CPPFLAGS_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 | |||
71 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o | 71 | obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o |
72 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 72 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
73 | 73 | ||
74 | CFLAGS_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) | 74 | CFLAGS_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 | ||
76 | obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o | 76 | obj-$(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 | ||
64 | head-y := arch/parisc/kernel/head.o | 64 | head-y := arch/parisc/kernel/head.o |
65 | 65 | ||
66 | CFLAGS += $(cflags-y) | 66 | KBUILD_CFLAGS += $(cflags-y) |
67 | 67 | ||
68 | kernel-y := mm/ kernel/ math-emu/ kernel/init_task.o | 68 | kernel-y := mm/ kernel/ math-emu/ kernel/init_task.o |
69 | kernel-$(CONFIG_HPUX) += hpux/ | 69 | kernel-$(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 | |||
77 | CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple | 77 | CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple |
78 | CPPFLAGS += $(CPPFLAGS-y) | 78 | CPPFLAGS += $(CPPFLAGS-y) |
79 | AFLAGS += $(AFLAGS-y) | 79 | AFLAGS += $(AFLAGS-y) |
80 | CFLAGS += -msoft-float -pipe $(CFLAGS-y) | 80 | KBUILD_CFLAGS += -msoft-float -pipe $(CFLAGS-y) |
81 | CPP = $(CC) -E $(CFLAGS) | 81 | CPP = $(CC) -E $(KBUILD_CFLAGS) |
82 | 82 | ||
83 | CHECKFLAGS += -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__ | 83 | CHECKFLAGS += -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 | |||
88 | ifeq ($(CONFIG_POWER4_ONLY),y) | 88 | ifeq ($(CONFIG_POWER4_ONLY),y) |
89 | ifeq ($(CONFIG_ALTIVEC),y) | 89 | ifeq ($(CONFIG_ALTIVEC),y) |
90 | ifeq ($(GCC_BROKEN_VEC),y) | 90 | ifeq ($(GCC_BROKEN_VEC),y) |
91 | CFLAGS += $(call cc-option,-mcpu=970) | 91 | KBUILD_CFLAGS += $(call cc-option,-mcpu=970) |
92 | else | 92 | else |
93 | CFLAGS += $(call cc-option,-mcpu=power4) | 93 | KBUILD_CFLAGS += $(call cc-option,-mcpu=power4) |
94 | endif | 94 | endif |
95 | else | 95 | else |
96 | CFLAGS += $(call cc-option,-mcpu=power4) | 96 | KBUILD_CFLAGS += $(call cc-option,-mcpu=power4) |
97 | endif | 97 | endif |
98 | else | 98 | else |
99 | CFLAGS += $(call cc-option,-mtune=power4) | 99 | KBUILD_CFLAGS += $(call cc-option,-mtune=power4) |
100 | endif | 100 | endif |
101 | endif | 101 | endif |
102 | 102 | ||
103 | ifeq ($(CONFIG_TUNE_CELL),y) | 103 | ifeq ($(CONFIG_TUNE_CELL),y) |
104 | CFLAGS += $(call cc-option,-mtune=cell) | 104 | KBUILD_CFLAGS += $(call cc-option,-mtune=cell) |
105 | endif | 105 | endif |
106 | 106 | ||
107 | # No AltiVec instruction when building kernel | 107 | # No AltiVec instruction when building kernel |
108 | CFLAGS += $(call cc-option,-mno-altivec) | 108 | KBUILD_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. |
112 | CFLAGS += $(call cc-option,-funit-at-a-time) | 112 | KBUILD_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 |
116 | CFLAGS += -mno-string | 116 | KBUILD_CFLAGS += -mno-string |
117 | 117 | ||
118 | ifeq ($(CONFIG_6xx),y) | 118 | ifeq ($(CONFIG_6xx),y) |
119 | CFLAGS += -mcpu=powerpc | 119 | KBUILD_CFLAGS += -mcpu=powerpc |
120 | endif | 120 | endif |
121 | 121 | ||
122 | cpu-as-$(CONFIG_4xx) += -Wa,-m405 | 122 | cpu-as-$(CONFIG_4xx) += -Wa,-m405 |
@@ -126,7 +126,7 @@ cpu-as-$(CONFIG_E500) += -Wa,-me500 | |||
126 | cpu-as-$(CONFIG_E200) += -Wa,-me200 | 126 | cpu-as-$(CONFIG_E200) += -Wa,-me200 |
127 | 127 | ||
128 | AFLAGS += $(cpu-as-y) | 128 | AFLAGS += $(cpu-as-y) |
129 | CFLAGS += $(cpu-as-y) | 129 | KBUILD_CFLAGS += $(cpu-as-y) |
130 | 130 | ||
131 | head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o | 131 | head-y := arch/powerpc/kernel/head_$(CONFIG_WORD_SIZE).o |
132 | head-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o | 132 | head-$(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 |
25 | CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include | 25 | CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include |
26 | AFLAGS += -Iarch/$(ARCH) | 26 | AFLAGS += -Iarch/$(ARCH) |
27 | CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ | 27 | KBUILD_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 |
31 | CFLAGS += $(call cc-option, -mno-altivec) | 31 | KBUILD_CFLAGS += $(call cc-option, -mno-altivec) |
32 | 32 | ||
33 | CPP = $(CC) -E $(CFLAGS) | 33 | CPP = $(CC) -E $(KBUILD_CFLAGS) |
34 | # Temporary hack until we have migrated to asm-powerpc | 34 | # Temporary hack until we have migrated to asm-powerpc |
35 | LINUXINCLUDE += -Iarch/$(ARCH)/include | 35 | LINUXINCLUDE += -Iarch/$(ARCH)/include |
36 | 36 | ||
37 | CHECKFLAGS += -D__powerpc__ | 37 | CHECKFLAGS += -D__powerpc__ |
38 | 38 | ||
39 | ifndef CONFIG_FSL_BOOKE | 39 | ifndef CONFIG_FSL_BOOKE |
40 | CFLAGS += -mstring | 40 | KBUILD_CFLAGS += -mstring |
41 | endif | 41 | endif |
42 | 42 | ||
43 | cpu-as-$(CONFIG_4xx) += -Wa,-m405 | 43 | cpu-as-$(CONFIG_4xx) += -Wa,-m405 |
@@ -46,7 +46,7 @@ cpu-as-$(CONFIG_E500) += -Wa,-me500 | |||
46 | cpu-as-$(CONFIG_E200) += -Wa,-me200 | 46 | cpu-as-$(CONFIG_E200) += -Wa,-me200 |
47 | 47 | ||
48 | AFLAGS += $(cpu-as-y) | 48 | AFLAGS += $(cpu-as-y) |
49 | CFLAGS += $(cpu-as-y) | 49 | KBUILD_CFLAGS += $(cpu-as-y) |
50 | 50 | ||
51 | # Default to the common case. | 51 | # Default to the common case. |
52 | KBUILD_DEFCONFIG := common_defconfig | 52 | KBUILD_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 | ||
16 | ifndef CONFIG_64BIT | 16 | ifndef CONFIG_64BIT |
17 | LDFLAGS := -m elf_s390 | 17 | LDFLAGS := -m elf_s390 |
18 | CFLAGS += -m31 | 18 | KBUILD_CFLAGS += -m31 |
19 | AFLAGS += -m31 | 19 | AFLAGS += -m31 |
20 | UTS_MACHINE := s390 | 20 | UTS_MACHINE := s390 |
21 | STACK_SIZE := 8192 | 21 | STACK_SIZE := 8192 |
@@ -23,7 +23,7 @@ CHECKFLAGS += -D__s390__ -msize-long | |||
23 | else | 23 | else |
24 | LDFLAGS := -m elf64_s390 | 24 | LDFLAGS := -m elf64_s390 |
25 | MODFLAGS += -fpic -D__PIC__ | 25 | MODFLAGS += -fpic -D__PIC__ |
26 | CFLAGS += -m64 | 26 | KBUILD_CFLAGS += -m64 |
27 | AFLAGS += -m64 | 27 | AFLAGS += -m64 |
28 | UTS_MACHINE := s390x | 28 | UTS_MACHINE := s390x |
29 | STACK_SIZE := 16384 | 29 | STACK_SIZE := 16384 |
@@ -77,8 +77,8 @@ cflags-$(CONFIG_WARN_STACK) += -mwarn-dynamicstack | |||
77 | cflags-$(CONFIG_WARN_STACK) += -mwarn-framesize=$(CONFIG_WARN_STACK_SIZE) | 77 | cflags-$(CONFIG_WARN_STACK) += -mwarn-framesize=$(CONFIG_WARN_STACK_SIZE) |
78 | endif | 78 | endif |
79 | 79 | ||
80 | CFLAGS += -mbackchain -msoft-float $(cflags-y) | 80 | KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y) |
81 | CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare | 81 | KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare |
82 | AFLAGS += $(aflags-y) | 82 | AFLAGS += $(aflags-y) |
83 | 83 | ||
84 | OBJCOPYFLAGS := -O binary | 84 | OBJCOPYFLAGS := -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' | |||
91 | LDFLAGS += -EB | 91 | LDFLAGS += -EB |
92 | endif | 92 | endif |
93 | 93 | ||
94 | CFLAGS += -pipe $(cflags-y) | 94 | KBUILD_CFLAGS += -pipe $(cflags-y) |
95 | AFLAGS += $(cflags-y) | 95 | AFLAGS += $(cflags-y) |
96 | 96 | ||
97 | head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o | 97 | head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o |
98 | 98 | ||
99 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 99 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
100 | 100 | ||
101 | core-y += arch/sh/kernel/ arch/sh/mm/ | 101 | core-y += arch/sh/kernel/ arch/sh/mm/ |
102 | core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/ | 102 | core-$(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 | ||
24 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 24 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
25 | 25 | ||
26 | LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup -T $(obj)/../../kernel/vmlinux.lds | 26 | LDFLAGS_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 | |||
26 | endif | 26 | endif |
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 |
29 | CFLAGS += $(cpu-y) | 29 | KBUILD_CFLAGS += $(cpu-y) |
30 | 30 | ||
31 | LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \ | 31 | LDFLAGS_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),) | |||
57 | core-y += arch/sh64/mach-$(machine-y)/ | 57 | core-y += arch/sh64/mach-$(machine-y)/ |
58 | endif | 58 | endif |
59 | 59 | ||
60 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 60 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
61 | libs-y += arch/$(ARCH)/lib/ $(LIBGCC) | 61 | libs-y += arch/$(ARCH)/lib/ $(LIBGCC) |
62 | 62 | ||
63 | drivers-$(CONFIG_OPROFILE) += arch/sh64/oprofile/ | 63 | drivers-$(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 | ||
14 | AS := $(AS) -32 | 14 | AS := $(AS) -32 |
15 | LDFLAGS := -m elf32_sparc | 15 | LDFLAGS := -m elf32_sparc |
16 | CHECKFLAGS += -D__sparc__ | 16 | CHECKFLAGS += -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 |
19 | CFLAGS := $(CFLAGS) -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 | 19 | KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 |
20 | AFLAGS := $(AFLAGS) -m32 | 20 | AFLAGS := $(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 | |||
39 | endif | 39 | endif |
40 | 40 | ||
41 | ifneq ($(NEW_GCC),y) | 41 | ifneq ($(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 |
44 | else | 44 | else |
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) |
49 | endif | 49 | endif |
50 | 50 | ||
51 | ifeq ($(CONFIG_MCOUNT),y) | 51 | ifeq ($(CONFIG_MCOUNT),y) |
52 | CFLAGS := $(CFLAGS) -pg | 52 | KBUILD_CFLAGS += -pg |
53 | endif | 53 | endif |
54 | 54 | ||
55 | head-y := arch/sparc64/kernel/head.o arch/sparc64/kernel/init_task.o | 55 | head-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 | ||
61 | CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ | 61 | KBUILD_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 | ||
65 | AFLAGS += $(ARCH_INCLUDE) | 65 | AFLAGS += $(ARCH_INCLUDE) |
66 | 66 | ||
67 | USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ | 67 | USER_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 | ||
71 | include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) | 71 | include $(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 | ||
82 | KERNEL_DEFINES = -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ | 82 | KERNEL_DEFINES = -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ |
83 | -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES) | 83 | -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES) |
84 | CFLAGS += $(KERNEL_DEFINES) | 84 | KBUILD_CFLAGS += $(KERNEL_DEFINES) |
85 | CFLAGS += $(call cc-option,-fno-unit-at-a-time,) | 85 | KBUILD_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 | ||
16 | ifeq ("$(origin SUBARCH)", "command line") | 16 | ifeq ("$(origin SUBARCH)", "command line") |
17 | ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") | 17 | ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") |
18 | CFLAGS += $(call cc-option,-m32) | 18 | KBUILD_CFLAGS += $(call cc-option,-m32) |
19 | AFLAGS += $(call cc-option,-m32) | 19 | AFLAGS += $(call cc-option,-m32) |
20 | LINK-y += $(call cc-option,-m32) | 20 | LINK-y += $(call cc-option,-m32) |
21 | UML_OBJCOPYFLAGS += -F $(ELF_FORMAT) | 21 | UML_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. |
37 | cflags-y += -ffreestanding | 37 | cflags-y += -ffreestanding |
38 | 38 | ||
39 | CFLAGS += $(cflags-y) | 39 | KBUILD_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 |
7 | USER_CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE | 7 | USER_CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE |
8 | CFLAGS += -D_LARGEFILE64_SOURCE | 8 | KBUILD_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! |
11 | ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__ | 11 | ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__ |
12 | CFLAGS += $(_extra_flags_) | 12 | KBUILD_CFLAGS += $(_extra_flags_) |
13 | 13 | ||
14 | CHECKFLAGS += -m64 | 14 | CHECKFLAGS += -m64 |
15 | AFLAGS += -m64 | 15 | AFLAGS += -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 | |||
17 | port-objs := port_kern.o port_user.o | 17 | port-objs := port_kern.o port_user.o |
18 | harddog-objs := harddog_kern.o harddog_user.o | 18 | harddog-objs := harddog_kern.o harddog_user.o |
19 | 19 | ||
20 | LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) | 20 | LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) |
21 | 21 | ||
22 | targets := pcap_kern.o pcap_user.o | 22 | targets := 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 | ||
21 | include arch/um/scripts/Makefile.rules | 21 | include 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 | ||
29 | include arch/um/scripts/Makefile.rules | 29 | include 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 | ||
17 | arch_dir = arch/v850 | 17 | arch_dir = arch/v850 |
18 | 18 | ||
19 | CFLAGS += -mv850e | 19 | KBUILD_CFLAGS += -mv850e |
20 | # r16 is a fixed pointer to the current task | 20 | # r16 is a fixed pointer to the current task |
21 | CFLAGS += -ffixed-r16 -mno-prolog-function | 21 | KBUILD_CFLAGS += -ffixed-r16 -mno-prolog-function |
22 | CFLAGS += -fno-builtin | 22 | KBUILD_CFLAGS += -fno-builtin |
23 | CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\" | 23 | KBUILD_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. |
26 | KBUILD_DEFCONFIG := sim_defconfig | 26 | KBUILD_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. |
51 | cflags-i386 := | 51 | cflags-i386 := |
52 | cflags-x86_64 := -m32 | 52 | cflags-x86_64 := -m32 |
53 | CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ | 53 | KBUILD_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) |
64 | AFLAGS := $(CFLAGS) -D__ASSEMBLY__ | 64 | AFLAGS := $(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 | |||
11 | LDFLAGS_vmlinux := -T | 11 | LDFLAGS_vmlinux := -T |
12 | hostprogs-y := relocs | 12 | hostprogs-y := relocs |
13 | 13 | ||
14 | CFLAGS := -m32 -D__KERNEL__ $(LINUX_INCLUDE) -O2 \ | 14 | KBUILD_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 | ||
7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz head_64.o misc_64.o piggy.o | 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz head_64.o misc_64.o piggy.o |
8 | 8 | ||
9 | CFLAGS := -m64 -D__KERNEL__ $(LINUXINCLUDE) -O2 \ | 9 | KBUILD_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) |
13 | AFLAGS := $(CFLAGS) -D__ASSEMBLY__ | 13 | AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ |
14 | LDFLAGS := -m elf_x86_64 | 14 | LDFLAGS := -m elf_x86_64 |
15 | 15 | ||
16 | LDFLAGS_vmlinux := -T | 16 | LDFLAGS_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 | ||
35 | CFL := $(PROFILING) -mcmodel=small -fPIC -g0 -O2 -fasynchronous-unwind-tables -m64 | 35 | CFL := $(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 | |||
70 | cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector ) | 70 | cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector ) |
71 | cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all ) | 71 | cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all ) |
72 | 72 | ||
73 | CFLAGS += $(cflags-y) | 73 | KBUILD_CFLAGS += $(cflags-y) |
74 | CFLAGS_KERNEL += $(cflags-kernel-y) | 74 | CFLAGS_KERNEL += $(cflags-kernel-y) |
75 | AFLAGS += -m64 | 75 | AFLAGS += -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) | |||
28 | export PLATFORM | 28 | export PLATFORM |
29 | 29 | ||
30 | # temporarily until string.h is fixed | 30 | # temporarily until string.h is fixed |
31 | cflags-y += -ffreestanding | 31 | KBUILD_CFLAGS += -ffreestanding |
32 | 32 | ||
33 | cflags-y += -pipe -mlongcalls | 33 | KBUILD_CFLAGS += -pipe -mlongcalls |
34 | |||
35 | CFLAGS += $(cflags-y) | ||
36 | 34 | ||
37 | KBUILD_DEFCONFIG := iss_defconfig | 35 | KBUILD_DEFCONFIG := iss_defconfig |
38 | 36 | ||
@@ -56,7 +54,7 @@ endif | |||
56 | 54 | ||
57 | # | 55 | # |
58 | 56 | ||
59 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 57 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
60 | 58 | ||
61 | head-y := arch/xtensa/kernel/head.o | 59 | head-y := arch/xtensa/kernel/head.o |
62 | core-y += arch/xtensa/kernel/ arch/xtensa/mm/ | 60 | core-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 | |||
19 | OBJS := $(addprefix $(obj)/,$(boot-y)) | 19 | OBJS := $(addprefix $(obj)/,$(boot-y)) |
20 | LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a | 20 | LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a |
21 | 21 | ||
22 | LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) | 22 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
23 | 23 | ||
24 | zImage: vmlinux $(OBJS) $(LIBS) | 24 | zImage: 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 | |||
30 | include/linux/compile.h: FORCE | 30 | include/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 | ||
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 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)))" | |||
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 | ||