aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
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 /Makefile
parent9a39e273d4df0560c724c5fe71f6314a0583ca2b (diff)
kbuild: enable 'make CFLAGS=...' to add additional options to CC
The variable CFLAGS is a wellknown variable and the usage by kbuild may result in unexpected behaviour. On top of that several people over time has asked for a way to pass in additional flags to gcc. This patch replace use of CFLAGS with KBUILD_CFLAGS all over the tree and enabling one to use: make CFLAGS=... to specify additional gcc commandline options. One usecase is when trying to find gcc bugs but other use cases has been requested too. Patch was tested on following architectures: alpha, arm, i386, x86_64, mips, sparc, sparc64, ia64, m68k Test was simple to do a defconfig build, apply the patch and check that nothing got rebuild. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 10 insertions, 10 deletions
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)%,%,\