1# Configuration fragment for GAS.
2
3Set target_arch `echo {target_canonical} | sed -e 's/-.*-.*//'`
4
5If "{target_arch}" =~ /powerpc/
6	Set short_arch_name "ppc"
7	Set target_cpu "powerpc"
8Else
9	Set short_arch_name "{target_arch}"
10End If
11
12# The following works for many configurations, though not all.
13
14Set obj_format `echo {target_canonical} | sed -e 's/.*-.*-//'`
15Set target_os `echo {target_canonical} | sed -e 's/.*-.*-//'`
16
17Set bfd_gas no
18
19Set TDEFINES ""
20
21Set EXTRA_OBJECTS ""
22
23# Default emulation.
24
25Set em generic
26
27If "{target_canonical}" =~ /m68k-apple-macos/
28	Set obj_format "coff"
29	Set TDEFINES '-d M68KCOFF'
30	Set EXTRA_OBJECTS '"{o}"m68k-parse.c.o'
31
32Else If "{target_canonical}" =~ /powerpc-apple-macos/
33	Set obj_format "coff"
34	Set bfd_gas yes
35	Set em macos
36
37Else If "{target_canonical}" =~ /i386-\Option-x-go32/
38	Set obj_format "coff"
39	Set TDEFINES '-d I386COFF'
40
41Else If "{target_canonical}" =~ /m68k-\Option-x-coff/
42	Set TDEFINES '-d M68KCOFF'
43
44Else If "{target_canonical}" =~ /mips-idt-ecoff/
45	Set bfd_gas yes
46	Set TDEFINES '-d TARGET_BYTES_BIG_ENDIAN=1'
47
48Else If "{target_canonical}" =~ /mips-\Option-x-\Option-x/
49	# Assume other OSes etc use ELF
50	Set obj_format "elf"
51	Set bfd_gas yes
52	Set TDEFINES '-d TARGET_BYTES_BIG_ENDIAN=1'
53	forward-include "{srcroot}"bfd:elf-bfd.h 'bfd/elf-bfd.h'
54
55Else If "{target_canonical}" =~ /sh-\Option-x-hms/
56	Set obj_format "coff"
57	forward-include "{srcroot}"opcodes:sh-opc.h 'opcodes/sh-opc.h'
58End If
59
60forward-include "{srcdir}"config:tc-{short_arch_name}.c targ-cpu.c
61forward-include "{srcdir}"config:tc-{short_arch_name}.h targ-cpu.h
62
63forward-include "{srcdir}"config:obj-{obj_format}.c obj-format.c
64forward-include "{srcdir}"config:obj-{obj_format}.h obj-format.h
65
66forward-include "{srcdir}"config:te-{em}.h targ-env.h
67
68# Special cases for float handling.
69
70If "{target_arch}" =~ /ns32k/
71	forward-include "{srcdir}"config:atof-ns32k.c atof-targ.c
72Else If "{target_arch}" =~ /tahoe/
73	forward-include "{srcdir}"config:atof-tahoe.c atof-targ.c
74Else If "{target_arch}" =~ /vax/
75	forward-include "{srcdir}"config:atof-vax.c atof-targ.c
76Else
77	# Use IEEE by default.
78	forward-include "{srcdir}"config:atof-ieee.c atof-targ.c
79End If
80
81Echo '# From mpw-config.in'     		 > "{o}"mk.tmp
82Echo "TDEFINES = " {TDEFINES}			>> "{o}"mk.tmp
83Echo "EXTRA_OBJECTS = " {EXTRA_OBJECTS}		>> "{o}"mk.tmp
84# (We use the -n option here so as not to get extra spaces inserted)
85Echo -n 'TARG_CPU_DEP = {TARG_CPU_DEP_'		>> "{o}"mk.tmp
86Echo -n {short_arch_name}			>> "{o}"mk.tmp
87Echo -n '}'					>> "{o}"mk.tmp
88Echo '# End from mpw-config.in'			>> "{o}"mk.tmp
89
90Echo '/* conf.  Generated by mpw-configure.  */' > "{o}"conf.new
91Echo -n '#define TARGET_CPU       "'       	>> "{o}"conf.new
92Echo -n "{target_cpu}"       			>> "{o}"conf.new
93Echo    '"'       				>> "{o}"conf.new
94Echo -n '#define TARGET_OS       "'       	>> "{o}"conf.new
95Echo -n "{target_os}"       			>> "{o}"conf.new
96Echo    '"'       				>> "{o}"conf.new
97Echo -n '#define TARGET_ALIAS       "'       	>> "{o}"conf.new
98Echo -n "{target_alias}"       			>> "{o}"conf.new
99Echo    '"'       				>> "{o}"conf.new
100Echo -n '#define TARGET_CANONICAL       "'     	>> "{o}"conf.new
101Echo -n "{target_canonical}"			>> "{o}"conf.new
102Echo    '"'       				>> "{o}"conf.new
103Echo '#include "mpw.h"'				>> "{o}"conf.new
104If "{bfd_gas}" =~ /yes/
105	Echo "#define BFD_ASSEMBLER"		>> "{o}"conf.new
106Else
107	Echo "#define MANY_SEGMENTS"		>> "{o}"conf.new
108End If
109Echo '#define CR_EOL'				>> "{o}"conf.new
110Echo '#define OBJ_COFF_OMIT_TIMESTAMP'		>> "{o}"conf.new
111Echo '#define LOSING_COMPILER'			>> "{o}"conf.new
112
113MoveIfChange "{o}"conf.new "{o}"conf
114
115sed -e "s/@srcdir@/{srcdir}/" "{srcdir}"gdbinit.in > "{o}"_gdbinit
116