s4:lib/stream: make use of smb_len_tcp()
[Samba.git] / docs-xml / Makefile
blob40aa16108bde24733eba140006cdee5398b778a3
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: parameters
186 # The phony parameters target exists in order to always create the
187 # the parameters xml files. Otherwise, when parameters.*.xml does not exist
188 # yet, the parameters are not generated when smb.conf.5.xml is newer than
189 # any smbdotconf/*/*.xml file ...
190 .PHONY: parameters
192 parameters: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
194 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
195 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
197 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
198 @echo "Generating list of global smb.conf options"
199 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
201 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
202 @echo "Generating list of share-mode smb.conf options"
203 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
205 $(OUTPUTDIR):
206 test -d $@ || mkdir $@
208 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
209 @mkdir -p $(@D)
210 $(XSLTPROC) --output $@ xslt/man.xsl $<
212 # Individual smb.conf parameters
213 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
215 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
216 @mkdir -p $(@D)
217 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
219 # Pearson compatible XML
220 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
221 @mkdir -p $(@D)
222 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
224 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
225 @mkdir -p $(@D)
226 -$(XMLLINT) --valid --noout $< 2> $@
228 # Validation verification
229 %-validate: %/index.xml
230 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
232 # Find undocumented parameters
233 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
234 $(PERL) scripts/find_missing_doc.pl $(SRCDIR)
235 $(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
237 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
238 @mkdir -p examples
239 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
240 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
242 # Archiving
243 archive: pdf
244 @mkdir -p $(ARCHIVEDIR)
245 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
246 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
248 # XSL scripts
249 xslt/html.xsl: xslt/html-common.xsl
250 xslt/html-chunk.xsl: xslt/html-common.xsl
252 distclean clobber:: clean
253 rm -f Makefile.settings config.status config.log
255 realdistclean:: distclean
256 rm -f configure
257 rm -rf autom4te.cache
258 rm -rf output
260 # Always keep intermediate files if we can
261 .SECONDARY:
262 .PHONY: clean clobber archive release everything all