From d941ddfee0c5350725566a1cbb310e3d82bb33ee Mon Sep 17 00:00:00 2001
From: thorpej <thorpej@NetBSD.org>
Date: Tue, 4 Jun 2002 21:39:09 +0000
Subject: [PATCH] Don't use -traditional-cpp if HAVE_GCC3.

---
 sys/arch/amiga/conf/Makefile.amiga     |  6 +++++-
 sys/arch/atari/conf/Makefile.atari     |  6 +++++-
 sys/arch/cesfic/conf/Makefile.cesfic   |  6 +++++-
 sys/arch/hp300/conf/Makefile.hp300     |  6 +++++-
 sys/arch/i386/conf/Makefile.i386       |  6 +++++-
 sys/arch/luna68k/conf/Makefile.luna68k |  6 +++++-
 sys/arch/m68k/fpsp/Makefile            |  6 +++++-
 sys/arch/mac68k/conf/Makefile.mac68k   | 11 ++++++-----
 sys/arch/mips/conf/Makefile.mips       |  6 +++++-
 sys/arch/mvme68k/conf/Makefile.mvme68k |  6 +++++-
 sys/arch/news68k/conf/Makefile.news68k |  6 +++++-
 sys/arch/next68k/conf/Makefile.next68k |  6 +++++-
 sys/arch/sparc/conf/Makefile.sparc     |  6 +++++-
 sys/arch/sparc64/conf/Makefile.sparc64 |  6 +++++-
 sys/arch/sun2/conf/Makefile.sun2       | 17 ++++++-----------
 sys/arch/sun3/conf/Makefile.sun3       |  6 +++++-
 sys/arch/x68k/conf/Makefile.x68k       |  6 +++++-
 17 files changed, 87 insertions(+), 31 deletions(-)

diff --git a/sys/arch/amiga/conf/Makefile.amiga b/sys/arch/amiga/conf/Makefile.amiga
index 6714ad65b204..8a14c0b97a61 100644
--- a/sys/arch/amiga/conf/Makefile.amiga
+++ b/sys/arch/amiga/conf/Makefile.amiga
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amiga,v 1.99 2002/05/26 12:47:42 jdolecek Exp $
+#	$NetBSD: Makefile.amiga,v 1.100 2002/06/04 21:39:09 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -38,7 +38,11 @@ CMACHFLAGS=	-m68020
 CMACHFLAGS=	-m68060 -Wa,-m68030 -Wa,-m68851
 .endif
 CFLAGS+=	${CMACHFLAGS} -msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/atari/conf/Makefile.atari b/sys/arch/atari/conf/Makefile.atari
index f3ca728a5b3f..ae13b45f181b 100644
--- a/sys/arch/atari/conf/Makefile.atari
+++ b/sys/arch/atari/conf/Makefile.atari
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.atari,v 1.66 2001/12/09 05:00:43 atatat Exp $
+#	$NetBSD: Makefile.atari,v 1.67 2002/06/04 21:39:09 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -33,7 +33,11 @@ CMACHFLAGS=	-m68020
 CMACHFLAGS=	-m68060 -Wa,-m68030
 .endif
 CFLAGS+=	${CMACHFLAGS} -msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/cesfic/conf/Makefile.cesfic b/sys/arch/cesfic/conf/Makefile.cesfic
