# Makefile for Apout PDP-11 application emulator
#
# $Revision: 1.18 $
# $Date: 1999/01/15 03:57:00 $
#
# You will need gcc if you choose the optimised compile below
CC=gcc

# Set the CFLAGS, LDFLAGS for speed or debugging. If you don't want 2.11BSD
# emulation, then remove the -DEMU211 flag.
# Set up the LIBS if required for your system
#
# These flags for doing debugging
CFLAGS= -Wall -g -DEMU211 -DNATIVES -DDEBUG -DZERO_MEMORY
LDFLAGS= -static -g

# These flags for speed
#CFLAGS= -DEMU211 -DNATIVES -DINLINE=inline -O3 -Winline -Wall \
#	-finline-functions -fomit-frame-pointer
#LDFLAGS=

# Any extra libraries required
LIBS= -lm

# Install destinations
MANDIR=/usr/local/man/man1
BINDIR=/usr/local/bin

VERSION= apout2.2alpha8
SRCS=	cpu.c aout.c branch.c double.c ea.c itab.c main.c \
	single.c fp.c v7trap.c bsdtrap.c defines.h v7trap.h debug.c \
	bsdtrap.h bsd_ioctl.c magic.c apout.1 apout.0 \
	README COPYRIGHT CHANGES LIMITATIONS TODO Makefile
OBJS=	cpu.o aout.o branch.o double.o ea.o itab.o main.o \
	single.o fp.o v7trap.o bsdtrap.o debug.o bsd_ioctl.o magic.o

apout: $(OBJS)
	cc $(LDFLAGS) $(OBJS) -o apout $(LIBS)

install: apout
	cp apout $(BINDIR)
	chmod 755 $(BINDIR)/apout
	cp apout.1 $(MANDIR)
	chmod 644 $(MANDIR)/apout.1

clean:
	rm -rf apout *core $(OBJS) *.dbg $(VERSION) $(VERSION).tar.gz apout.0

apout.0: apout.1
	nroff -man apout.1 > apout.0

disttar: clean apout.0
	- mkdir $(VERSION)
	cp $(SRCS) $(VERSION)
	chmod -R go+rX $(VERSION)
	chmod -R u+w $(VERSION)
	tar vzcf $(VERSION).tar.gz $(VERSION)

# Dependencies for object files
branch.o: branch.c defines.h Makefile
cpu.o: cpu.c defines.h Makefile
double.o: double.c defines.h Makefile
ea.o: ea.c defines.h Makefile
fp.o: fp.c defines.h Makefile
itab.o: itab.c defines.h Makefile
main.o: main.c defines.h Makefile
single.o: single.c defines.h Makefile
aout.o: aout.c defines.h Makefile
v7trap.o: v7trap.c defines.h Makefile v7trap.h
bsdtrap.o: bsdtrap.c defines.h Makefile bsdtrap.h
