-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
83 lines (70 loc) · 1.97 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
LATEXMK = latexmk
LATEXMKOPT = -xelatex -bibtex -shell-escape -synctex=1 -interaction=nonstopmode -file-line-error
CONTINUOUS = -pvc -view=default -halt-on-error
DOCUMENT := document
OUTPUT := $(DOCUMENT)
RESEARCHR := b0402c72-980f-6580-6b0e-7a614ed2d64c-master-thesis
SRCDIR := src
FIGDIR := src/fig
IMGDIR := src/img
RESDIR := src/res
OUTDIR := out
SRCBIB := $(SRCDIR)/researchr.bib
SRCS := Makefile $(wildcard $(SRCDIR)/*.tex) $(shell find $(FIGDIR)/* $(IMGDIR)/* $(RESDIR)/* -type f) $(SRCBIB)
IMGS := $(wildcard $(IMGDIR)/*.ps) $(wildcard $(IMGDIR)/*.eps)
OBJS := $(wildcard $(OUTDIR)/*.aux) $(wildcard $(OUTDIR)/*.bbl) $(wildcard $(OUTDIR)/*.pdf)
.PHONY: all clean .refresh view show bib clean-bib
all: $(DOCUMENT).pdf
.refresh:
touch .refresh
$(DOCUMENT).pdf: .refresh $(SRCS)
mkdir -p ../$(OUTDIR)/
cd $(SRCDIR)/ && \
$(LATEXMK) $(LATEXMKOPT) \
-output-directory=../$(OUTDIR) \
$(DOCUMENT)
mv $(OUTDIR)/$(DOCUMENT).pdf $(OUTPUT).pdf
-mv $(OUTDIR)/$(DOCUMENT).vtc $(OUTPUT).vtc
-mv $(OUTDIR)/$(DOCUMENT).synctex.gz $(OUTPUT).synctex.gz
watch:
mkdir -p ../$(OUTDIR)/
cd $(SRCDIR)/ && \
$(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) \
-output-directory=../$(OUTDIR) \
$(DOCUMENT)
bib: clean-bib $(SRCBIB) fix-bib
$(SRCBIB):
curl https://researchr.org/downloadbibtex/bibliography/$(RESEARCHR)/ -o $(SRCBIB)
fix-bib: $(SRCBIB)
sed -i '' '1 s/^/% /' $(SRCBIB)
sed -i '' 's/doi = {http.*\/\(10\..*\)}/doi = {\1}/' $(SRCBIB)
sed -i '' '/doi = {http.*}/d' $(SRCBIB)
clean-bib:
rm -f $(SRCBIB)
clean: clean-bib
rm -rf $(OUTDIR)/
rm -f *.aux
rm -f *.bbl
rm -f *.blg
rm -f *.fdb_latexmk
rm -f *.fls
rm -f *.log
rm -f *.out
rm -f *.pdf
rm -f *.swp
rm -f *.synctex.gz
rm -f *.vtc
rm -f src/*.aux
rm -f src/*.bbl
rm -f src/*.blg
rm -f src/*.fdb_latexmk
rm -f src/*.fls
rm -f src/*.log
rm -f src/*.out
rm -f src/*.pdf
rm -f src/*.swp
rm -f src/*.synctex.gz
rm -f src/*.vtc
show: view
view: all
open $(OUTPUT).pdf