1 #################################################################
2 # Makefile for Samba Documentation
4 # James Moore <jmoore@php.net>
5 # Gerald Carter <jerry@samba.org>
6 # Jelmer Vernooij <jelmer@samba.org>
7 include Makefile.settings
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)
20 XSLTPROC += --profile --load-trace --timing
24 Makefile.settings: configure
27 configure: configure.ac
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 $(DOCBOOKDIR)/Samba3-ByExample.xml: $(filter-out Samba3-ByExample/index.xml,$(wildcard Samba3-ByExample/*.xml))
44 $(DOCBOOKDIR)/Samba3-HOWTO.xml: $(filter-out Samba3-HOWTO/index.xml,$(wildcard Samba3-HOWTO/*.xml)) Samba3-HOWTO-attributions.xml
45 Samba3-HOWTO/manpages.xml: $(MANPAGEDIR3)/smb.conf.5.xml
46 $(DOCBOOKDIR)/Samba3-Developers-Guide.xml: $(filter-out Samba3-Developers-Guide/index.xml,$(wildcard Samba3-Developers-Guide/*.xml)) Samba3-Developers-Guide-attributions.xml
47 $(DOCBOOKDIR)/Samba4-HOWTO.xml: $(filter-out Samba4-HOWTO/index.xml,$(wildcard Samba4-HOWTO/*.xml)) Samba4-HOWTO-attributions.xml
51 everything:: manpages3 pdf html-single html htmlman3 txt ps fo htmlhelp pearson
52 release:: manpages3 htmlman3 html pdf
54 @echo "Cleaning up..."
55 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
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
62 rm -f *-images-latex-* $(LATEX_FIGURES)
63 rm -f xslt/figures/*pdf
64 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
65 rm -f $(addsuffix .*,$(MAIN_DOCS))
66 rm -f build/catalog.xml
68 # Output format targets
69 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
70 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
71 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
72 tex:: $(addsuffix .tex,$(MAIN_DOCS))
73 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
74 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
75 manpages3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(OUTPUTDIR)/manpages-3/%,$(MANPAGES3))
76 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
77 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
78 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
79 htmlman3:: $(patsubst $(MANPAGEDIR3)/%.xml,$(HTMLDIR)/manpages-3/%.html,$(MANPAGES3)) $(HTMLDIR)/manpages-3/index.html
80 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
81 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
82 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
83 validate:: $(addsuffix -validate,$(MAIN_DOCS))
88 .PHONY: test check validate
90 # Intermediate docbook docs
92 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
93 @echo "Converting Samba-specific tags for $*..."
95 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
97 $(DOCBOOKDIR)/manpages-3/%.xml: $(MANPAGEDIR3)/%.xml xslt/expand-sambadoc.xsl
99 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
101 $(DOCBOOKDIR)/manpages-3/index.xml: $(MANPAGES3) xslt/manpage-summary.xsl
103 echo "<article><variablelist>" > $@
104 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES3) >> $@
105 @echo "</variablelist></article>" >> $@
108 $(HTMLDIR)/index.html: htmldocs.html
112 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
114 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
116 # Single large HTML files
117 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
121 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
123 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
124 $(XSLTPROC) --output $@ xslt/html.xsl $<
128 @echo "Generating attributions file $@ from $*/"
129 @cp -f templates/attributions.xml $@
130 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
133 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
135 $(HTML2TEXT) -nobs -style pretty -o $@ $<
138 %.tex: %/index.xml xslt/latex.xsl
139 @echo "Generating $@..."
141 @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
144 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
145 @echo "Generating dependency file for $*"
146 @$(XSLTPROC) --novalid \
147 --stringparam txtbasedir "$(TXTDIR)/$*/" \
148 --stringparam target "$*" \
149 -o $@ xslt/generate-dependencies.xsl $<
150 @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
151 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
152 @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
153 @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
156 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
157 @echo " @mkdir -p \$$(@D)" >> $@
158 @echo " @cp \$$< \$$@" >> $@
160 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
161 @echo " @mkdir -p \$$(@D)" >> $@
162 @echo " @cp \$$< \$$@" >> $@
164 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
165 @echo " @mkdir -p \$$(@D)" >> $@
166 @echo " @cp \$$< \$$@" >> $@
168 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
169 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
170 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
173 ifneq ($(MAKECMDGOALS),clobber)
174 -include $(addsuffix .d,$(MAIN_DOCS))
179 $(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf
180 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
183 $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
184 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
187 $(INKSCAPE) -z -f $< --export-eps=$@
190 $(INKSCAPE) -z -f $< --export-png=$@
196 $(PNGTOPNM) $< | $(PNMTOPS) > $@
198 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
199 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
200 --stringparam manifest.in.base.dir "$@/" \
201 --stringparam base.dir "$@/" \
202 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
205 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
207 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
210 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
212 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
214 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
215 $(MAKEINFO) --no-validate --force -o $@ "$<"
218 $(MANPAGEDIR3)/smb.conf.5.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
220 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
221 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
223 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
224 @echo "Generating list of global smb.conf options"
225 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
227 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
228 @echo "Generating list of share-mode smb.conf options"
229 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
232 test -d $@ || mkdir $@
234 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
236 $(XSLTPROC) --output $@ xslt/man.xsl $<
238 # Individual smb.conf parameters
239 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
241 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
243 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
245 # Pearson compatible XML
246 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
248 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
250 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
252 -$(XMLLINT) --valid --noout $< 2> $@
254 # Validation verification
255 %-validate: %/index.xml
256 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
258 # Find undocumented parameters
259 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
260 $(PERL) scripts/find_missing_doc.pl $(SRCDIR)
261 $(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
263 samples: $(DOCBOOKDIR)/Samba3-HOWTO.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
265 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
266 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
270 @mkdir -p $(ARCHIVEDIR)
271 cp $(PDFDIR)/Samba3-HOWTO.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
272 cp $(PDFDIR)/Samba3-ByExample.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
275 xslt/html.xsl: xslt/html-common.xsl
276 xslt/html-chunk.xsl: xslt/html-common.xsl
278 xslt/expand-sambadoc.xsl:
279 xslt/generate-attributions.xsl:
283 distclean clobber:: clean
284 rm -f Makefile.settings config.status config.log
286 realdistclean:: distclean
288 rm -rf autom4te.cache
290 # Always keep intermediate files if we can
292 .PHONY: clean clobber archive release everything all