/[pdpsoft]/trunk/grid-mw-security/ees/thesis/Makefile
ViewVC logotype

Contents of /trunk/grid-mw-security/ees/thesis/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 787 - (show annotations) (download)
Tue Sep 15 13:30:48 2009 UTC (12 years, 8 months ago) by aramv
File size: 6034 byte(s)
Latest thesis updates
1 # Makefile for LaTeX files
2
3 # Original Makefile from http://www.math.psu.edu/elkin/math/497a/Makefile
4
5 # Please check http://www.acoustics.hut.fi/u/mairas/UltimateLatexMakefile
6 # for new versions.
7
8 # Copyright (c) 2005,2006 (in order of appearance):
9 # Matti Airas <Matti.Airas@hut.fi>
10 # Rainer Jung
11 # Antoine Chambert-Loir
12 # Timo Kiravuo
13
14 # Permission is hereby granted, free of charge, to any person obtaining
15 # a copy of this software and associated documentation files (the
16 # "Software"), to deal in the Software without restriction, including
17 # without limitation the rights to use, copy, modify, merge, publish,
18 # distribute, sublicense, and/or sell copies of the Software, and to
19 # permit persons to whom the Software is furnished to do so, subject to
20 # the following conditions:
21
22 # The above copyright notice and this permission notice shall be
23 # included in all copies or substantial portions of the Software.
24
25 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
28 # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
29 # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
30 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
33 # $Id: Makefile,v 1.18 2006-06-19 10:58:11 mairas Exp $
34
35 LATEX = latex
36 BIBTEX = bibtex
37 MAKEINDEX = makeindex
38 XDVI = xdvi -gamma 4
39 DVIPS = dvips
40 DVIPDF = dvipdft
41 L2H = latex2html
42 GH = gv
43
44 RERUN = "(There were undefined references|Rerun to get (cross-references|the bars) right)"
45 RERUNBIB = "No file.*\.bbl|Citation.*undefined"
46 MAKEIDX = "^[^%]*\\makeindex"
47 MPRINT = "^[^%]*print"
48 USETHUMBS = "^[^%]*thumbpdf"
49
50 DATE=$(shell date +%Y-%m-%d)
51
52 COPY = if test -r $(<:%.tex=%.toc); then cp $(<:%.tex=%.toc) $(<:%.tex=%.toc.bak); fi
53 RM = rm -f
54 OUTDATED = echo "EPS-file is out-of-date!" && false
55
56 # These are OK
57
58 SRC := $(shell egrep -l '^[^%]*\\begin\{document\}' *.tex)
59 TRG = $(SRC:%.tex=%.dvi)
60 PSF = $(SRC:%.tex=%.ps)
61 PDF = $(SRC:%.tex=%.pdf)
62
63 # These are not
64
65 #BIBFILE := $(shell perl -ne '($$_)=/^[^%]*\\bibliography\{(.*?)\}/;@_=split /,/;foreach $$b (@_) {print "$$b.bib "}' $(SRC))
66 #DEP := $(shell perl -ne '($$_)=/^[^%]*\\include\{(.*?)\}/;@_=split /,/;foreach $$t (@_) {print "$$t.tex "}' $(SRC))
67 #EPSPICS := $(shell perl -ne '@foo=/^[^%]*\\(includegraphics|psfig)(\[.*?\])?\{(.*?)\}/g;if (defined($$foo[2])) { if ($$foo[2] =~ /.eps$$/) { print "$$foo[2] "; } else { print "$$foo[2].eps "; }}' $(SRC) $(DEP))
68
69
70 define run-latex
71 $(COPY);$(LATEX) $<
72 egrep $(MAKEIDX) $< && ($(MAKEINDEX) $(<:%.tex=%);$(COPY);$(LATEX) $<) >/dev/null; true
73 egrep -c $(RERUNBIB) $(<:%.tex=%.log) && ($(BIBTEX) $(<:%.tex=%);$(COPY);$(LATEX) $<) ; true
74 egrep $(RERUN) $(<:%.tex=%.log) && ($(COPY);$(LATEX) $<) >/dev/null; true
75 egrep $(RERUN) $(<:%.tex=%.log) && ($(COPY);$(LATEX) $<) >/dev/null; true
76 if cmp -s $(<:%.tex=%.toc) $(<:%.tex=%.toc.bak); then true ;else $(LATEX) $< ; fi
77 $(RM) $(<:%.tex=%.toc.bak)
78 # Display relevant warnings
79 egrep -i "(Reference|Citation).*undefined" $(<:%.tex=%.log) ; true
80 endef
81
82 define run-pdflatex
83 LATEX=pdflatex
84 @$(run-latex)
85 endef
86
87 define get_dependencies
88 deps=`perl -ne '($$_)=/^[^%]*\\\(?:include|input)\{(.*?)\}/;@_=split /,/;foreach $$t (@_) {print "$$t.tex "}' $<`
89 endef
90
91 define getbibs
92 bibs=`perl -ne '($$_)=/^[^%]*\\\bibliography\{(.*?)\}/;@_=split /,/;foreach $$b (@_) {print "$$b.bib "}' $< $$deps`
93 endef
94
95 define geteps
96 epses=`perl -ne '@foo=/^[^%]*\\\(includegraphics|psfig)(\[.*?\])?\{(.*?)\}/g;if (defined($$foo[2])) { if ($$foo[2] =~ /.eps$$/) { print "$$foo[2] "; } else { print "$$foo[2].eps "; }}' $< $$deps`
97 endef
98
99 define manconf
100 mandeps=`if test -r $(basename $@).cnf ; then cat $(basename $@).cnf |tr -d '\n\r' ; fi`
101 endef
102
103 all : $(TRG)
104
105 .PHONY : all show clean ps pdf showps veryclean
106
107 clean :
108 -rm -f $(TRG) $(PSF) $(PDF) $(TRG:%.dvi=%.aux) $(TRG:%.dvi=%.bbl) $(TRG:%.dvi=%.blg) $(TRG:%.dvi=%.log) $(TRG:%.dvi=%.out) $(TRG:%.dvi=%.idx) $(TRG:%.dvi=%.ilg) $(TRG:%.dvi=%.ind) $(TRG:%.dvi=%.toc) $(TRG:%.dvi=%.d) $(TRG:%.dvi=%.glo) $(TRG:%.dvi=%.gls) $(TRG:%.dvi=%.nlo) $(TRG:%.dvi=%.nls) $(TRG:%.dvi=%.gig) $(TRG:%.dvi=%.ist) $(TRG:%.dvi=%.lof) thesis_booklet.pdf
109
110 veryclean : clean
111 -rm -f *.log *.aux *.dvi *.bbl *.blg *.ilg *.toc *.lof *.lot *.idx *.ind *.ps *~
112
113 # This is a rule to generate a file of prerequisites for a given .tex file
114 %.d : %.tex
115 $(get_dependencies) ; echo $$deps ; \
116 $(getbibs) ; echo $$bibs ; \
117 $(geteps) ; echo $$epses ; \
118 $(manconf) ; echo $$mandeps ;\
119 echo "$*.dvi $@ : $< $$deps $$bibs $$epses $$mandeps" > $@
120
121 include $(SRC:.tex=.d)
122
123 # $(DEP) $(EPSPICS) $(BIBFILE)
124 $(TRG) : %.dvi : %.tex
125 @$(run-latex)
126
127 $(PSF) : %.ps : %.dvi
128 @$(DVIPS) $< -o $@
129
130 $(PDF) : %.pdf : %.dvi
131 @$(DVIPDF) -o $@ $<
132 # To use pdflatex, comment the two lines above and uncomment the lines below
133 #$(PDF) : %.pdf : %.tex
134 # @$(run-pdflatex)
135
136
137 show : $(TRG)
138 @for i in $(TRG) ; do $(XDVI) $$i & done
139
140 showps : $(PSF)
141 @for i in $(PSF) ; do $(GH) $$i & done
142
143 ps : $(PSF)
144
145 nomenclature : $(PSF)
146 @$(MAKEINDEX) thesis.nlo -s nomencl.ist -o thesis.nls
147
148 glossary : $(PSF)
149 @$(MAKEINDEX) thesis.glo -s thesis.ist -t thesis.gig -o thesis.gls
150
151 booklet : $(PSF)
152 @psbook ./thesis.ps ./out2.ps
153 @psnup -2 ./out2.ps ./out2up.ps
154 @ps2pdf ./out2up.ps ./thesis_booklet.pdf
155 @rm ./out2.ps
156 @rm ./out2up.ps
157
158 pdf : $(PDF)
159
160 # TODO: This probably needs fixing
161 html : @$(DEP) $(EPSPICS)
162 @$(L2H) $(SRC)
163
164
165
166 ######################################################################
167 # Define rules for EPS source files.
168
169 # These rules probably just cause unnecessary confusion, so commenting
170 # them away for the time being. -- mairas 2005-01-12
171
172 #%.eps: %.sxd
173 # $(OUTDATED)
174 #%.eps: %.sda
175 # $(OUTDATED)
176 #%.eps: %.png
177 # $(OUTDATED)
178 #%.eps: %.sxc
179 # $(OUTDATED)
180 #%.eps: %.xcf
181 # $(OUTDATED)
182 ##%.eps: %.zargo
183 # $(OUTDATED)
184 #%.eps: %.m
185 # @egrep -q $(MPRINT) $< && ($(OUTDATED))

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28