s4:dsdb/schema_load: make error message more verbose
[Samba.git] / docs-xml / Makefile
blobf9c60d0fab983b4f04fb29cf1b11b16bdcf78a97
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 MANPAGES = $(wildcard $(MANPAGEDIR)/*.?.xml)
13 # Lists of files to process
14 MANPAGES_PLUCKER = $(patsubst $(MANPAGEDIR)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES))
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,manpages,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 " htmlman - 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: $(MANPAGEDIR)/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
48 # Pseudo targets
49 all:: $(TARGETS)
50 everything:: manpages pdf html-single html htmlman txt ps fo htmlhelp pearson
51 release:: manpages htmlman html pdf
52 clean::
53 @echo "Cleaning up..."
54 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
55 rm -f *-attributions.xml
56 rm -f $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-dia))) \
57 $(patsubst %.svg,%.pdf,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
58 $(patsubst %.svg,%.eps,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg))) \
59 $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg)))
60 rm -f *-attributions.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
61 rm -f *-images-html*
62 rm -f *-images-latex-* $(LATEX_FIGURES)
63 rm -f xslt/figures/*pdf
64 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
65 rm -f build/catalog.xml
67 # Output format targets
68 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
69 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
70 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
71 tex:: $(addsuffix .tex,$(MAIN_DOCS))
72 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
73 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
74 manpages:: $(patsubst $(MANPAGEDIR)/%.xml,$(OUTPUTDIR)/manpages/%,$(MANPAGES))
75 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
76 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
77 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
78 htmlman:: $(patsubst $(MANPAGEDIR)/%.xml,$(HTMLDIR)/manpages/%.html,$(MANPAGES)) $(HTMLDIR)/manpages/index.html
79 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
80 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
81 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
82 validate:: $(addsuffix -validate,$(MAIN_DOCS))
84 test:: validate
85 check:: validate
87 .PHONY: test check validate manpages
89 # Intermediate docbook docs
91 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
92 @echo "Converting Samba-specific tags for $*..."
93 @mkdir -p $(@D)
94 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
96 $(DOCBOOKDIR)/manpages/%.xml: $(MANPAGEDIR)/%.xml xslt/expand-sambadoc.xsl
97 @mkdir -p $(@D)
98 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
100 $(DOCBOOKDIR)/manpages/index.xml: $(MANPAGES) xslt/manpage-summary.xsl
101 @mkdir -p $(@D)
102 echo "<article><variablelist>" > $@
103 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES) >> $@
104 @echo "</variablelist></article>" >> $@
106 # HTML docs
107 $(HTMLDIR)/index.html: htmldocs.html
108 @mkdir -p $(@D)
109 cp $< $@
111 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
112 @mkdir -p $(@D)
113 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
115 # Single large HTML files
116 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
117 @mkdir -p $(@D)
118 cp $< $@
120 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
122 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
123 $(XSLTPROC) --output $@ xslt/html.xsl $<
125 # Attributions
126 %-attributions.xml:
127 @echo "Generating attributions file $@ from $*/"
128 @cp -f templates/attributions.xml $@
129 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
131 # Text files
132 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
133 @mkdir -p $(@D)
134 $(HTML2TEXT) -nobs -style pretty -o $@ $<
136 # Tex files
137 %.tex: %/index.xml xslt/latex.xsl
138 @echo "Generating $@..."
139 @mkdir -p $(@D)
140 @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
142 # Dependency files
143 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
144 @echo "Generating dependency file for $*"
145 @$(XSLTPROC) --novalid \
146 --stringparam txtbasedir "$(TXTDIR)/$*/" \
147 --stringparam target "$*" \
148 -o $@ xslt/generate-dependencies.xsl $<
149 @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
150 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
151 @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
152 @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
154 @echo >> $@
155 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
156 @echo " @mkdir -p \$$(@D)" >> $@
157 @echo " @cp \$$< \$$@" >> $@
158 @echo >> $@
159 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
160 @echo " @mkdir -p \$$(@D)" >> $@
161 @echo " @cp \$$< \$$@" >> $@
162 @echo >> $@
163 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
164 @echo " @mkdir -p \$$(@D)" >> $@
165 @echo " @cp \$$< \$$@" >> $@
166 @echo >> $@
167 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
168 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
169 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
171 ifdef OUTPUTDIR
172 ifneq ($(MAKECMDGOALS),clobber)
173 -include $(addsuffix .d,$(MAIN_DOCS))
174 endif
175 endif
177 # Adobe PDF files
178 $(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf
179 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
181 # PostScript files
182 $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
183 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
185 %.eps: %.svg
186 $(INKSCAPE) -z -f $(abspath $<) --export-eps=$(abspath $@)
188 %.png: %.svg
189 $(INKSCAPE) -z -f $(abspath $<) --export-png=$(abspath $@)
191 %.eps: %.png
192 $(PNGTOPNM) $< | $(PNMTOPS) > $@
194 %.pdf: %.svg
195 $(INKSCAPE) -z -f $(abspath $<) --export-pdf=$(abspath $@)
197 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
198 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
199 --stringparam manifest.in.base.dir "$@/" \
200 --stringparam base.dir "$@/" \
201 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
203 # Plucker docs
204 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
205 @mkdir -p $(@D)
206 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
208 # Texinfo docs
209 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
210 @mkdir -p $(@D)
211 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
213 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
214 $(MAKEINFO) --no-validate --force -o $@ "$<"
216 # Manpages
217 $(MANPAGEDIR)/smb.conf.5.xml: parameters
219 # The phony parameters target exists in order to always create the
220 # the parameters xml files. Otherwise, when parameters.*.xml does not exist
221 # yet, the parameters are not generated when smb.conf.5.xml is newer than
222 # any smbdotconf/*/*.xml file ...
223 .PHONY: parameters
225 parameters: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
227 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
228 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
230 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
231 @echo "Generating list of global smb.conf options"
232 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
234 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
235 @echo "Generating list of share-mode smb.conf options"
236 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
238 $(OUTPUTDIR):
239 test -d $@ || mkdir $@
241 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
242 @mkdir -p $(@D)
243 $(XSLTPROC) --output $@ xslt/man.xsl $<
245 # Individual smb.conf parameters
246 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
248 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
249 @mkdir -p $(@D)
250 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
252 # Pearson compatible XML
253 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
254 @mkdir -p $(@D)
255 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
257 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
258 @mkdir -p $(@D)
259 -$(XMLLINT) --valid --noout $< 2> $@
261 # Validation verification
262 %-validate: %/index.xml
263 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
265 # Find undocumented parameters
266 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_manpages
267 $(PERL) scripts/find_missing_manpages $(SRCDIR)/source3
269 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
270 @mkdir -p examples
271 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
272 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
274 # Archiving
275 archive: pdf
276 @mkdir -p $(ARCHIVEDIR)
277 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
278 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
280 # XSL scripts
281 xslt/html.xsl: xslt/html-common.xsl
282 xslt/html-chunk.xsl: xslt/html-common.xsl
283 xslt/latex.xsl:
284 xslt/expand-sambadoc.xsl:
285 xslt/generate-attributions.xsl:
286 xslt/man.xsl:
287 xslt/pearson.xsl:
289 distclean clobber:: clean
290 rm -f Makefile.settings config.status config.log
292 realdistclean:: distclean
293 rm -f configure
294 rm -rf autom4te.cache
295 rm -rf output
297 # Always keep intermediate files if we can
298 .SECONDARY:
299 .PHONY: clean clobber archive release everything all