selftest/Samba3: remove unused close(USERMAP); calls
[Samba.git] / docs-xml / Makefile
blobc614097f6c0ecd2b43a9dd72874903a880d6d7a2
1 #################################################################
2 # Makefile for Samba Documentation
3 # Authors:
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
11 # Docs to build
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
22 ifeq ($(PROFILE), Y)
23 XSLTPROC += --profile --load-trace --timing
24 endif
26 ifndef OUTPUTDIR
27 Makefile.settings: configure
28 ./configure
30 configure: configure.ac
31 autoreconf
32 endif
34 help:
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
46 # Pseudo targets
47 all:: $(TARGETS)
48 everything:: manpages pdf html-single html htmlman ps fo htmlhelp
49 release:: manpages htmlman html pdf
50 clean::
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
55 rm -f *-images-html*
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))
72 test:: validate
73 check:: validate
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 $*..."
81 @mkdir -p $(@D)
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)
85 @mkdir -p $(@D)
86 $(XSLTPROC) --xinclude --stringparam noreference 0 --output $@ xslt/expand-sambadoc.xsl $<
88 $(DOCBOOKDIR)/manpages/index.xml: $(MANPAGES) xslt/manpage-summary.xsl $(XSLTPROC_DEPS)
89 @mkdir -p $(@D)
90 echo "<article><variablelist>" > $@
91 $(XSLTPROC) xslt/manpage-summary.xsl $(MANPAGES) >> $@
92 @echo "</variablelist></article>" >> $@
94 # HTML docs
95 $(HTMLDIR)/index.html: htmldocs.html
96 @mkdir -p $(@D)
97 cp $< $@
99 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl %-images-html-chunks $(XSLTPROC_DEPS)
100 @mkdir -p $(@D)
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)
105 @mkdir -p $(@D)
106 cp $< $@
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 $<
113 # Attributions
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
119 # Tex files
120 %.tex: %/index.xml xslt/latex.xsl
121 @echo "Generating $@..."
122 @mkdir -p $(@D)
123 @$(DBLATEX) $(DBLATEX_OPTIONS) -t tex -o $@ $<
125 # Dependency files
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))" >> $@
133 @echo >> $@
134 @echo "\$$(HTMLDIR)/%: $*/%" >> $@
135 @echo " @mkdir -p \$$(@D)" >> $@
136 @echo " @cp \$$< \$$@" >> $@
137 @echo >> $@
138 @echo "\$$(HTMLDIR)/$*/%: $*/%" >> $@
139 @echo " @mkdir -p \$$(@D)" >> $@
140 @echo " @cp \$$< \$$@" >> $@
141 @echo >> $@
142 @echo "\$$(HTMLHELPDIR)/$*/%: $*/%" >> $@
143 @echo " @mkdir -p \$$(@D)" >> $@
144 @echo " @cp \$$< \$$@" >> $@
145 @echo >> $@
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))" >> $@
150 ifdef OUTPUTDIR
151 ifneq ($(MAKECMDGOALS),clobber)
152 -include $(addsuffix .d,$(MAIN_DOCS))
153 endif
154 endif
156 # Adobe PDF files
157 $(PDFDIR)/%.pdf: %/index.xml $(PDFDIR) xslt/latex.xsl %-images-latex-png %-images-latex-pdf
158 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t pdf -o $@ $<
160 # PostScript files
161 $(PSDIR)/%.ps: %/index.xml $(PSDIR) xslt/latex.xsl %-images-latex-eps
162 $(DBLATEX) $(DBLATEX_OPTIONS) -I $*/images -t ps -o $@ $<
164 %.eps: %.png
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 $<
173 # Manpages
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 ...
180 .PHONY: parameters
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) > $@
187 $(OUTPUTDIR):
188 test -d $@ || mkdir $@
190 $(OUTPUTDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
191 @mkdir -p $(@D)
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
198 @mkdir -p $(@D)
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
208 # XSL scripts
209 xslt/html.xsl: xslt/html-common.xsl
210 xslt/html-chunk.xsl: xslt/html-common.xsl
211 xslt/latex.xsl:
212 xslt/expand-sambadoc.xsl:
213 xslt/generate-attributions.xsl:
214 xslt/man.xsl:
216 distclean clobber:: clean
217 rm -f Makefile.settings config.status config.log
219 realdistclean:: distclean
220 rm -f configure
221 rm -rf autom4te.cache
222 rm -rf output
224 # Always keep intermediate files if we can
225 .SECONDARY:
226 .PHONY: clean clobber release everything all