-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (48 loc) · 1.62 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
LATEX=pdflatex
LATEXOPT=--shell-escape
NONSTOP=--interaction=nonstopmode
BIBTEX=bibtex
LATEXMK=latexmk
LATEXMKOPT=-pdf
CONTINUOUS=-pvc
BIBLIO=references
MAIN=main
DRAFT=draft
CHANGES_POSTFIX=_changes
TEX_FILES := $(shell find tex/* -type f)
SOURCES=$(MAIN).tex $(TEX_FILES) Makefile
DRAFT_SOURCES=$(DRAFT).tex $(TEX_FILES) Makefile
FIGURES := $(shell find figures/* -type f)
all: $(MAIN).pdf
.refresh:
touch .refresh
$(MAIN).pdf: $(MAIN).tex .refresh $(SOURCES) $(FIGURES)
$(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) \
-pdflatex="$(LATEX) $(LATEXOPT) $(NONSTOP) %O %S" $(MAIN)
$(BIBLIO):
$(BIBTEX) $(MAIN).aux
force:
touch .refresh
rm $(MAIN).pdf
$(LATEXMK) $(LATEXMKOPT) $(CONTINUOUS) -pdflatex="$(LATEX) $(LATEXOPT) %O %S" $(MAIN)
clean:
$(LATEXMK) -f -C $(MAIN)
$(LATEXMK) -f -C $(DRAFT)
$(LATEXMK) -f -C $(MAIN)$(CHANGES_POSTFIX)
rm -f $(MAIN).pdfsync $(DRAFT).pdfsync
rm -rf *~ *.tmp
rm -f *.bbl *.blg *.aux *.end *.fls *.log *.out *.fdb_latexmk
rm -f $(MAIN)$(CHANGES_POSTFIX).tex
once:
$(LATEXMK) $(LATEXMKOPT) -pdflatex="$(LATEX) $(LATEXOPT) %O %S" $(MAIN)
debug:
$(LATEX) $(LATEXOPT) $(MAIN)
draft: $(DRAFT).tex $(DRAFT_SOURCES) $(FIGURES)
$(LATEXMK) $(LATEXMKOPT) -pdflatex="$(LATEX) $(LATEXOPT) %O %S" $(DRAFT)
$(MAIN)$(CHANGES_POSTFIX).tex: $(MAIN).tex $(DRAFT).tex $(SOURCES) $(FIGURES)
# rm $(MAIN)$(CHANGES_POSTFIX).tex
latexdiff --flatten $(DRAFT).tex $(MAIN).tex > $(MAIN)$(CHANGES_POSTFIX).tex
diff: $(MAIN)$(CHANGES_POSTFIX).tex
compile_diff: $(MAIN)$(CHANGES_POSTFIX).tex $(FIGURES)
$(LATEXMK) $(LATEXMKOPT) -pdflatex="$(LATEX) $(LATEXOPT) %O %S" $(MAIN)$(CHANGES_POSTFIX)
.PHONY: clean force once all