Don't generate the Makefile, but rather include an autogenerated settings file
[Samba.git] / docs / Makefile
blob93c2f6199ccf2fc0fcaceaa9d88bc35b9f232033
1 #################################################################
2 # Makefile.in 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 # Docs to build
10 MAIN_DOCS = $(patsubst %/index.xml,$(DOCBOOKDIR)/%.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 ifndef OUTPUTDIR
18 Makefile.settings: Makefile.settings.in configure
19 @echo Makefile.settings not present, trying to run configure...
20 @./configure
22 configure: configure.in
23 @echo configure not present, trying to generate
24 @autoreconf
25 endif
27 help:
28 @echo "Supported make targets:"
29 @echo " release - Build the docs needed for a Samba release"
30 @echo " all - Build all docs that can be build using the utilities found by configure"
31 @echo " everything - Build all of the above"
32 @echo " pdf,tex,dvi,ps,manpages,txt,pearson,fo,htmlhelp - Build specific output format"
33 @echo " html - Build multi-file HTML version of HOWTO Collection, Guide and Dev-Guide"
34 @echo " html-single - Build single-file HTML version of HOWTO Collection, Guide and Dev-Guide"
35 @echo " htmlman - Build HTML version of manpages"
36 @echo " undocumented - Output list of undocumented smb.conf options"
37 @echo " samples - Extract examples"
38 @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
46 # Pseudo targets
47 all: @TARGETS@
48 everything: manpages pdf html-single html htmlman txt ps fo htmlhelp pearson verify
49 release: manpages htmlman html pdf
51 # Output format targets
52 pdf: $(patsubst $(DOCBOOKDIR)/%.xml,$(PDFDIR)/%.pdf,$(MAIN_DOCS))
53 dvi: $(patsubst $(DOCBOOKDIR)/%.xml,$(DVIDIR)/%.dvi,$(MAIN_DOCS))
54 ps: $(patsubst $(DOCBOOKDIR)/%.xml,$(PSDIR)/%.ps,$(MAIN_DOCS))
55 txt: $(patsubst $(DOCBOOKDIR)/%.xml,$(TXTDIR)/%.txt,$(MAIN_DOCS))
56 fo: $(patsubst $(DOCBOOKDIR)/%.xml,$(FODIR)/%.fo,$(MAIN_DOCS))
57 tex: $(patsubst $(DOCBOOKDIR)/%.xml,%.tex,$(MAIN_DOCS))
58 manpages: $(patsubst $(MANPAGEDIR)/%.xml,$(MANDIR)/%,$(MANPAGES))
59 pearson: $(PEARSONDIR)/Samba-HOWTO-Collection.xml
60 pearson-verify: $(PEARSONDIR)/Samba-HOWTO-Collection.report.html
61 plucker: $(patsubst $(DOCBOOKDIR)/%.xml,$(PLUCKERDIR)/%.pdb,$(MAIN_DOCS))
62 htmlman: $(patsubst $(MANPAGEDIR)/%.xml,$(HTMLDIR)/%.html,$(MANPAGES)) $(HTMLDIR)/manpages.html
63 html-single: $(patsubst $(DOCBOOKDIR)/%.xml,$(HTMLDIR)/%.html,$(MAIN_DOCS))
64 html: $(patsubst $(DOCBOOKDIR)/%.xml,$(HTMLDIR)/%/index.html,$(MAIN_DOCS)) $(HTMLDIR)/index.html
65 htmlhelp: $(patsubst $(DOCBOOKDIR)/%.xml,$(HTMLHELPDIR)/%,$(MAIN_DOCS))
67 # Intermediate docbook docs
69 $(DOCBOOKDIR)/%.xml: %/index.xml xslt/expand-sambadoc.xsl
70 mkdir -p $(@D)
71 $(XSLTPROC) --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
73 $(DOCBOOKDIR)/%.xml: $(MANPAGEDIR)/%.xml xslt/expand-sambadoc.xsl
74 mkdir -p $(@D)
75 $(XSLTPROC) --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ xslt/expand-sambadoc.xsl $<
77 $(DOCBOOKDIR)/manpages.xml: $(MANPAGES) xslt/manpage-summary.xsl
78 mkdir -p $(@D)
79 echo "<article><variablelist>" > $@
80 for I in $(MANPAGES); do $(XSLTPROC) xslt/manpage-summary.xsl $$I >> $@; done
81 echo "</variablelist></article>" >> $@
83 # HTML docs
85 $(HTMLDIR)/index.html: htmldocs.html
86 mkdir -p $(@D)
87 cp $< $@
89 $(HTMLDIR)/%/index.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/%/samba.css xslt/html-chunk.xsl
90 mkdir -p $(@D)
91 $(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/$*/" xslt/html-chunk.xsl $<
92 -mkdir $(@D)/images
93 $(COPY_IMAGES) html $(DOCBOOKDIR)/$*.xml $* $(@D)
95 # Single large HTML files
96 $(OUTPUTDIR)/%/samba.css: xslt/html/samba.css
97 mkdir -p $(@D)
98 cp $< $@
100 $(HTMLDIR)/%.html: $(DOCBOOKDIR)/%.xml $(HTMLDIR)/samba.css xslt/html.xsl
101 mkdir -p $(@D)/images
102 $(COPY_IMAGES) html $(DOCBOOKDIR)/$*.xml $* $(@D)
103 $(XSLTPROC) --output $@ xslt/html.xsl $<
105 %-attributions.xml:
106 echo "<para/>" > $@
107 $(XSLTPROC) --xinclude xslt/generate-attributions.xsl $*/index.xml > $@
109 clobber: clean
110 rm Makefile.settings settings.xsl config.status config.log configure
112 clean:
113 rm -rf $(OUTPUTDIR)/* $(DOCBOOKDIR)
114 rm -f *.xml
115 rm -f xslt/figures/*pdf
116 rm -f $(SMBDOTCONFDOC)/parameters.*.xml
117 rm -f $(patsubst $(DOCBOOKDIR)/%.xml,%.*,$(MAIN_DOCS))
119 # Text files
120 $(TXTDIR)/%.txt: $(HTMLDIR)/%.html
121 mkdir -p $(@D)
122 $(HTML2TEXT) -nobs -style pretty -o $@ $<
124 # Tex files
125 %.tex: $(DOCBOOKDIR)/%.xml xslt/latex.xsl
126 mkdir -p $(@D)
127 $(XSLTPROC) --output $@ xslt/latex.xsl $<
129 latexfigures: $(LATEX_FIGURES)
131 $(PDFDIR)/%.pdf: %.pdf
132 mkdir -p $(@D)
133 cp $< $@
135 %.idx: %.tex latexfigures
136 -$(PDFLATEX) $<
138 %.ind: %.idx
139 $(MAKEINDEX) $<
141 # Adobe PDF files
142 %.pdf: %.tex %.ind latexfigures
143 $(MAKE) $(shell $(XSLTPROC) --stringparam prepend "" --stringparam append ".png" --stringparam role latex xslt/find-image-dependencies.xsl $(DOCBOOKDIR)/$*.xml)
144 -$(PDFLATEX) $<
145 $(THUMBPDF) $*.pdf
146 -$(PDFLATEX) $<
148 # DVI files
149 $(DVIDIR)/%.dvi: %.dvi
150 mkdir -p $(@D)
151 cp $< $@
153 %.dvi: %.tex %.idx
154 $(MAKE) $(shell $(XSLTPROC) --stringparam prepend "" --stringparam append ".eps" --stringparam role latex xslt/find-image-dependencies.xsl $(DOCBOOKDIR)/$*.xml)
155 -$(LATEX) $<
157 %.png: %.dia
158 $(DIA) -e $@ $<
160 %.eps: %.png
161 $(PNGTOPNM) $< | $(PNMTOPS) > $@
163 # PostScript files
164 $(PSDIR)/%.ps: $(DVIDIR)/%.dvi
165 mkdir -p $(@D)
166 $(DVIPS) -o $@ $<
168 xslt/figures/%.pdf: xslt/figures/%.eps
169 $(EPSTOPDF) $<
171 # Fo
172 $(FODIR)/%.fo: $(DOCBOOKDIR)/%.xml
173 mkdir -p $(@D)
174 $(XSLTPROC) --output $@ http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl $<
176 $(HTMLHELPDIR)/%: $(DOCBOOKDIR)/%.xml
177 -mkdir -p $@/images
178 $(COPY_IMAGES) html $(DOCBOOKDIR)/$*.xml $* $@
179 $(XSLTPROC) --stringparam htmlhelp.chm $*.chm --stringparam manifest.in.base.dir "$@/" --stringparam base.dir "$@/" http://docbook.sourceforge.net/release/xsl/current/htmlhelp/htmlhelp.xsl $<
181 # Plucker docs
182 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
183 mkdir -p $(@D)
184 $(PLUCKERBUILD) -v -M1 --stayonhost --noimages --zlib-compression -H file:$< -f $* -p $(PLUCKERDIR)
186 # Manpages
187 $(MANPAGEDIR)/smb.conf.5.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/parameters.global.xml
189 $(SMBDOTCONFDOC)/parameters.all.xml: $(shell find $(SMBDOTCONFDOC) -type f -name '*.xml' -mindepth 2 | sort -t/ -k3 | xargs) $(SMBDOTCONFDOC)/generate-file-list.sh
190 $(SMBDOTCONFDOC)/generate-file-list.sh $(SMBDOTCONFDOC) > $@
192 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
193 $(XSLTPROC) --xinclude --param smb.context "'G'" --output $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
195 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
196 $(XSLTPROC) --xinclude --param smb.context "'S'" --output $(SMBDOTCONFDOC)/parameters.service.xml $(SMBDOTCONFDOC)/generate-context.xsl $<
198 $(MANDIR)/%: $(DOCBOOKDIR)/%.xml xslt/man.xsl
199 mkdir -p $(@D)
200 $(XSLTPROC) --output $@ xslt/man.xsl $<
202 # Individual smb.conf parameters
203 smb.conf-chunks: $(patsubst $(SMBDOTCONFDOC)/%.xml,$(HTMLDIR)/smb.conf/%.html,$(wildcard $(SMBDOTCONFDOC)/*/*.xml))
205 $(HTMLDIR)/smb.conf/%.html: $(SMBDOTCONFDOC)/%.xml
206 mkdir -p $(@D)
207 $(XSLTPROC) --output $@ xslt/smb.conf-html.xsl $<
209 # Pearson compatible XML
211 $(PEARSONDIR)/%.xml: %/index.xml xslt/pearson.xsl
212 mkdir -p $(@D)
213 $(XSLTPROC) --xinclude --output $@ xslt/sambadoc2pearson.xsl $<
215 $(PEARSONDIR)/%.report.html: $(PEARSONDIR)/%.xml
216 mkdir -p $(@D)
217 $(XMLLINT) --valid --noout --htmlout $< 2> $@
219 # Validation verification
221 $(VALIDATEDIR)/%.report.html: $(DOCBOOKDIR)/%.xml
222 mkdir -p $(@D)
223 $(XMLLINT) --valid --noout --htmlout $< 2> $@
225 verify: $(VALIDATEDIR)/Samba-HOWTO-Collection.report.html $(VALIDATEDIR)/Samba-Developers-Guide.report.html $(VALIDATEDIR)/Samba-Guide.report.html
227 # Find undocumented parameters
229 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml scripts/find_missing_doc.pl scripts/find_missing_manpages.pl
230 @$(PERL) scripts/find_missing_doc.pl $(SRCDIR)
231 @$(PERL) scripts/find_missing_manpages.pl $(SRCDIR)
233 # Examples and the like
235 files: $(HOWTODIR)/index.xml xslt/extract-smbfiles.xsl
236 $(XSLTPROC) xslt/extract-smbfiles.xsl $< > /dev/null
238 samples: $(DOCBOOKDIR)/Samba-HOWTO-Collection.xml xslt/extract-examples.xsl scripts/indent-smb.conf.pl
239 mkdir -p $(EXAMPLESDIR)
240 $(XSLTPROC) --xinclude xslt/extract-examples.xsl $< > /dev/null 2> examples/README
241 for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
243 # Archiving
244 archive: pdf
245 mkdir -p $(ARCHIVEDIR)
246 cp $(PDFDIR)/Samba-HOWTO-Collection.pdf $(ARCHIVEDIR)/TOSHARG-`date +%Y%m%d%H%M%S`.pdf
247 cp $(PDFDIR)/Samba-Guide.pdf $(ARCHIVEDIR)/S3bE-`date +%Y%m%d%H%M%S`.pdf
249 # XSL scripts
250 xslt/html.xsl: xslt/html-common.xsl settings.xsl
251 xslt/html-chunk.xsl: xslt/html-common.xsl settings.xsl
252 xslt/latex.xsl: settings.xsl
253 xslt/expand-sambadoc.xsl: settings.xsl
254 xslt/generate-attributions.xsl:
255 xslt/man.xsl:
256 xslt/pearson.xsl:
258 .SECONDARY: