public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] factor common GCC options check
@ 2002-10-30  3:15 Brian Gerst
  2002-10-30  3:27 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Gerst @ 2002-10-30  3:15 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 74 bytes --]

Make the test for supported GCC options into a macro.

--
				Brian Gerst

[-- Attachment #2: checkgcc-1 --]
[-- Type: text/plain, Size: 2237 bytes --]

diff -urN linux-2.5.44-bk4/arch/i386/Makefile linux/arch/i386/Makefile
--- linux-2.5.44-bk4/arch/i386/Makefile	Tue Oct 29 21:24:37 2002
+++ linux/arch/i386/Makefile	Tue Oct 29 22:09:30 2002
@@ -22,19 +22,21 @@
 
 CFLAGS += -pipe
 
+check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+
 # prevent gcc from keeping the stack 16 byte aligned
-CFLAGS += $(shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi)
+CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
 
 cflags-$(CONFIG_M386)		+= -march=i386
 cflags-$(CONFIG_M486)		+= -march=i486
 cflags-$(CONFIG_M586)		+= -march=i586
 cflags-$(CONFIG_M586TSC)	+= -march=i586
-cflags-$(CONFIG_M586MMX)	+= $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo "-march=i586"; fi) 
+cflags-$(CONFIG_M586MMX)	+= $(call check_gcc,-march=pentium-mmx,-march=i586)
 cflags-$(CONFIG_M686)		+= -march=i686
-cflags-$(CONFIG_MPENTIUMIII)	+= $(shell if $(CC) -march=pentium3 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium3"; else echo "-march=i686"; fi) 
-cflags-$(CONFIG_MPENTIUM4)	+= $(shell if $(CC) -march=pentium4 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium4"; else echo "-march=i686"; fi) 
-cflags-$(CONFIG_MK6)		+= $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
-cflags-$(CONFIG_MK7)		+= $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; else echo "-march=i686 -malign-functions=4"; fi) 
+cflags-$(CONFIG_MPENTIUMIII)	+= $(call check_gcc,-march=pentium3,-march=i686)
+cflags-$(CONFIG_MPENTIUM4)	+= $(call check_gcc,-march=pentium4,-march=i686)
+cflags-$(CONFIG_MK6)		+= $(call check_gcc,-march=k6,-march=i586)
+cflags-$(CONFIG_MK7)		+= $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
 cflags-$(CONFIG_MCRUSOE)	+= -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
 cflags-$(CONFIG_MWINCHIPC6)	+= -march=i586
 cflags-$(CONFIG_MWINCHIP2)	+= -march=i586

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] factor common GCC options check
  2002-10-30  3:15 [PATCH] factor common GCC options check Brian Gerst
@ 2002-10-30  3:27 ` Jeff Garzik
  2002-10-30  3:51   ` Brian Gerst
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2002-10-30  3:27 UTC (permalink / raw)
  To: Brian Gerst; +Cc: Linus Torvalds, Linux-Kernel

If you were really motivated you could test for and add the options I 
added to gcc a couple months ago,
    -march={winchip-c6,winchip2,c3}




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] factor common GCC options check
  2002-10-30  3:27 ` Jeff Garzik
@ 2002-10-30  3:51   ` Brian Gerst
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Gerst @ 2002-10-30  3:51 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Linus Torvalds, Linux-Kernel

[-- Attachment #1: Type: text/plain, Size: 146 bytes --]

Revised patch:
Make the test for supported GCC options into a macro, and add new checks 
for -march={winchip-c6,winchip2,c3}.

--
				Brian Gerst

[-- Attachment #2: checkgcc-2 --]
[-- Type: text/plain, Size: 2579 bytes --]

diff -urN linux-2.5.44-bk4/arch/i386/Makefile linux/arch/i386/Makefile
--- linux-2.5.44-bk4/arch/i386/Makefile	Tue Oct 29 21:24:37 2002
+++ linux/arch/i386/Makefile	Tue Oct 29 22:43:49 2002
@@ -22,24 +22,26 @@
 
 CFLAGS += -pipe
 
+check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)
+
 # prevent gcc from keeping the stack 16 byte aligned
-CFLAGS += $(shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi)
+CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
 
 cflags-$(CONFIG_M386)		+= -march=i386
 cflags-$(CONFIG_M486)		+= -march=i486
 cflags-$(CONFIG_M586)		+= -march=i586
 cflags-$(CONFIG_M586TSC)	+= -march=i586
-cflags-$(CONFIG_M586MMX)	+= $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo "-march=i586"; fi) 
+cflags-$(CONFIG_M586MMX)	+= $(call check_gcc,-march=pentium-mmx,-march=i586)
 cflags-$(CONFIG_M686)		+= -march=i686
-cflags-$(CONFIG_MPENTIUMIII)	+= $(shell if $(CC) -march=pentium3 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium3"; else echo "-march=i686"; fi) 
-cflags-$(CONFIG_MPENTIUM4)	+= $(shell if $(CC) -march=pentium4 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=pentium4"; else echo "-march=i686"; fi) 
-cflags-$(CONFIG_MK6)		+= $(shell if $(CC) -march=k6 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=k6"; else echo "-march=i586"; fi)
-cflags-$(CONFIG_MK7)		+= $(shell if $(CC) -march=athlon -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-march=athlon"; else echo "-march=i686 -malign-functions=4"; fi) 
+cflags-$(CONFIG_MPENTIUMIII)	+= $(call check_gcc,-march=pentium3,-march=i686)
+cflags-$(CONFIG_MPENTIUM4)	+= $(call check_gcc,-march=pentium4,-march=i686)
+cflags-$(CONFIG_MK6)		+= $(call check_gcc,-march=k6,-march=i586)
+cflags-$(CONFIG_MK7)		+= $(call check_gcc,-march=athlon,-march=i686 -malign-functions=4)
 cflags-$(CONFIG_MCRUSOE)	+= -march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
-cflags-$(CONFIG_MWINCHIPC6)	+= -march=i586
-cflags-$(CONFIG_MWINCHIP2)	+= -march=i586
+cflags-$(CONFIG_MWINCHIPC6)	+= $(call check_gcc,-march=winchip-c6,-march=i586)
+cflags-$(CONFIG_MWINCHIP2)	+= $(call check_gcc,-march=winchip2,-march=i586)
 cflags-$(CONFIG_MWINCHIP3D)	+= -march=i586
-cflags-$(CONFIG_MCYRIXIII)	+= -march=i586
+cflags-$(CONFIG_MCYRIXIII)	+= $(call check_gcc,-march=c3,-march=i586)
 
 CFLAGS += $(cflags-y)
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-30  3:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-30  3:15 [PATCH] factor common GCC options check Brian Gerst
2002-10-30  3:27 ` Jeff Garzik
2002-10-30  3:51   ` Brian Gerst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox