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 $(DOCBOOKDIR
)/Samba-Guide.xml
: $(filter-out Samba-Guide
/index.xml
,$(wildcard Samba-Guide
/*.xml
))
43 $(DOCBOOKDIR
)/Samba-HOWTO-Collection.xml
: $(filter-out Samba-HOWTO-Collection
/index.xml
,$(wildcard Samba-HOWTO-Collection
/*.xml
)) Samba-HOWTO-Collection-attributions.xml
44 $(DOCBOOKDIR
)/Samba-Developers-Guide.xml
: $(filter-out 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 $(XSLTPROC
) xslt
/manpage-summary.xsl
$(MANPAGES
) >> $@
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 ifneq ($(MAKECMDGOALS
),clobber)
169 include $(addsuffix .d
,$(MAIN_DOCS
))
174 %.pdf
: %.
tex %.ind latexfigures
%-images-latex-png
176 $(THUMBPDF
) --quiet
$*.pdf
180 $(DVIDIR
)/%.
dvi: %.
dvi
184 %.
dvi: %.
tex %.idx
%-images-latex-eps
191 $(PNGTOPNM
) $< |
$(PNMTOPS
) > $@
194 $(PSDIR
)/%.ps
: $(DVIDIR
)/%.
dvi
198 xslt
/figures
/%.pdf
: xslt
/figures
/%.eps
202 $(FODIR
)/%.fo
: $(DOCBOOKDIR
)/%.xml
204 $(XSLTPROC
) --output
$@ xslt
/fo.xsl
$<
207 $(FOPDFDIR
)/%.pdf
: $(FODIR
)/%.fo
209 JAVA_OPTS
=-Xmx250m
$(FOP
) -q
-d
$< -pdf
$@
211 $(HTMLHELPDIR
)/%: $(DOCBOOKDIR
)/%.xml
%-images-htmlhelp
212 $(XSLTPROC
) --stringparam htmlhelp.chm
$*.chm \
213 --stringparam manifest.in.base.
dir "$@/" \
214 --stringparam base.
dir "$@/" \
215 http
://docbook.sourceforge.net
/release
/xsl
/current
/htmlhelp
/htmlhelp.xsl
$<
218 $(PLUCKERDIR
)/%.pdb
: $(HTMLDIR
)/%.html
220 $(PLUCKERBUILD
) -v
-V
2 --stayonhost
--zlib-compression
-f
$* -p
$(PLUCKERDIR
) file
:$<
223 $(TEXINFODIR
)/%.texi
: $(DOCBOOKDIR
)/%.xml
225 cd
$(@D
) && $(DB2TEXI
) $(shell pwd
)/$<
227 $(TEXINFODIR
)/%.
info: $(TEXINFODIR
)/%.texi
228 $(MAKEINFO
) --no-validate
--force -o
$@
"$<"
231 $(MANPAGEDIR
)/smb.conf
.5.xml
: $(SMBDOTCONFDOC
)/parameters.
all.xml
$(SMBDOTCONFDOC
)/parameters.service.xml
$(SMBDOTCONFDOC
)/parameters.global.xml
233 $(SMBDOTCONFDOC
)/parameters.
all.xml
: $(shell find
$(SMBDOTCONFDOC
) -type f
-name
'*.xml' -mindepth
2 |
sort -t
/ -k3 | xargs
) $(SMBDOTCONFDOC
)/generate-file-list.sh
234 $(SMBDOTCONFDOC
)/generate-file-list.sh
$(SMBDOTCONFDOC
) > $@
236 $(SMBDOTCONFDOC
)/parameters.global.xml
: $(SMBDOTCONFDOC
)/parameters.
all.xml
$(SMBDOTCONFDOC
)/generate-context.xsl
237 $(XSLTPROC
) --xinclude
--param smb.context
"'G'" --output
$(SMBDOTCONFDOC
)/parameters.global.xml
$(SMBDOTCONFDOC
)/generate-context.xsl
$<
239 $(SMBDOTCONFDOC
)/parameters.service.xml
: $(SMBDOTCONFDOC
)/parameters.
all.xml
$(SMBDOTCONFDOC
)/generate-context.xsl
240 $(XSLTPROC
) --xinclude
--param smb.context
"'S'" --output
$(SMBDOTCONFDOC
)/parameters.service.xml
$(SMBDOTCONFDOC
)/generate-context.xsl
$<
242 $(MANDIR
)/%: $(DOCBOOKDIR
)/%.xml xslt
/man.xsl
244 $(XSLTPROC
) --output
$@ xslt
/man.xsl
$<
246 # Individual smb.conf parameters
247 smb.conf-chunks
: $(patsubst $(SMBDOTCONFDOC
)/%.xml
,$(HTMLDIR
)/smb.conf
/%.html
,$(wildcard $(SMBDOTCONFDOC
)/*/*.xml
))
249 $(HTMLDIR
)/smb.conf
/%.html
: $(SMBDOTCONFDOC
)/%.xml
251 $(XSLTPROC
) --output
$@ xslt
/smb.conf-html.xsl
$<
253 # Pearson compatible XML
254 $(PEARSONDIR
)/%.xml
: %/index.xml xslt
/pearson.xsl
256 $(XSLTPROC
) --xinclude
--output
$@ xslt
/sambadoc2pearson.xsl
$<
258 $(PEARSONDIR
)/%.report.html
: $(PEARSONDIR
)/%.xml
260 -$(XMLLINT
) --valid
--noout
$< 2> $@
262 # Validation verification
263 %-validate
: %/index.xml
264 cd
$(<D
) && $(XMLLINT
) --xinclude
--noent
--postvalid
--noout
$(<F
)
266 # Find undocumented parameters
267 undocumented
: $(SMBDOTCONFDOC
)/parameters.
all.xml scripts
/find_missing_doc.pl scripts
/find_missing_manpages.pl
268 @
$(PERL
) scripts
/find_missing_doc.pl
$(SRCDIR
)
269 @
$(PERL
) scripts
/find_missing_manpages.pl
$(SRCDIR
)
271 # Examples and the like
272 files
: Samba-HOWTO-Collection
/index.xml xslt
/extract-smbfiles.xsl
273 $(XSLTPROC
) xslt
/extract-smbfiles.xsl
$< > /dev
/null
275 samples
: $(DOCBOOKDIR
)/Samba-HOWTO-Collection.xml xslt
/extract-examples.xsl scripts
/indent-smb.conf.pl
276 mkdir
-p
$(EXAMPLESDIR
)
277 $(XSLTPROC
) --xinclude xslt
/extract-examples.xsl
$< > /dev
/null
2> examples
/README
278 for I in examples
/*.conf
; do
{ .
/scripts
/indent-smb.conf.pl
< $$I > $$I.tmp
; mv
$$I.tmp
$$I; } done
282 mkdir
-p
$(ARCHIVEDIR
)
283 cp
$(PDFDIR
)/Samba-HOWTO-Collection.pdf
$(ARCHIVEDIR
)/TOSHARG-
$(DATETIME
).pdf
284 cp
$(PDFDIR
)/Samba-Guide.pdf
$(ARCHIVEDIR
)/S3bE-
$(DATETIME
).pdf
287 xslt
/html.xsl
: xslt
/html-common.xsl settings.xsl
288 xslt
/html-chunk.xsl
: xslt
/html-common.xsl settings.xsl
289 xslt
/latex.xsl
: settings.xsl
290 xslt
/expand-sambadoc.xsl
: settings.xsl
291 xslt
/generate-attributions.xsl
:
296 rm Makefile.settings settings.xsl config.status config.log configure
299 rm -rf
$(OUTPUTDIR
)/* $(DOCBOOKDIR
)
301 rm -f xslt
/figures
/*pdf
302 rm -f
$(SMBDOTCONFDOC
)/parameters.
*.xml
303 rm -f
$(addsuffix .
*,$(MAIN_DOCS
))
305 # Always keep intermediate files if we can
307 .PHONY
: clean clobber archive release everything
all