From 4df4af8593b16d676cacba135c80ec24004972dc Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 26 Jan 2017 19:27:26 +0100 Subject: [PATCH] update makefile --- final_assignment/Makefile | 30 ++++++++++++++---------- final_assignment/{preamble.tex => a.pre} | 0 2 files changed, 18 insertions(+), 12 deletions(-) rename final_assignment/{preamble.tex => a.pre} (100%) diff --git a/final_assignment/Makefile b/final_assignment/Makefile index 08b2acf..6babb94 100644 --- a/final_assignment/Makefile +++ b/final_assignment/Makefile @@ -1,24 +1,30 @@ -DOC:=a +DOCS:=a LATEX:=pdflatex BIBTEX:=bibtex +BIBTEXFLAGS:= LATEXFLAGS:=-file-line-error -halt-on-error -no-shell-escape -TEXS:=$(wildcard *.tex) +TEXS:=$(filter-out preamble.tex,$(wildcard *.tex)) +PREAMBLE:=$(wildcard preamble.tex) -.PHONY: all -.SECONDARY: $(DOC).fmt +.PHONY: all clean +.SECONDARY: $(addsuffix .fmt,$(DOCS)) -all: $(DOC).pdf +all: $(addsuffix .pdf,$(DOCS)) -%.fmt: preamble.tex +%.fmt: %.pre $(LATEX) $(LATEXFLAGS) -ini -jobname="$(basename $@)" "&$(LATEX) $<\dump" -%.pdf: %.tex %.fmt %.bib $(TEXS) +%.pdf: %.mlog + grep -iFq 'Rerun to get' $< &&\ + $(LATEX) $(LATEXFLAGS) $(basename $<) || true + +%.mlog: %.tex %.fmt %.bib $(TEXS) $(LATEX) $(LATEXFLAGS) $< - grep -q '^\\bibdata{' $(basename $<).aux && $(BIBTEX) $(basename $<) || true - $(LATEX) $(LATEXFLAGS) $< | tee $(basename $<).mlog - grep -iqF 'rerun' $(basename $<).mlog &&\ - $(LATEX) $(LATEXFLAGS) $< || true + grep -q '^\\bibdata{' $(basename $<).aux &&\ + $(BIBTEX) $(BIBTEXFLAGS) $(basename $<) || true + $(LATEX) $(LATEXFLAGS) $< | tee $@ clean: - $(RM) $(addprefix $(DOC).,aux log fmt toc bbl blg mlog run.xml out pdf) + $(RM) $(foreach DOC,$(DOCS),\ + $(addprefix $(DOC).,aux log fmt toc bbl blg run.xml out pdf)) diff --git a/final_assignment/preamble.tex b/final_assignment/a.pre similarity index 100% rename from final_assignment/preamble.tex rename to final_assignment/a.pre -- 2.20.1