index f1996450efe9..656da62d1aaf 100644
--- a/sys/arch/cesfic/conf/Makefile.cesfic
+++ b/sys/arch/cesfic/conf/Makefile.cesfic
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.cesfic,v 1.7 2001/12/09 05:00:43 atatat Exp $
+#	$NetBSD: Makefile.cesfic,v 1.8 2002/06/04 21:39:09 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -34,7 +34,11 @@ GENASSYM=	${CESFIC}/cesfic/genassym.cf
 WEAK_POINTERS=	yes
 CWARNFLAGS+=	-Wno-format
 CFLAGS+=	-msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp -Wa,-m68030 -Wa,-m68851 -Wa,-m68040
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp -Wa,-m68030 -Wa,-m68851 -Wa,-m68040
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/hp300/conf/Makefile.hp300 b/sys/arch/hp300/conf/Makefile.hp300
index 86c3f7fa28ad..55281cba19b2 100644
--- a/sys/arch/hp300/conf/Makefile.hp300
+++ b/sys/arch/hp300/conf/Makefile.hp300
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.hp300,v 1.82 2001/12/09 05:00:44 atatat Exp $
+#	$NetBSD: Makefile.hp300,v 1.83 2002/06/04 21:39:10 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -33,7 +33,11 @@ GENASSYM=	${HP300}/hp300/genassym.cf
 ##
 CPPFLAGS+=	-Dhp300
 CFLAGS+=	-msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/i386/conf/Makefile.i386 b/sys/arch/i386/conf/Makefile.i386
index 7b3f7959e674..af7f667e10d2 100644
--- a/sys/arch/i386/conf/Makefile.i386
+++ b/sys/arch/i386/conf/Makefile.i386
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.i386,v 1.122 2001/12/09 05:00:45 atatat Exp $
+#	$NetBSD: Makefile.i386,v 1.123 2002/06/04 21:39:10 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -32,7 +32,11 @@ GENASSYM=	${I386}/i386/genassym.cf
 ## (2) compile settings
 ##
 CPPFLAGS+=	-Di386
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/luna68k/conf/Makefile.luna68k b/sys/arch/luna68k/conf/Makefile.luna68k
index 75e9fb400c28..a1e22b8f965d 100644
--- a/sys/arch/luna68k/conf/Makefile.luna68k
+++ b/sys/arch/luna68k/conf/Makefile.luna68k
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.luna68k,v 1.13 2001/12/09 05:00:45 atatat Exp $
+#	$NetBSD: Makefile.luna68k,v 1.14 2002/06/04 21:39:10 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -32,7 +32,11 @@ GENASSYM=	${LUNA68K}/luna68k/genassym.cf
 ##
 CPPFLAGS+=	-Dluna68k
 CFLAGS+=	-msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/m68k/fpsp/Makefile b/sys/arch/m68k/fpsp/Makefile
index 34a8229cd997..e4f28dca2ddd 100644
--- a/sys/arch/m68k/fpsp/Makefile
+++ b/sys/arch/m68k/fpsp/Makefile
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2001/10/07 01:39:51 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.10 2002/06/04 21:39:10 thorpej Exp $
 
 #	MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
 #	M68000 Hi-Performance Microprocessor Division
@@ -47,7 +47,11 @@ CPPFLAGS=	${FPSPCPPFLAGS} ${FPSPMISCCPPFLAGS}
 
 AS?		= as
 LD?		= ld
+.if defined(HAVE_GCC3)
+AFLAGS		= -x assembler-with-cpp -m68040
+.else
 AFLAGS		= -x assembler-with-cpp -traditional-cpp -m68040
+.endif
 
 #
 # For the Library Version:
diff --git a/sys/arch/mac68k/conf/Makefile.mac68k b/sys/arch/mac68k/conf/Makefile.mac68k
index 48fddaa42788..7bccc4a87267 100644
--- a/sys/arch/mac68k/conf/Makefile.mac68k
+++ b/sys/arch/mac68k/conf/Makefile.mac68k
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.mac68k,v 1.83 2001/12/09 05:00:45 atatat Exp $
+#	$NetBSD: Makefile.mac68k,v 1.84 2002/06/04 21:39:10 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -33,10 +33,11 @@ GENASSYM=	${MAC68K}/mac68k/genassym.cf
 ##
 CPPFLAGS+=	-Dmac68k
 CFLAGS+=	-msoft-float
