Index: doc/theses/mike_brooks_MMath/Makefile
===================================================================
--- doc/theses/mike_brooks_MMath/Makefile	(revision 8e819a94d8115bf4605e13dfbb79f504db752d6e)
+++ doc/theses/mike_brooks_MMath/Makefile	(revision bbf6a180ec56c3a8bde4df5c6038321c5d74f130)
@@ -1,72 +1,57 @@
-## Define the configuration variables.
+# Configuration variables
 
-MODULES = \
-	string
+Build = build
+Pictures = pictures
+Programs = programs
 
-Build ?= build
-Macros ?= ../../LaTeXmacros
-PLBib ?= ../../bibliography
+TeXSRC = ${wildcard *.tex}
+PicSRC = ${notdir ${wildcard ${Pictures}/*.png}}
+DemoSRC = ${notdir ${wildcard ${Programs}/*-demo.cfa}}
+PgmSRC = ${notdir ${wildcard ${Programs}/*.cfa}}
+BibSRC = ${wildcard *.bib}
 
-MODULE_PHONIES = ${addsuffix .module,$(MODULES)}
-MODULE_BUILDDIRS = ${addprefix $(Build)/,$(MODULES)}
-
-TeXLIB = .:${Macros}:${Build}:${MODULE_BUILDDIRS}:${PLBib}:
-LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build}
-pdfLaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
-BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex
+TeXLIB = .:../../LaTeXmacros:${Build}:		# common latex macros
+BibLIB = .:../../bibliography			# common citation repository
 
 MAKEFLAGS = --no-print-directory # --silent
+VPATH = ${Build} ${Pictures} ${Programs} # extra search path for file names used in document
 
+DOCUMENT = uw-ethesis.pdf
+BASE = ${basename ${DOCUMENT}}			# remove suffix
 
+# Commands
 
-## Define the documents that need to be made.
-all: thesis.pdf
-thesis.pdf: ${MODULE_PHONIES} thesis.tex glossary.tex $(Macros)/common.tex $(Macros)/common.sty  # local.bib
+LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
+BibTeX = BIBINPUTS=${BibLIB} && export BIBINPUTS && bibtex
 
-DOCUMENT = thesis.pdf
-BASE = ${basename ${DOCUMENT}}
+# Rules and Recipes
 
-# Directives #
-
-.NOTPARALLEL:						# cannot make in parallel
-
-.PHONY : all clean %.module			# not file names
+.PHONY : all clean				# not file names
+.ONESHELL :
 
 all : ${DOCUMENT}
 
 clean :
-	@rm -frv ${DOCUMENT} ${BASE}.ps ${Build}
+	@rm -frv ${DOCUMENT} ${Build}
 
-# File Dependencies #
+# File Dependencies
 
-# %.pdf : build/%.ps | ${Build}
-# 	ps2pdf $<
-
-# build/%.ps : build/%.dvi | ${Build}
-# 	dvips $< -o $@
-
-# build/%.dvi : %.tex Makefile | ${Build}
-# 	# Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
-# 	if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi
-# 	# Must have *.aux file containing citations for bibtex
-# 	if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} $< ; fi
-# 	-${BibTeX} ${basename $@}
-# 	# Some citations reference others so run again to resolve these citations
-# 	${LaTeX} $<
-# 	-${BibTeX} ${basename $@}
-# 	# Make index from *.aux entries and input index at end of document
-# 	-makeglossaries -q -s ${basename $@}.ist ${basename $@}
-# 	# Make index from *.aux entries and input index at end of document
-# 	-makeindex ${basename $@}.idx
-# 	# Run again to finish citations
-# 	${LaTeX} $<
-
-%.pdf : %.tex | ${Build}
-	${pdfLaTeX} $<
+%.pdf : ${TeXSRC} ${DemoSRC:%.cfa=%.tex} ${PicSRC} ${PgmSRC} ${BibSRC} Makefile | ${Build}
+	${LaTeX} ${BASE}
+	${BibTeX} ${Build}/${BASE}
+	${LaTeX} ${BASE}
+	# if needed, run latex again to get citations
+	if fgrep -s "LaTeX Warning: Citation" ${basename $@}.log ; then ${LaTeX} ${BASE} ; fi
+#	${Glossary} ${Build}/${BASE}
+#	${LaTeX} ${BASE}
 	cp ${Build}/$@ $@
 
 ${Build}:
-	mkdir -p ${Build}
+	mkdir -p $@
 
-%.module: content/%
-	$(MAKE) -C $< BuildBase=../../$(Build)
+%-demo.tex: %-demo | ${Build}
+	${Build}/$< > ${Build}/$@
+
+%-demo: %-demo.cfa
+	cfa $< -o ${Build}/$@
+
