Automatically setting CMACHFLAGS -m680x0
David Brownlee <[email protected]> Sat, 24 Jan 2009 14:29:37 +0000 (GMT)
| Newsgroups | gmane.os.netbsd.ports.amiga,gmane.os.netbsd.ports.atari,gmane.os.netbsd.ports.m68k |
|---|---|
| Message-ID | <alpine.NEB.2.00.0901241417010.15027@localhost> |
I've taken another pass at setting CMACHFLAGS based on the
values of -DM68020, -DM68030, -DM68040, and -DM68060, plus
making it sharable between m68k ports.
It consists of a sys/arch/m68k/Makefile.cmachflags which
can be included by a given port's Makefile.${foo} (patch
for atari and amiga included).
Obviously this only makes sense for ports which have kernel
configs that target multiple CPU types (so that excludes
sun3 :)
The idea is Makefile.cmachflags is included IFF the config
file has not set CMACHFLAGS, allowing people to easily
override it.
It doesn't deal with adding -Wa,-m68030 or similar - that
should be decided by the port.
What do people think?
As an aside atari includes '-Wa,-m68030' in CMACHFLAGS
while amiga uses '-Wa,-m68030 -Wa,-m68851' - is there a
significance to the difference?
Makefile.cmachflags
(text/plain, 1.4 KB)
# $NetBSD$ # Set CMACHFLAGS best target the specific CPU combination, based on # -DM68020, -DM68030, -DM68040, and -DM68060 # This should typically be included iff the config file has not already set # CMACHFLAGS, eg: # .if !defined(CMACHFLAGS) # .include "$S/arch/m68k/Makefile.cmachflags" # CMACHFLAGS+= -Wa,-m68030 -Wa,-m68851 # .endif # Table of CPUs targetted vs gcc flags. Note: -m68020 and -m68030 are # ~identical, but they are both included for completeness. # 020 030 040 060 -m68020-60 # 030 040 060 -m68020-60 # 020 040 060 -m68020-60 # 020 030 060 -m68020-60 # 040 060 -m68020-60 (Would have been nice to have a -m68040-60) # 030 060 -m68020-60 # 020 060 -m68020-60 # 060 -m68060 # # 020 030 040 -m68020-40 # 030 040 -m68020-40 # 020 040 -m68020-40 # 040 -m68040 # # 020 030 -m68020 # 030 -m68030 # 020 -m68020 .if !empty(IDENT:M-DM68060) .if empty(IDENT:M-DM68020) && empty(IDENT:M-DM68030) && empty(IDENT:M-DM68040) CMACHFLAGS= -m68060 .else CMACHFLAGS= -m68020-60 .endif .elif !empty(IDENT:M-DM68040) .if empty(IDENT:M-DM68020) && empty(IDENT:M-DM68030) CMACHFLAGS= -m68040 .else /* !-DM68060 */ CMACHFLAGS= -m68020-40 .endif .elif !empty(IDENT:M-DM68020) CMACHFLAGS= -m68020 .else CMACHFLAGS= -m68030 .endif /* !-DM68060 */
diff
(text/plain, 1.5 KB)
Index: sys/arch/atari/conf/Makefile.atari
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/conf/Makefile.atari,v
retrieving revision 1.72
diff -u -r1.72 Makefile.atari
--- sys/arch/atari/conf/Makefile.atari 25 Jan 2008 20:02:06 -0000 1.72
+++ sys/arch/atari/conf/Makefile.atari 24 Jan 2009 14:27:42 -0000
@@ -27,10 +27,9 @@
## (2) compile settings
##
CPPFLAGS+= -Datari
-.if empty(IDENT:M-DM68060)
-CMACHFLAGS= -m68020
-.else
-CMACHFLAGS= -m68060 -Wa,-m68030
+.if !defined(CMACHFLAGS)
+.include "$S/arch/m68k/Makefile.cmachflags"
+CMACHFLAGS+= -Wa,-m68030
.endif
CFLAGS+= ${CMACHFLAGS} -msoft-float
AFLAGS+= -x assembler-with-cpp -traditional-cpp
Index: sys/arch/amiga/conf/Makefile.amiga
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/conf/Makefile.amiga,v
retrieving revision 1.105
diff -u -r1.105 Makefile.amiga
--- sys/arch/amiga/conf/Makefile.amiga 25 Jan 2008 19:39:22 -0000 1.105
+++ sys/arch/amiga/conf/Makefile.amiga 24 Jan 2009 14:27:42 -0000
@@ -32,10 +32,9 @@
## (2) compile settings
##
CPPFLAGS+= -Damiga -DFPCOPROC
-.if empty(IDENT:M-DM68060)
-CMACHFLAGS= -m68020
-.else
-CMACHFLAGS= -m68060 -Wa,-m68030 -Wa,-m68851
+.if !defined(CMACHFLAGS)
+.include "$S/arch/m68k/Makefile.cmachflags"
+CMACHFLAGS+= -Wa,-m68030 -Wa,-m68851
.endif
CFLAGS+= ${CMACHFLAGS} -msoft-float
AFLAGS+= -x assembler-with-cpp -traditional-cpp