Ian Jauslin
summaryrefslogtreecommitdiff
blob: d32a79cdf5e94c875f8d75e9cd4f9245a6da77d4 (plain)
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
PROJECTNAME=$(basename $(wildcard *.tex))
LIBS=$(notdir $(wildcard libs/*))
FIGS=$(notdir $(wildcard figs/*.fig))
JPGS=$(notdir $(wildcard figs/*.jpg))

PDFS=$(addsuffix .pdf, $(PROJECTNAME))
SYNCTEXS=$(addsuffix .synctex.gz, $(PROJECTNAME))

all: $(PROJECTNAME)

$(PROJECTNAME): $(LIBS) $(FIGS) $(JPGS)
	pdflatex -file-line-error $@.tex
	pdflatex -synctex=1 $@.tex

$(SYNCTEXS): $(LIBS) $(FIGS) $(JPGS)
	pdflatex -synctex=1 $(patsubst %.synctex.gz, %.tex, $@)


$(LIBS):
	ln -fs libs/$@ ./


$(FIGS):
	make -C figs/$@
	for pdf in $$(find figs/$@/ -name '*.pdf'); do ln -fs "$$pdf" ./ ; done

$(JPGS):
	ln -fs figs/$@ ./


clean-aux: clean-figs-aux
	rm -f $(addsuffix .aux, $(PROJECTNAME))
	rm -f $(addsuffix .log, $(PROJECTNAME))
	rm -f $(addsuffix .out, $(PROJECTNAME))

clean-libs:
	rm -f $(LIBS)

clean-figs:
	$(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean; )
	rm -f $(notdir $(wildcard figs/*.fig/*.pdf))

clean-figs-aux:
	$(foreach fig,$(addprefix figs/, $(FIGS)), make -C $(fig) clean-aux; )


clean-tex:
	rm -f $(PDFS) $(SYNCTEXS)

clean: clean-aux clean-tex clean-libs clean-figs