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 DBLATEX_OPTIONS
= -p xslt
/latex.xsl
-i xslt
/latex
18 DATETIME
:= $(shell date
+%Y
%m
%d
%H
%M
%S
)
20 XSLTPROC_DEPS
= build
/catalog.xml build
/DTD
/samba.build.version
23 XSLTPROC
+= --profile
--load-trace
--timing
27 Makefile.settings
: configure
30 configure
: configure.ac
35 @echo
"Supported make targets:"
36 @echo
" release - Build the docs needed for a Samba release"
37 @echo
" all - Build all docs that can be build using the utilities found by configure"
38 @echo
" everything - Build all of the above"
39 @echo
" pdf,tex,ps,manpages,htmlhelp - Build specific output format"
40 @echo
" html - Build multi-file HTML versions"
41 @echo
" html-single - Build single-file HTML versions"
42 @echo
" htmlman - Build HTML version of manpages"
44 $(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
48 everything
:: manpages pdf html-single html htmlman ps fo htmlhelp
49 release
:: manpages htmlman html pdf
51 @echo
"Cleaning up..."
52 rm -rf
$(OUTPUTDIR
)/* $(DOCBOOKDIR
)
53 rm -f
*-attributions.xml
54 rm -f
*-attributions.xml
*.d
*.tpt
*.
tex *.loc
*.toc
*.lof
*.glo
*.idx
*.aux
56 rm -f
*-images-latex-
* $(LATEX_FIGURES
)
57 rm -f xslt
/figures
/*pdf
58 rm -f
$(SMBDOTCONFDOC
)/parameters.
*.xml
59 rm -f build
/catalog.xml
61 # Output format targets
62 pdf
:: $(patsubst %,$(PDFDIR
)/%.pdf
,$(MAIN_DOCS
))
63 ps
:: $(patsubst %,$(PSDIR
)/%.ps
,$(MAIN_DOCS
))
64 tex:: $(addsuffix .
tex,$(MAIN_DOCS
))
65 manpages
:: $(patsubst $(MANPAGEDIR
)/%.xml
,$(OUTPUTDIR
)/manpages
/%,$(MANPAGES
))
66 htmlman
:: $(patsubst $(MANPAGEDIR
)/%.xml
,$(HTMLDIR
)/manpages
/%.html
,$(MANPAGES
)) $(HTMLDIR
)/manpages
/index.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
))
75 .PHONY
: test check validate manpages
77 # Intermediate docbook docs
79 $(DOCBOOKDIR
)/%.xml
: %/index.xml xslt
/expand-sambadoc.xsl
$(XSLTPROC_DEPS
)
80 @echo
"Converting Samba-specific tags for $*..."
82 @
$(XSLTPROC
) --stringparam latex.imagebasedir
"$*/" --stringparam noreference
0 --xinclude
--output
$@ xslt
/expand-sambadoc.xsl
$<
84 $(DOCBOOKDIR
)/manpages
/%.xml
: $(MANPAGEDIR
)/%.xml xslt
/expand-sambadoc.xsl Makefile.settings
$(XSLTPROC_DEPS
)
86 $(XSLTPROC
) --xinclude
--stringparam noreference
0 --output
$@ xslt
/expand-sambadoc.xsl
$<
88 $(DOCBOOKDIR
)/manpages
/index.xml
: $(MANPAGES
) xslt
/manpage-summary.xsl
$(XSLTPROC_DEPS
)
90 echo
"<article><variablelist>" > $@
91 $(XSLTPROC
) xslt
/manpage-summary.xsl
$(MANPAGES
) >> $@
92 @echo
"</variablelist></article>" >> $@
95 $(HTMLDIR
)/index.html
: htmldocs.html
99 $(HTMLDIR
)/%/index.html
: $(DOCBOOKDIR
)/%.xml
$(HTMLDIR
)/%/samba.css xslt
/html-chunk.xsl
%-images-html-chunks
$(XSLTPROC_DEPS
)
101 $(XSLTPROC
) --stringparam base.
dir "$(HTMLDIR)/$*/" xslt
/html-chunk.xsl
$<
103 # Single large HTML files
104 $(OUTPUTDIR
)/%/samba.css
: xslt
/html
/samba.css
$(XSLTPROC_DEPS
)
108 $(patsubst %,$(HTMLDIR
)/%.html
,$(MAIN_DOCS
)): $(HTMLDIR
)/%.html
: %-images-html-single
110 $(HTMLDIR
)/%.html
: $(DOCBOOKDIR
)/%.xml
$(HTMLDIR
)/samba.css xslt
/html.xsl
$(XSLTPROC_DEPS
)
111 $(XSLTPROC
) --output
$@ xslt
/html.xsl
$<
114 %-attributions.xml
: $(XSLTPROC_DEPS
)
115 @echo
"Generating attributions file $@ from $*/"
116 @cp
-f templates
/attributions.xml
$@
117 @
$(XSLTPROC
) --xinclude
-o
$@ xslt
/generate-attributions.xsl
$*/index.xml
120 %.
tex: %/index.xml xslt
/latex.xsl
121 @echo
"Generating $@..."
123 @
$(DBLATEX
) $(DBLATEX_OPTIONS
) -t
tex -o
$@
$<
126 %.d
: $(DOCBOOKDIR
)/%.xml xslt
/generate-dependencies.xsl
$(XSLTPROC_DEPS
)
127 @echo
"Generating dependency file for $*"
128 @
$(XSLTPROC
) --novalid \
129 --stringparam target
"$*" \
130 -o
$@ xslt
/generate-dependencies.xsl
$<
131 @echo
"$*-images-latex-eps: \$$(addsuffix .eps, \$$($*-images-latex))" >> $@
134 @echo
"\$$(HTMLDIR)/%: $*/%" >> $@
135 @echo
" @mkdir -p \$$(@D)" >> $@
136 @echo
" @cp \$$< \$$@" >> $@
138 @echo
"\$$(HTMLDIR)/$*/%: $*/%" >> $@
139 @echo
" @mkdir -p \$$(@D)" >> $@
140 @echo
" @cp \$$< \$$@" >> $@
142 @echo
"\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
143 @echo
" @mkdir -p \$$(@D)" >> $@
144 @echo
" @cp \$$< \$$@" >> $@
146 @echo
"$*-images-html-single: \$$(addprefix \$$(HTMLDIR)/, \$$($*-images-html))" >> $@
147 @echo
"$*-images-html-chunks: \$$(addprefix \$$(HTMLDIR)/$*/, \$$($*-images-html))" >> $@
148 @echo
"$*-images-htmlhelp: \$$(addprefix \$$(HTMLHELPDIR)/$*/, \$$($*-images-html))" >> $@
151 ifneq ($(MAKECMDGOALS
),clobber)
152 -include $(addsuffix .d
,$(MAIN_DOCS
))
157 $(PDFDIR
)/%.pdf
: %/index.xml
$(PDFDIR
) xslt
/latex.xsl
%-images-latex-png
%-images-latex-pdf
158 $(DBLATEX
) $(DBLATEX_OPTIONS
) -I
$*/images
-t pdf
-o
$@
$<
161 $(PSDIR
)/%.ps
: %/index.xml
$(PSDIR
) xslt
/latex.xsl
%-images-latex-eps
162 $(DBLATEX
) $(DBLATEX_OPTIONS
) -I
$*/images
-t ps
-o
$@
$<
165 $(PNGTOPNM
) $< |
$(PNMTOPS
) > $@
167 $(HTMLHELPDIR
)/%: $(DOCBOOKDIR
)/%.xml
%-images-htmlhelp
$(XSLTPROC_DEPS
)
168 $(XSLTPROC
) --stringparam htmlhelp.chm
$*.chm \
169 --stringparam manifest.in.base.
dir "$@/" \
170 --stringparam base.
dir "$@/" \
171 http
://docbook.sourceforge.net
/release
/xsl
/current
/htmlhelp
/htmlhelp.xsl
$<
174 $(MANPAGEDIR
)/smb.conf
.5.xml
: parameters
176 # The phony parameters target exists in order to always create the
177 # the parameters xml files. Otherwise, when parameters.*.xml does not exist
178 # yet, the parameters are not generated when smb.conf.5.xml is newer than
179 # any smbdotconf/*/*.xml file ...
182 parameters
: $(SMBDOTCONFDOC
)/parameters.
all.xml
184 $(SMBDOTCONFDOC
)/parameters.
all.xml
: $(wildcard $(SMBDOTCONFDOC
)/*/*.xml
) $(SMBDOTCONFDOC
)/generate-file-list.sh
185 $(SMBDOTCONFDOC
)/generate-file-list.sh
$(SMBDOTCONFDOC
) > $@
188 test -d
$@ || mkdir
$@
190 $(OUTPUTDIR
)/%: $(DOCBOOKDIR
)/%.xml xslt
/man.xsl
192 $(XSLTPROC
) --output
$@ xslt
/man.xsl
$<
194 # Individual smb.conf parameters
195 smb.conf-chunks
: $(patsubst $(SMBDOTCONFDOC
)/%.xml
,$(HTMLDIR
)/smb.conf
/%.html
,$(wildcard $(SMBDOTCONFDOC
)/*/*.xml
))
197 $(HTMLDIR
)/smb.conf
/%.html
: $(SMBDOTCONFDOC
)/%.xml
199 $(XSLTPROC
) --output
$@ xslt
/smb.conf-html.xsl
$<
201 # Validation verification
202 %-validate
: %/index.xml
203 cd
$(<D
) && $(XMLLINT
) --xinclude
--noent
--postvalid
--noout
$(<F
)
205 build
/catalog.xml
: build
/catalog.xml.in
206 sed
-e
"s|@abs_top_srcdir@|`pwd`|g;s|@abs_top_builddir@|`pwd`|g" < build
/catalog.xml.in
> build
/catalog.xml
209 xslt
/html.xsl
: xslt
/html-common.xsl
210 xslt
/html-chunk.xsl
: xslt
/html-common.xsl
212 xslt
/expand-sambadoc.xsl
:
213 xslt
/generate-attributions.xsl
:
216 distclean clobber:: clean
217 rm -f Makefile.settings config.status config.log
219 realdistclean
:: distclean
221 rm -rf autom4te.cache
224 # Always keep intermediate files if we can
226 .PHONY
: clean clobber release everything
all