AS68	=	/bin/as

OFILES	=	exit.o gethdr.o getmon.o 		\
		loadfast.o loadprog.o main.o message.o		\
		procargs.o readuntil.o sendmon.o sendpack.o	\
		startmon.o unctrl.o usagexit.o 	\
		autostart.o

CFLAGS	=	-g


all:		odt download

odt:		odt.c
		$(CC) $(CFLAGS) -o odt odt.c

download:	$(OFILES)
		cc $(CFLAGS) -o download $(OFILES)

fast.o:		fast.s
		/lib/cpp -P fast.s >temp.s
		$(AS68) -o fast.o temp.s
		rm temp.s

depend:
	grep '^#[ 	]*include' *.c | grep -v '<' | \
	sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' \
	    -e 's/\.c/.o/' \
	    -e 's,../[a-zA-Z]*/,,' | \
	awk ' { if ($$1 != prev) { print rec; rec = $$0; prev = $$1; } \
		else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
		       else rec = rec " " $$2 } } \
	      END { print rec } ' > makedep
	echo '$$r makedep' >>eddep
	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ed - Makefile < eddep
	rm eddep makedep

# DO NOT DELETE THIS LINE

autostart.o: define.h
exit.o: define.h
gethdr.o: define.h
getmon.o: define.h
loadfast.o: define.h
loadprog.o: define.h
main.o: define.h
message.o: define.h
procargs.o: define.h
readuntil.o: define.h
sendmon.o: define.h
sendpack.o: define.h
startmon.o: define.h
usagexit.o: define.h
