Add all the source files from the old CVS tree,
[tprouty/samba.git] / docs / Makefile.in
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 #
8 # Please see http://www.samba.org/samba/cvs.html
9 # for information on getting the latest  
10 # source and documentation source files.  
11 #
12 #
13
14 # Programs
15 WGET = @WGET@
16 XSLTPROC = @XSLTPROC@
17 DVIPS = @DVIPS@
18 CVS2CL = @CVS2CL@
19 PNGTOPNM = @PNGTOPNM@
20 EPSTOPNM = @EPSTOPNM@
21 PNMTOPNG = @PNMTOPNG@
22 PNMTOPS = @PNMTOPS@
23 XMLTO = @XMLTO@
24 PLUCKERBUILD = @PLUCKERBUILD@
25 PDFLATEX = TEXINPUTS=xslt/latex:.: @PDFLATEX@
26 LATEX = TEXINPUTS=xslt/latex:.: @LATEX@
27 RM = @RM@
28 ifndef DEBUG_LATEX
29 PDFLATEX += --interaction nonstopmode
30 LATEX += --interaction nonstopmode
31 endif
32
33 # Paths
34 OUTPUTDIR = output
35 SRCDIR = @srcdir@
36 MANDIR=$(OUTPUTDIR)/manpages
37 EPSTOPDF = @EPSTOPDF@
38 MANPROJDOC = manpages
39 PROJDOC = projdoc
40 MAKEINDEX = @MAKEINDEX@
41 IMAGEPROJDIR = $(PROJDOC)/imagefiles
42 GUIDEDOC = guide
43 EXAMPLESDIR = examples
44 DEVDOC = devdoc
45 SMBDOTCONFDOC = smbdotconf
46 PSDIR = $(OUTPUTDIR)
47 PDFDIR = $(OUTPUTDIR)
48 DVIDIR = $(OUTPUTDIR)
49 TXTDIR = $(OUTPUTDIR)/textdocs
50 FAQPROJDOC = faq
51 FAQDIR = $(OUTPUTDIR)/faq
52 HTMLDIR=$(OUTPUTDIR)/htmldocs
53 PLUCKERDIR=$(OUTPUTDIR)/plucker
54
55 # Lists of files to process
56 LATEX_FIGURES = xslt/figures/caution.pdf xslt/figures/important.pdf xslt/figures/note.pdf xslt/figures/tip.pdf xslt/figures/warning.pdf
57 MANPAGES_SOURCES = $(wildcard $(MANPROJDOC)/*.?.xml)
58 MANPAGES = $(patsubst $(MANPROJDOC)/%.xml,$(MANDIR)/%,$(MANPAGES_SOURCES)) $(MANDIR)/smb.conf.5
59 MANPAGES_HTML = $(patsubst $(MANPROJDOC)/%.xml,$(HTMLDIR)/%.html,$(MANPAGES_SOURCES)) $(HTMLDIR)/smb.conf.5.html
60 MANPAGES_PLUCKER = $(patsubst $(MANPROJDOC)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES_SOURCES)) $(PLUCKERDIR)/smb.conf.5.pdb
61
62 PROJDOC_IMAGES_PNG = $(wildcard $(IMAGEPROJDIR)/*.png)
63 PROJDOC_IMAGES_EPS=$(patsubst %.png,%.eps,$(wildcard $(IMAGEPROJDIR)/*.png))
64 PROJDOC_DEPS = $(PROJDOC)/*.xml $(PROJDOC)/attributions.xml $(MANPROJDOC)/*.xml $(SMBDOTCONFDOC)/smb.conf.5.xml $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/parameters.service.xml 
65 DEVDOC_DEPS = $(DEVDOC)/*.xml $(DEVDOC)/attributions.xml
66
67 all: 
68         @echo "Supported make targets:"
69         @echo "release - Build the docs needed for a Samba release"
70         @echo "pdf - Build PDF version of book"
71         @echo "tex - Build Latex version of book"
72         @echo "dvi - Build Device Independant File of book"
73         @echo "ps - Build PostScript version of book"
74         @echo "manpages - Build manpages"
75         @echo "txt - Build plain text version of HOWTO Collection and Developers Guide"
76         @echo -n "html-single - Build single file HTML version of HOWTO Collection"
77         @echo " and developers guide"
78         @echo "html - Build HTML version of HOWTO Collection and Developers Guide"
79         @echo "htmlman - Build html version of manpages"
80         @echo "htmlfaq - Build html version of the FAQ"
81         @echo "plucker - Build HOWTO, Developers Guide, man pages, and FAQ in Plucker format for PDA"
82         @echo "undocumented - Output list of undocumented smb.conf options"
83         @echo "samples - Extract examples"
84         @echo "files - Extract other files"
85         @echo "everything - Build all of the above"
86
87 everything: manpages pdf html-single html htmlman htmlfaq txt ps
88
89 release: manpages htmlman html html-single htmlfaq pdf
90
91 # Global rules
92
93 pdf: $(PDFDIR) $(PDFDIR)/Samba-HOWTO-Collection.pdf $(PDFDIR)/Samba-Developers-Guide.pdf
94
95 dvi: $(DVIDIR) $(DVIDIR)/Samba-HOWTO-Collection.dvi $(DVIDIR)/Samba-Developers-Guide.dvi
96
97 ps: $(PSDIR) $(PSDIR)/Samba-HOWTO-Collection.ps $(PSDIR)/Samba-Developers-Guide.ps
98
99 txt: $(TXTDIR) $(TXTDIR)/Samba-HOWTO-Collection.txt $(TXTDIR)/Samba-Developers-Guide.txt
100
101 htmlman: $(HTMLDIR) $(MANPAGES_HTML) CSS
102
103 htmlfaq: $(HTMLDIR) CSS
104         $(XSLTPROC) --stringparam base.dir "$(FAQDIR)/" --stringparam root.filename samba-faq xslt/html-chunk.xsl $(FAQPROJDOC)/sambafaq.xml
105 html-single: $(HTMLDIR) CSS $(HTMLDIR)/Samba-HOWTO-Collection.html  $(HTMLDIR)/Samba-Developers-Guide.html
106         @if [ ! -d $(HTMLDIR)/images/ ]; then \
107                 mkdir $(HTMLDIR)/images/; \
108         fi \
109         && cp -p projdoc/imagefiles/*png $(HTMLDIR)/images/
110
111 html: $(HTMLDIR) CSS Samba-HOWTO-Collection.xml $(HTMLDIR)/Samba-Developers-Guide.html
112         $(XSLTPROC) -o "$(HTMLDIR)/" xslt/html-chunk.xsl Samba-HOWTO-Collection.xml
113         @if [ ! -d $(HTMLDIR)/images/ ]; then \
114                 mkdir $(HTMLDIR)/images/; \
115         fi \
116         && cp -p projdoc/imagefiles/*png $(HTMLDIR)/images/
117
118 manpages: $(MANDIR) $(MANPAGES)
119
120 tex: Samba-HOWTO-Collection.tex Samba-Developers-Guide.tex gpl.tex
121
122 plucker: html-single htmlman htmlfaq $(PLUCKERDIR) $(MANPAGES_PLUCKER) $(PLUCKERDIR)/Samba-Developers-Guide.pdb $(PLUCKERDIR)/Samba-HOWTO-Collection.pdb
123         $(PLUCKERBUILD) -v -M2 --stayonhost  --noimages --zlib-compression -H file:$(FAQDIR)/samba-faq.html -f samba-faq -p $(PLUCKERDIR)
124
125 Samba-HOWTO-Collection.xml: $(PROJDOC)/samba-doc.xml $(PROJDOC_DEPS)
126         $(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
127
128 Samba-Guide.xml: $(GUIDEDOC)/guide-main.xml
129         $(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
130
131 Samba-Developers-Guide.xml: $(DEVDOC)/dev-doc.xml $(DEVDOC_DEPS)
132         $(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
133
134 $(PROJDOC)/attributions.xml: $(PROJDOC)/samba-doc.xml
135         @echo > $@ # Make sure we don't get recursive dependencies, etc!
136         $(XSLTPROC) --output $@ xslt/generate-attributions.xsl $<
137
138 $(DEVDOC)/attributions.xml: $(DEVDOC)/dev-doc.xml
139         @echo > $@ # Make sure we don't get recursive dependencies, etc!
140         $(XSLTPROC) --output $@ xslt/generate-attributions.xsl $<
141
142 clean: 
143         rm -f *.xml $(MANPAGES) $(TXTDIR)/*.txt $(PSDIR)/*.ps \
144             $(PDFDIR)/*.pdf $(FAQDIR)/*.html $(HTMLDIR)/*html $(HTMLDIR)/samba.css
145         rm -f xslt/figures/*pdf
146         rm -f $(SMBDOTCONFDOC)/parameters.*.xml $(DVIDIR)/*.dvi
147         rm -f samba-doc.* dev-doc.* $(PROJDOC)/changelog.xml $(PROJDOC)/attributions.xml $(DEVDOC)/attributions.xml
148         rm -f Samba-HOWTO-Collection.*
149         rm -f Samba-Developers-Guide.*
150         rm -f Samba-Guide.*
151         rm -f $(IMAGEPROJDIR)/*.eps $(MANPROJDOC)/smb.conf.5.xml
152         rm -f $(PLUCKERDIR)/*.pdb
153
154 # Text files
155 $(TXTDIR):
156         mkdir $(TXTDIR)
157
158 $(TXTDIR)/%.txt: %.xml
159         $(XMLTO) txt -o $(TXTDIR) $< > $@
160
161 # Tex files
162 %.tex: %.xml
163         $(XSLTPROC) --output $@ xslt/latex.xsl $<
164
165 gpl.tex:
166         $(WGET) http://www.gnu.org/licenses/gpl.tex
167
168 latexfigures: $(LATEX_FIGURES)
169         
170 # Adobe PDF files
171 $(PDFDIR)/%.pdf: %.tex latexfigures gpl.tex
172         -$(PDFLATEX) $<
173         $(MAKEINDEX) `echo $< | sed -e 's/.tex//'`
174         -$(PDFLATEX) $<
175         -$(PDFLATEX) $<
176         mv $(patsubst %.tex,%.pdf,$<) $@
177
178 epsimages: $(PROJDOC_IMAGES_EPS)
179
180 # DVI files
181 $(DVIDIR)/%.dvi: %.tex epsimages gpl.tex
182         -$(LATEX) $<
183         $(MAKEINDEX) `echo $< | sed -e 's/.tex//'`
184         -$(LATEX) $< 
185         -$(LATEX) $< 
186         mv $(patsubst %.tex,%.dvi,$<) $@
187
188 %.eps: %.png
189         $(PNGTOPNM) $< | $(PNMTOPS) > $@
190
191 # PostScript files
192 $(PSDIR)/%.ps: $(DVIDIR)/%.dvi
193         $(DVIPS) -o $@ $<
194
195 xslt/figures/%.pdf: xslt/figures/%.eps
196         $(EPSTOPDF) $<
197
198 # Single large HTML files
199
200 $(HTMLDIR):
201         mkdir $(HTMLDIR)
202
203 $(PLUCKERDIR):
204         mkdir $(PLUCKERDIR)
205
206 CSS: $(HTMLDIR) xslt/html/samba.css
207         cp xslt/html/samba.css $(HTMLDIR)/
208
209 $(HTMLDIR)/Samba-HOWTO-Collection.html: Samba-HOWTO-Collection.xml $(PROJDOC_DEPS) $(PROJDOC_IMAGES_PNG)
210         $(XSLTPROC) --output $@ xslt/html.xsl $<
211
212 $(HTMLDIR)/Samba-Developers-Guide.html: Samba-Developers-Guide.xml $(DEVDOC_DEPS)
213         $(XSLTPROC) --output $@ xslt/html.xsl $<
214
215 $(HTMLDIR)/%.html: %.xml
216         $(XSLTPROC) --output $@ xslt/html.xsl $<
217
218 $(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
219         $(PLUCKERBUILD) -v -M1 --stayonhost  --noimages --zlib-compression -H file:$< -f $(patsubst $(PLUCKERDIR)/%.pdb,%,$@) -p $(PLUCKERDIR)
220
221 %.xml: $(MANPROJDOC)/%.xml
222         $(XSLTPROC) --stringparam noreference 1 --output $@ xslt/expand-sambadoc.xsl $<
223
224 # Manpages
225 $(SMBDOTCONFDOC)/parameters.all.xml: $(SMBDOTCONFDOC)/generate-file-list.sh
226         @cd $(SMBDOTCONFDOC) && \
227         /bin/sh generate-file-list.sh >parameters.all.xml && \
228         cd $(OUTPUTDIR)
229
230 $(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
231         @cd $(SMBDOTCONFDOC) && \
232         $(XSLTPROC) --xinclude \
233         --param smb.context "'G'" \
234         --output parameters.global.xml \
235         generate-context.xsl parameters.all.xml && \
236         cd $(OUTPUTDIR)
237
238 $(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
239         @cd $(SMBDOTCONFDOC) && \
240         $(XSLTPROC) --xinclude \
241         --param smb.context "'S'" \
242         --output parameters.service.xml \
243         generate-context.xsl parameters.all.xml && \
244         cd $(OUTPUTDIR)
245
246 smb.conf.5.xml: $(SMBDOTCONFDOC)/smb.conf.5.xml $(SMBDOTCONFDOC)/parameters.all.xml \
247                 $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/parameters.service.xml 
248         $(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<
249
250 $(MANDIR): 
251         mkdir $(MANDIR)
252
253 $(MANDIR)/%: %.xml
254         $(XSLTPROC) --output $@ xslt/man.xsl $<
255
256 # Find undocumented parameters
257
258 undocumented: $(SMBDOTCONFDOC)/parameters.all.xml
259         $(PERL) scripts/find_missing_doc.pl ../..
260
261 # Examples and the like
262
263 $(EXAMPLESDIR):
264         mkdir $(EXAMPLESDIR)
265
266 files: $(PROJDOC)/samba-doc.xml $(PROJDOC)/attributions.xml $(EXAMPLESDIR)
267         $(XSLTPROC) xslt/extract-smbfiles.xsl $< > /dev/null
268
269 samples: $(EXAMPLESDIR) Samba-HOWTO-Collection.xml
270         $(XSLTPROC) xslt/extract-examples.xsl Samba-HOWTO-Collection.xml > /dev/null 2> examples/README
271         for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done
272
273 howto: $(PDFDIR)/Samba-HOWTO-Collection.pdf
274 guide: $(PDFDIR)/Samba-Guide.pdf
275
276 %/changelog.xml: % $(wildcard %/CVS/*)
277         $(CVS2CL) --stdout --xml $< | $(XSLTPROC) --output $@ xslt/genchangelog.xsl -