s3/lib/ctdbd_conn: assert hdr following read/recv
[Samba.git] / docs-xml / Makefile
blobba49eae06c28e28310a307dc556dd56a21db7849
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
9 export XML_CATALOG_FILES := $(XML_CATALOG_FILES) /etc/xml/catalog $(shell pwd)/build/catalog.xml
11 # Docs to build
12 MAIN_DOCS = $(patsubst %/index.xml,%,$(wildcard */index.xml))
13 MANPAGES = $(sort $(wildcard $(MANPAGEDIR)/*.?.xml))
15 # Lists of files to process
16 MANPAGES_PLUCKER = $(patsubst $(MANPAGEDIR)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES))
17 DBLATEX_OPTIONS = -p xslt/latex.xsl -i xslt/latex
19 DATETIME := $(shell date +%Y%m%d%H%M%S)
21 XSLTPROC_DEPS = build/catalog.xml build/DTD/samba.build.version
23 ifeq ($(PROFILE), Y)
24 XSLTPROC += --profile --load-trace --timing
25 endif
27 ifndef OUTPUTDIR
28 Makefile.settings: configure
29 ./configure
31 configure: configure.ac
32 autoreconf
33 endif
35 help:
36 @echo "Supported make targets:"
37 @echo " release - Build the docs needed for a Samba release"
38 @echo " all - Build all docs that can be build using the utilities found by configure"
39 @echo " everything - Build all of the above"
40 @echo " pdf,tex,ps,manpages,txt,pearson,htmlhelp - Build specific output format"
41 @echo " html - Build multi-file HTML versions"
42 @echo " html-single - Build single-file HTML versions"
43 @echo " htmlman - Build HTML version of manpages"
44 @echo " samples - Extract examples"
46 $(PDFDIR)/Samba3-ByExample.pdf $(PSDIR)/Samba3-ByExample.ps $(DOCBOOKDIR)/Samba3-ByExample.xml Samba3-ByExample.tex: $(wildcard Samba3-ByExample/*.xml)
47 $(PDFDIR)/Samba3-HOWTO.pdf $(PSDIR)/Samba3-HOWTO.ps Samba3-HOWTO.tex $(DOCBOOKDIR)/Samba3-HOWTO.xml: $(wildcard Samba3-HOWTO/*.xml) Samba3-HOWTO-attributions.xml
48 Samba3-HOWTO/manpages.xml: $(MANPAGEDIR)/smb.conf.5.xml
49 $(PDFDIR)/Samba3-Developers-Guide.pdf $(PSDIR)/Samba3-Developers-Guide.ps $(DOCBOOKDIR)/Samba3-Developers-Guide.xml Samba3-Developers-Guide.tex: $(wildcard Samba3-Developers-Guide/*.xml) Samba3-Developers-Guide-attributions.xml
51 # Pseudo targets
52 all:: $(TARGETS)
53 everything:: manpages pdf html-single html htmlman txt ps fo htmlhelp pearson
54 release:: manpages htmlman html pdf
55 clean::
56 @echo "Cleaning up..."
57 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
58 rm -f *-attributions.xml
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 build/catalog.xml
70 # Output format targets
71 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
72 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
73 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
74 tex:: $(addsuffix .tex,$(MAIN_DOCS))
75 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
76 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
77 manpages:: $(patsubst $(MANPAGEDIR)/%.xml,$(OUTPUTDIR)/manpages/%,$(MANPAGES))
78 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
79 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
80 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
81 htmlman:: $(patsubst $(MANPAGEDIR)/%.xml,$(HTMLDIR)/manpages/%.html,$(MANPAGES)) $(HTMLDIR)/manpages/index.html
82 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
83 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
84 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
85 validate:: $(addsuffix -validate,$(MAIN_DOCS))
87 test:: validate
88 check:: validate
90 .PHONY: test check validate manpages
92 # Intermediate docbook docs
94 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl $(XSLTPROC_DEPS)
95 @echo "Converting Samba-specific tags for $*..."
96 @mkdir -p $(@D)
97 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
99 $(DOCBOOKDIR)/manpages/%.xml: $(MANPAGEDIR)/%.xml xslt/expand-sambadoc.xsl Makefile.settings $(XSLTPROC_DEPS)
100 @mkdir -p $(@D)
101 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
103 $(DOCBOOKDIR)/manpages/index.xml: $(MANPAGES) xslt/manpage-summary.xsl $(XSLTPROC_DEPS)
104 @mkdir -p $(@D)
105 echo "<article><variablelist>" > $@
106 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES) >> $@
107 @echo "</variablelist></article>" >> $@
109 # HTML docs
110 $(HTMLDIR)/index.html: htmldocs.html
111 @mkdir -p $(@D)
112 cp $< $@
114 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks $(XSLTPROC_DEPS)
115 @mkdir -p $(@D)
116 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
118 # Single large HTML files
119 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css $(XSLTPROC_DEPS)
120 @mkdir -p $(@D)
121 cp $< $@
123 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
125 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl $(XSLTPROC_DEPS)
126 $(XSLTPROC) --output $@ xslt/html.xsl $<
128 # Attributions
129 %-attributions.xml: $(XSLTPROC_DEPS)
130 @echo "Generating attributions file $@ from $*/"
131 @cp -f templates/attributions.xml $@
132 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
134 # Text files
135 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
136 @mkdir -p $(@D)
137 $(HTML2TEXT) -nobs -style pretty -o $@ $<
139 # Tex files
140 %.tex: %/index.xml xslt/latex.xsl
141 @echo "Generating $@..."
142 @mkdir -p $(@D)
143 @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
145 # Dependency files
146 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl $(XSLTPROC_DEPS)
147 @echo "Generating dependency file for $*"
148 @$(XSLTPROC) --novalid \
149 --stringparam txtbasedir "$(TXTDIR)/$*/" \
150 --stringparam target "$*" \
151 -o $@ xslt/generate-dependencies.xsl $<
152 @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
153 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
154 @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
155 @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
157 @echo >> $@
158 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
159 @echo " @mkdir -p \$$(@D)" >> $@
160 @echo " @cp \$$< \$$@" >> $@
161 @echo >> $@
162 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
163 @echo " @mkdir -p \$$(@D)" >> $@
164 @echo " @cp \$$< \$$@" >> $@
165 @echo >> $@
166 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
167 @echo " @mkdir -p \$$(@D)" >> $@
168 @echo " @cp \$$< \$$@" >> $@
169 @echo >> $@
170 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
171 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
172 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
174 ifdef OUTPUTDIR
175 ifneq ($(MAKECMDGOALS),clobber)
176 -include $(addsuffix .d,$(MAIN_DOCS))
177 endif
178 endif
180 # Adobe PDF files
181 $(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf
182 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
184 # PostScript files
185 $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
186 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
188 %.eps: %.svg
189 $(INKSCAPE) -z -f $(abspath $<) --export-eps=$(abspath $@)
191 %.png: %.svg
192 $(INKSCAPE) -z -f $(abspath $<) --export-png=$(abspath $@)
194 %.eps: %.png
195 $(PNGTOPNM) $< | $(PNMTOPS) > $@
197 %.pdf: %.svg
198 $(INKSCAPE) -z -f $(abspath $<) --export-pdf=$(abspath $@)
200 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp $(XSLTPROC_DEPS)
201 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
202 --stringparam manifest.in.base.dir "$@/" \
203 --stringparam base.dir "$@/" \
204 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
206 # Plucker docs
207 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
208 @mkdir -p $(@D)
209 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
211 # Texinfo docs
212 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
213 @mkdir -p $(@D)
214 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
216 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
217 $(MAKEINFO) --no-validate --force -o $@ "$<"
219 # Manpages
220 $(MANPAGEDIR)/smb.conf.5.xml: parameters
222 # The phony parameters target exists in order to always create the
223 # the parameters xml files. Otherwise, when parameters.*.xml does not exist
224 # yet, the parameters are not generated when smb.conf.5.xml is newer than
225 # any smbdotconf/*/*.xml file ...
226 .PHONY: parameters
228 parameters: $(SMBDOTCONFDOC)/parameters.all.xml
230 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
231 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
233 $(OUTPUTDIR):
234 test -d $@ || mkdir $@
236 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
237 @mkdir -p $(@D)
238 $(XSLTPROC) --output $@ xslt/man.xsl $<
240 # Individual smb.conf parameters
241 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
243 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
244 @mkdir -p $(@D)
245 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
247 # Pearson compatible XML
248 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
249 @mkdir -p $(@D)
250 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
252 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
253 @mkdir -p $(@D)
254 -$(XMLLINT) --valid --noout $< 2> $@
256 # Validation verification
257 %-validate: %/index.xml
258 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
260 build/catalog.xml: build/catalog.xml.in
261 sed -e "s|@abs_top_srcdir@|`pwd`|g;s|@abs_top_builddir@|`pwd`|g" < build/catalog.xml.in > build/catalog.xml
263 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
264 @mkdir -p examples
265 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
266 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
268 # Archiving
269 archive: pdf
270 @mkdir -p $(ARCHIVEDIR)
271 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
272 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
274 # XSL scripts
275 xslt/html.xsl: xslt/html-common.xsl
276 xslt/html-chunk.xsl: xslt/html-common.xsl
277 xslt/latex.xsl:
278 xslt/expand-sambadoc.xsl:
279 xslt/generate-attributions.xsl:
280 xslt/man.xsl:
281 xslt/pearson.xsl:
283 distclean clobber:: clean
284 rm -f Makefile.settings config.status config.log
286 realdistclean:: distclean
287 rm -f configure
288 rm -rf autom4te.cache
289 rm -rf output
291 # Always keep intermediate files if we can
292 .SECONDARY:
293 .PHONY: clean clobber archive release everything all