summaryrefslogtreecommitdiff
path: root/docs/Makefile.in
blob: 29791cb36f2edcc24fcb2b7f9cd3494306cbd8e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
#################################################################
# Makefile.in for Samba Documentation
# Authors:	
# 		James Moore <jmoore@php.net>
# 		Gerald Carter <jerry@samba.org>
# 		Jelmer Vernooij <jelmer@samba.org>
#
# Please see http://www.samba.org/samba/cvs.html
# for information on getting the latest  
# source and documentation source files.  
#
#

# Programs
WGET = @WGET@
XSLTPROC = @XSLTPROC@
XMLLINT = @XMLLINT@
DVIPS = @DVIPS@
PNGTOPNM = @PNGTOPNM@
EPSTOPNM = @EPSTOPNM@
PNMTOPNG = @PNMTOPNG@
PNMTOPS = @PNMTOPS@
HTML2TEXT = @HTML2TEXT@
PLUCKERBUILD = @PLUCKERBUILD@
PDFLATEX = TEXINPUTS=xslt/latex:.: @PDFLATEX@
LATEX = TEXINPUTS=xslt/latex:.: @LATEX@
RM = @RM@
ifndef DEBUG_LATEX
PDFLATEX += --interaction nonstopmode
LATEX += --interaction nonstopmode
endif

# Paths
TOPDIR = $(shell pwd)
OUTPUTDIR = $(TOPDIR)/output
ARCHIVEDIR = $(OUTPUTDIR)/archive
SRCDIR = @SAMBASOURCEDIR@
MANDIR = $(OUTPUTDIR)/manpages
EPSTOPDF = @EPSTOPDF@
MANPAGEDIR = $(TOPDIR)/manpages
HOWTODIR = $(TOPDIR)/howto
GUIDEDOC = $(TOPDIR)/guide
DEVDOCDIR = $(TOPDIR)/devel
MAKEINDEX = @MAKEINDEX@
IMAGEPROJDIR = $(HOWTODIR)/imagefiles
IMAGEGUIDEDIR = $(GUIDEDOC)/images
EXAMPLESDIR = $(TOPDIR)/examples
SMBDOTCONFDOC = $(TOPDIR)/smbdotconf
PSDIR = $(OUTPUTDIR)
PDFDIR = $(OUTPUTDIR)
DVIDIR = $(OUTPUTDIR)
VALIDATEDIR = $(OUTPUTDIR)/validate
TXTDIR = $(OUTPUTDIR)/textdocs
HTMLDIR=$(OUTPUTDIR)/htmldocs
PLUCKERDIR=$(OUTPUTDIR)/plucker

