-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (39 loc) · 1.46 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
## Makefile to copmile .tex files.
## targets and dependencies
# by default all .tex will be converted into .pdf:
targets=$(subst .tex,.pdf,$(wildcard *.tex))
#svgfigs=$(wildcard figures/*.svg)
#genfigs=$(svgfigs:figures/%.svg=generated-figures/%.pdf)
deps=$(wildcard *.sty) $(wildcard *.inc) $(wildcard figures/*.pdf) $(wildcard figures/*.jpg) $(wildcard figures/*.png) $(genfigs) Makefile
# Alternatively for one document split in several .tex:
#targets=main.pdf
#deps=$(wildcard images/*.pdf) $(wildcard images/*.jpg) $(wildcard images/*.png) Makefile $(wildcard *.tex)
##
## list of bibtex files
bib=$(wildcard *.bib)
##
## You should not have to touch anything below.
# default: all
all: $(targets)
%.pdf: %.tex $(bib) $(deps) | build
cd build && TEXINPUTS=..:${TEXINPUTS} BSTINPUTS=..:${BSTINPUTS} pdflatex ../$<
ifneq ($(bib),)
cd build && BIBINPUTS=..:${BIBINPUTS} BSTINPUTS=..:${BSTINPUTS} bibtex $*
cd build && TEXINPUTS=..:${TEXINPUTS} BSTINPUTS=..:${BSTINPUTS} pdflatex ../$<
endif
cd build && TEXINPUTS=..:${TEXINPUTS} BSTINPUTS=..:${BSTINPUTS} pdflatex ../$<
mv build/$@ .
build:
mkdir -p build
generated-figures:
mkdir -p generated-figures
# generated-figures/%.pdf: figures/%.svg | generated-figures
# inkscape --export-area-page --export-pdf=$@ -f=$<
debug:
@echo $(targets)
clean: buildclean
buildclean:
rm -rf build *~ figures/*~ generated-figures
distclean: clean
rm -f $(targets)
.PHONY: all clean buildclean distclean debug generated-figures