Set target_arch `echo {target_canonical} | sed -e 's/-.*-.*//'`
+If "{target_arch}" =~ /powerpc/
+ Set short_arch_name "ppc"
+ Set target_cpu "powerpc"
+Else
+ Set short_arch_name "{target_arch}"
+End If
+
# The following works for many configurations, though not all.
Set obj_format `echo {target_canonical} | sed -e 's/.*-.*-//'`
Set TDEFINES ""
+Set EXTRA_OBJECTS ""
+
If "{target_canonical}" =~ /m68k-apple-macos/
Set obj_format "coff"
Set TDEFINES '-d M68KCOFF'
-Else If "{target_canonical}" =~ /ppc-apple-macos/
- Set obj_format "xcoff"
+ Set EXTRA_OBJECTS '"{o}"m68k-parse.c.o'
+Else If "{target_canonical}" =~ /powerpc-apple-macos/
+ Set obj_format "coff"
Set bfd_gas yes
Else If "{target_canonical}" =~ /i386-unknown-go32/
Set obj_format "coff"
forward-include "{srcroot}"opcodes:sh-opc.h 'opcodes/sh-opc.h'
End If
-forward-include "{srcdir}"config:tc-{target_arch}.c targ-cpu.c
-forward-include "{srcdir}"config:tc-{target_arch}.h targ-cpu.h
+forward-include "{srcdir}"config:tc-{short_arch_name}.c targ-cpu.c
+forward-include "{srcdir}"config:tc-{short_arch_name}.h targ-cpu.h
forward-include "{srcdir}"config:obj-{obj_format}.c obj-format.c
forward-include "{srcdir}"config:obj-{obj_format}.h obj-format.h
forward-include "{srcdir}"config:atof-ieee.c atof-targ.c
End If
-Echo '# From mpw-config.in' > "{o}"mk.tmp
-
-Echo 'VERSION = ' `Search 'VERSION=' "{srcdir}"Makefile.in | sed -e 's/.*VERSION=\(.*\)/\1/'` >> "{o}"mk.tmp
-
+Echo '# From mpw-config.in' > "{o}"mk.tmp
+Echo "TDEFINES = " {TDEFINES} >> "{o}"mk.tmp
+Echo "EXTRA_OBJECTS = " {EXTRA_OBJECTS} >> "{o}"mk.tmp
+# (We use the -n option here so as not to get extra spaces inserted)
+Echo -n 'TARG_CPU_DEP = {TARG_CPU_DEP_' >> "{o}"mk.tmp
+Echo -n {short_arch_name} >> "{o}"mk.tmp
+Echo -n '}' >> "{o}"mk.tmp
+Echo '# End from mpw-config.in' >> "{o}"mk.tmp
+
+Echo '/* conf. Generated by mpw-configure. */' > "{o}"conf.new
+Echo -n '#define TARGET_CPU "' >> "{o}"conf.new
+Echo -n "{target_cpu}" >> "{o}"conf.new
+Echo '"' >> "{o}"conf.new
+Echo -n '#define TARGET_ALIAS "' >> "{o}"conf.new
+Echo -n "{target_alias}" >> "{o}"conf.new
+Echo '"' >> "{o}"conf.new
+Echo -n '#define TARGET_CANONICAL "' >> "{o}"conf.new
+Echo -n "{target_canonical}" >> "{o}"conf.new
+Echo '"' >> "{o}"conf.new
+Echo '#include "mpw.h"' >> "{o}"conf.new
If "{bfd_gas}" =~ /yes/
- Echo "HACK_O_RAMA = BFD_ASSEMBLER" >> "{o}"mk.tmp
+ Echo "#define BFD_ASSEMBLER" >> "{o}"conf.new
Else
- Echo "HACK_O_RAMA = MANY_SEGMENTS" >> "{o}"mk.tmp
+ Echo "#define MANY_SEGMENTS" >> "{o}"conf.new
End If
+Echo '#define CR_EOL' >> "{o}"conf.new
+Echo '#define OBJ_COFF_OMIT_TIMESTAMP' >> "{o}"conf.new
+Echo '#define LOSING_COMPILER' >> "{o}"conf.new
-Echo "TDEFINES = " {TDEFINES} >> "{o}"mk.tmp
+MoveIfChange "{o}"conf.new "{o}"conf
-Echo '# End from mpw-config.in' >> "{o}"mk.tmp
+sed -e "s/@srcdir@/{srcdir}/" "{srcdir}"gdbinit.in > "{o}"_gdbinit
+++ /dev/null
-# Makefile fragment for GAS.
-
-s = "{srcdir}"
-
-o = :
-
-CROSS = -d CROSS_COMPILE
-
-ALL_CFLAGS = {CFLAGS} {CROSS} {TDEFINES} -i "{topsrcdir}"include: -i "{topsrcdir}"bfd:,"{srcdir}",::libiberty:,::bfd:,::extra-include,"{srcroot}"include:mpw:
-# debug options: -mbg on -sym on
-
-"{o}" \Option-f : "{s}"
-
-# Default rule that puts each file into separate segment.
-
-.c.o \Option-f .c
- {CC} {DepDir}{Default}.c {ALL_CFLAGS} -s gas_{Default} -o {TargDir}{Default}.c.o
-
-prefix = usr:local:
-
-bindir = {prefix}bin:
-
-OBJECTS = \Option-d
- "{o}"app.c.o \Option-d
- "{o}"as.c.o \Option-d
- "{o}"atof-generic.c.o \Option-d
- "{o}"bignum-copy.c.o \Option-d
- "{o}"cond.c.o \Option-d
- "{o}"expr.c.o \Option-d
- "{o}"flonum-konst.c.o \Option-d
- "{o}"flonum-copy.c.o \Option-d
- "{o}"flonum-mult.c.o \Option-d
- "{o}"frags.c.o \Option-d
- "{o}"hash.c.o \Option-d
- "{o}"input-file.c.o \Option-d
- "{o}"input-scrub.c.o \Option-d
- "{o}"listing.c.o \Option-d
- "{o}"messages.c.o \Option-d
- "{o}"output-file.c.o \Option-d
- "{o}"read.c.o \Option-d
- "{o}"stabs.c.o \Option-d
- "{o}"subsegs.c.o \Option-d
- "{o}"symbols.c.o \Option-d
- "{o}"write.c.o \Option-d
- "{o}"ecoff.c.o
-
-
-TARG_OBJECTS = "{o}"obj-format.c.o "{o}"targ-cpu.c.o "{o}"atof-targ.c.o
-
-# If you put config.h in INCLUDES, then MPW's stupid make will always
-# want to rebuild everything. Better to do in two stages.
-
-INCLUDES =
-# "{o}"config.h
-# host.h
-#"{s}".h
-
-CLIBS = ::libiberty:libiberty.o ::bfd:libbfd.o ::opcodes:libopcodes.o
-
-all \Option-f "{o}"config.h as.new
-
-as.new \Option-f\Option-f {OBJECTS} {TARG_OBJECTS} {CLIBS} "{o}"Version.r
- Rez -rd -o as.new "{o}"Version.r -append
- Link {LDFLAGS} -o as.new {OBJECTS} {TARG_OBJECTS} {CLIBS} {EXTRALIBS}
-
-"{o}"config.h \Option-f "{o}"config-stamp
-
-"{o}"config-stamp \Option-f Makefile
- Delete -i -y "{o}"config.new "{o}"config-stamp
- Echo '#ifndef GAS_VERSION' > "{o}"config.new
- Echo '#define GAS_VERSION "{VERSION}"' >> "{o}"config.new
- Echo '#define TARGET_CPU "{target_cpu}"' >> "{o}"config.new
- Echo '#define TARGET_ALIAS "{target_alias}"' >> "{o}"config.new
- Echo '#define TARGET_CANONICAL "{target_canonical}"' >> "{o}"config.new
- Echo '#define bzero(a,b) memset(a,0,b)' >> "{o}"config.new
- Echo '#define bcopy(a,b,c) memcpy(b,a,c)' >> "{o}"config.new
- Echo '#define bcmp(a,b,c) memcmp(a,b,c)' >> "{o}"config.new
- Echo '#define M_ANSI 1' >> "{o}"config.new
- Echo '#include <stdlib.h>' >> "{o}"config.new
- Echo '#include <string.h>' >> "{o}"config.new
- Echo '#include <memory.h>' >> "{o}"config.new
- Echo '#include <spin.h>' >> "{o}"config.new
- Echo 'char *strdup();' >> "{o}"config.new
- Echo '#ifdef MPW_C' >> "{o}"config.new
- Echo '#undef __PTR_TO_INT' >> "{o}"config.new
- Echo '#define __PTR_TO_INT(P) ((int)(P))' >> "{o}"config.new
- Echo '#undef __INT_TO_PTR' >> "{o}"config.new
- Echo '#define __INT_TO_PTR(P) ((char *)(P))' >> "{o}"config.new
- Echo '#endif' >> "{o}"config.new
- Echo '#define sys_nerr _sys_nerr' >> "{o}"config.new
- Echo '#define sys_errlist _sys_errlist' >> "{o}"config.new
- Echo '#ifdef __STDIO__' >> "{o}"config.new
- Echo 'FILE *mpw_fopen();' >> "{o}"config.new
- Echo '#endif' >> "{o}"config.new
- Echo '#define fopen mpw_fopen' >> "{o}"config.new
- Echo '#define fseek mpw_fseek' >> "{o}"config.new
- Echo '#define abort mpw_abort' >> "{o}"config.new
- Echo '#define TRUE_FALSE_ALREADY_DEFINED' >> "{o}"config.new
- Echo '#define CR_EOL' >> "{o}"config.new
- Echo '#define ABORT_ON_ERROR' >> "{o}"config.new
- Echo '#define LOSING_COMPILER' >> "{o}"config.new
- Echo '#define HOST_SPECIAL_INIT(argc,argv) mpw_special_init ((argv)[0]);' >> "{o}"config.new
- Echo '#define WANT_FOPEN_BIN' >> "{o}"config.new
- Echo '#define HAVE_ERRNO_H' >> "{o}"config.new
- Echo '#define HAVE_STDARG_H' >> "{o}"config.new
- Echo '#define ' {HACK_O_RAMA} >> "{o}"config.new
- Echo '#define OBJ_COFF_OMIT_TIMESTAMP' >> "{o}"config.new
- Echo '#endif /* GAS_VERSION */' >> "{o}"config.new
- MoveIfChange "{o}"config.new "{o}"config.h
- Echo ' ' >"{o}"config-stamp
-
-
-"{o}"Version.r \Option-f "{o}"version-stamp
-
-"{o}"version-stamp \Option-f Makefile
- Delete -i -y "{o}"version.new "{o}"version-stamp
- Set major 0
- Set minor 0
- Set release 0
- Echo '/* Version resources. */' > "{o}"version.new
- Echo '#include "SysTypes.r"' >> "{o}"version.new
- Echo '' >> "{o}"version.new
- Echo "resource 'vers' (1) " `open-brace` >> "{o}"version.new
- Echo " {major}," >> "{o}"version.new
- Echo " {minor}," >> "{o}"version.new
- Echo " {release}," >> "{o}"version.new
- Echo ' 0,' >> "{o}"version.new
- Echo ' verUs,' >> "{o}"version.new
- Echo ' "{VERSION}",' >> "{o}"version.new
- Echo ' "{VERSION} (c) 1986-95 FSF, Inc. "' >> "{o}"version.new
- Echo '};' >> "{o}"version.new
- Echo '' >> "{o}"version.new
- Echo "resource 'vers' (2, purgeable) " `open-brace` >> "{o}"version.new
- Echo " {major}," >> "{o}"version.new
- Echo " {minor}," >> "{o}"version.new
- Echo " {release}," >> "{o}"version.new
- Echo ' 0,' >> "{o}"version.new
- Echo ' verUs,' >> "{o}"version.new
- Echo ' "{VERSION}",' >> "{o}"version.new
- Echo ' "GNU AS for MPW"' >> "{o}"version.new
- Echo '};' >> "{o}"version.new
- MoveIfChange "{o}"version.new "{o}"Version.r
- Echo ' ' > "{o}"version-stamp
-
-"{o}"app.c.o \Option-f "{s}"app.c {INCLUDES}
-"{o}"as.c.o \Option-f "{s}"as.c {INCLUDES}
-"{o}"atof-generic.c.o \Option-f "{s}"atof-generic.c {INCLUDES}
-"{o}"bignum-copy.c.o \Option-f "{s}"bignum-copy.c {INCLUDES}
-"{o}"cond.c.o \Option-f "{s}"cond.c {INCLUDES}
-"{o}"expr.c.o \Option-f "{s}"expr.c {INCLUDES}
-"{o}"flonum-konst.c.o \Option-f "{s}"flonum-konst.c {INCLUDES}
-"{o}"flonum-copy.c.o \Option-f "{s}"flonum-copy.c {INCLUDES}
-"{o}"flonum-mult.c.o \Option-f "{s}"flonum-mult.c {INCLUDES}
-"{o}"frags.c.o \Option-f "{s}"frags.c {INCLUDES}
-"{o}"hash.c.o \Option-f "{s}"hash.c {INCLUDES}
-"{o}"input-file.c.o \Option-f "{s}"input-file.c {INCLUDES}
-"{o}"input-scrub.c.o \Option-f "{s}"input-scrub.c {INCLUDES}
-"{o}"listing.c.o \Option-f "{s}"listing.c {INCLUDES}
-"{o}"messages.c.o \Option-f "{s}"messages.c {INCLUDES}
-"{o}"output-file.c.o \Option-f "{s}"output-file.c {INCLUDES}
-"{o}"read.c.o \Option-f "{s}"read.c {INCLUDES}
-"{o}"subsegs.c.o \Option-f "{s}"subsegs.c {INCLUDES}
-"{o}"symbols.c.o \Option-f "{s}"symbols.c {INCLUDES}
-"{o}"write.c.o \Option-f "{s}"write.c {INCLUDES}
-"{o}"ecoff.c.o \Option-f "{s}"ecoff.c {INCLUDES}
-
-"{o}"targ-cpu.c.o \Option-f "{o}"targ-cpu.c {INCLUDES}
-"{o}"obj-format.c.o \Option-f "{o}"obj-format.c {INCLUDES}
-"{o}"atof-targ.c.o \Option-f "{o}"atof-targ.c {INCLUDES}
-
-install \Option-f all install-only
-
-install-only \Option-f
- If "`Exists "{prefix}"`" == ""
- Echo "{prefix}" does not exist, cannot install anything
- Exit 1
- End If
- If "`Exists "{bindir}"`" == ""
- NewFolder "{bindir}"
- End If
- Duplicate -y :as.new "{bindir}"as
--- /dev/null
+# Sed commands that finish translating the GAS Unix Makefile to MPW syntax.
+
+/^# @target_frag@/a\
+\
+HDEFINES = \
+LOCAL_LOADLIBES = \
+
+/^srcroot = /s/^/#/
+/^target_alias = /s/^/#/
+
+/INCLUDES/s/-i "{srcdir}":\([a-z]*\)/-i "{topsrcdir}"\1/
+/INCLUDES/s/-i "{srcdir}"\.\./-i "{topsrcdir}"/
+
+/^INCLUDES = .*$/s/$/ -i "{topsrcdir}"include:mpw: -i ::extra-include:/
+
+/$(TARG_CPU_DEP_@target_cpu_type@)/s/$(TARG_CPU_DEP_@target_cpu_type@)/{TARG_CPU_DEP}/
+
+/@OPCODES_LIB@/s/@OPCODES_LIB@/::opcodes:libopcodes.o/
+/@BFDLIB@/s/@BFDLIB@/::bfd:libbfd.o/
+
+/extra_objects@/s/extra_objects@/{EXTRA_OBJECTS}/
+
+/LOADLIBES/s/{LOADLIBES}/{EXTRALIBS}/
+
+/@ALL_OBJ_DEPS@/s/@ALL_OBJ_DEPS@/::bfd:bfd.h/
+
+# This causes problems - not sure why.
+/^tags TAGS/,/etags /d
+
+/^make-gas.com/s/^/#/
+
+/true/s/ ; @true$//
+
+# Remove references to conf.in, we don't need them.
+/conf\.in/s/conf\.in//g
+
+# Use _gdbinit everywhere instead of .gdbinit.
+/gdbinit/s/\.gdbinit/_gdbinit/g
+
+/atof-targ/s/"{s}"atof-targ\.c/"{o}"atof-targ.c/g
+/config/s/"{s}"config\.h/"{o}"config.h/g
+/config/s/^config\.h/"{o}"config.h/
+/obj-format/s/"{s}"obj-format\.c/"{o}"obj-format.c/g
+/obj-format/s/"{s}"obj-format\.h/"{o}"obj-format.h/g
+/targ-cpu/s/"{s}"targ-cpu\.c/"{o}"targ-cpu.c/g
+/targ-cpu/s/"{s}"targ-cpu\.h/"{o}"targ-cpu.h/g
+/targ-env/s/"{s}"targ-env\.h/"{o}"targ-env.h/g
+
+/m68k-parse.c/s/"{s}"m68k-parse\.c/"{o}"m68k-parse.c/g
+/m68k-parse.c/s/^m68k-parse\.c/"{o}"m68k-parse.c/
+
+# Whack out the config.h dependency, it only causes excess rebuilds.
+/{OBJS}/s/{OBJS} \\Option-f "{o}"config.h/{OBJS} \\Option-f/
+/gasp.c/s/gasp\.c "{o}"config.h/gasp.c/
+
+# The resource file is called mac-as.r.
+/as.new.r/s/as\.new\.r/mac-as.r/
+/gasp.new.r/s/gasp\.new\.r/mac-as.r/
+
+# ...and the PROG_NAME doesn't have a .new in it.
+/PROG_NAME/s/PROG_NAME='"'as.new'"'/PROG_NAME='"'as'"'/
+/PROG_NAME/s/PROG_NAME='"'gasp.new'"'/PROG_NAME='"'gasp'"'/
+
+# Whack out recursive makes, they won't work.
+/^[ ][ ]*srcroot=/,/^[ ][ ]*(cd /d
+
+/'#define GAS_VERSION "{VERSION}"'/c\
+ Echo -n '#define GAS_VERSION "' >> "{o}"config.new\
+ Echo -n "{VERSION}" >> "{o}"config.new\
+ Echo -n '"' >> "{o}"config.new
+
+# Whack out config-rebuilding targets, they won't work.
+/^config.status \\Option-f/,/^$/d
+
+/^"{o}"config.h \\Option-f/s/^/#/
+
+# Add a "stamps" target.
+$a\
+stamps \\Option-f config-stamp\