Build = build
Macros = ../../LaTeXmacros
TeXLIB = .:${Macros}:${Build}:../../bibliography:
LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex

VPATH = ${Build}

all : thesis.pdf

thesis.pdf : Makefile ${Build} ${Macros}/common.tex cfa-format.tex thesis.tex intro.tex ctordtor.tex tuples.tex variadic.tex conclusions.tex
	${LaTeX} thesis
	${BibTeX} ${Build}/thesis
	${LaTeX} thesis
	${LaTeX} thesis
	cp -p ${Build}/thesis.pdf .
	pdf2ps thesis.pdf thesis.ps

${Build}:
	mkdir -p ${Build}

clean :
	@rm -frv ${Build}

spotless : clean
	rm -f thesis.pdf thesis.ps
