]> granicus.if.org Git - postgresql/blob - doc/src/sgml/Makefile
Allow the planner's estimate of the fraction of a cursor's rows that will be
[postgresql] / doc / src / sgml / Makefile
1 #----------------------------------------------------------------------------
2 #
3 # PostgreSQL documentation makefile
4 #
5 # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.105 2007/12/15 10:28:21 momjian Exp $
6 #
7 #----------------------------------------------------------------------------
8
9 subdir = doc/src/sgml
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
12
13 .NOTPARALLEL:
14 .PRECIOUS: %-A4.tex-ps %-US.tex-ps %-A4.tex-pdf %-US.tex-pdf
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 # docbook2man generates man pages from docbook refentry source code.
41 D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl
42
43
44 GENERATED_SGML = bookindex.sgml version.sgml \
45         features-supported.sgml features-unsupported.sgml
46
47 ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
48
49 ifdef DOCBOOKSTYLE
50 CATALOG = -c $(DOCBOOKSTYLE)/catalog
51 endif
52
53 # Enable some extra warnings
54 # -wfully-tagged needed to throw a warning on missing tags 
55 # for older tool chains, 2007-08-31
56 override SPFLAGS += -wall -wno-unused-param -wno-empty -wfully-tagged
57
58 ##
59 ## Man pages
60 ##
61
62 .PHONY: html man draft clean
63
64 DEFAULTSECTION = $(sqlmansect_dummy)
65
66 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-]*\]}{in the documentation}g'
67
68 man: postgres.sgml $(ALLSGML)
69         $(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
70 # One more time, to resolve cross-references
71         $(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
72         $(fix_man_xrefs) *.1 *.$(DEFAULTSECTION)
73         $(mkinstalldirs) man1 man$(DEFAULTSECTION)
74         mv *.1 man1/
75         mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
76
77
78 ##
79 ## HTML
80 ##
81
82 all: html
83
84 # The draft target creates HTML output in draft mode
85 draft : JADEFLAGS += -V draft-mode
86 draft: html-output
87
88 html: html-output
89 # Re-run this target until HTML.index does not change
90         @cmp -s HTML.index.start HTML.index || $(MAKE) $@
91
92 # This is run for all output formats because we need bookindex.sgml
93 html-output: postgres.sgml $(ALLSGML) stylesheet.dsl
94         @rm -f *.html
95         $(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $<
96 ifeq ($(vpath_build), yes)
97         @cp $(srcdir)/stylesheet.css .
98 endif
99
100 COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
101
102 # bookindex.sgml is required so there is a proper index for all output formats
103 bookindex.sgml: HTML.index
104 # create a dummy bookindex.html
105         test -s HTML.index || $(COLLATEINDEX) -o $@ -N
106 # If HTML.index is valid, create a valid bookindex.sgml.
107         test ! -s HTML.index || $(COLLATEINDEX) -i 'bookindex' -o $@ $<
108 # save copy of HTML.index for later comparison
109         @cp HTML.index HTML.index.start
110
111 # HTML.index is used to create bookindex.sgml
112 HTML.index:
113 # create an empty HTML.index if it does not exist
114         @$(if $(wildcard HTML.index), , touch HTML.index)
115
116 version.sgml: $(top_builddir)/src/Makefile.global
117         { \
118           echo "<!entity version \"$(VERSION)\">"; \
119           echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
120         } >$@
121
122 features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
123         $(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@
124
125 features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
126         $(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
127
128
129 ##
130 ## Print
131 ##
132
133
134 # RTF to allow minor editing for hardcopy
135 %.rtf: %.sgml $(ALLSGML) html
136         $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print postgres.sgml
137
138 # TeX
139 # Regular TeX and pdfTeX have slightly differing requirements, so we
140 # need to distinguish the path we're taking.
141
142 JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/stylesheet.dsl -t tex -V tex-backend -i output-print
143
144 %-A4.tex-ps: %.sgml $(ALLSGML) html
145         $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $<
146
147 %-US.tex-ps: %.sgml $(ALLSGML) html
148         $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $<
149
150 %-A4.tex-pdf: %.sgml $(ALLSGML) html
151         $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $<
152
153 %-US.tex-pdf: %.sgml $(ALLSGML) html
154         $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $<
155
156 %.dvi: %.tex-ps
157         @rm -f $*.aux $*.log
158 # multiple runs are necessary to create proper intra-document links
159         jadetex $<
160         jadetex $<
161         jadetex $<
162
163 # PostScript from TeX
164 postgres.ps:
165         $(error Invalid target;  use postgres-A4.ps or postgres-US.ps as targets)
166         
167 %.ps: %.dvi
168         dvips -o $@ $<
169
170 postgres.pdf:
171         $(error Invalid target;  use postgres-A4.pdf or postgres-US.pdf as targets)
172         
173 %.pdf: %.tex-pdf
174         @rm -f $*.aux $*.log $*.out
175 # multiple runs are necessary to create proper intra-document links
176         pdfjadetex $<
177         pdfjadetex $<
178         pdfjadetex $<
179
180
181 # This generates an XML version of the flow-object tree.  It's useful
182 # for debugging DSSSL code, and possibly to interface to some other
183 # tools that can make use of this.
184 %.fot: %.sgml $(ALLSGML) html
185         $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<
186
187
188 ##
189 ## Semi-automatic generation of some text files.
190 ##
191
192 JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
193 LYNX = lynx
194
195 INSTALL HISTORY regress_README: % : %.html
196         $(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | $(LYNX) -force_html -dump -nolist -stdin >$@
197
198 INSTALL.html: standalone-install.sgml installation.sgml version.sgml
199         $(JADE.text) -V nochunks standalone-install.sgml installation.sgml >$@
200
201 # remove links to main documentation
202 HISTORY.html: release.sgml
203         ( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN">'; \
204           cat $< ) | \
205         $(PERL) -p -0 -e 's/<link\s+linkend[^>]*>//g' | \
206         $(PERL) -p -e 's/<\/link>//g' >tempfile_HISTORY.sgml
207         $(JADE.text) -V nochunks tempfile_HISTORY.sgml >$@
208         rm tempfile_HISTORY.sgml
209
210 regress_README.html: regress.sgml
211         ( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
212           echo '<!entity % standalone-ignore "IGNORE">'; \
213           echo '<!entity % standalone-include "INCLUDE"> ]>'; \
214           cat $< ) >tempfile_regress_README.sgml
215         $(JADE.text) -V nochunks tempfile_regress_README.sgml >$@
216         rm tempfile_regress_README.sgml
217
218
219 ##
220 ## XSLT processing
221 ##
222
223 OSX = osx # (may be called sx or sgml2xml on some systems)
224 XSLTPROC = xsltproc
225
226 postgres.xml: postgres.sgml $(GENERATED_SGML)
227         $(OSX) -x lower $< | \
228           sed -e 's/\[\(amp\|copy\|egrave\|gt\|lt\|mdash\|nbsp\|ouml\|pi\|quot\|uuml\) *\]/\&\1;/g' \
229               -e '1a\' -e '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">' \
230           >$@
231 # ' hello Emacs
232
233 override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
234
235 xslthtml: stylesheet.xsl postgres.xml
236         $(XSLTPROC) $(XSLTPROCFLAGS) $^
237
238 htmlhelp: stylesheet-hh.xsl postgres.xml
239         $(XSLTPROC) $(XSLTPROCFLAGS) $^
240
241 %-A4.fo: stylesheet-fo.xsl %.xml
242         $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type A4 -o $@ $^
243
244 %-US.fo: stylesheet-fo.xsl %.xml
245         $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type USletter -o $@ $^
246
247
248 ##
249 ## Experimental Texinfo targets
250 ##
251
252 DB2X_TEXIXML = db2x_texixml
253 DB2X_XSLTPROC = db2x_xsltproc
254 MAKEINFO = makeinfo
255
256 %.texixml: %.xml
257         $(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
258
259 %.texi: %.texixml
260         $(DB2X_TEXIXML) --encoding=iso-8859-1//TRANSLIT $< --to-stdout >$@
261
262 %.info: %.texi
263         $(MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
264
265 # Cancel built-in suffix rules, interfering with PS building
266 .SUFFIXES:
267
268
269 ##
270 ## Check
271 ##
272
273 # Quick syntax check without style processing
274 check: postgres.sgml $(ALLSGML)
275         $(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
276
277
278 ##
279 ## Clean
280 ##
281
282 clean distclean maintainer-clean:
283 # HTML
284         rm -f HTML.manifest *.html
285 # man
286         rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
287 # print
288         rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.fot
289 # index
290         rm -f HTML.index HTML.index.start $(GENERATED_SGML)
291 # text
292         rm -f INSTALL HISTORY regress_README
293 # XSLT
294         rm -f postgres.xml htmlhelp.hhp toc.hhc index.hhk *.fo
295 # Texinfo
296         rm -f *.texixml *.texi *.info db2texi.refs
297 ifeq ($(vpath_build), yes)
298         rm -f stylesheet.css
299 endif