# Lists of files to process
LATEX_FIGURES = xslt/figures/caution.pdf xslt/figures/important.pdf xslt/figures/note.pdf xslt/figures/tip.pdf xslt/figures/warning.pdf
MANPAGES_SOURCES = $(wildcard $(MANPAGEDIR)/*.?.xml)
MANPAGES = $(patsubst $(MANPAGEDIR)/%.xml,$(MANDIR)/%,$(MANPAGES_SOURCES)) $(MANDIR)/smb.conf.5
MANPAGES_HTML = $(patsubst $(MANPAGEDIR)/%.xml,$(HTMLDIR)/%.html,$(MANPAGES_SOURCES)) $(HTMLDIR)/smb.conf.5.html $(HTMLDIR)/manpages.html
MANPAGES_PLUCKER = $(patsubst $(MANPAGEDIR)/%.xml,$(PLUCKERDIR)/%.pdb,$(MANPAGES_SOURCES)) $(PLUCKERDIR)/smb.conf.5.pdb

HOWTODIR_IMAGES_PNG = $(wildcard $(IMAGEPROJDIR)/*.png)
GUIDEDOC_IMAGES_PNG = $(wildcard $(IMAGEGUIDEDIR)/*.png)
HOWTODIR_IMAGES_EPS=$(patsubst %.png,%.eps,$(wildcard $(IMAGEPROJDIR)/*.png))
HOWTODIR_DEPS = $(HOWTODIR)/*.xml $(HOWTODIR)/attributions.xml $(MANPAGEDIR)/*.xml $(SMBDOTCONFDOC)/smb.conf.5.xml $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/parameters.service.xml 
DEVDOCDIR_DEPS = $(DEVDOCDIR)/*.xml $(DEVDOCDIR)/attributions.xml

help: 
	@echo "Supported make targets:"
	@echo "release - Build the docs needed for a Samba release"
	@echo "pdf - Build PDF version of book"
	@echo "tex - Build Latex version of book"
	@echo "dvi - Build Device Independant File of book"
	@echo "ps - Build PostScript version of book"
	@echo "manpages - Build manpages"
	@echo "txt - Build plain text version of HOWTO Collection and Developers Guide"
	@echo -n "html-single - Build single file HTML version of HOWTO Collection"
	@echo " and developers guide"
	@echo "html - Build HTML version of HOWTO Collection and Developers Guide"
	@echo "htmlman - Build html version of manpages"
	@echo "plucker - Build HOWTO, Developers Guide, man pages in Plucker format for PDA"
	@echo "undocumented - Output list of undocumented smb.conf options"
	@echo "samples - Extract examples"
	@echo "files - Extract other files"
	@echo "all - Build all docs that can be build using the utilities found by configure"
	@echo "everything - Build all of the above"

all: @TARGETS@

everything: manpages pdf html-single html htmlman txt ps

release: manpages htmlman html pdf guide

# Global rules

pdf: $(PDFDIR) $(PDFDIR)/Samba-HOWTO-Collection.pdf $(PDFDIR)/Samba-Developers-Guide.pdf

dvi: $(DVIDIR) $(DVIDIR)/Samba-HOWTO-Collection.dvi $(DVIDIR)/Samba-Developers-Guide.dvi

ps: $(PSDIR) $(PSDIR)/Samba-HOWTO-Collection.ps $(PSDIR)/Samba-Developers-Guide.ps

txt: $(TXTDIR) $(TXTDIR)/Samba-HOWTO-Collection.txt $(TXTDIR)/Samba-Developers-Guide.txt

htmlman: $(HTMLDIR) $(MANPAGES_HTML) $(HTMLDIR)/samba.css

html-single: $(HTMLDIR) $(HTMLDIR)/samba.css $(HTMLDIR)/Samba-HOWTO-Collection.html  $(HTMLDIR)/Samba-Developers-Guide.html $(HTMLDIR)/Samba-Guide.html
	cp -p $(GUIDEDOC_IMAGES_PNG) $(HOWTODIR_IMAGES_PNG) $(HTMLDIR)/images/

html: $(HTMLDIR)/howto $(HTMLDIR)/guide $(HTMLDIR)/devel
	
$(HTMLDIR)/howto: $(HTMLDIR) $(HTMLDIR)/howto/samba.css Samba-HOWTO-Collection.xml
	$(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/howto/" xslt/html-chunk.xsl Samba-HOWTO-Collection.xml
	-mkdir $(HTMLDIR)/howto/images
	cp -R $(HOWTODIR_IMAGES_PNG) $(HTMLDIR)/howto/images

$(HTMLDIR)/devel: $(HTMLDIR) $(HTMLDIR)/devel/samba.css Samba-Developers-Guide.xml
	$(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/devel/" xslt/html-chunk.xsl Samba-Developers-Guide.xml

$(HTMLDIR)/guide: $(HTMLDIR) $(HTMLDIR)/guide/samba.css Samba-Guide.xml
	$(XSLTPROC) --stringparam base.dir "$(HTMLDIR)/guide/" xslt/html-chunk.xsl Samba-Guide.xml
	-mkdir $(HTMLDIR)/guide/images
	cp -R $(GUIDEDOC_IMAGES_PNG) $(HTMLDIR)/guide/images

manpages: $(MANDIR) $(MANPAGES)

manpages.xml: $(MANPAGES_SOURCES)
	echo "<article><variablelist>" > $@
	for I in $(MANPAGES_SOURCES); do $(XSLTPROC) xslt/manpage-summary.xsl $$I >> $@; done
	echo "</variablelist></article>" >> $@

tex: Samba-HOWTO-Collection.tex Samba-Developers-Guide.tex gpl.tex

plucker: html-single htmlman $(PLUCKERDIR) $(MANPAGES_PLUCKER) $(PLUCKERDIR)/Samba-Developers-Guide.pdb $(PLUCKERDIR)/Samba-HOWTO-Collection.pdb

Samba-HOWTO-Collection.xml: $(HOWTODIR)/index.xml $(HOWTODIR_DEPS)
	$(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<

Samba-Guide.xml: $(GUIDEDOC)/guide-main.xml
	$(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<

Samba-Developers-Guide.xml: $(DEVDOCDIR)/index.xml $(DEVDOCDIR_DEPS)
	$(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<

$(HOWTODIR)/attributions.xml: $(HOWTODIR)/index.xml
	@echo > $@ # Make sure we don't get recursive dependencies, etc!
	$(XSLTPROC) --output $@ xslt/generate-attributions.xsl $<

$(DEVDOCDIR)/attributions.xml: $(DEVDOCDIR)/index.xml
	@echo > $@ # Make sure we don't get recursive dependencies, etc!
	$(XSLTPROC) --output $@ xslt/generate-attributions.xsl $<

clean: 
	rm -rf $(OUTPUTDIR)/*
	rm -f *.xml $(MANPAGES) $(TXTDIR)/*.txt $(PSDIR)/*.ps \
	    $(PDFDIR)/*.pdf $(HTMLDIR)/*html $(HTMLDIR)/samba.css
	rm -f xslt/figures/*pdf
	rm -f $(SMBDOTCONFDOC)/parameters.*.xml $(DVIDIR)/*.dvi
	rm -f samba-doc.* index.* $(HOWTODIR)/changelog.xml $(HOWTODIR)/attributions.xml $(DEVDOCDIR)/attributions.xml
	rm -f Samba-HOWTO-Collection.*
	rm -f Samba-Developers-Guide.*
	rm -f Samba-Guide.*
	rm -f $(IMAGEPROJDIR)/*.eps $(MANPAGEDIR)/smb.conf.5.xml

# Text files
$(TXTDIR):
	mkdir $(TXTDIR)

$(TXTDIR)/%.txt: $(HTMLDIR)/%.html
	$(HTML2TEXT) -nobs -style pretty -o $@ $<

# Tex files
%.tex: %.xml
	$(XSLTPROC) --output $@ xslt/latex.xsl $<

gpl.tex:
	$(WGET) http://www.gnu.org/licenses/gpl.tex

latexfigures: $(LATEX_FIGURES)
	
# Adobe PDF files
$(PDFDIR)/%.pdf: %.tex latexfigures gpl.tex
	-$(PDFLATEX) $<
	$(MAKEINDEX) `echo $< | sed -e 's/.tex//'`
	-$(PDFLATEX) $<
	-$(PDFLATEX) $<
	mv $(patsubst %.tex,%.pdf,$<) $@

epsimages: $(HOWTODIR_IMAGES_EPS)

# DVI files
$(DVIDIR)/%.dvi: %.tex epsimages gpl.tex
	-$(LATEX) $<
	$(MAKEINDEX) `echo $< | sed -e 's/.tex//'`
	-$(LATEX) $< 
	-$(LATEX) $< 
	mv $(patsubst %.tex,%.dvi,$<) $@

%.eps: %.png
	$(PNGTOPNM) $< | $(PNMTOPS) > $@

# PostScript files
$(PSDIR)/%.ps: $(DVIDIR)/%.dvi
	$(DVIPS) -o $@ $<

xslt/figures/%.pdf: xslt/figures/%.eps
	$(EPSTOPDF) $<

# Single large HTML files

$(HTMLDIR):
	mkdir $(HTMLDIR)
	mkdir $(HTMLDIR)/howto
	mkdir $(HTMLDIR)/guide
	mkdir $(HTMLDIR)/devel
	mkdir $(HTMLDIR)/images

$(PLUCKERDIR):
	mkdir $(PLUCKERDIR)

%/samba.css: xslt/html/samba.css
	if [ ! -d `dirname $@` ]; then mkdir -p `dirname $@`; fi
	cp $< $@

$(HTMLDIR)/Samba-HOWTO-Collection.html: Samba-HOWTO-Collection.xml $(HOWTODIR_DEPS) $(HOWTODIR_IMAGES_PNG)
	$(XSLTPROC) --output $@ xslt/html.xsl $<

$(HTMLDIR)/Samba-Guide.html: Samba-Guide.xml $(GUIDEDOC_IMAGES_PNG)
	$(XSLTPROC) --output $@ xslt/html.xsl $<

$(HTMLDIR)/Samba-Developers-Guide.html: Samba-Developers-Guide.xml $(DEVDOCDIR_DEPS)
	$(XSLTPROC) --output $@ xslt/html.xsl $<

$(HTMLDIR)/%.html: %.xml
	$(XSLTPROC) --output $@ xslt/html.xsl $<

$(PLUCKERDIR)/%.pdb: $(HTMLDIR)/%.html
	$(PLUCKERBUILD) -v -M1 --stayonhost  --noimages --zlib-compression -H file:$< -f $(patsubst $(PLUCKERDIR)/%.pdb,%,$@) -p $(PLUCKERDIR)

%.xml: $(MANPAGEDIR)/%.xml
	$(XSLTPROC) --stringparam noreference 1 --output $@ xslt/expand-sambadoc.xsl $<

# Manpages
$(SMBDOTCONFDOC)/parameters.all.xml: $(SMBDOTCONFDOC)/generate-file-list.sh
	@cd $(SMBDOTCONFDOC) && \
	/bin/sh generate-file-list.sh >parameters.all.xml && \
	cd $(OUTPUTDIR)

$(SMBDOTCONFDOC)/parameters.global.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
	@cd $(SMBDOTCONFDOC) && \
	$(XSLTPROC) --xinclude \
	--param smb.context "'G'" \
	--output parameters.global.xml \
	generate-context.xsl parameters.all.xml && \
	cd $(OUTPUTDIR)

$(SMBDOTCONFDOC)/parameters.service.xml: $(SMBDOTCONFDOC)/parameters.all.xml $(SMBDOTCONFDOC)/generate-context.xsl
	@cd $(SMBDOTCONFDOC) && \
	$(XSLTPROC) --xinclude \
	--param smb.context "'S'" \
	--output parameters.service.xml \
	generate-context.xsl parameters.all.xml && \
	cd $(OUTPUTDIR)

smb.conf.5.xml: $(SMBDOTCONFDOC)/smb.conf.5.xml $(SMBDOTCONFDOC)/parameters.all.xml \
 		$(SMBDOTCONFDOC)/parameters.global.xml $(SMBDOTCONFDOC)/parameters.service.xml 
	$(XSLTPROC) --stringparam noreference 1 --xinclude --output $@ xslt/expand-sambadoc.xsl $<

$(MANDIR): 
	mkdir $(MANDIR)

$(MANDIR)/%: %.xml
	$(XSLTPROC) --output $@ xslt/man.xsl $<

$(VALIDATEDIR):
	mkdir $@

$(VALIDATEDIR)/%.report.html: %.xml
	$(XMLLINT) --valid --noout --htmlout $< 2> $@

verify: $(VALIDATEDIR) $(VALIDATEDIR)/Samba-HOWTO-Collection.report.html $(VALIDATEDIR)/Samba-Developers-Guide.report.html $(VALIDATEDIR)/Samba-Guide.report.html

# Find undocumented parameters

undocumented: $(SMBDOTCONFDOC)/parameters.all.xml
	@$(PERL) scripts/find_missing_doc.pl $(SRCDIR)
	@$(PERL) scripts/find_missing_manpages.pl $(SRCDIR)

# Examples and the like

$(EXAMPLESDIR):
	mkdir $(EXAMPLESDIR)

files: $(HOWTODIR)/index.xml $(HOWTODIR)/attributions.xml $(EXAMPLESDIR)
	$(XSLTPROC) xslt/extract-smbfiles.xsl $< > /dev/null

samples: $(EXAMPLESDIR) Samba-HOWTO-Collection.xml
	$(XSLTPROC) xslt/extract-examples.xsl Samba-HOWTO-Collection.xml > /dev/null 2> examples/README
	for I in examples/*.conf; do { ./scripts/indent-smb.conf.pl < $$I > $$I.tmp; mv $$I.tmp $$I; } done

howto: $(PDFDIR)/Samba-HOWTO-Collection.pdf
guide: $(PDFDIR)/Samba-Guide.pdf

%/changelog.xml: % $(wildcard %/CVS/*)
	touch $@
	# FIXME

$(ARCHIVEDIR):
	mkdir $(ARCHIVEDIR)

archive: $(ARCHIVEDIR) guide howto
	cp $(PDFDIR)/Samba-HOWTO-Collection.pdf $(ARCHIVEDIR)/TOSHARG-`date +%Y%m%d`.pdf
	cp $(PDFDIR)/Samba-Guide.pdf $(ARCHIVEDIR)/S3bE-`date +%Y%m%d`.pdf