DVIPS_CMD = dvips -o

.PHONY: rcirefman manpages

rcirefman:	manpages.ps rcirefman.ps 

rcirefman.ps:	rcirefman.dvi
		$(DVIPS_CMD) rcirefman.ps rcirefman.dvi

manpages.ps: 	manpages.dvi
		$(DVIPS_CMD) manpages.ps manpages.dvi

manpages.dvi:	manpages.tex
		tex manpages

rcirefman.dvi:	manpages.IDX
		latex rcirefman.latex

manpages.IDX:   manpages.idx
		sort -f < $? > manpages.IDX

manpages.idx:	manpages.tex
		tex manpages
#
# Command sequence to generate manpages.tex
#
manpages manpages.tex:
	- cp manpages.tex manpages.tex.BAK
	  (echo '\input manualMacros.tex'; \
	   echo '\tolerance=1000'; \
	   echo '\manFontStyle{times}'; \
	   echo '\manOpenIndex'; \
	   egrep -l "manPageInfo{RCI Reference Manual}" \
		 ../../man/tex[1357]/$(EMPTY)*.tex | sort -f +0.15 \
		 | sed 's/^/\\manInput{/' | sed 's/$$/}/' && \
	   echo '\end' ; \
	   echo '\bye' ) > manpages.tmp
	  mv manpages.tmp manpages.tex

clean::
	/bin/rm -f *.BAK *.= *.dvi *.aux *.log *.toc
 

