Don't show obvious sections from manpages.
[Samba/bb.git] / docs / Makefile
blob2d3b3e8cc6f43f09ebe27c90259b19ea183fc231
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)
12 export TEXINPUTS=xslt/latex:.:
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))
18 DATETIME := $(shell date +%Y%m%d%H%M%S)
20 ifndef OUTPUTDIR
21 Makefile.settings: configure
22 @echo Makefile.settings not present, trying to run configure...
23 @./configure
25 configure: configure.in
26 @echo configure not present, trying to generate
27 @autoreconf
28 endif
30 help:
31 @echo "Supported make targets:"
32 @echo " release - Build the docs needed for a Samba release"
33 @echo " all - Build all docs that can be build using the utilities found by configure"
34 @echo " everything - Build all of the above"
35 @echo " pdf,tex,dvi,ps,manpages3,txt,pearson,fo,htmlhelp - Build specific output format"
36 @echo " html - Build multi-file HTML versions"
37 @echo " html-single - Build single-file HTML versions"
38 @echo " htmlman3 - Build HTML version of manpages"
39 @echo " undocumented - Output list of undocumented smb.conf options"
40 @echo " samples - Extract examples"
42 $(DOCBOOKDIR)/Samba3-ByExample.xml: $(filter-out Samba3-ByExample/index.xml,$(wildcard Samba3-ByExample/*.xml))
43 $(DOCBOOKDIR)/Samba3-HOWTO.xml: $(filter-out Samba3-HOWTO/index.xml,$(wildcard Samba3-HOWTO/*.xml)) Samba3-HOWTO-attributions.xml
44 Samba3-HOWTO/manpages.xml: $(MANPAGEDIR3)/smb.conf.5.xml
45 $(DOCBOOKDIR)/Samba3-Developers-Guide.xml: $(filter-out Samba3-Developers-Guide/index.xml,$(wildcard Samba3-Developers-Guide/*.xml)) Samba3-Developers-Guide-attributions.xml
46 $(DOCBOOKDIR)/Samba4-HOWTO.xml: $(filter-out Samba4-HOWTO/index.xml,$(wildcard Samba4-HOWTO/*.xml)) Samba4-HOWTO-attributions.xml
48 # Pseudo targets
49 all: $(TARGETS)
50 everything: manpages3 pdf html-single html htmlman3 txt ps fo htmlhelp pearson
51 release: manpages3 htmlman3 html pdf
53 # Output format targets
54 pdf: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
55 dvi: $(patsubst %,$(DVIDIR)/%.dvi,$(MAIN_DOCS))
56 ps: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
57 txt: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
58 txt-chunks: $(addsuffix -txt-chunks,$(MAIN_DOCS))
59 fo: $(patsubst %,$(FODIR)/%.fo,$(MAIN_DOCS))
60 fo-pdf: $(patsubst %,$(FOPDFDIR)/%.pdf,$(MAIN_DOCS))
61 tex: $(addsuffix .tex,$(MAIN_DOCS))
62 texi: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
63 texiinfo: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
64 manpages3: $(patsubst $(MANPAGEDIR3)/%.xml,$(OUTPUTDIR)/manpages-3/%,$(MANPAGES3))
65 pearson: $(PEARSONDIR)/Samba3-HOWTO.xml
66 pearson-verify: $(PEARSONDIR)/Samba3-HOWTO.report.html
67 plucker: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
68 htmlman3: $(patsubst $(MANPAGEDIR3)/%.xml,$(HTMLDIR)/manpages-3/%.html,$(MANPAGES3)) $(HTMLDIR)/manpages-3/index.html
69 html-single: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
70 html: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
71 htmlhelp: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
72 validate: $(addsuffix -validate,$(MAIN_DOCS))
74 # Intermediate docbook docs
76 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
77 @echo "Converting Samba-specific tags..."
78 @mkdir -p $(@D)
79 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
81 $(DOCBOOKDIR)/manpages-3/%.xml: $(MANPAGEDIR3)/%.xml xslt/expand-sambadoc.xsl
82 @mkdir -p $(@D)
83 $(XSLTPROC) --xinclude --stringparam noreference 1 --output $@ xslt/expand-sambadoc.xsl $<
85 $(DOCBOOKDIR)/manpages-3/index.xml: $(MANPAGES3) xslt/manpage-summary.xsl
86 @mkdir -p $(@D)
87 echo "<article><variablelist>" > $@
88 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES3) >> $@
89 echo "</variablelist></article>" >> $@
91 # HTML docs
93 $(HTMLDIR)/index.html: htmldocs.html
94 @mkdir -p $(@D)
95 cp $< $@
97 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
98 @mkdir -p $(@D)
99 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
101 # Single large HTML files
102 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
103 @mkdir -p $(@D)
104 cp $< $@
106 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
108 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
109 $(XSLTPROC) --output $@ xslt/html.xsl $<
111 # Attributions
112 %-attributions.xml:
113 @echo "Generating attributions file $@ from $*/"
114 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
116 # Text files
117 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
118 @mkdir -p $(@D)
119 $(HTML2TEXT) -nobs -style pretty -o $@ $<
121 # Tex files
122 %.tex: %/index.xml xslt/latex.xsl
123 @echo "Generating $@..."
124 @mkdir -p $(@D)
125 @$(XSLTPROC) $(DB2LATEX_ARGS) --stringparam latex.imagebasedir "$*/" --xinclude --output $@ xslt/latex.xsl $<
127 latexfigures: $(LATEX_FIGURES)
129 $(PDFDIR)/%.pdf: %.pdf
130 @mkdir -p $(@D)
131 cp $< $@
133 %.idx: %.tex latexfigures
134 -$(PDFLATEX) $<
136 %.ind: %.idx
137 $(MAKEINDEX) $<
139 # Dependency files
140 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
141 @echo "Generating dependency file for $*"
142 @$(XSLTPROC) \
143 --novalid \
144 --stringparam txtbasedir "$(TXTDIR)/$*/" \
145 --stringparam target "$*" \
146 -o $@ xslt/generate-dependencies.xsl $<
147 @echo "$*-images-latex-dia = \$$(wildcard \$$(addsuffix .dia, \$$($*-images-latex)))" >> $@
148 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
149 @echo "$*-images-latex-pdf: \$$(patsubst %.dia, %.pdf, \$$($*-images-latex-dia))" >> $@
150 @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.dia,%.png,\$$($*-images-latex-dia)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
152 @echo >> $@
153 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
154 @echo " @mkdir -p \$$(@D)" >> $@
155 @echo " @cp \$$< \$$@" >> $@
156 @echo >> $@
157 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
158 @echo " @mkdir -p \$$(@D)" >> $@
159 @echo " @cp \$$< \$$@" >> $@
160 @echo >> $@
161 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
162 @echo " @mkdir -p \$$(@D)" >> $@
163 @echo " @cp \$$< \$$@" >> $@
164 @echo >> $@
165 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
166 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
167 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
169 ifdef OUTPUTDIR
170 ifneq ($(MAKECMDGOALS),clobber)
171 include $(addsuffix .d,$(MAIN_DOCS))
172 endif
173 endif
175 # Adobe PDF files
176 %.pdf: %.tex %.ind latexfigures %-images-latex-png %-images-latex-pdf
177 -$(PDFLATEX) $<
178 $(THUMBPDF) --quiet $*.pdf
179 -$(PDFLATEX) $<
181 # DVI files
182 $(DVIDIR)/%.dvi: %.dvi
183 @mkdir -p $(@D)
184 @cp $< $@
186 %.dvi: %.tex %.idx %-images-latex-eps
187 -$(LATEX) $<
189 %.eps: %.dia
190 @$(DIA) -t eps-builtin -e $@ $<
192 %.png: %.dia
193 @$(DIA) -e $@ $<
195 %.pdf: %.eps
196 $(EPSTOPDF) $<
198 %.eps: %.png
199 $(PNGTOPNM) $< | $(PNMTOPS) > $@
201 # PostScript files
202 $(PSDIR)/%.ps: $(DVIDIR)/%.dvi
203 @mkdir -p $(@D)
204 $(DVIPS) -o $@ $<
206 # Fo
207 $(FODIR)/%.fo: $(DOCBOOKDIR)/%.xml
208 @mkdir -p $(@D)
209 $(XSLTPROC) --output $@ xslt/fo.xsl $<
211 # PDF thru Fo
212 $(FOPDFDIR)/%.pdf: $(FODIR)/%.fo
213 @mkdir -p $(@D)
214 JAVA_OPTS=-Xmx250m $(FOP) -q -d $< -pdf $@
216 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
217 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
218 --stringparam manifest.in.base.dir "$@/" \
219 --stringparam base.dir "$@/" \
220 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
222 # Plucker docs
223 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
224 @mkdir -p $(@D)
225 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
227 # Texinfo docs
228 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
229 @mkdir -p $(@D)
230 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
232 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
233 $(MAKEINFO) --no-validate --force -o $@ "$<"
235 # Manpages
236 $(MANPAGEDIR3)/smb.conf.5.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
238 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
239 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
241 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
242 @echo "Generating list of global smb.conf options"
243 @$(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
245 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
246 @echo "Generating list of share-mode smb.conf options"
247 @$(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
249 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
250 @mkdir -p $(@D)
251 $(XSLTPROC) --output $@ xslt/man.xsl $<
253 # Individual smb.conf parameters
254 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
256 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
257 @mkdir -p $(@D)
258 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
260 # Pearson compatible XML
261 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
262 @mkdir -p $(@D)
263 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
265 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
266 @mkdir -p $(@D)
267 -$(XMLLINT) --valid --noout $< 2> $@
269 # Validation verification
270 %-validate: %/index.xml
271 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
273 # Find undocumented parameters
274 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
275 @$(PERL) scripts/find_missing_doc.pl $(SRCDIR)
276 @$(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
278 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
279 @mkdir -p $(EXAMPLESDIR)
280 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
281 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
283 # Archiving
284 archive: pdf
285 @mkdir -p $(ARCHIVEDIR)
286 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
287 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
289 # XSL scripts
290 xslt/html.xsl: xslt/html-common.xsl
291 xslt/html-chunk.xsl: xslt/html-common.xsl
292 xslt/latex.xsl:
293 xslt/expand-sambadoc.xsl:
294 xslt/generate-attributions.xsl:
295 xslt/man.xsl:
296 xslt/pearson.xsl:
298 clobber: clean
299 @rm Makefile.settings config.status config.log configure
301 clean:
302 @echo "Cleaning up..."
303 @rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
304 @rm -f $(patsubst %.dia,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-dia))) \
305 $(patsubst %.dia,%.pdf,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-dia))) \
306 $(patsubst %.dia,%.eps,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-dia)))
307 @rm -f *.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
308 @rm -f *-images-html*
309 @rm -f *-images-latex-* latexfigures
310 @rm -f xslt/figures/*pdf
311 @rm -f $(SMBDOTCONFDOC)/parameters.*.xml
312 @rm -f $(addsuffix .*,$(MAIN_DOCS))
314 # Always keep intermediate files if we can
315 .SECONDARY:
316 .PHONY: clean clobber archive release everything all $(TARGETS) latexfigures