# $Header: Makefile,v 1.4 90/04/06 19:22:02 toddb Exp $
  TROFFDEV = -Tpsc
DITROFFDEV = -TX100
       EQN = /usr/tek/eqn
       TBL = /usr/tek/tbl
   DITROFF = /usr/tek/lib/ditroff
     TROFF = /usr/tek/troff -t
PROTOFILES = ../macros.t protocol
     PAGES=1-
      ONLY = -o$(PAGES)
#
# This is only necessary if your troff calls up fonts that it
# doesn't need.  See ../trimfonts.c for a list.
#
 TRIMFONTS = | ../trimfonts
 TRIM_EXEC = ../trimfonts

all: protocol.ps index.ps

preview: protocol.dit index.dit

protocol.ps: highlight.awk $(PROTOFILES) $(TRIM_EXEC)
	cat $(PROTOFILES) \
		| highlight.awk \
		| $(EQN) $(TROFFDEV) \
		| $(TBL) \
		| $(TROFF) $(ONLY) $(TROFFDEV) -ms 2> index.raw.tmp \
		$(TRIMFONTS) > $@.tmp
	mv $@.tmp $@
	mv index.raw.tmp index.raw

protocol.dit: highlight.awk $(PROTOFILES)
	cat $(PROTOFILES) \
		| highlight.awk \
		| $(EQN) $(DITROFFDEV) \
		| $(TBL) \
		| $(DITROFF) $(ONLY) $(DITROFFDEV) -ms \
		  > $@.tmp 2> index.raw.tmp
	mv $@.tmp $@
	mv index.raw.tmp index.raw

index: index.raw ../fixindex.awk ../block.awk
	sort -f -t: +1 -3 +0n -1n index.raw \
		| awk -f ../fixindex.awk \
		| awk -f ../block.awk > index
	
index.ps: protocol.ps index ../indexmacros.t
	cat ../indexmacros.t index \
		| ${TROFF} -me $(TRIMFONTS) > index.ps.tmp
	mv index.ps.tmp index.ps

index.dit: protocol.dit index ../indexmacros.t
	cat ../indexmacros.t index \
		| ${DITROFF} $(DITROFFDEV) -me  > index.dit.tmp
	mv index.dit.tmp index.dit

print: protocol.ps index.ps
	lpr -qps protocol.ps
	sleep 30;
	lpr -qps index.ps
