source: vendor/current/docs-xml/Makefile@ 988

Last change on this file since 988 was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

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