LATEX = pdflatex -interaction=nonstopmode
BIBTEX = bibtex

BASE = thesis
DOCUMENT = ${BASE}.pdf
AUX = ${BASE}.aux ${BASE}.bbl ${BASE}.blg ${BASE}.log ${BASE}.out ${BASE}.toc

SOURCES = ${addsuffix .tex, \
thesis \
macros \
cfa-macros \
frontpgs \
introduction \
background \
type-environment \
resolution-heuristics \
conclusion \
}

.PHONY : all rebuild-refs clean wc

all : ${DOCUMENT}

clean : 
	@rm -frv ${DOCUMENT} ${AUX}

wc :
	wc ${SOURCES}

${DOCUMENT} : ${SOURCES}
	${LATEX} ${BASE}
	${LATEX} ${BASE}

rebuild-refs : ${SOURCES} aaron-thesis.bib
	${LATEX} ${BASE}
	${BIBTEX} ${BASE}
	${LATEX} ${BASE}
	${LATEX} ${BASE}
