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