tevent: Rename ev_timeval* functions to tevent_timeval, export them.
[jra/samba/.git] / docs-xml / Makefile
1 #################################################################
2 # Makefile for Samba Documentation
3 # Authors:      
4 #               James Moore <jmoore@php.net>
5 #               Gerald Carter <jerry@samba.org>
6 #               Jelmer Vernooij <jelmer@samba.org>
7 include Makefile.settings
8
9 # Docs to build
10 MAIN_DOCS = $(patsubst %/index.xml,%,$(wildcard */index.xml))
11 MANPAGES3 = $(wildcard $(MANPAGEDIR3)/*.?.xml)
12 export TEXINPUTS=xslt/latex:.:
13
14 # Lists of files to process
15 LATEX_FIGURES = xslt/figures/caution.pdf xslt/figures/important.pdf xslt/figures/note.pdf xslt/figures/tip.pdf xslt/figures/warning.pdf
16 MANPAGES_PLUCKER = $(patsubst $(MANPAGEDIR3)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES3))
17
18 DATETIME := $(shell date +%Y%m%d%H%M%S)
19
20 ifeq ($(PROFILE), Y)
21 XSLTPROC += --profile --load-trace --timing
22 endif
23
24 ifndef OUTPUTDIR
25 Makefile.settings: configure
26         @echo Makefile.settings not present, trying to run configure...
27         ./configure
28
29 configure: configure.ac
30         @echo configure not present, trying to regenerate it...
31         autoreconf
32 endif
33
34 help: 
35         @echo "Supported make targets:"
36         @echo " release - Build the docs needed for a Samba release"
37         @echo " all - Build all docs that can be build using the utilities found by configure"
38         @echo " everything - Build all of the above"
39         @echo " pdf,tex,dvi,ps,manpages3,txt,pearson,fo,htmlhelp - Build specific output format"
40         @echo " html - Build multi-file HTML versions"
41         @echo " html-single - Build single-file HTML versions"
42         @echo " htmlman3 - Build HTML version of manpages"
43         @echo " undocumented - Output list of undocumented smb.conf options"
44         @echo " samples - Extract examples"
45
46 $(DOCBOOKDIR)/Samba3-ByExample.xml: $(filter-out Samba3-ByExample/index.xml,$(wildcard Samba3-ByExample/*.xml))
47 $(DOCBOOKDIR)/Samba3-HOWTO.xml: $(filter-out Samba3-HOWTO/index.xml,$(wildcard Samba3-HOWTO/*.xml)) Samba3-HOWTO-attributions.xml
48 Samba3-HOWTO/manpages.xml: $(MANPAGEDIR3)/smb.conf.5.xml
49 $(DOCBOOKDIR)/Samba3-Developers-Guide.xml: $(filter-out Samba3-Developers-Guide/index.xml,$(wildcard Samba3-Developers-Guide/*.xml)) Samba3-Developers-Guide-attributions.xml
50 $(DOCBOOKDIR)/Samba4-HOWTO.xml: $(filter-out Samba4-HOWTO/index.xml,$(wildcard Samba4-HOWTO/*.xml)) Samba4-HOWTO-attributions.xml
51
52 # Pseudo targets 
53 all:: $(TARGETS)
54 everything:: manpages3 pdf html-single html htmlman3 txt ps fo htmlhelp pearson 
55 release:: manpages3 htmlman3 html pdf 
56 clean::
57         @echo "Cleaning up..." 
58         rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
59         rm -f $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-dia))) \
60                         $(patsubst %.svg,%.pdf,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
61                         $(patsubst %.svg,%.eps,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
62                         $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg)))
63         rm -f *-attributions.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
64         rm -f *-images-html*
65         rm -f *-images-latex-* $(LATEX_FIGURES)
66         rm -f xslt/figures/*pdf
67         rm -f $(SMBDOTCONFDOC)/parameters.*.xml
68         rm -f $(addsuffix .*,$(MAIN_DOCS))
69         rm -f build/catalog.xml
70
71 # Output format targets
72 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
73 dvi:: $(patsubst %,$(DVIDIR)/%.dvi,$(MAIN_DOCS))
74 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
75 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
76 txt-chunks:: $(addsuffix -txt-chunks,$(MAIN_DOCS))
77 fo:: $(patsubst %,$(FODIR)/%.fo,$(MAIN_DOCS))
78 fo-pdf:: $(patsubst %,$(FOPDFDIR)/%.pdf,$(MAIN_DOCS))
79 tex:: $(addsuffix .tex,$(MAIN_DOCS))
80 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
81 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
82 manpages3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(OUTPUTDIR)/manpages-3/%,$(MANPAGES3))
83 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
84 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
85 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
86 htmlman3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(HTMLDIR)/manpages-3/%.html,$(MANPAGES3)) $(HTMLDIR)/manpages-3/index.html
87 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
88 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
89 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
90 validate:: $(addsuffix -validate,$(MAIN_DOCS))
91
92 test:: validate
93 check:: validate
94
95 .PHONY: test check validate
96
97 # Intermediate docbook docs
98 #
99 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
100         @echo "Converting Samba-specific tags for $*..."
101         @mkdir -p $(@D)
102         @$(XSLTPROC) --stringparam latex.imagebasedir "$*/"  --stringparam noreference 0  --xinclude --output $@ xslt/expand-sambadoc.xsl $<
103
104 $(DOCBOOKDIR)/manpages-3/%.xml: $(MANPAGEDIR3)/%.xml xslt/expand-sambadoc.xsl
105         @mkdir -p $(@D)
106         $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
107
108 $(DOCBOOKDIR)/manpages-3/index.xml: $(MANPAGES3) xslt/manpage-summary.xsl
109         @mkdir -p $(@D)
110         echo "<article><variablelist>" > $@
111         $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES3) >> $@
112         @echo "</variablelist></article>" >> $@
113
114 # HTML docs
115 $(HTMLDIR)/index.html: htmldocs.html
116         @mkdir -p $(@D)
117         cp $< $@
118         
119 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
120         @mkdir -p $(@D)
121         $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
122
123 # Single large HTML files
124 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
125         @mkdir -p $(@D)
126         cp $< $@
127
128 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
129
130 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl 
131         $(XSLTPROC) --output $@ xslt/html.xsl $<
132
133 # Attributions
134 %-attributions.xml: 
135         @echo "Generating attributions file $@ from $*/"
136         @cp -f templates/attributions.xml $@
137         @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml 
138
139 # Text files
140 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
141         @mkdir -p $(@D)
142         $(HTML2TEXT) -nobs -style pretty -o $@ $<
143
144 # Tex files
145 %.tex: %/index.xml xslt/latex.xsl
146         @echo "Generating $@..."
147         @mkdir -p $(@D)
148         @$(XSLTPROC) $(DB2LATEX_ARGS) --stringparam latex.imagebasedir "$*/" --xinclude --output $@ xslt/latex.xsl $<
149
150 $(PDFDIR)/%.pdf: %.pdf
151         @mkdir -p $(@D)
152         cp $< $@
153
154 %.idx: %.tex $(LATEX_FIGURES)
155         -$(PDFLATEX) $<
156
157 %.ind: %.idx
158         $(MAKEINDEX) $<
159
160 # Dependency files
161 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
162         @echo "Generating dependency file for $*" 
163         @$(XSLTPROC) --novalid \
164                 --stringparam txtbasedir "$(TXTDIR)/$*/" \
165                 --stringparam target "$*" \
166                 -o $@ xslt/generate-dependencies.xsl $<
167         @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
168         @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
169         @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
170         @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
171
172         @echo >> $@
173         @echo "\$$(HTMLDIR)/%: $*/%" >> $@
174         @echo " @mkdir -p \$$(@D)" >> $@
175         @echo " @cp \$$< \$$@" >> $@
176         @echo >> $@
177         @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
178         @echo " @mkdir -p \$$(@D)" >> $@
179         @echo " @cp \$$< \$$@" >> $@
180         @echo >> $@
181         @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
182         @echo " @mkdir -p \$$(@D)" >> $@
183         @echo " @cp \$$< \$$@" >> $@
184         @echo >> $@
185         @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
186         @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
187         @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
188
189 ifdef OUTPUTDIR 
190 ifneq ($(MAKECMDGOALS),clobber)
191 -include $(addsuffix .d,$(MAIN_DOCS))
192 endif
193 endif
194
195 # Adobe PDF files
196 %.pdf: %.tex %.ind $(LATEX_FIGURES) %-images-latex-png %-images-latex-pdf
197         -$(PDFLATEX) $<
198         -$(PDFLATEX) $<
199         -$(PDFLATEX) $<
200         -$(PDFLATEX) $<
201         $(THUMBPDF) --quiet $*.pdf
202         -$(PDFLATEX) $<
203
204 # DVI files
205 $(DVIDIR)/%.dvi: %.dvi
206         @mkdir -p $(@D)
207         cp $< $@
208
209 %.dvi: %.tex %.idx %-images-latex-eps
210         -$(LATEX) $< 
211
212 %.eps: %.svg
213         $(INKSCAPE) -z -f $< --export-eps=$@
214
215 %.png: %.svg
216         $(INKSCAPE) -z -f $< --export-png=$@
217
218 #%.pdf: %.svg
219 #       $(INKSCAPE) -z -f $< --export-pdf=$@
220
221 %.pdf: %.eps
222         $(EPSTOPDF) $<
223
224 %.eps: %.png
225         $(PNGTOPNM) $< | $(PNMTOPS) > $@
226
227 # PostScript files
228 $(PSDIR)/%.ps: $(DVIDIR)/%.dvi
229         @mkdir -p $(@D)
230         $(DVIPS) -o $@ $<
231
232 # Fo
233 $(FODIR)/%.fo: $(DOCBOOKDIR)/%.xml
234         @mkdir -p $(@D)
235         $(XSLTPROC) --output $@ xslt/fo.xsl $<
236
237 # PDF thru Fo
238 $(FOPDFDIR)/%.pdf: $(FODIR)/%.fo
239         @mkdir -p $(@D)
240         JAVA_OPTS=-Xmx250m $(FOP) -q -d $< -pdf $@
241
242 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
243         $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
244                                 --stringparam manifest.in.base.dir "$@/" \
245                                 --stringparam base.dir "$@/" \
246         http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
247
248 # Plucker docs
249 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html 
250         @mkdir -p $(@D)
251         $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$< 
252
253 # Texinfo docs
254 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
255         @mkdir -p $(@D)
256         cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
257
258 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
259         $(MAKEINFO) --no-validate --force -o $@ "$<"
260
261 # Manpages
262 $(MANPAGEDIR3)/smb.conf.5.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
263
264 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
265         $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
266
267 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
268         @echo "Generating list of global smb.conf options" 
269         $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
270
271 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
272         @echo "Generating list of share-mode smb.conf options" 
273         $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
274
275 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
276         @mkdir -p $(@D)
277         $(XSLTPROC) --output $@ xslt/man.xsl $<
278
279 # Individual smb.conf parameters
280 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
281         
282 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
283         @mkdir -p $(@D)
284         $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
285
286 # Pearson compatible XML
287 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
288         @mkdir -p $(@D)
289         $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
290
291 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
292         @mkdir -p $(@D)
293         -$(XMLLINT) --valid --noout $< 2> $@
294
295 # Validation verification
296 %-validate: %/index.xml
297         cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
298
299 # Find undocumented parameters
300 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
301         $(PERL) scripts/find_missing_doc.pl $(SRCDIR)
302         $(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
303
304 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
305         @mkdir -p $(EXAMPLESDIR)
306         $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
307         for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
308
309 # Archiving
310 archive: pdf
311         @mkdir -p $(ARCHIVEDIR)
312         cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
313         cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
314
315 # XSL scripts
316 xslt/html.xsl: xslt/html-common.xsl 
317 xslt/html-chunk.xsl: xslt/html-common.xsl 
318 xslt/latex.xsl: 
319 xslt/expand-sambadoc.xsl: 
320 xslt/generate-attributions.xsl: 
321 xslt/man.xsl:
322 xslt/pearson.xsl:
323
324 distclean clobber:: clean
325         rm -f Makefile.settings config.status config.log
326
327 realdistclean:: distclean
328         rm -f configure
329         rm -rf autom4te.cache
330
331
332 # Always keep intermediate files if we can
333 .SECONDARY:
334 .PHONY: clean clobber archive release everything all 
335