#
# Makefile -- Create the "Inside LessTif" book from the LaTeX2e sources.
#
# (c) 1996, 97 The Hungry Programmers
# (c) 1996, 97 Harald Albrecht (albrecht@igpm.rwth-aachen.de)
# See the file PUBLIC for details.
#

.SUFFIXES: .dvi .fig .eps .gif .ind .ist .jpeg .pdf .ps .sty .tex

# See below for the configuration section!

TEXES =	LessTif.tex \
	SyntheticResources.tex XmStrings.tex Caches.tex \
	Geometry.tex GeoUtils.tex VirtKeys.tex Grab.tex BaseClass.tex \
	DragNDrop.tex \
	Appendix.tex \
	Hungry.sty Hungry.ist

PICS =	SynthresPrinciple.eps SynthresImport.eps \
	HookBasics.eps WrapperBasics.eps WrapperStack.eps \
	WED_Stack.eps WED_SecObj.eps WED_Vendor.eps \
	Fam_Dialog.eps Ml_Dialog.eps Pam_Dialog.eps ExtObjClasses.eps \
	DesktopClass.eps ShadowShell.eps \
	GeoPicture.eps \
	DD_Reason.eps DD_Effect.eps DD_TargetTable.eps DD_DSB.eps \
	TAG_val.eps \
	BER_len1.eps BER_len2.eps BER_len3.eps XmStringInt_Repr.eps \
	EventProcessing.eps VKMapping.eps Bindings.eps \
	ClassFamily.eps \
	Hungry.eps LessTifTitle.eps LessTif.eps

PDF_PICS =SynthresPrinciple.pdf SynthresImport.pdf \
	HookBasics.pdf WrapperBasics.pdf WrapperStack.pdf \
	WED_Stack.pdf WED_SecObj.pdf WED_Vendor.pdf \
	Fam_Dialog.pdf Ml_Dialog.pdf Pam_Dialog.pdf ExtObjClasses.pdf \
	DesktopClass.pdf ShadowShell.pdf \
	GeoPicture.pdf \
	DD_Reason.pdf DD_Effect.pdf DD_TargetTable.pdf DD_DSB.pdf \
	TAG_val.pdf \
	BER_len1.pdf BER_len2.pdf BER_len3.pdf XmStringInt_Repr.pdf \
	EventProcessing.pdf VKMapping.pdf Bindings.pdf \
	ClassFamily.pdf \
	Hungry.pdf LessTifTitle.pdf LessTif.pdf

#
# ++++++++++++++++++ Configuration section: ++++++++++++++++++
#
LATEX=latex
MAKEINDEX=makeindex
DVIPS=dvips
LATEX2HTML=latex2html

# Now select the PDF compiler.
# For now we support both pdftex and vtex.
# pdftex requires the .eps files to be converted in .pdf first,
# so it requires additional dependencies:

PDFLATEX=pdflatex
PDF_DEPS = $(PDF_PICS)

#PDFLATEX=vlatex
#PDF_DEPS =


#
# +++++++++++++++ End of configuration section +++++++++++++++
#

DEPS =	$(TEXES) $(PICS) $(PDF_DEPS)

# ----------------------------------------------------------------------------
# For quick preview, just do a simple "make". If you want to build the ps
# files, either one or for all supported paper sizes, do a "make all" or an
# appropiate "make LessTifsa4.dvi" for example. The naming convention is as
# follows:
#   LessTif<?><?>.dvi / LessTif<?><?>.ps
#           |  |
#           |  +-- a4   for european a4 paper size
#           |      l    for u.s. letter paper size
#           |
#           +----- s    for single-sided printing
#                  d    for double-sided printing
#                  odd  for files containing odd pages  ***.ps files only***
#                  even for files containing even pages ***.ps files only***
#

default: pdf

pdf:	InsideLessTif.pdf

dvi:	LessTifsa4.dvi

