BIBTEXFLAGS:=
MAKEGLOSSARIES?=makeglossaries
MAKEGLOSSARIESFLAGS?=
-LATEXFLAGS:=-file-line-error -halt-on-error -no-shell-escape
+LATEXFLAGS:=\
+ -file-line-error\
+ -halt-on-error\
+ -no-shell-escape\
+ -output-directory=./output/
FIGURES:=$(addsuffix .png,$(addprefix img/,$(notdir $(basename $(wildcard fig/*.dot)))))
LISTINGS:=$(wildcard listings/*)
all: $(addsuffix .pdf,$(DOCS))
-%.fmt: %.pre
- $(LATEX) $(LATEXFLAGS) -ini -jobname="$(basename $@)" "&$(LATEX) $<\dump"
+output/%.fmt: %.pre
+ $(LATEX) $(LATEXFLAGS) -ini -jobname="$(basename $<)" "&$(LATEX) $<\dump"
%.pdf: %.mlog
if $(GREP) -iFq 'Rerun' $<; then $(LATEX) $(LATEXFLAGS) $(basename $<); fi
-%.mlog: %.tex %.fmt $(BIBS) $(TEXS) $(FIGURES) $(LISTINGS)
+%.mlog: %.tex output/%.fmt $(BIBS) $(TEXS) $(FIGURES) $(LISTINGS)
$(LATEX) $(LATEXFLAGS) $<
if $(GREP) -q '^\\bibdata{' $(basename $<).aux; then $(BIBTEX) $(BIBTEXFLAGS) $(basename $<); fi
if $(GREP) -q '\@istfilename' $(basename $<).aux; then $(MAKEGLOSSARIES) $(MAKEGLOSSARIESFLAGSFLAGS) $(basename $<); fi
dot -Tpng $< > $@
clean:
- $(RM) $(foreach DOC,$(DOCS),$(addprefix $(DOC).,\
- acn acr alg aux bbl blg fmt glg glo gls ist lof log lol lot nav out\
- pdf run.xml snm tdo toc vrb xdy)) $(FIGURES)
+ $(RM) output/** $(FIGURES)