-AFLAGS+=	-traditional
-
-NORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's/^\#.*//' | \
-		${AS} -o ${.TARGET}
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
+AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/mips/conf/Makefile.mips b/sys/arch/mips/conf/Makefile.mips
index b2abaf7f8945..229563236423 100644
--- a/sys/arch/mips/conf/Makefile.mips
+++ b/sys/arch/mips/conf/Makefile.mips
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.mips,v 1.26 2002/03/05 14:28:31 simonb Exp $
+#	$NetBSD: Makefile.mips,v 1.27 2002/06/04 21:39:11 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -59,7 +59,11 @@ CPPFLAGS+=	-D${MACHINE}
 DEFGP?=		-G 0
 GP?=		${DEFGP}
 CFLAGS+=	${ENDIAN} ${GP} -mno-abicalls -mno-half-pic
+.if defined(HAVE_GCC3)
+AFLAGS+=	${ENDIAN} -x assembler-with-cpp
+.else
 AFLAGS+=	${ENDIAN} -x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/mvme68k/conf/Makefile.mvme68k b/sys/arch/mvme68k/conf/Makefile.mvme68k
index 8b080f9ad0ad..55fd98a0b71c 100644
--- a/sys/arch/mvme68k/conf/Makefile.mvme68k
+++ b/sys/arch/mvme68k/conf/Makefile.mvme68k
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.mvme68k,v 1.55 2001/12/09 05:00:47 atatat Exp $
+#	$NetBSD: Makefile.mvme68k,v 1.56 2002/06/04 21:39:11 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -46,7 +46,11 @@ CMACHFLAGS=	-m68020-60 -Wa,-m68030 -Wa,-m68851
 .endif
 .endif
 CFLAGS+=	${CMACHFLAGS} -msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/news68k/conf/Makefile.news68k b/sys/arch/news68k/conf/Makefile.news68k
index b03dc9109fe8..ca68df4867c9 100644
--- a/sys/arch/news68k/conf/Makefile.news68k
+++ b/sys/arch/news68k/conf/Makefile.news68k
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.news68k,v 1.13 2001/12/09 05:00:48 atatat Exp $
+#	$NetBSD: Makefile.news68k,v 1.14 2002/06/04 21:39:11 thorpej Exp $
 #
 # Makefile for NetBSD
 #
@@ -36,7 +36,11 @@ GENASSYM=	${NEWS68K}/news68k/genassym.cf
 ##
 CPPFLAGS+=	-Dnews68k
 CFLAGS+=	-msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/next68k/conf/Makefile.next68k b/sys/arch/next68k/conf/Makefile.next68k
index c013fd263120..a38feaab25e5 100644
--- a/sys/arch/next68k/conf/Makefile.next68k
+++ b/sys/arch/next68k/conf/Makefile.next68k
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.next68k,v 1.23 2001/12/09 05:00:48 atatat Exp $
+# $NetBSD: Makefile.next68k,v 1.24 2002/06/04 21:39:11 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -33,7 +33,11 @@ GENASSYM=	${NEXT68K}/next68k/genassym.cf
 ##
 CPPFLAGS+=	-Dnext68k
 CFLAGS+=	-msoft-float
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/sparc/conf/Makefile.sparc b/sys/arch/sparc/conf/Makefile.sparc
index 3e268c862e9c..f4a661e095ea 100644
--- a/sys/arch/sparc/conf/Makefile.sparc
+++ b/sys/arch/sparc/conf/Makefile.sparc
@@ -1,4 +1,4 @@
-# 	$NetBSD: Makefile.sparc,v 1.79 2002/01/22 17:04:31 pk Exp $
+# 	$NetBSD: Makefile.sparc,v 1.80 2002/06/04 21:39:12 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -34,7 +34,11 @@ GENASSYM=	${SPARC}/sparc/genassym.cf
 # work around GCC (egcs-2.91.66) bug which is liable
 # to use FPU registers as temporaries:
 CFLAGS+=	-mno-fpu
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/sparc64/conf/Makefile.sparc64 b/sys/arch/sparc64/conf/Makefile.sparc64
index 4bee578368fa..fd010b37178a 100644
--- a/sys/arch/sparc64/conf/Makefile.sparc64
+++ b/sys/arch/sparc64/conf/Makefile.sparc64
@@ -1,4 +1,4 @@
-# 	$NetBSD: Makefile.sparc64,v 1.45 2002/03/19 18:10:33 eeh Exp $
+# 	$NetBSD: Makefile.sparc64,v 1.46 2002/06/04 21:39:12 thorpej Exp $
 
 #=========================================================================
 #
