new layout
[msc-thesis1617.git] / Makefile
index 6c581a2..8f9b551 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,11 @@ BIBTEX?=bibtex
 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/*)
@@ -15,15 +19,15 @@ BIBS:=$(wildcard *.tex)
 .PHONY: all clean
 .SECONDARY: $(addsuffix .fmt,$(DOCS)) $(FIGURES)
 
-all: $(addsuffix .pdf,$(DOCS))
+all: $(addprefix output/,$(addsuffix .pdf,$(DOCS)))
 
-%.fmt: %.pre
-       $(LATEX) $(LATEXFLAGS) -ini -jobname="$(basename $@)" "&$(LATEX) $<\dump"
+output/%.fmt: %.pre
+       $(LATEX) $(LATEXFLAGS) -ini -jobname="$(basename $<)" "&$(LATEX) $<\dump"
 
-%.pdf: %.mlog
+output/%.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
@@ -33,6 +37,4 @@ img/%.png: fig/%.dot
        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)