# Makefile for Apout PDP-11 application emulator
#
# Set the CFLAGS, LDFLAGS for speed or debugging. If you don't want 2.11BSD
# emulation (which doesn't fully work), then remove the -DEMU211 flag.
# Set up the LIBS if required for your system
#
# These flags for doing debugging
CFLAGS= -Wall -g -DEMU211 -DDEBUG
LDFLAGS= -static -g

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

# Any extra libraries required
LIBS= -lm

VERSION= apout2.2alpha5
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
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

apout: $(OBJS)
	cc $(LDFLAGS) $(OBJS) -o apout $(LIBS)
	cp apout /usr/local/bin

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

tar:	clean
	tar vzcf ../apout.tar.gz [A-Z]* *c *h

disttar: clean
	- mkdir $(VERSION)
	cp README COPYRIGHT CHANGES LIMITATIONS Makefile $(SRCS) $(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