@@ -70,7 +70,11 @@ CPPFLAGS+=	-m32 -Wa,-Av8plusa -mcpu=ultrasparc
 AFLAGS+=	-Wa,-Av8plusa
 .endif
 CFLAGS+=	-mno-fpu
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 NOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
 
diff --git a/sys/arch/sun2/conf/Makefile.sun2 b/sys/arch/sun2/conf/Makefile.sun2
index b6a58c801ead..5cfeace7072c 100644
--- a/sys/arch/sun2/conf/Makefile.sun2
+++ b/sys/arch/sun2/conf/Makefile.sun2
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sun2,v 1.12 2002/01/28 21:29:46 thorpej Exp $
+# $NetBSD: Makefile.sun2,v 1.13 2002/06/04 21:39:12 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -30,17 +30,13 @@ GENASSYM=	${SUN2}/sun2/genassym.cf
 ##
 ## (2) compile settings
 ##
-# Override CPP defaults entirely, so cross-compilation works.
-# Keep -nostdinc before all -I flags, similar for -undef ...
 CPPFLAGS+=	-Dsun2
 CFLAGS+=	-msoft-float -fno-defer-pop
-APPFLAGS=	-x assembler-with-cpp -P -traditional ${CPPFLAGS} -D_LOCORE
-
-# Do NOT assume the compiler does "-x funny_format" (gcc-specific)
-# This needs an intermediate file.  The original file is always
-# safe in some far away directory, so just use the base name.
-NORMAL_S=	${CPP} ${APPFLAGS} $< > $*.s ;\
-		${AS} -o $@ $*.s ; rm $*.s
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
+AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
@@ -87,7 +83,6 @@ stub.o: Makefile
 ##
 ## (7) misc settings
 ##
-MKDEP_AFLAGS=	${APPFLAGS}
 
 ##
 ## (8) config(8) generated machinery
diff --git a/sys/arch/sun3/conf/Makefile.sun3 b/sys/arch/sun3/conf/Makefile.sun3
index ccb002049dc6..5e3e6300a9a2 100644
--- a/sys/arch/sun3/conf/Makefile.sun3
+++ b/sys/arch/sun3/conf/Makefile.sun3
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.sun3,v 1.94 2002/05/30 22:02:13 thorpej Exp $
+# $NetBSD: Makefile.sun3,v 1.95 2002/06/04 21:39:12 thorpej Exp $
 
 # Makefile for NetBSD
 #
@@ -33,7 +33,11 @@ GENASSYM=	${SUN3}/${MACHTYPE}/genassym.cf
 ##
 CPPFLAGS+=	-Dsun3
 CFLAGS+=	${CMACHFLAGS} -msoft-float -fno-defer-pop
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 
 ##
 ## (3) libkern and compat
diff --git a/sys/arch/x68k/conf/Makefile.x68k b/sys/arch/x68k/conf/Makefile.x68k
index a5a8d8f453a2..f61811324a29 100644
--- a/sys/arch/x68k/conf/Makefile.x68k
+++ b/sys/arch/x68k/conf/Makefile.x68k
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.x68k,v 1.55 2001/12/04 15:22:29 minoura Exp $
+#	$NetBSD: Makefile.x68k,v 1.56 2002/06/04 21:39:13 thorpej Exp $
 #
 # Makefile for NetBSD
 #
@@ -32,7 +32,11 @@ GENASSYM=	${X68K}/x68k/genassym.cf
 ## (2) compile settings
 ##
 CPPFLAGS+=	-Dx68k
+.if defined(HAVE_GCC3)
+AFLAGS+=	-x assembler-with-cpp
+.else
 AFLAGS+=	-x assembler-with-cpp -traditional-cpp
+.endif
 CMACHFLAGS?=	-m68020-60 -Wa,-m68030 -Wa,-m68851
 CFLAGS+=	${CMACHFLAGS} -msoft-float