-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (34 loc) · 1.17 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
TARGET := main.pdf
IMAGE_DIR := images
TABLE_DIR := tables
CODE_DIR := code
BUILD_DIR := build
IMAGES := $(shell find $(IMAGE_DIR) -name "*.tex")
TABLES := $(shell find $(TABLE_DIR) -name "*.tex")
CODES := $(shell find $(CODE_DIR) -name "*.tex")
SOURCES := deps/pkgs.tex deps/macros.tex main.tex $(CODES) $(TABLES) $(IMAGES)
RASTERIMG := $(wildcard images/*.png)
VECTORIMG := $(wildcard images/*.svg)
LATEX = pdflatex -shell-escape -file-line-error -interaction=nonstopmode --output-directory=$(BUILD_DIR)
BIBTEX = bibtex
.PHONY: all debug clean distclean .dirs
all: $(TARGET)
$(TARGET): .dirs $(SOURCES) $(RASTERIMG) $(patsubst %.svg,%.pdf,$(VECTORIMG))
.dirs:
mkdir -p $(BUILD_DIR) $(IMAGE_DIR) $(TABLE_DIR) $(CODE_DIR)
%.pdf: %.tex %.bib
($(LATEX) $<; \
$(BIBTEX) $* > $(BUILD_DIR)/$(BIBTEX)_out.log; \
$(LATEX) $<; \
$(LATEX) $<;)
while ( grep -q '^LaTeX Warning: Label(s) may have changed' $(BUILD_DIR)/$*.log) \
do $(LATEX) $<; done
$(RM) *.aux *.idx *.ind *.out *.toc *.log *.bbl *.blg *.brf
mv $(BUILD_DIR)/$@ .
debug:
-grep Warning *.log
clean:
@ #$(RM) *.aux *.idx *.ind *.out *.toc *.log *.bbl *.blg *.brf
$(RM) $(BUILD_DIR) -r
distclean: clean
$(RM) *.pdf