-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (52 loc) · 2.18 KB
/
Copy pathMakefile
File metadata and controls
69 lines (52 loc) · 2.18 KB
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
# Rules for compiling the PDF from the LaTeX sources and displaying the output
# Variables
###############################################################################
### Git tags for different revisions
SUBMITTED = submitted-gji
### Documents to build
PDF = paper/preprint.pdf paper/manuscript.pdf paper/cover-letter.pdf
### File Types (for dependencies)
TEX = $(filter-out $(PDF:.pdf=.tex), $(wildcard paper/*.tex))
TEXVARS = $(wildcard paper/variables/*.tex)
BIB = $(wildcard paper/*.bib)
FIG = $(wildcard paper/figures/*)
# For word counting, how many words does the journal consider for each figure
WORDS_PER_FIGURE = 300
# Main targets
###############################################################################
preprint: paper/preprint.pdf
manuscript: paper/manuscript.pdf
# Use this to make a version with marked changes after the first reviews
diff-submitted: paper/manuscript-diff-$(SUBMITTED).pdf
letter: paper/cover-letter.pdf
all: $(PDF)
clean:
rm -rf $(PDF) paper/manuscript-diff-*.tex paper/_diff
format:
black code/
# The lock file specifies all packages installed at their exact versions. This
# can be used to completely replicate the environment on another computer. See
# REPRODUCING.md
lock: conda-lock.yml
wordcount:
@echo -n "Paper: "
@echo $$((`detex paper/content.tex | wc --words` + `detex paper/abstract.tex | wc --words` + $(WORDS_PER_FIGURE) * `ls paper/figures/*.png | wc --lines`))
@echo -n "Abstract: "
@echo $$((`detex paper/abstract.tex | wc --words`))
# Rules for building PDFs
###############################################################################
%.pdf: %.tex $(TEX) $(BIB) $(FIG)
tectonic -X compile $<
paper/manuscript-diff-$(SUBMITTED).tex: paper/manuscript.tex $(TEX) $(BIB) $(FIG)
cd paper \
&& latexdiff-vc --git --flatten --force --dir=_diff --rev $(SUBMITTED) `basename $<` \
&& cd .. \
&& mv paper/_diff/*.tex $@
paper/misc/cover-letter.pdf: paper/misc/cover-letter.tex paper/information.tex
tectonic -X compile $<
paper/variables.tex: $(TEXVARS)
cat $^ > $@
# Rules for generating results and other files
###############################################################################
conda-lock.yml: environment.yml
conda-lock -f $<