#  %W% %G%

#	makefile for the Vaxima manual
#
# sources: newmacs: macros for the Macsyma Manual

TROFF=	csh /usr/ucb/vtroff
NROFF=  nroff

.SUFFIXES: .n .t .x .o .r .rx .q .qx .v

# the syntaxes have this meaning:
#  .n  nroff/troff source file
#  .t  troff output file, can be vpr -t 'ed 
#  .x  index file from a troff run, when collected and run through troff
#	again, an index is produced.
#  .o  this file never exists, but asking for it will cause a .t file to
#	be created and then vpr'ed.  the .t file will not be deleted.
#  .r  nroff output file.
#  .rx  special index output from nroff run.  These files should be catted
#       together and then left around for VAXIMA to read when given the help
#	command.
#
#  .q  nroff output file compatible with model 37
#  .qx index file for .q files.
#
#  .v  this file never exists, but asking for it will cause a .t file to
#      be created and then vpr'ed.  The .t file will not be deleted.
#
# make install will install the nroff versions of the manual in the
# directory (DESTDIR) where the auxfns0.l help command can find them.
#

DESTDIR = /vb/mac/manual

SRC = newmacs ch1.n ch2.n ch3.n ch4.n

INDX= ch1.x ch2.x ch3.x ch4.x

QINDX= ch1.qx ch2.qx ch3.qx ch4.qx

TGS= ch1.n ch2.n ch3.n ch4.n

RXFILES= ch1.rx ch2.rx ch3.rx ch4.rx 
all: ch1.o ch2.o ch3.o ch4.o index.o

RFILES= primer1.r ch0.r ch1.r ch2.r ch3.r ch4.r 
tall: primer1.t ch0.t ch1.t ch2.t ch3.t ch4.t index.t


rall: ${RFILES}

qall: primer1.q ch0.q ch1.q ch2.q ch3.q ch4.q 
      
.t.o:
	vpr -t $*.t

.n.v:
	tbl newmacs $*.n |eqn| ${TROFF} -me -t 1> $*.t 2> $*.x
	vpr -t $*.t
	
.n.t:	
	tbl newmacs $*.n |eqn| ${TROFF} -me -t 1> $*.t 2> $*.x

.n.p:
	tbl newmacs $*.n |eqn| csh /usr/ucb/nettroff -me 2> $*.x

.n.x:
	tbl newmacs $*.n |eqn| ${TROFF} -me -z 2> $*.x

.n.r:
	tbl newmacs $*.n |neqn| ${NROFF} -me 1> $*.r 2> $*.rx

.n.rx:
	tbl newmacs $*.n |neqn| ${NROFF} -me 1> $*.r 2> $*.rx

.n.q:
	tbl newmacs $*.n |neqn| ${NROFF} -me -T37 2> $*.qx | col > $*.q

install: ${RFILES} helpindex
	cp ${RFILES} helpindex ${DESTDIR}

findex: ${INDX}
	epto ".Ib" > index
	sort +3 -o index index ${INDX}
	sed -f indexsed index > indexx 
	${TROFF} -me newmacs indexx

index.t: ${INDX}
	epto ".Ib" > index
	sort +3 -o index index ${INDX}
	sed -f indexsed index > indexx
	${TROFF} -me -x -t newmacs indexx > index.t

pindex:
	epto ".Ib" > index
	sort +3 -o index index ${INDX}
	sed -f indexsed index > indexx
	csh /usr/ucb/nettroff -me -o5- newmacs indexx

index.q:
	epto ".Ib" > index
	cat index ${QINDX} | tr '\227' ' ' | sort +3 -o indexx
	nroff -me -T37 newmacs indexx | col > index.q

helpindex: ${RXFILES}
	cat ${RXFILES} | tr '\227' ' ' > helpindex

tags:	/dev/tty
	awk -f mantags ${TGS} | sort > tags

sources: ${SRC}
${SRC}:
	sccs get $@

clean:
	rm index *.x