# developer -*-Makefile-*-

HOST = i486-linux
CPU = i386
GCC = gcc
GCCFLAGS = -O2 -fomit-frame-pointer
ASPREFIX = /usr1/gnu/lib
RM = rm -f
ROFF_MAN = groff -Tascii -mandoc

all : proto-i386.s proto-m68k.s proto-mips.s proto-mipsn32.s proto-mips64.s proto-sparc.s proto-sparc64.s proto-alpha.s proto-hppa.s proto-arm.s proto-rs6000-aix.old.s proto-rs6000-aix.new.s proto-rs6000-sysv4.s proto-rs6000-macos.s proto-m88k.s proto-convex.s proto-ia64.c proto-x86_64.c \
      cache-sparc.S cache-alpha.s cache-hppa.s cache-rs6000-sysv4.s cache-rs6000-macos.s cache-convex.s \
      trampoline_r.man \
      config.h.msvc config.h.mingw32

proto-i386.s : proto.c
	$(GCC) -V 2.7.2 -b i486-linuxaout $(GCCFLAGS) -D__i386__ -S proto.c -o $@

proto-m68k.s : proto.c
	$(GCC) -V egcs-2.91.57 -b m68k-sun $(GCCFLAGS) -D__m68k__ -S proto.c -o $@

proto-mips.s : proto.c
	$(GCC) -V 2.95.2 -b mips-sgi $(GCCFLAGS) -D__mips__ -S proto.c -o $@ -mabicalls

proto-mipsn32.s : proto.c
	$(GCC) -V 2.95.2 -b mips-sgi-irix6 $(GCCFLAGS) -D__mipsn32__ -S proto.c -o $@ -mabicalls

proto-mips64.s : proto64.c
	$(GCC) -V 2.95.2 -b mips-sgi -mips3 -mlong64 $(GCCFLAGS) -D__mips64__ -S proto64.c -o $@ -mabicalls

proto-sparc.s : proto.c
	$(GCC) -V 2.95.2 -b sparc-sun $(GCCFLAGS) -D__sparc__ -S proto.c -o $@

proto-sparc64.s : proto64.c
	sparc64-linux-gcc -V 2.95.2 -b sparc64-linux $(GCCFLAGS) -D__sparc64__ -S proto64.c -o $@

proto-alpha.s : proto64.c
	$(GCC) -V 2.7.2 -b alpha-dec-osf $(GCCFLAGS) -D__alpha__ -S proto64.c -o $@

proto-hppa.s : proto.c
	$(GCC) -V 2.6.3 -b hppa1.0-hpux $(GCCFLAGS) -D__hppa__ -S proto.c -o $@

proto-arm.s : proto.c
	$(GCC) -V 2.6.3 -b arm-acorn-riscix $(GCCFLAGS) -D__arm__ -S proto.c -o $@

proto-rs6000-aix.old.s : proto.c
	$(GCC) -V 2.95.2 -b rs6000 -mno-power -mno-power2 -mno-powerpc -mold-mnemonics $(GCCFLAGS) -D__rs6000__ -S proto.c -o $@

proto-rs6000-aix.new.s : proto.c
	$(GCC) -V 2.95.2 -b rs6000 -mno-power -mno-power2 -mno-powerpc -mnew-mnemonics $(GCCFLAGS) -D__rs6000__ -S proto.c -o $@

proto-rs6000-sysv4.s : proto.c
	$(GCC) -V 2.95.2 -b ppc-linux -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__rs6000__ -S proto.c -o $@

proto-rs6000-macos.s : proto.c
	$(GCC) -V 3.3.2 -b powerpc-darwin $(GCCFLAGS) -D__rs6000__ -S proto.c -o $@

proto-m88k.s : proto.c
	$(GCC) -V 2.95.2 -b m88k-dgux $(GCCFLAGS) -D__m88k__ -S proto.c -o $@

proto-convex.s : proto.c
	$(GCC) -V 2.6.3 -b convex-c2 $(GCCFLAGS) -D__convex__ -S proto.c -o $@

proto-ia64.s : proto64.c
	$(GCC) -V 2.9-ia64-000216 -b ia64-hp-linux $(GCCFLAGS) -D__ia64__ -S proto64.c -o $@

proto-x86_64.s : proto64.c
	$(GCC) -V 3.2.2 -b x86_64-suse-linux $(GCCFLAGS) -D__x86_64__ -S proto64.c -o $@

cache-sparc.S : cache-sparc.c asmsparc.sh
	$(GCC) -V 2.95.2 -b sparc-sun $(GCCFLAGS) -D__sparc__ -S $< -o cache-sparc.s
	(echo '#include "asmsparc.h"' ; ./asmsparc.sh < cache-sparc.s) > cache-sparc.S
	$(RM) cache-sparc.s