all:	LessTifsa4.dvi LessTifda4.dvi LessTifsl.dvi LessTifdl.dvi
	$(DVIPS) -P NoCourier        -o LessTifsa4.ps    LessTifsa4.dvi
	$(DVIPS) -P NoCourier        -o LessTifda4.ps    LessTifda4.dvi
	$(DVIPS) -P NoCourier -A     -o LessTifodda4.ps  LessTifda4.dvi
	$(DVIPS) -P NoCourier -B -r  -o LessTifevena4.ps LessTifda4.dvi
	$(DVIPS) -P NoCourier        -o LessTifsl.ps     LessTifsl.dvi
	$(DVIPS) -P NoCourier        -o LessTifdl.ps     LessTifdl.dvi
	$(DVIPS) -P NoCourier -A     -o LessTifoddl.ps   LessTifdl.dvi
	$(DVIPS) -P NoCourier -B -r  -o LessTifevenl.ps  LessTifdl.dvi

# ----------------------------------------------------------------------------
# Create the complete book from the LaTeX sources. This part covers all the
# the single- and double-sided books for european a4 paper as well as the u.s.
# letter paper size.
#
InsideLessTif.pdf: InsideLessTif.tex $(DEPS)
	rm -f InsideLessTif.ind
	$(PDFLATEX) InsideLessTif
	$(MAKEINDEX) -s Hungry.ist InsideLessTif
	$(PDFLATEX) InsideLessTif

LessTifsa4.dvi:	LessTifsa4.tex $(DEPS)
	rm -f LessTifsa4.ind
	$(LATEX) LessTifsa4
	$(MAKEINDEX) -s Hungry.ist LessTifsa4
	$(LATEX) LessTifsa4

LessTifda4.dvi:	LessTifda4.tex $(DEPS)
	rm -f LessTifda4.ind
	$(LATEX) LessTifda4
	$(MAKEINDEX) -s Hungry.ist LessTifda4
	$(LATEX) LessTifda4

LessTifsl.dvi:	LessTifsl.tex $(DEPS)
	rm -f LessTifsl.ind
	$(LATEX) LessTifsl
	$(MAKEINDEX) -s Hungry.ist LessTifsl
	$(LATEX) LessTifsl

LessTifdl.dvi:	LessTifdl.tex $(DEPS)
	rm -f LessTifdl.ind
	$(LATEX) LessTifdl
	$(MAKEINDEX) -s Hungry.ist LessTifdl
	$(LATEX) LessTifdl

# ----------------------------------------------------------------------------
# Generic rules
#

.dvi.ps:
	$(DVIPS) $*.dvi

# ----------------------------------------------------------------------------
# Further misc targets
#
ps:	LessTifda4.dvi
	$(DVIPS) -P NoCourier -o LessTifda4.ps LessTifda4.dvi


htm: html
	$(LATEX2HTML) -dir html LessTifh.tex

html:
	mkdir html

# ----------------------------------------------------------------------------
# Processing the figures.
#

ClassFamily.eps:	ClassFamily.fig
	fig2dev -L ps -m 0.47 $*.fig | awk -f trnsfig.awk > $*.eps

.fig.eps:
	fig2dev -L ps $*.fig | awk -f trnsfig.awk > $*.eps

.eps.pdf:
	epstopdf $*.eps

# ----------------------------------------------------------------------------
# Create the source tar file.
#
tar:
	tar cf hungry.tar *.tex *.sty *.fig *.ist *.eps *.awk \
		config.NoCourier NoCourier.map \
	        PUBLIC README Makefile
	gzip -9 -f hungry.tar
	ls -l hungry.tar.gz

# Make all the files necessary for upload on the FTP server.
#
package:	clean tar all
	gzip -9 -f *.ps
	ls -l hungry.tar.gz
	ls -l LessTif*ps.gz

clean:
	rm -f *.bak *~
	rm -f *.aux *.idx *.ilg *.ind *.lof *.log *.lot *.out *.toc 
	rm -f *.dvi *.pdf *.ps

#
# Maintenance targets
#
xdvi: LessTifsa4.dvi
	xdvi -keep -s 8 -geo 600x720-0+0 $<

gv: LessTifsa4.ps
	gv -scale -2 $<

# ----------------------------------------------------------------------------
