]> granicus.if.org Git - postgresql/blob - doc/src/sgml/Makefile
97f15bf6f4911321ecb69ea022d4dac7c91427b4
[postgresql] / doc / src / sgml / Makefile
1 #----------------------------------------------------------------------------
2 #
3 # PostgreSQL documentation makefile
4 #
5 # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.80 2006/10/07 23:48:52 momjian Exp $
6 #
7 #----------------------------------------------------------------------------
8
9 subdir = doc/src/sgml
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
12
13 .SECONDARY:
14 .NOTPARALLEL:
15
16 ifndef COLLATEINDEX
17 COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl
18 endif
19
20 ifndef JADE
21 JADE = jade
22 endif
23 SGMLINCLUDE = -D $(srcdir)
24
25 # If this is a vpath build, some generated SGML will be in the build
26 # tree, so we need to make sure we look there as well as in the
27 # source tree
28 ifeq ($(vpath_build), yes)
29 SGMLINCLUDE += -D .
30 endif
31
32 ifndef NSGMLS
33 NSGMLS = nsgmls
34 endif
35
36 ifndef SGMLSPL
37 SGMLSPL = sgmlspl
38 endif
39
40 CONVERT = convert
41 EPSTOPDF = epstopdf
42
43 # docbook2man generates man pages from docbook refentry source code.
44 D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl
45
46
47 GENERATED_SGML = bookindex.sgml version.sgml \
48         features-supported.sgml features-unsupported.sgml
49
50 ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
51
52 ifdef DOCBOOKSTYLE
53 CATALOG = -c $(DOCBOOKSTYLE)/catalog
54 endif
55
56 # Enable draft mode during development
57 ifneq (,$(findstring devel, $(VERSION)))
58 override JADEFLAGS += -V draft-mode
59 endif
60
61 # Enable some extra warnings
62 override SPFLAGS += -wall -wno-unused-param -wno-empty
63
64 ##
65 ## Man pages
66 ##
67
68 .PHONY: man
69
70 DEFAULTSECTION := $(sqlmansect_dummy)
71
72 fix_man_xrefs = $(PERL) -npi -e 's{\[XRef to GUC-([A-Z0-9-]*)\]}{($$l = $$1) =~ tr/A-Z-/a-z_/, $$l}ge || s{\[XRef to [A-Z0-9-]*\]}{the documentation}g'
73
74 man: postgres.sgml $(ALLSGML)
75         $(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
76 # One more time, to resolve cross-references
77         $(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
78         $(fix_man_xrefs) *.1 *.$(DEFAULTSECTION)
79         $(mkinstalldirs) man1 man$(DEFAULTSECTION)
80         mv *.1 man1/
81         mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
82
83
84 ##
85 ## HTML
86 ##
87
88 all: html
89
90 .PHONY: html
91
92 html: postgres.sgml $(ALLSGML) stylesheet.dsl
93         @rm -f *.html
94         $(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $<
95 ifeq ($(vpath_build), yes)
96         @cp $(srcdir)/stylesheet.css .
97 endif
98
99
100 COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
101
102 ifeq (,$(wildcard HTML.index))
103 bookindex.sgml:
104         $(COLLATEINDEX) -o $@ -N
105 else
106 bookindex.sgml: HTML.index
107         $(COLLATEINDEX) -i 'bookindex' -o $@ $<
108 endif
109
110 version.sgml: $(top_builddir)/src/Makefile.global
111         { \
112           echo "<!entity version \"$(VERSION)\">"; \
113           echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
114         } >$@
115
116 features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
117         $(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@
118
119 features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
120         $(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
121
122
123 ##
124 ## Print
125 ##
126
127 # RTF to allow minor editing for hardcopy
128
129 %.rtf: %.sgml $(ALLSGML) stylesheet.dsl
130         $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print $<
131
132 # TeX
133 # Regular TeX and pdfTeX have slightly differing requirements, so we
134 # need to distinguish the path we're taking.
135
136 %.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl
137         $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texdvi-output -o $@ $<
138
139 %.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl
140         $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texpdf-output -o $@ $<
141
142 %.dvi: %.tex-ps
143         @rm -f $*.aux $*.log
144         jadetex $<
145         jadetex $<
146         jadetex $<
147
148 # Postscript from TeX
149 %.ps: %.dvi
150         dvips -o $@ $<
151
152 %.pdf: %.tex-pdf
153         @rm -f $*.aux $*.log $*.out
154         pdfjadetex $<
155         pdfjadetex $<
156         pdfjadetex $<
157
158
159 # This generates an XML version of the flow-object tree.  It's useful
160 # for debugging DSSSL code, and possibly to interface to some other
161 # tools that can make use of this.
162 %.fot: %.sgml $(ALLSGML) stylesheet.dsl
163         $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<
164
165
166 # Graphics
167
168 %.gif:
169         cp $(srcdir)/../graphics/$@ .
170
171 %.eps: %.gif
172         $(CONVERT) $< eps:$@
173
174 %.pdf: %.eps
175         $(EPSTOPDF) $<
176
177
178 ##
179 ## Semi-automatic generation of some text files.
180 ##
181
182 JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
183 LYNX = lynx
184
185 INSTALL HISTORY regress_README: % : %.html
186         $(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | $(LYNX) -force_html -dump -nolist -stdin >$@
187
188 INSTALL.html: standalone-install.sgml installation.sgml version.sgml
189         $(JADE.text) -V nochunks standalone-install.sgml installation.sgml >$@
190
191 # remove links to main documentation
192 HISTORY.html: release.sgml
193         ( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN">'; \
194           cat $< ) | \
195         $(PERL) -p -0 -e 's/<link\s+linkend[^>]*>//g' | \
196         $(PERL) -p -e 's/<\/link>//g' >tempfile_HISTORY.sgml
197         $(JADE.text) -V nochunks tempfile_HISTORY.sgml >$@
198         rm tempfile_HISTORY.sgml
199
200 regress_README.html: regress.sgml
201         ( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
202           echo '<!entity % standalone-ignore "IGNORE">'; \
203           echo '<!entity % standalone-include "INCLUDE"> ]>'; \
204           cat $< ) >tempfile_regress_README.sgml
205         $(JADE.text) -V nochunks tempfile_regress_README.sgml >$@
206         rm tempfile_regress_README.sgml
207
208
209 ##
210 ## Experimental XML stuff
211 ##
212
213 OSX = osx # (may be called sx or sgml2xml on some systems)
214 XSLTPROC = xsltproc
215
216 postgres.xml: postgres.sgml $(GENERATED_SGML)
217         $(OSX) -x lower $< | \
218           sed -e 's/\[\(amp\|copy\|egrave\|gt\|lt\|mdash\|nbsp\|ouml\|pi\|quot\|uuml\) *\]/\&\1;/g' \
219               -e '1a\' -e '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">' \
220           >$@
221
222 testxml: stylesheet.xsl postgres.xml
223         $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam pg.version '$(VERSION)' $^
224
225 htmlhelp: stylesheet-hh.xsl postgres.xml
226         $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam pg.version '$(VERSION)' $^
227
228 ##
229 ## Experimental Texinfo targets
230 ##
231
232 DB2X_TEXIXML = db2x_texixml
233 DB2X_XSLTPROC = db2x_xsltproc
234 MAKEINFO = makeinfo
235
236 postgres.texixml: postgres.xml
237         $(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
238
239 postgres.texi: postgres.texixml
240         $(DB2X_TEXIXML) --encoding=iso-8859-1//TRANSLIT $< \
241                         --to-stdout > $@
242
243 postgres.info: postgres.texi
244         $(MAKEINFO) --enable-encoding --no-split \
245                     --no-validate $< -o $@
246
247 ##
248 ## Check
249 ##
250
251 # Quick syntax check without style processing
252 check: postgres.sgml $(ALLSGML)
253         $(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
254
255
256 ##
257 ## Clean
258 ##
259
260 clean distclean maintainer-clean:
261 # HTML
262         rm -f HTML.manifest *.html *.gif
263 # man
264         rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
265 # print
266         rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.eps *.fot
267 # index
268         rm -f HTML.index $(GENERATED_SGML)
269 # text
270         rm -f INSTALL HISTORY regress_README
271 # XML
272         rm -f postgres.xml htmlhelp.hhp toc.hhc index.hhk
273 # Texinfo
274         rm -f *.texixml *.texi *.info db2texi.refs