cache-alpha.s : cache-alpha.c
	$(GCC) -V 2.7.2 -b alpha-dec-osf $(GCCFLAGS) -D__alpha__ -S $< -o $@

cache-hppa.s : cache-hppa.c
	$(GCC) -V 2.6.3 -b hppa1.0-hpux $(GCCFLAGS) -D__hppa__ -S $< -o $@

cache-rs6000-sysv4.s : cache-rs6000.c
	$(GCC) -V 2.95.2 -b ppc-linux -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__rs6000__ -S $< -o $@

cache-rs6000-macos.s : cache-rs6000.c
	$(GCC) -V 3.3.2 -b powerpc-darwin $(GCCFLAGS) -D__rs6000__ -S $< -o $@

cache-convex.s : cache-convex.c
	$(GCC) -V 2.6.3 -b convex-c2 $(GCCFLAGS) -D__convex__ -S $< -o $@

trampoline_r.man : trampoline_r.3
	$(ROFF_MAN) trampoline_r.3 > trampoline_r.man

config.h.msvc : config.h.in
	sed -e 's,^#undef __i386__$$,#define __i386__ 1,' -e 's,^#undef STDC_HEADERS$$,#define STDC_HEADERS 1,' -e 's,^#undef HAVE_GETPAGESIZE$$,#define HAVE_GETPAGESIZE 1 /* fake */,' -e 's,^#undef RETGETPAGESIZETYPE$$,#define RETGETPAGESIZETYPE unsigned long,' -e 's,^#undef CODE_EXECUTABLE$$,#define CODE_EXECUTABLE 1,' < config.h.in > config.h.msvc

config.h.mingw32 : config.h.in
	sed -e 's,^#undef __i386__$$,#define __i386__ 1,' -e 's,^#undef STDC_HEADERS$$,#define STDC_HEADERS 1,' -e 's,^#undef HAVE_GETPAGESIZE$$,#define HAVE_GETPAGESIZE 1 /* fake */,' -e 's,^#undef RETGETPAGESIZETYPE$$,#define RETGETPAGESIZETYPE unsigned long,' -e 's,^#undef CODE_EXECUTABLE$$,#define CODE_EXECUTABLE 1,' < config.h.in > config.h.mingw32

tramp-i386.o : tramp-i386.s
	$(ASPREFIX)/i486-linux/bin/as tramp-i386.s -o $@

tramp-m68k.o : tramp-m68k.s
	$(ASPREFIX)/m68k-sun/bin/as tramp-m68k.s -o $@

tramp-mips.o : tramp-mips.s
	$(ASPREFIX)/mips-sgi/bin/as tramp-mips.s -o $@

tramp-mips64.o : tramp-mips64.s
	$(ASPREFIX)/mips-sgi/bin/as -mips3 -membedded-pic tramp-mips64.s -o $@

tramp-sparc.o : tramp-sparc.s
	$(ASPREFIX)/sparc-sun/bin/as tramp-sparc.s -o $@

tramp-sparc64.o : tramp-sparc64.s
	$(ASPREFIX)/sparc64-linux/bin/as tramp-sparc64.s -o $@

tramp-alpha.o : tramp-alpha.s
	$(ASPREFIX)/alpha-dec-osf/bin/as tramp-alpha.s -o $@

tramp-hppa.o : tramp-hppa.s
	$(ASPREFIX)/hppa1.0-hpux/bin/as tramp-hppa.s -o $@

tramp-arm.o : tramp-arm.s
	$(ASPREFIX)/arm-acorn-riscix/bin/as tramp-arm.s -o $@

tramp-rs6000-old.o : tramp-rs6000-old.s
	$(ASPREFIX)/rs6000/bin/as tramp-rs6000-old.s -o $@

tramp-rs6000-sysv4.o : tramp-rs6000-sysv4.s
	$(ASPREFIX)/ppc-linux/bin/as tramp-rs6000-sysv4.s -o $@

tramp-m88k.o : tramp-m88k.s
	$(ASPREFIX)/m88k-coff/bin/as tramp-m88k.s -o $@

tramp-convex.o : tramp-convex.s
	$(ASPREFIX)/convex-c2/bin/as tramp-convex.s -o $@

tramp-ia64.o : tramp-ia64.s
	/nue/usr/ia64-hp-linux/bin/as tramp-ia64.s -o $@

tramp-x86_64.o : tramp-x86_64.s
	$(ASPREFIX)/x86_64-suse-linux/bin/as tramp-x86_64.s -o $@

