-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
47 lines (33 loc) · 1.2 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
LATEXMK := latexmk -lualatex
LATEX := lualatex
MAINTEX := thesis.tex
MAINPDF := $(MAINTEX:.tex=.pdf)
FIGDIR := figures
FIGTEX := $(wildcard $(FIGDIR)/chapter_*/*.tex)
FIGPDF := $(FIGTEX:.tex=.pdf)
BACKMTR := $(wildcard front_back_matter/**/*.tex)
BMTRPDF := $(BACKMTR:.tex=.pdf)
PLOTDIR := plots
PLOTTEX := $(wildcard $(PLOTDIR)/chapter_*/*.tex) $(wildcard $(PLOTDIR)/appendix_*/*.tex) \
$(wildcard $(PLOTDIR)/chapter_*/section_*/*.tex)
PLOTPDF := $(PLOTTEX:.tex=.pdf)
STYLETEX := definitions/colour.tex definitions/lattice_styles.tex
AUXTEX := $(filter-out $(MAINTEX) $(FIGTEX),$(wildcard **/*.tex))
cd_and_clean = cd $(dir $(realpath $(1))); $(LATEXMK) -C $(notdir $(1))
.PHONY: clean cleanthesis
$(MAINPDF) : $(AUXTEX) $(MAINTEX) $(FIGPDF) $(PLOTPDF) $(BMTRPDF)
$(LATEXMK) -pdf $(MAINTEX)
$(FIGPDF): %.pdf: %.tex | $(STYLETEX)
cd $(dir $<); \
$(LATEX) $(notdir $<)
$(PLOTPDF): %.pdf: %.tex | $(STYLETEX)
cd $(dir $<); \
$(LATEXMK) -C $(notdir $<); \
$(LATEXMK) -pdf $(notdir $<)
$(BMTRPDF): %.pdf: %.tex
cd $(dir $<); \
$(LATEX) $(notdir $<)
clean: $(MAINTEX) $(FIGTEX)
$(foreach file, $^, $(call cd_and_clean,$(file));)
cleanthesis: $(MAINTEX)
$(LATEXMK) -C $(MAINTEX)