root/trunk/doc/latex/Makefile @ 61

Revision 61, 8.2 kB (checked in by anoosheh, 4 years ago)

Added latex doc of the TPM-Manager. This can be compiled using the Sirrix templates.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1# Makefile for pdflatex documents
2#  Author:   Christian Stueble <stueble@acm.org>
3#  Version:  $Id: Makefile,v 1.12 2002/06/28 12:47:21 steiner Exp $
4#
5PRIMTARGET  = tpmmanager
6
7# Path to templates of Sirrix AG. I suggest to set an absolut path using an
8# environment variable using 'export SIRRIXTEMPLATES=...'.
9ifndef SIRRIXTEMPLATES
10        SIRRIXTEMPLATES = /home/anoosheh/projects/templates/templates
11endif
12
13# site specific variables
14PDFLATEX=pdflatex
15BIBTEX=bibtex -min-crossrefs=5
16MAKEINDEX=makeindex -s ${SIRRIXTEMPLATES}/latex/styles/ignoreat.ist
17MAKEGLOSSARY=makeglos.pl
18# we need xfig/transfig >= 3.2.3c to prevent bug with psfrag
19RM=rm -f
20CP=cp -f
21ED=ed
22DIFF=diff
23ENV=env
24TOUCH=touch
25DIRSEP=/
26PATHSEP=:
27ifdef PWD
28        # note that we put already here the DIRSEP so we later don't have to add it ..
29        TOPDIR=${PWD}${DIRSEP}
30else
31        # .. and can tolerate a relative path if PWD doesn't exist
32        TOPDIR=
33endif
34
35## Local configuration file 'make.loc'
36##
37## Either the Makefile in the package or the optional make.loc file can redefine above
38## you might also like define TEXINPUTS there ...
39##
40## Windows users
41## In particular Windows users probably will have to define 'PATHSEP=\;' and 'VIEWDVI=yap'.
42## (for MiKTeX. it also seems that the MiKTeX's 'bibtex' doesn't understand 'BIBINPUTS';
43## you might have to edit your tex .ini file and add the directory ....\bibtex to your path ...
44## you might have to define TOPDIR
45-include make.loc
46
47# You shouldn't need to change anything below this.
48# If you did, the change probably needs to be reflected in all such files.
49
50
51# various standard definitions
52#------------------------------
53# various directories
54SRCDIR      = ${TOPDIR}src
55STYLEDIR    = ${TOPDIR}styles
56BIBDIR      = ${TOPDIR}bibtex
57FONTDIR     = ${TOPDIR}fonts
58IMAGEDIR    = ${TOPDIR}images
59
60# fix latex and bibtex invocation to match the paths ...
61TEXINPUTS  := .$(PATHSEP)$(SRCDIR)$(PATHSEP)$(STYLEDIR)$(PATHSEP)$(IMAGEDIR)$(PATHSEP)$(BIBDIR)$(PATHSEP)$(PATHSEP)$(TEXINPUTS)$(PATHSEP)$(SIRRIXTEMPLATES)//$(PATHSEP)
62MFINPUTS   := $(FONTDIR)$(DIRSEP)$(DIRSEP)$(PATHSEP)$(MFINPUTS)
63PDFLATEX   := $(ENV) MFINPUTS=$(MFINPUTS) TEXINPUTS=$(TEXINPUTS) $(PDFLATEX)
64
65GLOSSBIBTEX   :=$(ENV) BSTINPUTS=$(GLOSSBSTINPUTS) BIBINPUTS=$(GLOSSBIBINPUTS) $(BIBTEX)
66
67BIBINPUTS:=$(BIBDIR)$(PATHSEP)$(BIBINPUTS)$(PATHSEP)$(SIRRIXTEMPLATES)/latex/bibtex
68BSTINPUTS:=$(BIBDIR)$(PATHSEP)$(BSTINPUTS)
69BIBTEX   :=$(ENV) BIBINPUTS=$(BIBINPUTS) BSTINPUTS=$(BSTINPUTS) $(BIBTEX)
70# all modified environments
71NEWENVDEF = \
72        BSTINPUTS=$(GLOSSBSTINPUTS)\
73        BIBINPUTS=$(GLOSSBIBINPUTS)$(PATHSEP)$(BIBINPUTS)\
74        MFINPUTS=$(MFINPUTS) TEXINPUTS=$(TEXINPUTS) 
75
76# the prime source/target
77ifdef PRIMSOURCE
78  # PRIMTARGET is in the default case defined but maybe somebody might have a non-standard
79  # locations for PRIMSOURCE and has defined PRIMSOURCE instead of PRIMTARGET
80  PRIMTARGET= $(notdir $(PRIMSOURCE:%.tex=%))
81endif
82ifndef PRIMSOURCE
83  # somebody might have defined it for non-standard locations of PRIMSOURCE
84  PRIMSOURCE  = $(SRCDIR)$(DIRSEP)$(PRIMTARGET).tex
85endif
86
87# common sources
88STYLESOURCES= $(wildcard $(STYLEDIR)$(DIRSEP)*.sty)
89TEXSOURCES  = $(wildcard $(SRCDIR)$(DIRSEP)*.tex)
90BIBSOURCES  = $(wildcard $(BIBDIR)$(DIRSEP)*.bib)
91
92# common targets based on primtarget
93PDFTARGET      = $(PRIMTARGET).pdf
94BIBTARGET      = $(PRIMTARGET).bbl
95INDEXTARGET    = $(PRIMTARGET).ind
96GLOSSARYTARGET = $(PRIMTARGET).gls
97ACRONYMTARGET  = $(PRIMTARGET).acn
98
99# fixpoint temp-file
100PRIMFIXPOINT= $(PRIMTARGET).fpt
101
102
103# the 'exported' target-rules
104# -------------------------------------
105# Our primary goal is to make the final DVI file
106all:: $(PDFTARGET) 
107
108# clean up temp file
109clean::
110        $(RM) *.aux *.toc *.lof *.lot *.blg *.bbl *.cb *.idx *.ilg *.ind *.ent \
111              *.dvi *~ *.log err *.fpt head.tmp body.tmp *.out *.brf *.glo *.gls \
112              *.ist *.glg *.acr *.alg *.acn $(PRIMTARGET).pdf
113
114# clean up also "final" generated files
115veryclean:: clean
116        $(RM) $(PDFTARGET)
117
118# clean up all generatable files, regardless of target
119distclean:: veryclean
120        $(RM) *.ps *.dvi feymr10.*
121
122# the 'hidden' rules
123# -------------------------------------
124
125# BIBTEX specific targets
126# biboutput depends on the bib-sources as well as the tex-files
127# as this target is after the main dvi target latex should have been run already once so
128# aux file should exist (unfortunatly we cannot make a target on .aux or otherwise we will
129# never consider everything done
130# Ideally bibtex should only be run if texsources changed bib-references. But this seems
131# rather involved to figure out (e.g. diff of aux-files before/after and grep for
132# 'citation|bibcite|bibdata|bibstyle' ...)
133$(BIBTARGET):: $(BIBSOURCES) $(TEXSOURCES)
134        $(BIBTEX) $(PRIMTARGET) || ( $(RM) $@; $(RM) $(PRIMFIXPOINT); exit -1)
135        $(RM) $(PRIMFIXPOINT)   # we have to start 'fixpoint calculation' from scratch
136
137# if you just would like to run bibtex once (e.g for debugging)
138Bibtex:
139        $(BIBTEX) $(PRIMTARGET) 
140
141
142# INDEX specific target
143# index depends only texsource (again the usual thing about not being able to target *.idx)
144# Ideally makeindex should only be run only if texsources changed index related stuff.
145# But this seems rather involved to figure out (e.g. diff of $(PRIMTARGET).idx file)
146Makeindex:
147        # fix some index problems
148        # ed/vi replace expressions are
149        # - '1,$s/\(see{.*\)!/\1, /g'           # newabbrev (see thesis-common.sty for more information)
150        # - '1,$s/\([^"]\)\("0[0-9]*\)/\1"\2/g' # Math accent signs
151        # - '1,$s/\([^"]\)\(!}\)\)/\1"\2/g'     # some !'s
152        -echo -e '1,$$s/\(see{.*\)!/\\1, /g\n1,$$s/\([^"]\)\("0[0-9]*\)/\\1"\\2/g\n1,$$s/\([^"]\)\(!}\)/\\1"\\2/g\nw\nq' | $(ED) $(PRIMTARGET).idx
153        $(MAKEINDEX) $(PRIMTARGET)
154
155$(INDEXTARGET):: $(TEXSOURCES) 
156        # fix some index problems (see above)
157        -echo -e '1,$$s/\(see{.*\)!/\\1, /g\n1,$$s/\([^"]\)\("0[0-9]*\)/\\1"\\2/g\n1,$$s/\([^"]\)\(!}\)/\\1"\\2/g\nw\nq' | $(ED) $(PRIMTARGET).idx
158        $(MAKEINDEX) $(PRIMTARGET)
159        $(RM) $(PRIMFIXPOINT)   # we have to start 'fixpoint calculation' from scratch
160
161$(GLOSSARYTARGET):: $(TEXSOURCES)
162        $(MAKEGLOSSARY) $(PRIMTARGET)
163
164$(ACRONYMTARGET):: $(TEXSOURCES)
165        $(MAKEGLOSSARY) $(PRIMTARGET)
166
167
168# pdflatex version
169# make in sure that we always run pfdlatex (for fixpoint!)
170# primarily .pdf file depends on the main tex source files plus all other tex-files we find
171$(PDFTARGET):: $(PRIMSOURCE) $(TEXSOURCES) $(STYLESOURCES) 
172        $(PDFLATEX) $(PRIMSOURCE) || ($(RM) $@; exit -1)
173
174# additionaly it depends on bibliography, glossary and index. keep this target separate so
175# the first latex is run before this target is resolved
176$(PDFTARGET):: $(BIBTARGET) $(INDEXTARGET)
177
178$(PDFTARGET):: $(GLOSSARYTARGET)
179
180$(PDFTARGET):: $(ACRONYMTARGET)
181
182# and we also depend on the fixpoint
183# '$(PDFLATEXTARGET):: $(PRIMFIXPOINT)' does not work as we have to make sure that
184# the fixpoint is calculated with pdflatex and not latex!
185$(PDFTARGET)::
186        $(MAKE) LATEX="$(PDFLATEX)" $(PRIMFIXPOINT)
187
188# if you just would like to run pdflatex once (e.g for debugging)
189Pdflatex:
190        $(PDFLATEX) $(PRIMSOURCE)
191
192
193# FIXPOINT targets
194# after we have run bibtex we have to run latex again. as one latex run might not be
195# enough to correctly resolve all references we run latex after bibtex until .aux file
196# stays constant.
197# This is not optimal as we might run latex one time too often but at least all references should
198# be resolved afterwards (at least as much as possible)
199$(PRIMFIXPOINT):
200        # Save old aux-file state (Note that we cannot only do it for the PRIMTARGET
201        # as there might be \includes with separate aux-files!)
202        # Unfortunatly the make-functions are evaluated only the first time when
203        # potentially the aux-files don't exist. So make sure that at least
204        # $(PRIMTARGET).aux (which has to exist!) is there. Almost definitly
205        # the diff will fail and in the following recursion all aux-files will
206        # then be found ...
207        for file in $(PRIMTARGET) $(patsubst %.aux,%,$(wildcard *.aux)); do \
208           $(CP) $$file.aux $$file.fpt; \
209        done
210        $(LATEX) $(PRIMSOURCE) || ($(RM) $@; exit -1)   # run latex
211        # if aux-files changed we have to recurse
212        for file in $(PRIMTARGET) $(patsubst %.aux,%,$(wildcard *.aux)); do \
213            $(DIFF) -q $$file.aux $$file.fpt || \
214            ($(RM) $(PRIMFIXPOINT); $(MAKE) $(PRIMFIXPOINT)); \
215        done
216
217# create empty aux-files. usefull to be able to run with \includeonly
218# selected parts.
219aux: $(notdir $(TEXSOURCES:%.tex=%.aux))
220
221%.aux:
222        $(TOUCH) $@
Note: See TracBrowser for help on using the browser.