-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (30 loc) · 1.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# dynamically find chapters in markdown & expected tex
CHAPTERSMD := $(wildcard content/*.md)
CHAPTERSTX := $(patsubst %.md,%.tex,$(CHAPTERSMD))
CHAPTERS := $(patsubst content/%,tex/%,$(CHAPTERSTX))
# build dissertation, using main tex file and all chapters/content
# $< refers to first dependency, $@ refers to output
dissertation.pdf: dissertation.tex $(CHAPTERS)
latexmk -xelatex -outdir=tmp -pdf -silent -f $<; \
cp tmp/$@ .
# convert markdown to tex (depends on content/*.md)
tex/%.tex: content/%.md
pandoc -F pandoc-crossref --natbib --top-level-division=chapter refs/crossref.yaml $< -o $@
# embed yaml data into thesis template to produce tex
dissertation.tex: templates/dissertate.tex dissertation.yaml
pandoc --template=$< dissertation.yaml -o $@
# build dissertation (for uu-thesis-office)
uu: dissertation-uu.tex $(CHAPTERS)
latexmk -outdir=tmp -pdf -silent -f $<; \
cp tmp/dissertation-uu.pdf dissertation-uu.pdf
# embed yaml data (for uu-thesis-office)
dissertation-uu.tex: templates/uu.tex dissertation.yaml
pandoc --template=$< dissertation.yaml -o $@
cleanuu:
rm -f dissertation-uu.tex
rm -f dissertation-uu.pdf
clean: cleanuu
rm -rf tex/
mkdir tex/
rm -f dissertation.tex
rm -f dissertation.pdf