s3: Fix Coverity ID 2304: FORWARD_NULL
[Samba.git] / docs-xml / Makefile
blob40a6c7b6102a1effba506eb357508b35c989c903
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 $(patsubst %.svg,%.png,$(wildcard */images/*.svg)) \
57 $(patsubst %.svg,%.eps,$(wildcard */images/*.svg)) \
58 $(patsubst %.png,%.eps,$(wildcard */images/*.png))
59 rm -f *-attributions.xml
60 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
61 rm -f build/catalog.xml
63 # Output format targets
64 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
65 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
66 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
67 tex:: $(addsuffix .tex,$(MAIN_DOCS))
68 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
69 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
70 manpages3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(OUTPUTDIR)/manpages-3/%,$(MANPAGES3))
71 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
72 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
73 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
74 htmlman3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(HTMLDIR)/manpages-3/%.html,$(MANPAGES3)) $(HTMLDIR)/manpages-3/index.html
75 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
76 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
77 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
78 validate:: $(addsuffix -validate,$(MAIN_DOCS))
80 test:: validate
81 check:: validate
83 .PHONY: test check validate
85 # Intermediate docbook docs
87 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
88 @echo "Converting Samba-specific tags for $*..."
89 @mkdir -p $(@D)
90 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
92 $(DOCBOOKDIR)/manpages-3/%.xml: $(MANPAGEDIR3)/%.xml xslt/expand-sambadoc.xsl
93 @mkdir -p $(@D)
94 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
96 $(DOCBOOKDIR)/manpages-3/index.xml: $(MANPAGES3) xslt/manpage-summary.xsl
97 @mkdir -p $(@D)
98 echo "<article><variablelist>" > $@
99 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES3) >> $@
100 @echo "</variablelist></article>" >> $@
102 # HTML docs
103 $(HTMLDIR)/index.html: htmldocs.html
104 @mkdir -p $(@D)
105 cp $< $@
107 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl
108 @mkdir -p $(@D)
109 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
111 # Single large HTML files
112 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
113 @mkdir -p $(@D)
114 cp $< $@
116 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-png
118 define IMAGES_TEMPLATE
119 $(1)-images-png:: $$(patsubst %.svg,%.png,$$(wildcard $(1)/images/*.svg)) ;
120 $(1)-images-eps:: $$(patsubst %.svg,%.eps,$$(wildcard $(1)/images/*.svg)) ;
121 $(1)-images-eps:: $$(patsubst %.png,%.eps,$$(wildcard $(1)/images/*.png)) ;
123 endef
125 $(eval $(foreach DOC, $(MAIN_DOCS),$(call IMAGES_TEMPLATE,$(DOC))))
127 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
128 $(XSLTPROC) --output $@ xslt/html.xsl $<
130 # Attributions
131 %-attributions.xml:
132 @echo "Generating attributions file $@ from $*/"
133 @cp -f templates/attributions.xml $@
134 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
136 # Text files
137 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
138 @mkdir -p $(@D)
139 $(HTML2TEXT) -nobs -style pretty -o $@ $<
141 # Tex files
142 %.tex: %/index.xml xslt/latex.xsl
143 @echo "Generating $@..."
144 @mkdir -p $(@D)
145 @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
147 # Adobe PDF files
148 $(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-png
149 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
151 # PostScript files
152 $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-eps
153 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
155 %.eps: %.svg
156 $(INKSCAPE) -z -f $(abspath $<) --export-eps=$(abspath $@)
158 %.png: %.svg
159 $(INKSCAPE) -z -f $(abspath $<) --export-png=$(abspath $@)
161 %.eps: %.png
162 $(PNGTOPNM) $< | $(PNMTOPS) > $@
164 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-png
165 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
166 --stringparam manifest.in.base.dir "$@/" \
167 --stringparam base.dir "$@/" \
168 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
170 # Plucker docs
171 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
172 @mkdir -p $(@D)
173 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
175 # Texinfo docs
176 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
177 @mkdir -p $(@D)
178 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
180 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
181 $(MAKEINFO) --no-validate --force -o $@ "$<"
183 # Manpages
184 $(MANPAGEDIR3)/smb.conf.5.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
186 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
187 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
189 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
190 @echo "Generating list of global smb.conf options"
191 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
193 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
194 @echo "Generating list of share-mode smb.conf options"
195 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
197 $(OUTPUTDIR):
198 test -d $@ || mkdir $@
200 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
201 @mkdir -p $(@D)
202 $(XSLTPROC) --output $@ xslt/man.xsl $<
204 # Individual smb.conf parameters
205 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
207 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
208 @mkdir -p $(@D)
209 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
211 # Pearson compatible XML
212 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
213 @mkdir -p $(@D)
214 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
216 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
217 @mkdir -p $(@D)
218 -$(XMLLINT) --valid --noout $< 2> $@
220 # Validation verification
221 %-validate: %/index.xml
222 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
224 # Find undocumented parameters
225 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
226 $(PERL) scripts/find_missing_doc.pl $(SRCDIR)
227 $(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
229 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
230 @mkdir -p examples
231 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
232 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
234 # Archiving
235 archive: pdf
236 @mkdir -p $(ARCHIVEDIR)
237 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
238 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
240 # XSL scripts
241 xslt/html.xsl: xslt/html-common.xsl
242 xslt/html-chunk.xsl: xslt/html-common.xsl
244 distclean clobber:: clean
245 rm -f Makefile.settings config.status config.log
247 realdistclean:: distclean
248 rm -f configure
249 rm -rf autom4te.cache
250 rm -rf output
252 # Always keep intermediate files if we can
253 .SECONDARY:
254 .PHONY: clean clobber archive release everything all