-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
58 lines (43 loc) · 1.64 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
texroot=main
texfinal=grins.pdf
vectorsources := $(shell find rawfigs/ -name '*.dia' -o -name '*.eps' -o -name '*.ps' -o -name '*.pdf' -o -name '*.svg')
rastersources := $(shell find rawfigs/ -name '*.jpg' -o -name '*.gif')
readysources := $(shell find rawfigs/ -name '*.png' -o -name '*.pdf')
vectorfigs := $(shell echo ' ' $(vectorsources) ' ' | sed -e 's> *raw> >g' -e 's/\.[^. ]* /.pdf /g' )
rasterfigs := $(shell echo ' ' $(rastersources) ' ' | sed -e 's> *raw> >g' -e 's/\.[^. ]* /.png /g' )
readyfigs := $(shell echo ' ' $(readysources) ' ' | sed -e 's> *raw> >g' )
figures := $(vectorfigs) $(rasterfigs) $(readyfigs)
bibfiles := $(wildcard *.bib)
styfiles := $(wildcard $(repo_path)/latex_common/*.sty)
clsfiles := $(wildcard $(repo_path)/latex_common/*.cls)
all: $(texfinal)
figures: $(figures)
$(texfinal): *.tex $(bibfiles) $(figures) $(clsfiles) $(styfiles)
latexmk -pdf -f $(texroot).tex -jobname=grins
clean: cleanlatex cleanfigs
cleanfigs:
rm -rf $(figures)
cleanlatex:
latexmk -C -bibtex
figs/%.pdf: rawfigs/%.dia
@mkdir -p $(dir $@)
dia -t eps-builtin -e $?_roytemp.eps $? && epstopdf $?_roytemp.eps -o=$@
@rm -f $?_roytemp.eps
figs/%.pdf: rawfigs/%.eps
@mkdir -p $(dir $@)
epstopdf $? -o=$@
figs/%.pdf: rawfigs/%.pdf
@mkdir -p $(dir $@)
@reldir=`echo $(dir $@) | sed -e 's>[^/]*/*>../>g'`; ln -sf $${reldir}$? $@
figs/%.pdf: rawfigs/%.ps
@mkdir -p $(dir $@)
ps2pdf $? $@
figs/%.pdf: rawfigs/%.svg
@mkdir -p $(dir $@)
inkscape $? -z --export-pdf=$@
figs/%.png: rawfigs/%.jpg
@mkdir -p $(dir $@)
convert $? $@
figs/%.png: rawfigs/%.png
@mkdir -p $(dir $@)
@reldir=`echo $(dir $@) | sed -e 's>[^/]*/*>../>g'`; ln -sf $${reldir}$? $@