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 MANPAGES = $(wildcard $(MANPAGEDIR)/*.?.xml)
13 # Lists of files to process
14 LATEX_FIGURES = xslt/figures/caution.pdf xslt/figures/important.pdf xslt/figures/note.pdf xslt/figures/tip.pdf xslt/figures/warning.pdf
15 MANPAGES_PLUCKER = $(patsubst $(MANPAGEDIR)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES))
17 DATETIME := $(shell date +%Y%m%d%H%M%S)
20 Makefile.settings: configure
21 @echo Makefile.settings not present, trying to run configure...
24 configure: configure.in
25 @echo configure not present, trying to generate
30 @echo "Supported make targets:"
31 @echo " release - Build the docs needed for a Samba release"
32 @echo " all - Build all docs that can be build using the utilities found by configure"
33 @echo " everything - Build all of the above"
34 @echo " pdf,tex,dvi,ps,manpages,txt,pearson,fo,htmlhelp - Build specific output format"
35 @echo " html - Build multi-file HTML versions"
36 @echo " html-single - Build single-file HTML versions"
37 @echo " htmlman - Build HTML version of manpages"
38 @echo " undocumented - Output list of undocumented smb.conf options"
39 @echo " samples - Extract examples"
40 @echo " files - Extract other files"
42 Samba-Guide/index.xml: $(subst Samba-Guide/index.xml,,$(wildcard Samba-Guide/*.xml))
43 Samba-HOWTO-Collection/index.xml: $(subst Samba-HOWTO-Collection/index.xml,,$(wildcard Samba-HOWTO-Collection/*.xml)) Samba-HOWTO-Collection-attributions.xml
44 Samba-Developers-Guide/index.xml: $(subst Samba-Developers-Guide/index.xml,,$(wildcard Samba-Developers-Guide/*.xml)) Samba-Developers-Guide-attributions.xml
48 everything: manpages pdf html-single html htmlman txt ps fo htmlhelp pearson
49 release: manpages htmlman html pdf
51 # Output format targets
52 pdf: $(patsubst %,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
53 dvi: $(patsubst %,$(DVIDIR)/%.dvi,$(MAIN_DOCS))
54 ps: $(patsubst %,$(PSDIR)/%.ps,$(MAIN_DOCS))
55 txt: $(patsubst %,$(TXTDIR)/%.txt,$(MAIN_DOCS))
56 txt-chunks: $(addsuffix -txt-chunks,$(MAIN_DOCS))
57 fo: $(patsubst %,$(FODIR)/%.fo,$(MAIN_DOCS))
58 fo-pdf: $(patsubst %,$(FOPDFDIR)/%.pdf,$(MAIN_DOCS))
59 tex: $(addsuffix .tex,$(MAIN_DOCS))
60 texi: $(patsubst %,$(TEXINFODIR)/%.texi,$(MAIN_DOCS))
61 texiinfo: $(patsubst %,$(TEXINFODIR)/%.info,$(MAIN_DOCS))
62 manpages: $(patsubst $(MANPAGEDIR)/%.xml,$(MANDIR)/%,$(MANPAGES))
63 pearson: $(PEARSONDIR)/Samba-HOWTO-Collection.xml
64 pearson-verify: $(PEARSONDIR)/Samba-HOWTO-Collection.report.html
65 plucker: $(patsubst %,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
66 htmlman: $(patsubst $(MANPAGEDIR)/%.xml,$(HTMLDIR)/%.html,$(MANPAGES)) $(HTMLDIR)/manpages.html
67 html-single: $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS))
68 html: $(patsubst %,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
69 htmlhelp: $(addprefix $(HTMLHELPDIR)/,$(MAIN_DOCS))
70 validate: $(addsuffix -validate,$(MAIN_DOCS))
72 # Intermediate docbook docs
74 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
76 $(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
78 $(DOCBOOKDIR)/%.xml: $(MANPAGEDIR)/%.xml xslt/expand-sambadoc.xsl
80 $(XSLTPROC) --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ xslt/expand-sambadoc.xsl $<
82 $(DOCBOOKDIR)/manpages.xml: $(MANPAGES) xslt/manpage-summary.xsl
84 echo "<article><variablelist>" > $@
85 for I in $(MANPAGES); do $(XSLTPROC) xslt/manpage-summary.xsl $$I >> $@; done
86 echo "</variablelist></article>" >> $@
90 $(HTMLDIR)/index.html: htmldocs.html
94 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks
96 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
98 # Single large HTML files
99 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
103 $(patsubst %,$(HTMLDIR)/%.html,$(MAIN_DOCS)): $(HTMLDIR)/%.html: %-images-html-single
105 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
106 $(XSLTPROC) --output $@ xslt/html.xsl $<
110 $(XSLTPROC) --xinclude -o $@ xslt/generate-attributions.xsl $*/index.xml
113 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
115 $(HTML2TEXT) -nobs -style pretty -o $@ $<
118 %.tex: $(DOCBOOKDIR)/%.xml xslt/latex.xsl
120 $(XSLTPROC) --output $@ xslt/latex.xsl $<
122 latexfigures: $(LATEX_FIGURES)
125 $(PDFDIR)/%.pdf: %.pdf
129 %.idx: %.tex latexfigures
136 %.d: $(DOCBOOKDIR)/%.xml xslt/generate-dependencies.xsl
139 --stringparam txtbasedir "$(TXTDIR)/$*/" \
140 --stringparam target "$*" \
141 -o $@ xslt/generate-dependencies.xsl $<
142 @echo "$*-images-latex-png: \$$(addsuffix .png, \$$($*-images-latex))" >> $@
143 @echo " touch \$$@" >> $@
145 @echo "$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
146 @echo " touch \$$@" >> $@
148 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
149 @echo " mkdir -p \$$(@D)" >> $@
150 @echo " cp \$$< \$$@" >> $@
152 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
153 @echo " mkdir -p \$$(@D)" >> $@
154 @echo " cp \$$< \$$@" >> $@
156 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
157 @echo " mkdir -p \$$(@D)" >> $@
158 @echo " cp \$$< \$$@" >> $@
160 @echo "$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
161 @echo " touch \$$@" >> $@
162 @echo "$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
163 @echo " touch \$$@" >> $@
164 @echo "$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
165 @echo " touch \$$@" >> $@
168 include $(addsuffix .d,$(MAIN_DOCS))
172 %.pdf: %.tex %.ind latexfigures %-images-latex-png
174 $(THUMBPDF) --quiet $*.pdf
178 $(DVIDIR)/%.dvi: %.dvi
182 %.dvi: %.tex %.idx %-images-latex-eps
189 $(PNGTOPNM) $< | $(PNMTOPS) > $@
192 $(PSDIR)/%.ps: $(DVIDIR)/%.dvi
196 xslt/figures/%.pdf: xslt/figures/%.eps
200 $(FODIR)/%.fo: $(DOCBOOKDIR)/%.xml
202 $(XSLTPROC) --output $@ http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $<
205 $(FOPDFDIR)/%.pdf: $(FODIR)/%.fo
207 JAVA_OPTS=-Xmx250m $(FOP) -q -d $< -pdf $@
209 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml %-images-htmlhelp
210 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm \
211 --stringparam manifest.in.base.dir "$@/" \
212 --stringparam base.dir "$@/" \
213 http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
216 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
218 $(PLUCKERBUILD) -v -V 2 --stayonhost --zlib-compression -f $* -p $(PLUCKERDIR) file:$<
221 $(TEXINFODIR)/%.texi: $(DOCBOOKDIR)/%.xml
223 cd $(@D) && $(DB2TEXI) $(shell pwd)/$<
225 $(TEXINFODIR)/%.info: $(TEXINFODIR)/%.texi
226 $(MAKEINFO) --no-validate --force -o $@ "$<"
229 $(MANPAGEDIR)/smb.conf.5.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
231 $(SMBDOTCONFDOC)/parameters.all.xml: $(shell find $(SMBDOTCONFDOC) -type f -name '*.xml' -mindepth 2 | sort -t/ -k3 | xargs) $(SMBDOTCONFDOC)/generate-file-list.sh
232 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
234 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
235 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
237 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
238 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
240 $(MANDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
242 $(XSLTPROC) --output $@ xslt/man.xsl $<
244 # Individual smb.conf parameters
245 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
247 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
249 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
251 # Pearson compatible XML
252 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
254 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
256 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
258 -$(XMLLINT) --valid --noout $< 2> $@
260 # Validation verification
261 %-validate: %/index.xml
262 cd $(<D) && $(XMLLINT) --xinclude --noent --postvalid --noout $(<F)
264 # Find undocumented parameters
265 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
266 @$(PERL) scripts/find_missing_doc.pl $(SRCDIR)
267 @$(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
269 # Examples and the like
270 files: Samba-HOWTO-Collection/index.xml xslt/extract-smbfiles.xsl
271 $(XSLTPROC) xslt/extract-smbfiles.xsl $< > /dev/null
273 samples: $(DOCBOOKDIR)/Samba-HOWTO-Collection.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
274 mkdir -p $(EXAMPLESDIR)
275 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
276 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
280 mkdir -p $(ARCHIVEDIR)
281 cp $(PDFDIR)/Samba-HOWTO-Collection.pdf $(ARCHIVEDIR)/TOSHARG-$(DATETIME).pdf
282 cp $(PDFDIR)/Samba-Guide.pdf $(ARCHIVEDIR)/S3bE-$(DATETIME).pdf
285 xslt/html.xsl: xslt/html-common.xsl settings.xsl
286 xslt/html-chunk.xsl: xslt/html-common.xsl settings.xsl
287 xslt/latex.xsl: settings.xsl
288 xslt/expand-sambadoc.xsl: settings.xsl
289 xslt/generate-attributions.xsl:
294 rm Makefile.settings settings.xsl config.status config.log configure
297 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
299 rm -f xslt/figures/*pdf
300 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
301 rm -f $(addsuffix .*,$(MAIN_DOCS))
303 # Always keep intermediate files if we can
305 .PHONY: clean clobber archive release everything all