#
# Makefile for Pleuk documentation
#
# '$Author: pleuk $',
# '$Date: 1993/05/17 12:51:26 $',
# '$Revision: 1.0 $',
# '$Source: /usr/export/home/projects/ltg2/Pleuk/Distribution/Pleuk/Doc/Info/RCS/Makefile,v $',
# '$State: Exp $'

# Changes to allow xwindow dump to PostScript translation
 
include ../../Makefile.defs

INFOTOPFILES = overview backbone interface \
		specializations sle cfg

INFODVIFILES = overview.dvi backbone.dvi interface.dvi \
		specializations.dvi sle.dvi cfg.dvi

# We try and automate the process of producing hardcopy diagrams
# as much as possible.  This is a pain because we're going to be dumping
# massive amounts of stuff down the line to the printer, that is all
# the postscript code.  We minimize this by splitting postscript output
# into groups of files with distinct suffixes.  
# Those with the suffix .egcmr require the CLR fonts, while .eg ones
# don't. 

PLEUKHARDCOPY = ${PLEUKETC}/hardcopy

PLEUKEGS = angry.epsf germ.epsf phpsg1.epsf phpsg2.epsf phpsg3.epsf

PLEUKWINDOWPICTS = dcderiv.ps \
	dclexs.ps \
	dctrees.ps \
	fconfirm.ps \
	fmenu.ps \
	ghosttree.ps \
	listmenu.ps \
	parsedbox.ps \
	pfiles.ps \
	potree.ps \
	poutput.ps \
	tlmenu.ps


all: infofiles 

new: realclean infofiles
	

infofiles: ${INFOTOPFILES}

dvi: texindex  ${INFODVIFILES} 

# .eg is for pleuk output files not requiring Computer Modern Roman fonts
# .egcmr ditto but requiring CMR fonts. 

.SUFFIXES: .texinfo .dvi .egcmr .epsf .eg  .ps .Z

.texinfo:
	${GNUEMACS} -batch -q -l ${PLEUKINFO}/empty.el ${PLEUKINFO}/$< \
		-f texinfo-format-buffer -f save-buffer -kill
.texinfo.dvi: texindex
#	${TEX} $<
	${TEX} $<
	./texindex $*.??
	${TEX} $<

# The arguments to hardcopy tell it to pipe the result to stdout, 
# and to ignore any .ghostscript file that the user may have

.eg.epsf:
	${PLEUKHARDCOPY} -p -n  -nocmr $< > $@
.egcmr.epsf:
	${PLEUKHARDCOPY} -p -n  $< > $@


# X window dumps are stored in compressed format, as that leads to a 
# fifty-fold reduction in their size.  
# The fiddling around here is to get rid of faulty bounding box
# information produced by xpr.  That application always reports a
# positive x and y origin, even when the psfig option is used. 

.Z.ps:
	zcat $<  | xpr -device ps -portrait -compact -psfig -scale 3 | \
	sed 's@%%BoundingBox:[ 	][ 	]*[0-9][0-9]*[ 	][ 	]*[0-9][0-9]*@%%BoundingBox: 0 0@g' > $@

psfiles: ${PLEUKEGS}

overview.dvi: Makefile ${PLEUKWINDOWPICTS}

overviewpictsclean: 
	rm -f ${PLEUKWINDOWPICTS}

# We leave the info files in place
clean:
	/bin/rm -f *.aux *.cp *.cps *.fn *.fns *.ky *.kys *.log
	/bin/rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs *.ps *.epsf
	/bin/rm -f *.dvi
	/bin/rm -f texindex
	
realclean: clean
	/bin/rm -f ${INFOTOPFILES} 
	@for var in ${INFOTOPFILES} ; \
	    do rm -f $$var-[0-9] ;\
	done

interface.dvi:  ${PLEUKEGS}

# Write 
print: 
	@echo -n The printed manuals take up a considerable
	@echo amount of disk space.  To print them, type
	@echo make dvi
	@echo or 
	@echo make FILENAME.dvi 
	@echo where FILENAME is one of
	@for var in ${INFODVIFILES} ; \
	    do echo $$var ; \
	done
	@echo -n and then follow your local procedures for
	@echo printing TeX output.  

reallyprint: dvi ${PLEUKEGS}
	@for var in ${INFODVIFILES} ; \
		do ${DVI2PS} $$var > $$var.ps; \
	done


texindex:
	cc -o texindex texindex.c


