libnet dssync: refactor dsgetncchanges loop out into libnet_dssync_getncchanges().
[Samba/bb.git] / docs-xml / Makefile
blob2acef3e2432c012dc6fb552e74306c13420e877c
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 ifeq ($(PROFILE), Y)
21 XSLTPROC += --profile --load-trace --timing
22 endif
24 ifndef OUTPUTDIR
25 Makefile.settings: configure
26 @echo Makefile.settings not present, trying to run configure...
27 ./configure
29 configure: configure.ac
30 @echo configure not present, trying to regenerate it...
31 autoreconf
32 endif
34 help:
35 @echo "Supported make targets:"
36 @echo " release - Build the docs needed for a Samba release"
37 @echo " all - Build all docs that can be build using the utilities found by configure"
38 @echo " everything - Build all of the above"
39 @echo " pdf,tex,dvi,ps,manpages3,txt,pearson,fo,htmlhelp - Build specific output format"
40 @echo " html - Build multi-file HTML versions"
41 @echo " html-single - Build single-file HTML versions"
42 @echo " htmlman3 - Build HTML version of manpages"
43 @echo " undocumented - Output list of undocumented smb.conf options"
44 @echo " samples - Extract examples"
46 $(DOCBOOKDIR)/Samba3-ByExample.xml: $(filter-out Samba3-ByExample/index.xml,$(wildcard Samba3-ByExample/*.xml))
47 $(DOCBOOKDIR)/Samba3-HOWTO.xml: $(filter-out Samba3-HOWTO/index.xml,$(wildcard Samba3-HOWTO/*.xml)) Samba3-HOWTO-attributions.xml
48 Samba3-HOWTO/manpages.xml: $(MANPAGEDIR3)/smb.conf.5.xml
49 $(DOCBOOKDIR)/Samba3-Developers-Guide.xml: $(filter-out Samba3-Developers-Guide/index.xml,$(wildcard Samba3-Developers-Guide/*.xml)) Samba3-Developers-Guide-attributions.xml
50 $(DOCBOOKDIR)/Samba4-HOWTO.xml: $(filter-out Samba4-HOWTO/index.xml,$(wildcard Samba4-HOWTO/*.xml)) Samba4-HOWTO-attributions.xml
52 # Pseudo targets
53 all:: $(TARGETS)
54 everything:: manpages3 pdf html-single html htmlman3 txt ps fo htmlhelp pearson
55 release:: manpages3 htmlman3 html pdf
56 clean::
57 @echo "Cleaning up..."
58 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
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 rm -f *-attributions.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
63 rm -f *-images-html*
64 rm -f *-images-latex-* $(LATEX_FIGURES)
65 rm -f xslt/figures/*pdf
66 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
67 rm -f $(addsuffix .*,$(MAIN_DOCS))
69 # Output format targets
70 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
71 dvi:: $(patsubst %,$(DVIDIR)/%.dvi,$(MAIN_DOCS))
72 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
73 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
74 txt-chunks:: $(addsuffix -txt-chunks,$(MAIN_DOCS))
75 fo:: $(patsubst %,$(FODIR)/%.fo,$(MAIN_DOCS))
76 fo-pdf:: $(patsubst %,$(FOPDFDIR)/%.pdf,$(MAIN_DOCS))
77 tex:: $(addsuffix .tex,$(MAIN_DOCS))
78 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
79 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
80 manpages3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(OUTPUTDIR)/manpages-3/%,$(MANPAGES3))
81 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
82 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
83 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
84 htmlman3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(HTMLDIR)/manpages-3/%.html,$(MANPAGES3)) $(HTMLDIR)/manpages-3/index.html
85 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
86 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
87 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
88 validate:: $(addsuffix -validate,$(MAIN_DOCS))
90 test:: validate
91 check:: validate
93 .PHONY: test check validate
95 # Intermediate docbook docs
97 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
98 @echo "Converting Samba-specific tags for $*..."
99 @mkdir -p $(@D)
100 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
102 $(DOCBOOKDIR)/manpages-3/%.xml: $(MANPAGEDIR3)/%.xml xslt/expand-sambadoc.xsl
103 @mkdir -p $(@D)
104 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
106 $(DOCBOOKDIR)/manpages-3/index.xml: $(MANPAGES3) xslt/manpage-summary.xsl
107 @mkdir -p $(@D)
108 echo "<article><variablelist>" > $@
109 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES3) >> $@
110 @echo "</variablelist></article>" >> $@
112 # HTML docs
113 $(HTMLDIR)/index.html: htmldocs.html
114 @mkdir -p $(@D)
115 cp $< $@
117 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
118 @mkdir -p $(@D)
119 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
121 # Single large HTML files
122 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
123 @mkdir -p $(@D)
124 cp $< $@
126 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
128 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
129 $(XSLTPROC) --output $@ xslt/html.xsl $<
131 # Attributions
132 %-attributions.xml:
133 @echo "Generating attributions file $@ from $*/"
134 @cp -f templates/attributions.xml $@
135 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
137 # Text files
138 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
139 @mkdir -p $(@D)
140 $(HTML2TEXT) -nobs -style pretty -o $@ $<
142 # Tex files
143 %.tex: %/index.xml xslt/latex.xsl
144 @echo "Generating $@..."
145 @mkdir -p $(@D)
146 @$(XSLTPROC) $(DB2LATEX_ARGS) --stringparam latex.imagebasedir "$*/" --xinclude --output $@ xslt/latex.xsl $<
148 $(PDFDIR)/%.pdf: %.pdf
149 @mkdir -p $(@D)
150 cp $< $@
152 %.idx: %.tex $(LATEX_FIGURES)
153 -$(PDFLATEX) $<
155 %.ind: %.idx
156 $(MAKEINDEX) $<
158 # Dependency files
159 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
160 @echo "Generating dependency file for $*"
161 @$(XSLTPROC) --novalid \
162 --stringparam txtbasedir "$(TXTDIR)/$*/" \
163 --stringparam target "$*" \
164 -o $@ xslt/generate-dependencies.xsl $<
165 @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
166 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
167 @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
168 @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
170 @echo >> $@
171 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
172 @echo " @mkdir -p \$$(@D)" >> $@
173 @echo " @cp \$$< \$$@" >> $@
174 @echo >> $@
175 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
176 @echo " @mkdir -p \$$(@D)" >> $@
177 @echo " @cp \$$< \$$@" >> $@
178 @echo >> $@
179 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
180 @echo " @mkdir -p \$$(@D)" >> $@
181 @echo " @cp \$$< \$$@" >> $@
182 @echo >> $@
183 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
184 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
185 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
187 ifdef OUTPUTDIR
188 ifneq ($(MAKECMDGOALS),clobber)
189 -include $(addsuffix .d,$(MAIN_DOCS))
190 endif
191 endif
193 # Adobe PDF files
194 %.pdf: %.tex %.ind $(LATEX_FIGURES) %-images-latex-png %-images-latex-pdf
195 -$(PDFLATEX) $<
196 -$(PDFLATEX) $<
197 -$(PDFLATEX) $<
198 -$(PDFLATEX) $<
199 $(THUMBPDF) --quiet $*.pdf
200 -$(PDFLATEX) $<
202 # DVI files
203 $(DVIDIR)/%.dvi: %.dvi
204 @mkdir -p $(@D)
205 cp $< $@
207 %.dvi: %.tex %.idx %-images-latex-eps
208 -$(LATEX) $<
210 %.eps: %.svg
211 $(INKSCAPE) -z -f $< --export-eps=$@
213 %.png: %.svg
214 $(INKSCAPE) -z -f $< --export-png=$@
216 #%.pdf: %.svg
217 # $(INKSCAPE) -z -f $< --export-pdf=$@
219 %.pdf: %.eps
220 $(EPSTOPDF) $<
222 %.eps: %.png
223 $(PNGTOPNM) $< | $(PNMTOPS) > $@
225 # PostScript files
226 $(PSDIR)/%.ps: $(DVIDIR)/%.dvi
227 @mkdir -p $(@D)
228 $(DVIPS) -o $@ $<
230 # Fo
231 $(FODIR)/%.fo: $(DOCBOOKDIR)/%.xml
232 @mkdir -p $(@D)
233 $(XSLTPROC) --output $@ xslt/fo.xsl $<
235 # PDF thru Fo
236 $(FOPDFDIR)/%.pdf: $(FODIR)/%.fo
237 @mkdir -p $(@D)
238 JAVA_OPTS=-Xmx250m $(FOP) -q -d $< -pdf $@
240 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
241 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
242 --stringparam manifest.in.base.dir "$@/" \
243 --stringparam base.dir "$@/" \
244 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
246 # Plucker docs
247 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
248 @mkdir -p $(@D)
249 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
251 # Texinfo docs
252 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
253 @mkdir -p $(@D)
254 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
256 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
257 $(MAKEINFO) --no-validate --force -o $@ "$<"
259 # Manpages
260 $(MANPAGEDIR3)/smb.conf.5.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
262 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
263 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
265 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
266 @echo "Generating list of global smb.conf options"
267 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
269 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
270 @echo "Generating list of share-mode smb.conf options"
271 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
273 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
274 @mkdir -p $(@D)
275 $(XSLTPROC) --output $@ xslt/man.xsl $<
277 # Individual smb.conf parameters
278 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
280 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
281 @mkdir -p $(@D)
282 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
284 # Pearson compatible XML
285 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
286 @mkdir -p $(@D)
287 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
289 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
290 @mkdir -p $(@D)
291 -$(XMLLINT) --valid --noout $< 2> $@
293 # Validation verification
294 %-validate: %/index.xml
295 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
297 # Find undocumented parameters
298 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
299 $(PERL) scripts/find_missing_doc.pl $(SRCDIR)
300 $(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
302 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
303 @mkdir -p $(EXAMPLESDIR)
304 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
305 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
307 # Archiving
308 archive: pdf
309 @mkdir -p $(ARCHIVEDIR)
310 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
311 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
313 # XSL scripts
314 xslt/html.xsl: xslt/html-common.xsl
315 xslt/html-chunk.xsl: xslt/html-common.xsl
316 xslt/latex.xsl:
317 xslt/expand-sambadoc.xsl:
318 xslt/generate-attributions.xsl:
319 xslt/man.xsl:
320 xslt/pearson.xsl:
322 distclean clobber:: clean
323 rm Makefile.settings config.status config.log configure
324 rm -rf autom4te.cache
327 # Always keep intermediate files if we can
328 .SECONDARY:
329 .PHONY: clean clobber archive release everything all