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>
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 9bf7345..ec89886 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -39,13 +39,13 @@
 ARCHMODFLAGS	+= -G0 -mlong-calls
 
 ifdef CONFIG_GPREL_DATA_8
-CFLAGS		+= -G8
+KBUILD_CFLAGS	+= -G8
 else
 ifdef CONFIG_GPREL_DATA_4
-CFLAGS		+= -G4
+KBUILD_CFLAGS	+= -G4
 else
 ifdef CONFIG_GPREL_DATA_NONE
-CFLAGS		+= -G0
+KBUILD_CFLAGS	+= -G0
 endif
 endif
 endif
@@ -53,25 +53,25 @@
 #LDFLAGS_vmlinux	:= -Map linkmap.txt
 
 ifdef CONFIG_GC_SECTIONS
-CFLAGS		+= -ffunction-sections -fdata-sections
+KBUILD_CFLAGS	+= -ffunction-sections -fdata-sections
 LINKFLAGS	+= --gc-sections
 endif
 
 ifndef CONFIG_FRAME_POINTER
-CFLAGS		+= -mno-linked-fp
+KBUILD_CFLAGS	+= -mno-linked-fp
 endif
 
 ifdef CONFIG_CPU_FR451_COMPILE
-CFLAGS		+= -mcpu=fr450
+KBUILD_CFLAGS	+= -mcpu=fr450
 AFLAGS		+= -mcpu=fr450
 ASFLAGS		+= -mcpu=fr450
 else
 ifdef CONFIG_CPU_FR551_COMPILE
-CFLAGS		+= -mcpu=fr550
+KBUILD_CFLAGS	+= -mcpu=fr550
 AFLAGS		+= -mcpu=fr550
 ASFLAGS		+= -mcpu=fr550
 else
-CFLAGS		+= -mcpu=fr400
+KBUILD_CFLAGS	+= -mcpu=fr400
 AFLAGS		+= -mcpu=fr400
 ASFLAGS		+= -mcpu=fr400
 endif
@@ -80,15 +80,15 @@
 # pretend the kernel is going to run on an FR400 with no media-fp unit
 # - reserve CC3 for use with atomic ops
 # - all the extra registers are dealt with only at context switch time
-CFLAGS		+= -mno-fdpic -mgpr-32 -msoft-float -mno-media
-CFLAGS		+= -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
+KBUILD_CFLAGS	+= -mno-fdpic -mgpr-32 -msoft-float -mno-media
+KBUILD_CFLAGS	+= -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
 AFLAGS		+= -mno-fdpic
 ASFLAGS		+= -mno-fdpic
 
 # make sure the .S files get compiled with debug info
 # and disable optimisations that are unhelpful whilst debugging
 ifdef CONFIG_DEBUG_INFO
-#CFLAGS		+= -O1
+#KBUILD_CFLAGS	+= -O1
 AFLAGS		+= -Wa,--gdwarf2
 ASFLAGS		+= -Wa,--gdwarf2
 endif