BOOK_FILES = \
 adapt-concept.tex \
 bas-concept.tex \
 concept.tex \
 defs.tex \
 dof-concept.tex \
 mesh-concept.tex \
 preface.tex \
 rc-concept.tex \
 submesh-concept.tex

MAN_FILES =\
 defs.tex\
 addon-tools.tex \
 adapt-tools.tex \
 alberta-book.tex \
 alberta-man.tex \
 assemble-tools.tex \
 bas-impl.tex \
 chain-impl.tex \
 concept.tex \
 defs.tex \
 dof-impl.tex \
 ellipt.tex \
 est-tools.tex \
 eval-tools.tex \
 examples.tex \
 init-element-impl.tex \
 files.tex \
 graph-tools.tex \
 heat.tex \
 impl.tex \
 intro.tex \
 mesh-impl.tex \
 nonlin.tex \
 param-impl.tex \
 periodic-impl.tex \
 preface.tex \
 rc-impl.tex \
 solve-tools.tex \
 splitindex.tex \
 struct-func.tex \
 submesh-impl.tex \
 tools.tex \
 traverse-impl.tex \
 util-impl.tex

default: all

all: alberta-man alberta-book

manual: alberta-man

book: alberta-book

alberta-man: $(MAN_FILES) $(BOOK_FILES)
	pdflatex alberta-man.tex
	bibtex alberta-man
	tex \\def\\idx{alberta-man}\\input splitindex
	makeindex alberta-man-idx.idx
	makeindex alberta-man-cdx.idx
	makeindex alberta-man-ddx.idx
	makeindex alberta-man-fdx.idx
	makeindex alberta-man-mdx.idx
	pdflatex alberta-man.tex
	pdflatex alberta-man.tex

alberta-book: $(MAN_FILES) $(BOOK_FILES)
	pdflatex alberta-book.tex
	bibtex alberta-book
	tex \\def\\idx{alberta-book}\\input splitindex
	makeindex alberta-book-idx.idx
	pdflatex alberta-book.tex
	pdflatex alberta-book.tex

clean:
	find . \( -name \*~ -o -name \*.out -o -name \*.aux -o -name \*.pdf -o -name \*.log -o -name \*.ilg -o -name \*.blg \) -exec /bin/rm -f {} \;

auxclean: clean
	find . \( -name \*.bbl -o -name \*.idx  -o -name \*.toc\
 -o -name \*.bbl -o -name \*.idx -o -name \*.ind -o -name \*.lof\
 -o -name \*.lot -o -name \*.\*pk -o -name \*.tfm \) -exec /bin/rm -f {} \;

vclean: auxclean
	rm -f *.pdf
