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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# Makefile.latex -- Rules for processing LaTeX files with "make"
#
# Copyright (C) 1999,2005 Rolf Niepraschk, Rolf.Niepraschk@ptb.de, 2005/01/20
.SUFFIXES : .tex .dvi .ps .pdf .eps .mp .mps
SHELL = /bin/sh
ifeq ($(BIBTEX),)
BIBTEX= bibtex
endif
ifeq ($(METAPOST),)
METAPOST = mpost
endif
ifeq ($(MAKEINDEX),)
MAKEINDEX = makeindex
endif
ifeq ($(MAKEGLOSSARY),)
MAKEGLOSSARY = makeindex
endif
ifeq ($(GREP),)
GREP = grep
endif
ifeq ($(DIFF),)
DIFF = diff
endif
ifeq ($(TOUCH),)
TOUCH = touch
endif
ifeq ($(CP),)
CP = cp
endif
ifneq ($(MAKEINDEXSTYLE),)
idxstyle = -s $(MAKEINDEXSTYLE)
endif
ifneq ($(MAKEGLOSSARYSTYLE),)
glostyle = -s $(MAKEGLOSSARYSTYLE)
endif
ifeq ($(RUNMAX),)
runmax = 5
else
runmax = $(RUNMAX)
endif
bibwarn = 'There were undefined references'
rerunwarn = 'Rerun to get cross-references right'
linenowarn = 'rerun to get it right'
# Package longtable Warning: Table widths have changed. Rerun LaTeX.
multlab = 'There were multiply-defined labels'
ltxmisc = $*.toc $*.lof $*.lot $*.idx $*.glo #$*.out
%.dvi %.pdf : %.ltx
@ $(latexcmds)
%.dvi %.pdf : %.tex
@ $(latexcmds)
define latexcmds
$(TOUCH) $(ltxmisc) # create some files if necessary
runs=0; \
while test $$runs -lt $(runmax); do \
runs=`expr $$runs + 1`; rerun=0; status=0; \
$(foreach i, $(ltxmisc), $(CP) $i $i.old;) \
$(LATEX) '$(DOCUMENTOPT)\input{$<}'; \
if test $$? -gt 0; then status=`expr $$status + 64`; fi; \
if $(GREP) $(rerunwarn) $*.log > /dev/null; then rerun=1; fi; \
if $(GREP) $(linenowarn) $*.log > /dev/null; then rerun=1; fi; \
if $(DIFF) $*.idx $*.idx.old > /dev/null; then :; else \
$(MAKEINDEX) $(MAKEINDEXFLAGS) $(idxstyle) \
-t $*.ilg -o $*.ind $*.idx; \
if test $$? -gt 0; then status=`expr $$status + 256`; break; fi; \
fi; \
if $(DIFF) $*.glo $*.glo.old > /dev/null; then :; else \
$(MAKEGLOSSARY) $(MAKEGLOSSARYFLAGS) $(glostyle) \
-t $*.glg -o $*.gls $*.glo; \
if test $$? -gt 0; then status=`expr $$status + 512`; break; fi; \
fi; \
$(foreach i, $(ltxmisc), \
if $(DIFF) $i $i.old > /dev/null; then :; else rerun=1; fi;) \
echo '++++++++++++++++++++++++++++++++' rerun=$$rerun runs=$$runs; \
if test $$rerun -eq 0; then break; fi; \
done; \
$(RM) $(ltxmisc:=.old); \
for i in $(ltxmisc); do if test ! -s $$i; then $(RM) $$i; fi; done; \
exit $$status
endef
_clean :
$(RM) $(addprefix $(MAIN), .log .aux .bbl .blg .ind .ilg .gls .glg \
$(ltxmisc))
|