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=problems
37MAINDOC=Bacula_Problem_Resolution_G.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
67pdfimages:
68	@echo "Generating PDF images..."
69	@(cd ${IMAGES}/svg ; make pdf)
70	@echo "Done."
71
72pngimages:
73	@echo "Generating PNG images..."
74	@(cd ${IMAGES}/svg ; make png)
75	@echo "Done."
76
77epsimages:
78	@echo "Generating EPS images..."
79	@(cd ${IMAGES}/svg ; make eps)
80	@rm -rf ${IMAGES}/png
81	@rm -rf ${IMAGES}/pdf
82	@echo "Done."
83
84epscovers:
85	@echo -n "Linking coverpage and background EPS format..."
86	@(cd $(SVGCOVERSDIR) ; make eps)
87	@ln -sf `pwd`/${EPSCOVERSDIR}/${COVERNAME}.eps `pwd`/${BSYSMANUALDIR}/${BSYSMANNAME}.eps
88	@rm -f `pwd`/${BSYSMANUALDIR}/${BSYSMANNAME}.pdf
89	@echo "Done."
90
91commonfiles:
92	@echo "Making version `cat version.tex`"
93	@echo -n "Linking shared files..."
94	@(for L in $(LICENCES); do ln -sf $$L .; done)
95	@echo "Done"
96
97destdir:
98	@echo
99	@echo "Making output directories..."
100	@mkdir -p $(PDF_DEST_DIR) $(HTML_DEST_DIR)
101	echo "Output directories done"
102
103pdfcovers:
104	@echo ""
105	@echo "Making covers for $(DOC)"
106	@(cd $(IMAGES)/svg ; make pdf)
107	@echo "Covers done."
108	@echo ""
109
110external-references: destdir
111	@echo " "
112	@echo "Building external references for $(DOC)"
113	@echo "\DeclareGraphicsExtensions{.pdf,.png,.jpg,.jpeg,.eps}" > graphicspolicy.tex
114	@export TEXINPUTS=.:../../../latex//: ; $(LATEX_TO_PDF) $(DOC)
115	@rm -f $(PDF_DEST_DIR)/$(DOC).pdf
116	@echo "$(DOC) external references done."
117
118pdftex: destdir
119	@echo ""
120	@echo "Making PDF manual with $(LATEX_TO_PDF)compile..."
121	@echo "\DeclareGraphicsExtensions{.pdf,.png,.jpg,.jpeg,.eps}" > graphicspolicy.tex
122	@export TEXINPUTS=.:../../../latex//: ; $(LATEX_TO_PDF) $(DOC); makeindex ${DOC}.idx -o ${DOC}.ind 2>/dev/null ; $(LATEX_TO_PDF) $(DOC); $(LATEX_TO_PDF) $(DOC)
123	@echo "Done"
124
125
126web: mini-clean
127	@echo "Making web"
128	@rm -rf $(WWW_BUILD_DIR)
129	@mkdir -p $(WWW_BUILD_DIR)
130	@echo "Adapting $(DOC) tex files for HTML documentation..."
131	@(for F in $(TEXFILES) ;\
132	do \
133	cat $$F | sed -f ../pattern-to-handle > $(WWW_BUILD_DIR)/$$F ; \
134	done)
135	@ln -sf $(MAKEFORWEB) $(WWW_BUILD_DIR)/Makefile
136	@(for F in $(WEBFILESTOLINK);\
137	do \
138	ln -sf $$F $(WWW_BUILD_DIR)/;\
139	done)
140	(cd $(WWW_BUILD_DIR) ; make )
141	@echo "Done making web"
142
143show:
144	evince $(PDF_DEST_DIR)/${DOC}.pdf
145
146texcheck:
147	./check_tex.pl ${DOC}.tex
148
149main_configs:
150	pic2graph -density 100 <main_configs.pic >main_configs.png
151
152mini-clean:
153	@rm -f 1 2 3 *.tex~
154	@rm -f *.gif *.jpg *.eps
155	@rm -f *.aux *.cp *.fn *.ky *.log *.pg
156	@rm -f *.backup *.ilg *.lof *.lot
157	@rm -f *.cdx *.cnd *.ddx *.ddn *.fdx *.fnd *.ind *.sdx *.snd
158	@rm -f *.dnd *.old *.out
159	@rm -f ${DOC}/*.gif ${DOC}/*.jpg ${DOC}/*.eps
160	@rm -f ${DOC}/*.aux ${DOC}/*.cp ${DOC}/*.fn ${DOC}/*.ky ${DOC}/*.log ${DOC}/*.pg
161	@rm -f ${DOC}/*.backup ${DOC}/*.ilg ${DOC}/*.lof ${DOC}/*.lot
162	@rm -f ${DOC}/*.cdx ${DOC}/*.cnd ${DOC}/*.ddx ${DOC}/*.ddn ${DOC}/*.fdx ${DOC}/*.fnd ${DOC}/*.ind ${DOC}/*.sdx ${DOC}/*.snd
163	@rm -f ${DOC}/*.dnd ${DOC}/*.old ${DOC}/*.out
164	@rm -f ${DOC}/WARNINGS
165	@rm -rf ../www-$(DOC)
166
167clean:
168	@rm -f graphicspolicy.tex
169	@rm -f 1 2 3
170	@rm -f *.png *.gif *.jpg *.eps
171	@rm -f *.pdf *.aux *.cp *.fn *.ky *.log *.pg
172	@rm -f *.html *.backup *.pdf *.ps *.dvi *.ilg *.lof *.lot
173	@rm -f *.cdx *.cnd *.ddx *.ddn *.fdx *.fnd *.ind *.sdx *.snd
174	@rm -f *.dnd imagename_translations
175	@rm -f *.old WARNINGS *.out *.toc *.idx
176	@rm -f images.pl labels.pl internals.pl
177	@rm -f images.tex ${DOC}i.tex
178	@rm -f ${DOC}i-*.tex
179	@rm -rf $(WWW_BUILD_DIR)
180
181distclean:  clean
182	@rm -f ${DOC}.html ${DOC}.pdf
183	@rm -rf $(WWW_BUILD_DIR)
184	@rm -rf $(HTML_DEST_DIR)
185