aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
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 /arch/um
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 'arch/um')
-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
7 files changed, 12 insertions, 12 deletions
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))