-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
69 lines (58 loc) · 1.57 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
59
60
61
62
63
64
65
66
67
68
include ./rules.mk
TARGET = main
LATEX = pdflatex < /dev/null
BIBTEX = bibtex
STYLE =
PDF = $(TARGET).pdf
SRCS = $(shell find . -name '*.tex' -type f -print)
FIGS = $(shell find */Figs/ -name '*.pdf' -type f -print)
OUTS = $(shell find */examples/ -name '*.out' -type f -print)
BIBS = pip.bib
all : clean examples Makefile
rm -f $(PDF)
make $(PDF)
pipkw.sh: pip-keywords.sh
./pip-keywords.sh
examples: pipkw.sh
find . -name examples -print | \
while read ex; do \
echo $$ex; \
make -C $$ex; \
done
.PHONY: examples
$(PDF): $(SRCS) $(FIGS) $(OUTS) $(BIBS) $(STYLE)
$(RM) $(TARGET).idx
$(LATEX) $(TARGET)
$(BIBTEX) $(TARGET)
rerun_count=5; rcount=0; \
while egrep -s 'Rerun (LaTeX|to get cross-references right)' $(TARGET).log; \
do \
if [ $${rcount} -ge $${rerun_count} ]; then \
echo 'Something goes wrong'; exit 1; \
fi; \
echo "Rerunning latex .... ($${rerun_count})" ;\
rm -f $(TARGET).log; \
$(LATEX) $(TARGET); \
makeindex -l $(TARGET).idx; \
rcount=`expr $${rcount} + 1` ;\
done
grep -e "LaTeX\ Warning" \
-e "Package\ natbib\ Warning" \
-e "undefined" \
-e "multiply\ defined" \
$(TARGET).log
clean-hook:
$(RM) *.lol *.lof *.lot *.toc *.bbl *.blg *.bbl
$(RM) *.idx *.ilg *.ind *.out *.aux *.log
find ./*/ -name Makefile -print | \
while read ex; do \
dir=$$(dirname $$ex); \
make -C $$dir clean; \
done
veryclean-hook: clean
$(RM) $(PDF) pipkw.sh
find ./*/ -name Makefile -print | \
while read ex; do \
dir=$$(dirname $$ex); \
make -C $$dir veryclean; \
done