1#
2#
3#  Makefile for LaTeX
4#
5# To build everything do
6#    make tex
7#    make web
8#    make html
9#    make dvipdf
10#
11# or simply
12#
13#    make
14#
15# for rapid development do:
16#    make tex
17#    make show
18#
19#
20# If you are having problems getting "make" to work, debugging it is
21#  easier if can see the output from latex, which is normally redirected
22#  to /dev/null.  To see it, do the following:
23#
24#   cd docs/manual
25#   make tex
26#   latex bacula.tex
27#
28#  typically the latex command will stop indicating the error (e.g. a
29#  missing \ in front of a _ or a missing { or ] ...
30#
31#  The following characters must be preceded by a backslash
32#    to be entered as printable characters:
33#
34#    # $ % & ~ _ ^ \ { }
35#
36DOC=utility
37MAINDOC=Bacula_Utility_Programs.html
38IMAGES=../../../images
39DOCDIR=`pwd`
40TEXFILES=$(wildcard *tex)
41MAKEFORWEB=$(DOCDIR)/web.makefile
42WEBFILESTOLINK=$(DOCDIR)/latex2html-init.pl $(DOCDIR)/bacula.sty $(DOCDIR)/translate_images.pl
43#
44# Main directory where to find all the documentation
45DESTDIR=../pdf-and-html
46#
47# Location of documentation in PDF
48PDF_DEST_DIR=$(DESTDIR)/$(DOC)
49#
50# Location of HTML documentation
51HTML_DEST_DIR=$(DESTDIR)/$(DOC)
52#
53# Temporary directory to translate tex to HTML
54WWW_BUILD_DIR=$(DESTDIR)/www-$(DOC)
55#
56# LATEX compiler
57LATEX_TO_PDF=pdflatex -halt-on-error --output-directory $(PDF_DEST_DIR)
58
59first_rule: all
60
61all: pdftex web mini-clean
62
63.SUFFIXES:     .tex .html
64.PHONY:
65.DONTCARE:
66
67
68destdir:
69	@echo
70	@echo "Making output directories..."
71	@mkdir -p $(PDF_DEST_DIR) $(HTML_DEST_DIR)
72	echo "Output directories done"
73
74pdfimages:
75	@echo "Generating PDF images..."
76	@(cd ${IMAGES}/svg ; make pdf)
77	@echo "Done."
78
79pngimages:
80	@echo "Generating PNG images..."
81	@(cd ${IMAGES}/svg ; make png)
82	@echo "Done."
83
84epsimages:
85	@echo "Generating EPS images..."
86	@(cd ${IMAGES}/svg ; make eps)
87	@rm -rf ${IMAGES}/png
88	@rm -rf ${IMAGES}/pdf
89	@echo "Done."
90
91epscovers:
92	@echo -n "Linking coverpage and background EPS format..."
93	@(cd $(SVGCOVERSDIR) ; make eps)
94	@ln -sf `pwd`/${EPSCOVERSDIR}/${COVERNAME}.eps `pwd`/${BSYSMANUALDIR}/${BSYSMANNAME}.eps
95	@rm -f `pwd`/${BSYSMANUALDIR}/${BSYSMANNAME}.pdf
96	@echo "Done."
97
98commonfiles:
99	@echo -n "Making version `cat version.tex`"
100	@echo -n "Linking shared files..."
101	@(for L in $(LICENCES); do ln -sf $$L .; done)
102	@echo "Done"
103
104pdfcovers:
105	@echo ""
106	@echo "Making covers for $(DOC)"
107	@(cd $(IMAGES)/svg ; make pdf)
108	@echo "Covers done."
109	@echo ""
110
111external-references: destdir
112	@echo " "
113	@echo "Building external references for $(DOC)"
114	@echo "\DeclareGraphicsExtensions{.pdf,.png,.jpg,.jpeg,.eps}" > graphicspolicy.tex
115	@export TEXINPUTS=.:../../../latex//: ; $(LATEX_TO_PDF) $(DOC)
116	@rm -f $(PDF_DEST_DIR)/$(DOC).pdf
117	@echo "$(DOC) external references done."
118
119pdftex: destdir
120	@echo ""
121	@echo "Making PDF manual with $(LATEX_TO_PDF)compile..."
122	@echo "\DeclareGraphicsExtensions{.pdf,.png,.jpg,.jpeg,.eps}" > graphicspolicy.tex
123	@export TEXINPUTS=.:../../../latex//: ; $(LATEX_TO_PDF) $(DOC); makeindex ${DOC}.idx -o ${DOC}.ind 2>/dev/null ; $(LATEX_TO_PDF) $(DOC); $(LATEX_TO_PDF) $(DOC)
124	@echo "Done"
125
126
127web: mini-clean
128	@echo "Making web"
129	@rm -rf $(WWW_BUILD_DIR)
130	@mkdir -p $(WWW_BUILD_DIR)
131	@echo "Adapting $(DOC) tex files for HTML documentation..."
132	@(for F in $(TEXFILES) ;\
133	do \
134	cat $$F | sed -f ../pattern-to-handle > $(WWW_BUILD_DIR)/$$F ; \
135	done)
136	@ln -sf $(MAKEFORWEB) $(WWW_BUILD_DIR)/Makefile
137	@(for F in $(WEBFILESTOLINK);\
138	do \
139	ln -sf $$F $(WWW_BUILD_DIR)/;\
140	done)
141	(cd $(WWW_BUILD_DIR) ; make )
142	@echo "Done making web"
143
144show:
145	evince $(PDF_DEST_DIR)/${DOC}.pdf
146
147texcheck:
148	./check_tex.pl ${DOC}.tex
149
150main_configs:
151	pic2graph -density 100 <main_configs.pic >main_configs.png
152
153mini-clean:
154	@rm -f 1 2 3 *.tex~
155	@rm -f *.gif *.jpg *.eps
156	@rm -f *.aux *.cp *.fn *.ky *.log *.pg
157	@rm -f *.backup *.ilg *.lof *.lot
158	@rm -f *.cdx *.cnd *.ddx *.ddn *.fdx *.fnd *.ind *.sdx *.snd
159	@rm -f *.dnd *.old *.out
160	@rm -f ${DOC}/*.gif ${DOC}/*.jpg ${DOC}/*.eps
161	@rm -f ${DOC}/*.aux ${DOC}/*.cp ${DOC}/*.fn ${DOC}/*.ky ${DOC}/*.log ${DOC}/*.pg
162	@rm -f ${DOC}/*.backup ${DOC}/*.ilg ${DOC}/*.lof ${DOC}/*.lot
163	@rm -f ${DOC}/*.cdx ${DOC}/*.cnd ${DOC}/*.ddx ${DOC}/*.ddn ${DOC}/*.fdx ${DOC}/*.fnd ${DOC}/*.ind ${DOC}/*.sdx ${DOC}/*.snd
164	@rm -f ${DOC}/*.dnd ${DOC}/*.old ${DOC}/*.out
165	@rm -f ${DOC}/WARNINGS
166	@rm -rf ../www-$(DOC)
167
168clean:
169	@rm -f graphicspolicy.tex
170	@rm -f 1 2 3
171	@rm -f *.png *.gif *.jpg *.eps
172	@rm -f *.pdf *.aux *.cp *.fn *.ky *.log *.pg
173	@rm -f *.html *.backup *.pdf *.ps *.dvi *.ilg *.lof *.lot
174	@rm -f *.cdx *.cnd *.ddx *.ddn *.fdx *.fnd *.ind *.sdx *.snd
175	@rm -f *.dnd imagename_translations
176	@rm -f *.old WARNINGS *.out *.toc *.idx
177	@rm -f images.pl labels.pl internals.pl
178	@rm -f images.tex ${DOC}i.tex
179	@rm -f ${DOC}i-*.tex
180	@rm -rf $(WWW_BUILD_DIR)
181
182distclean:  clean
183	@rm -f ${DOC}.html ${DOC}.pdf
184	@rm -rf $(WWW_BUILD_DIR)
185	@rm -rf $(HTML_DEST_DIR)
186