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
9 export XML_CATALOG_FILES := $(XML_CATALOG_FILES) /etc/xml/catalog $(shell pwd)/build/catalog.xml
12 MAIN_DOCS = $(patsubst %/index.xml,%,$(wildcard */index.xml))
13 MANPAGES = $(sort $(wildcard $(MANPAGEDIR)/*.?.xml))
15 # Lists of files to process
16 MANPAGES_PLUCKER = $(patsubst $(MANPAGEDIR)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES))
17 DBLATEX_OPTIONS = -p xslt/latex.xsl -i xslt/latex
19 DATETIME := $(shell date +%Y%m%d%H%M%S)
21 XSLTPROC_DEPS = build/catalog.xml build/DTD/samba.build.version
24 XSLTPROC += --profile --load-trace --timing
28 Makefile.settings: configure
31 configure: configure.ac
36 @echo "Supported make targets:"
37 @echo " release - Build the docs needed for a Samba release"
38 @echo " all - Build all docs that can be build using the utilities found by configure"
39 @echo " everything - Build all of the above"
40 @echo " pdf,tex,ps,manpages,txt,pearson,htmlhelp - Build specific output format"
41 @echo " html - Build multi-file HTML versions"
42 @echo " html-single - Build single-file HTML versions"
43 @echo " htmlman - Build HTML version of manpages"
44 @echo " samples - Extract examples"
46 $(PDFDIR)/Samba3-ByExample.pdf $(PSDIR)/Samba3-ByExample.ps $(DOCBOOKDIR)/Samba3-ByExample.xml Samba3-ByExample.tex: $(wildcard Samba3-ByExample/*.xml)
47 $(PDFDIR)/Samba3-HOWTO.pdf $(PSDIR)/Samba3-HOWTO.ps Samba3-HOWTO.tex $(DOCBOOKDIR)/Samba3-HOWTO.xml: $(wildcard Samba3-HOWTO/*.xml) Samba3-HOWTO-attributions.xml
48 Samba3-HOWTO/manpages.xml: $(MANPAGEDIR)/smb.conf.5.xml
49 $(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
53 everything:: manpages pdf html-single html htmlman txt ps fo htmlhelp pearson
54 release:: manpages htmlman html pdf
56 @echo "Cleaning up..."
57 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
58 rm -f *-attributions.xml
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 $(patsubst %.svg,%.png,$(foreach DOC,$(MAIN_DOCS),$($(DOC)-images-latex-svg)))
63 rm -f *-attributions.xml *.d *.tpt *.tex *.loc *.toc *.lof *.glo *.idx *.aux
65 rm -f *-images-latex-* $(LATEX_FIGURES)
66 rm -f xslt/figures/*pdf
67 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
68 rm -f build/catalog.xml
70 # Output format targets
71 pdf:: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
72 ps:: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
73 txt:: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
74 tex:: $(addsuffix .tex,$(MAIN_DOCS))
75 texi:: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
76 texiinfo:: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
77 manpages:: $(patsubst $(MANPAGEDIR)/%.xml,$(OUTPUTDIR)/manpages/%,$(MANPAGES))
78 pearson:: $(PEARSONDIR)/Samba3-HOWTO.xml
79 pearson-verify:: $(PEARSONDIR)/Samba3-HOWTO.report.html
80 plucker:: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
81 htmlman:: $(patsubst $(MANPAGEDIR)/%.xml,$(HTMLDIR)/manpages/%.html,$(MANPAGES)) $(HTMLDIR)/manpages/index.html
82 html-single:: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
83 html:: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
84 htmlhelp:: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
85 validate:: $(addsuffix -validate,$(MAIN_DOCS))
90 .PHONY: test check validate manpages
92 # Intermediate docbook docs
94 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl $(XSLTPROC_DEPS)
95 @echo "Converting Samba-specific tags for $*..."
97 @$(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 0 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
99 $(DOCBOOKDIR)/manpages/%.xml: $(MANPAGEDIR)/%.xml xslt/expand-sambadoc.xsl Makefile.settings $(XSLTPROC_DEPS)
101 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
103 $(DOCBOOKDIR)/manpages/index.xml: $(MANPAGES) xslt/manpage-summary.xsl $(XSLTPROC_DEPS)
105 echo "<article><variablelist>" > $@
106 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES) >> $@
107 @echo "</variablelist></article>" >> $@
110 $(HTMLDIR)/index.html: htmldocs.html
114 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks $(XSLTPROC_DEPS)
116 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
118 # Single large HTML files
119 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css $(XSLTPROC_DEPS)
123 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
125 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl $(XSLTPROC_DEPS)
126 $(XSLTPROC) --output $@ xslt/html.xsl $<
129 %-attributions.xml: $(XSLTPROC_DEPS)
130 @echo "Generating attributions file $@ from $*/"
131 @cp -f templates/attributions.xml $@
132 @$(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
135 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
137 $(HTML2TEXT) -nobs -style pretty -o $@ $<
140 %.tex: %/index.xml xslt/latex.xsl
141 @echo "Generating $@..."
143 @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
146 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl $(XSLTPROC_DEPS)
147 @echo "Generating dependency file for $*"
148 @$(XSLTPROC) --novalid \
149 --stringparam txtbasedir "$(TXTDIR)/$*/" \
150 --stringparam target "$*" \
151 -o $@ xslt/generate-dependencies.xsl $<
152 @echo "$*-images-latex-svg = \$$(wildcard \$$(addsuffix .svg, \$$($*-images-latex)))" >> $@
153 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
154 @echo "$*-images-latex-pdf: \$$(patsubst %.svg, %.pdf, \$$($*-images-latex-svg))" >> $@
155 @echo "$*-images-latex-png: \$$(filter-out \$$(patsubst %.svg,%.png,\$$($*-images-latex-svg)), \$$(addsuffix .png, \$$($*-images-latex)))" >> $@
158 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
159 @echo " @mkdir -p \$$(@D)" >> $@
160 @echo " @cp \$$< \$$@" >> $@
162 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
163 @echo " @mkdir -p \$$(@D)" >> $@
164 @echo " @cp \$$< \$$@" >> $@
166 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
167 @echo " @mkdir -p \$$(@D)" >> $@
168 @echo " @cp \$$< \$$@" >> $@
170 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
171 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
172 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
175 ifneq ($(MAKECMDGOALS),clobber)
176 -include $(addsuffix .d,$(MAIN_DOCS))
181 $(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf
182 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
185 $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
186 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
189 $(INKSCAPE) -z -f $(abspath $<) --export-eps=$(abspath $@)
192 $(INKSCAPE) -z -f $(abspath $<) --export-png=$(abspath $@)
195 $(PNGTOPNM) $< | $(PNMTOPS) > $@
198 $(INKSCAPE) -z -f $(abspath $<) --export-pdf=$(abspath $@)
200 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp $(XSLTPROC_DEPS)
201 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
202 --stringparam manifest.in.base.dir "$@/" \
203 --stringparam base.dir "$@/" \
204 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
207 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
209 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
212 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
214 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
216 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
217 $(MAKEINFO) --no-validate --force -o $@ "$<"
220 $(MANPAGEDIR)/smb.conf.5.xml: parameters
222 # The phony parameters target exists in order to always create the
223 # the parameters xml files. Otherwise, when parameters.*.xml does not exist
224 # yet, the parameters are not generated when smb.conf.5.xml is newer than
225 # any smbdotconf/*/*.xml file ...
228 parameters: $(SMBDOTCONFDOC)/parameters.all.xml
230 $(SMBDOTCONFDOC)/parameters.all.xml: $(wildcard $(SMBDOTCONFDOC)/*/*.xml) $(SMBDOTCONFDOC)/generate-file-list.sh
231 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
234 test -d $@ || mkdir $@
236 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
238 $(XSLTPROC) --output $@ xslt/man.xsl $<
240 # Individual smb.conf parameters
241 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
243 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
245 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
247 # Pearson compatible XML
248 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
250 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
252 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
254 -$(XMLLINT) --valid --noout $< 2> $@
256 # Validation verification
257 %-validate: %/index.xml
258 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
260 build/catalog.xml: build/catalog.xml.in
261 sed -e "s|@abs_top_srcdir@|`pwd`|g;s|@abs_top_builddir@|`pwd`|g" < build/catalog.xml.in > build/catalog.xml
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
291 # Always keep intermediate files if we can
293 .PHONY: clean clobber archive release everything all