From 51ae3ad8646d0ee74f3613a5bed5cf4ed440f6e1 Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sun, 19 Aug 2018 16:08:47 +0200 Subject: [PATCH] Store intermediate files in separate build directory --- .gitignore | 1 + Makefile | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 8a53aa6..dc31fc3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ *.synctex.gz /presentations/*.pdf /presentations/auto +/presentations/build/ diff --git a/Makefile b/Makefile index 4638c74..e090685 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,23 @@ PRESENTATIONS=$(patsubst %.tex, %.pdf, $(wildcard presentations/*.tex)) +BUILD_DIR=build +BUILD_DECKS=$(subst presentations, presentations/$(BUILD_DIR), $(wildcard presentations/content/*)) +LATEX=pdflatex -output-directory $(BUILD_DIR) all: ${PRESENTATIONS} clean: - rm -f presentations/*.log - rm -f presentations/*.out - rm -f presentations/*.nav - rm -f presentations/*.aux - rm -f presentations/*.snm - rm -f presentations/*.toc + rm -fr presentations/$(BUILD_DIR) + +distclean: clean + rm -f presentations/*.pdf + +.SECONDARY: $(BUILD_DECKS) +presentations/$(BUILD_DIR)/%: + mkdir -p $@ .ONESHELL: -presentations/%.pdf : presentations/%.tex +presentations/%.pdf : presentations/%.tex $(BUILD_DECKS) cd presentations - pdflatex $(notdir $<) - pdflatex $(notdir $<) + $(LATEX) $(notdir $<) + $(LATEX) $(notdir $<) + mv $(BUILD_DIR)/$*.pdf .