-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (35 loc) · 1.06 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
45
46
svgs := $(patsubst img/svg/%.svg,tmp/svg/%.pdf,$(wildcard img/svg/*.svg))
python := $(patsubst img/python/%.py,tmp/python/%.pdf,$(wildcard img/python/*.py))
dots := $(patsubst img/dot/%.dot,tmp/dot/%.tex,$(wildcard img/dot/*.dot))
Rs := $(patsubst img/R/%.R,tmp/R/%.tex,$(wildcard img/R/*.R))
thesis.pdf: thesis.tex
latexmk -pdflatex thesis.tex
thesis.tex: src/*.md template.tex thesis.yaml img/**/*.* $(svgs) $(python) $(dots) $(Rs) bibliography.bib
pandoc \
-d defaults.yaml \
src/chapter_*.md \
| \
sed -r \
-e 's/ \\autocite/~\\autocite/g' \
-e 's/\. /.\n/g' \
> thesis.tex
tmp/svg/%.pdf: img/svg/%.svg
inkscape -C --export-latex -o $@ $<
tmp/dot/%.tex: img/dot/%.dot | tmp/dot
dot2tex --figonly $< > $@
tmp/python/%.pdf: img/python/%.py | tmp/python
python3 $< > $@
tmp/R/%.tex: img/R/%.R | tmp/R
Rscript $< > $@
tmp/dot:
@mkdir -p tmp/dot
tmp/python:
@mkdir -p tmp/python
tmp/R:
@mkdir -p tmp/R
.PHONY: clean distclean upload open
clean:
latexmk -C -quiet thesis.tex
rm -rf thesis.tex
distclean: clean
rm -rf tmp/ "$(shell biber --cache)"