#
# Tools source and executable file makefile.
#
CC=	cc 
CFLAGS=	-O -20
LD=	ld
LFLAGS= -S -o $@
LIB=	/usr/lib/libc.a

UTILITIES=	centry hex makeimage maketape mathtest psplit xfer 
UFILES=	 centry.c hex.c makeimage.c maketape.c psplit.c xfer.c \
		../mathtest.c

.SUFFIXES:	.c .o
.c.o:	$*.c
	${CC} ${CFLAGS} -I.. -c $*.c

#

all:	${UTILITIES} ../mathtest.rslts

#
# following must be made on a system with a 68881 chip installed!!!
#
../mathtest.rslts:	mathtest
	./mathtest > $@  

clean:
	-rm -f *.o a.out core rslts ${UTILITIES} mathtest ../mathtest.rslts 

depend: 
	${CC} -M -I.. ${UFILES} | \
	sed -e ':loop' \
	    -e 's/\.\.\/[^ /]*\/\.\./../' \
	    -e 't loop' | \
	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 '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp Makefile Makefile.bak
	ex - Makefile < eddep
	rm -f eddep makedep

#
centry:	centry.o
	${CC} ${CFLAGS} -o $@ $@.o  
hex:	hex.o
	${CC} ${CFLAGS} -o $@ $@.o
psplit:	psplit.o
	${CC} ${CFLAGS} -o $@ $@.o  
makeimage:	makeimage.o
	${CC} ${CFLAGS} -o $@ $@.o  
maketape:	maketape.o
	${CC} ${CFLAGS} -o $@ $@.o  
mathtest: ../mathtest.c
	${CC} ${CFLAGS} -I.. -f -o $@ ../mathtest.c
xfer:	xfer.o
	${CC} -o $@ $@.o  
#
#----------------------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend uses it

centry.o: centry.c /usr/include/a.out.h /usr/include/sys/exec.h
hex.o: hex.c /usr/include/stdio.h /usr/include/a.out.h /usr/include/sys/exec.h
hex.o: /usr/include/sys/types.h /usr/include/sys/stat.h
makeimage.o: makeimage.c /usr/include/stdio.h /usr/include/nlist.h ../sadie.h
maketape.o: maketape.c /usr/include/stdio.h /usr/include/nlist.h
psplit.o: psplit.c /usr/include/stdio.h /usr/include/a.out.h
psplit.o: /usr/include/sys/exec.h /usr/include/sys/file.h
psplit.o: /usr/include/sys/fcntl.h
xfer.o: xfer.c /usr/include/stdio.h
mathtest.o: ../mathtest.c /usr/include/stdio.h /usr/include/math.h
