s4-dsdb: Remove unused variables
[Samba/bb.git] / docs-xml / Makefile
blob8cf05f771c9e8fbe3da492197edaecbc01b8b384
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 # Docs to build
10 MAIN_DOCS = $(patsubst %/index.xml,%,$(wildcard */index.xml))
11 MANPAGES3 = $(wildcard $(MANPAGEDIR3)/*.?.xml)
13 # Lists of files to process
14 MANPAGES_PLUCKER = $(patsubst $(MANPAGEDIR3)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES3))
15 DBLATEX_OPTIONS = -p xslt/latex.xsl -i xslt/latex
17 DATETIME := $(shell date +%Y%m%d%H%M%S)
19 ifeq ($(PROFILE), Y)
20 XSLTPROC += --profile --load-trace --timing
21 endif
23 ifndef OUTPUTDIR
24 Makefile.settings: configure
25 ./configure
27 configure: configure.ac
28 autoreconf
29 endif
31 help:
32 @echo "Supported make targets:"
33 @echo " release - Build the docs needed for a Samba release"
34 @echo " all - Build all docs that can be build using the utilities found by configure"
35 @echo " everything - Build all of the above"
36 @echo " pdf,tex,ps,manpages3,txt,pearson,htmlhelp - Build specific output format"
37 @echo " html - Build multi-file HTML versions"
38 @echo " html-single - Build single-file HTML versions"
39 @echo " htmlman3 - Build HTML version of manpages"
40 @echo " undocumented - Output list of undocumented smb.conf options"
41 @echo " samples - Extract examples"
43 $(PDFDIR)/Samba3-ByExample.pdf $(PSDIR)/Samba3-ByExample.ps $(DOCBOOKDIR)/Samba3-ByExample.xml Samba3-ByExample.tex: $(wildcard Samba3-ByExample/*.xml)
44 $(PDFDIR)/Samba3-HOWTO.pdf $(PSDIR)/Samba3-HOWTO.ps Samba3-HOWTO.tex $(DOCBOOKDIR)/Samba3-HOWTO.xml: $(wildcard Samba3-HOWTO/*.xml) Samba3-HOWTO-attributions.xml
45 Samba3-HOWTO/manpages.xml: $(MANPAGEDIR3)/smb.conf.5.xml
46 $(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
47 $(PDFDIR)/Samba4-HOWTO.pdf $(PSDIR)/Samba4-HOWTO.ps Samba4-HOWTO.tex $(DOCBOOKDIR)/Samba4-HOWTO.xml: $(filter-out Samba4-HOWTO/index.xml,$(wildcard Samba4-HOWTO/*.xml)) Samba4-HOWTO-attributions.xml
49 # Pseudo targets
50 all:: $(TARGETS)
51 everything:: manpages3 pdf html-single html htmlman3 txt ps fo htmlhelp pearson
52 release:: manpages3 htmlman3 html pdf
53 clean::
54 @echo "Cleaning up..."
55 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
56 rm -f *-attributions.xml
57 rm -f $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-dia))) \
58 $(patsubst %.svg,%.pdf,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
59 $(patsubst %.svg,%.eps,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
60 $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg)))
61 rm -f *-attributions.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
62 rm -f *-images-html*
63 rm -f *-images-latex-* $(LATEX_FIGURES)
64 rm -f xslt/figures/*pdf
65 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
66 rm -f build/catalog.xml
68 # Output format targets
69 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
70 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
71 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
72 tex:: $(addsuffix .tex,$(MAIN_DOCS))
73 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
74 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
75 manpages3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(OUTPUTDIR)/manpages-3/%,$(MANPAGES3))
76 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
77 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
78 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
79 htmlman3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(HTMLDIR)/manpages-3/%.html,$(MANPAGES3)) $(HTMLDIR)/manpages-3/index.html
80 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
81 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
82 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
83 validate:: $(addsuffix -validate,$(MAIN_DOCS))
85 test:: validate
86 check:: validate
88 .PHONY: test check validate
90 # Intermediate docbook docs
92 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
93 @echo "Converting Samba-specific tags for $*..."
94 @mkdir -p $(@D)
95 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
97 $(DOCBOOKDIR)/manpages-3/%.xml: $(MANPAGEDIR3)/%.xml xslt/expand-sambadoc.xsl
98 @mkdir -p $(@D)
99 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
101 $(DOCBOOKDIR)/manpages-3/index.xml: $(MANPAGES3) xslt/manpage-summary.xsl
102 @mkdir -p $(@D)
103 echo "<article><variablelist>" > $@
104 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES3) >> $@
105 @echo "</variablelist></article>" >> $@
107 # HTML docs
108 $(HTMLDIR)/index.html: htmldocs.html
109 @mkdir -p $(@D)
110 cp $< $@
112 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
113 @mkdir -p $(@D)
114 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
116 # Single large HTML files
117 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
118 @mkdir -p $(@D)
119 cp $< $@
121 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
123 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
124 $(XSLTPROC) --output $@ xslt/html.xsl $<
126 # Attributions
127 %-attributions.xml:
128 @echo "Generating attributions file $@ from $*/"
129 @cp -f templates/attributions.xml $@
130 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
132 # Text files
133 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
134 @mkdir -p $(@D)
135 $(HTML2TEXT) -nobs -style pretty -o $@ $<
137 # Tex files
138 %.tex: %/index.xml xslt/latex.xsl
139 @echo "Generating $@..."
140 @mkdir -p $(@D)
141 @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
143 # Dependency files
144 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
145 @echo "Generating dependency file for $*"
146 @$(XSLTPROC) --novalid \
147 --stringparam txtbasedir "$(TXTDIR)/$*/" \
148 --stringparam target "$*" \
149 -o $@ xslt/generate-dependencies.xsl $<
150 @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
151 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
152 @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
153 @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
155 @echo >> $@
156 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
157 @echo " @mkdir -p \$$(@D)" >> $@
158 @echo " @cp \$$< \$$@" >> $@
159 @echo >> $@
160 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
161 @echo " @mkdir -p \$$(@D)" >> $@
162 @echo " @cp \$$< \$$@" >> $@
163 @echo >> $@
164 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
165 @echo " @mkdir -p \$$(@D)" >> $@
166 @echo " @cp \$$< \$$@" >> $@
167 @echo >> $@
168 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
169 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
170 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
172 ifdef OUTPUTDIR
173 ifneq ($(MAKECMDGOALS),clobber)
174 -include $(addsuffix .d,$(MAIN_DOCS))
175 endif
176 endif
178 # Adobe PDF files
179 $(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf
180 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
182 # PostScript files
183 $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
184 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
186 %.eps: %.svg
187 $(INKSCAPE) -z -f $(abspath $<) --export-eps=$(abspath $@)
189 %.png: %.svg
190 $(INKSCAPE) -z -f $(abspath $<) --export-png=$(abspath $@)
192 %.eps: %.png
193 $(PNGTOPNM) $< | $(PNMTOPS) > $@
195 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
196 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
197 --stringparam manifest.in.base.dir "$@/" \
198 --stringparam base.dir "$@/" \
199 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
201 # Plucker docs
202 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
203 @mkdir -p $(@D)
204 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
206 # Texinfo docs
207 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
208 @mkdir -p $(@D)
209 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
211 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
212 $(MAKEINFO) --no-validate --force -o $@ "$<"
214 # Manpages
215 $(MANPAGEDIR3)/smb.conf.5.xml: parameters
217 # The phony parameters target exists in order to always create the
218 # the parameters xml files. Otherwise, when parameters.*.xml does not exist
219 # yet, the parameters are not generated when smb.conf.5.xml is newer than
220 # any smbdotconf/*/*.xml file ...
221 .PHONY: parameters
223 parameters: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
225 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
226 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
228 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
229 @echo "Generating list of global smb.conf options"
230 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
232 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
233 @echo "Generating list of share-mode smb.conf options"
234 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
236 $(OUTPUTDIR):
237 test -d $@ || mkdir $@
239 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
240 @mkdir -p $(@D)
241 $(XSLTPROC) --output $@ xslt/man.xsl $<
243 # Individual smb.conf parameters
244 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
246 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
247 @mkdir -p $(@D)
248 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
250 # Pearson compatible XML
251 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
252 @mkdir -p $(@D)
253 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
255 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
256 @mkdir -p $(@D)
257 -$(XMLLINT) --valid --noout $< 2> $@
259 # Validation verification
260 %-validate: %/index.xml
261 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
263 # Find undocumented parameters
264 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
265 $(PERL) scripts/find_missing_doc.pl $(SRCDIR)
266 $(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
268 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
269 @mkdir -p examples
270 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
271 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
273 # Archiving
274 archive: pdf
275 @mkdir -p $(ARCHIVEDIR)
276 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
277 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
279 # XSL scripts
280 xslt/html.xsl: xslt/html-common.xsl
281 xslt/html-chunk.xsl: xslt/html-common.xsl
282 xslt/latex.xsl:
283 xslt/expand-sambadoc.xsl:
284 xslt/generate-attributions.xsl:
285 xslt/man.xsl:
286 xslt/pearson.xsl:
288 distclean clobber:: clean
289 rm -f Makefile.settings config.status config.log
291 realdistclean:: distclean
292 rm -f configure
293 rm -rf autom4te.cache
294 rm -rf output
296 # Always keep intermediate files if we can
297 .SECONDARY:
298 .PHONY: clean clobber archive release everything all