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
#----------------------------------------------------------------------------
#
# PostgreSQL documentation makefile
#
# $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.103 2007/12/14 13:20:30 momjian Exp $
#
#----------------------------------------------------------------------------
subdir = doc/src/sgml
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
.NOTPARALLEL:
.PRECIOUS: %-A4.tex-ps %-US.tex-ps %-A4.tex-pdf %-US.tex-pdf
ifndef COLLATEINDEX
COLLATEINDEX = $(DOCBOOKSTYLE)/bin/collateindex.pl
endif
ifndef JADE
JADE = jade
endif
SGMLINCLUDE = -D $(srcdir)
# If this is a vpath build, some generated SGML will be in the build
# tree, so we need to make sure we look there as well as in the
# source tree
ifeq ($(vpath_build), yes)
SGMLINCLUDE += -D .
endif
ifndef NSGMLS
NSGMLS = nsgmls
endif
ifndef SGMLSPL
SGMLSPL = sgmlspl
endif
# docbook2man generates man pages from docbook refentry source code.
D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl
GENERATED_SGML = bookindex.sgml version.sgml \
features-supported.sgml features-unsupported.sgml
ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
ifdef DOCBOOKSTYLE
CATALOG = -c $(DOCBOOKSTYLE)/catalog
endif
# Enable some extra warnings
# -wfully-tagged needed to throw a warning on missing tags
# for older tool chains, 2007-08-31
override SPFLAGS += -wall -wno-unused-param -wno-empty -wfully-tagged
##
## Man pages
##
.PHONY: html man draft clean
DEFAULTSECTION = $(sqlmansect_dummy)
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'
man: postgres.sgml $(ALLSGML)
$(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
# One more time, to resolve cross-references
$(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
$(fix_man_xrefs) *.1 *.$(DEFAULTSECTION)
$(mkinstalldirs) man1 man$(DEFAULTSECTION)
mv *.1 man1/
mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
##
## HTML
##
all: html
# The draft target creates HTML output in draft mode
draft : JADEFLAGS += -V draft-mode
draft: html-output
html: html-output
# Re-run this target until HTML.index does not change
@cmp -s HTML.index.start HTML.index || $(MAKE) $@
# This is run for all output formats because we need bookindex.sgml
html-output: postgres.sgml $(ALLSGML) stylesheet.dsl
@rm -f *.html
$(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $<
ifeq ($(vpath_build), yes)
@cp $(srcdir)/stylesheet.css .
endif
COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
# bookindex.sgml is required so there is a proper index for all output formats
bookindex.sgml: HTML.index
# create a dummy bookindex.html
test -s HTML.index || $(COLLATEINDEX) -o $@ -N
# If HTML.index is valid, create a valid bookindex.sgml.
test ! -s HTML.index || $(COLLATEINDEX) -i 'bookindex' -o $@ $<
# save copy of HTML.index for later comparison
@cp HTML.index HTML.index.start
# HTML.index is used to create bookindex.sgml
HTML.index:
# create an empty HTML.index if it does not exist
@$(if $(wildcard HTML.index), , touch HTML.index)
version.sgml: $(top_builddir)/src/Makefile.global
{ \
echo "<!entity version \"$(VERSION)\">"; \
echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
} >$@
features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
$(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@
features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
$(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
##
## Print
##
# RTF to allow minor editing for hardcopy
%.rtf: %.sgml $(ALLSGML) html
$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print postgres.sgml
# TeX
# Regular TeX and pdfTeX have slightly differing requirements, so we
# need to distinguish the path we're taking.
JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/stylesheet.dsl -t tex -V tex-backend -i output-print
%-A4.tex-ps: %.sgml $(ALLSGML) html
$(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $<
%-US.tex-ps: %.sgml $(ALLSGML) html
$(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $<
%-A4.tex-pdf: %.sgml $(ALLSGML) html
$(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $<
%-US.tex-pdf: %.sgml $(ALLSGML) html
$(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $<
%.dvi: %.tex-ps
@rm -f $*.aux $*.log
# multiple runs are necessary to create proper intra-document links
jadetex $<
jadetex $<
jadetex $<
# PostScript from TeX
postgres.ps:
$(error Use 'gmake postgres-US.ps' or 'gmake postgres-A4.ps')
%.ps: %.dvi
dvips -o $@ $<
postgres.pdf:
$(error Use 'gmake postgres-US.pdf' or 'gmake postgres-A4.pdf')
%.pdf: %.tex-pdf
@rm -f $*.aux $*.log $*.out
# multiple runs are necessary to create proper intra-document links
pdfjadetex $<
pdfjadetex $<
pdfjadetex $<
# This generates an XML version of the flow-object tree. It's useful
# for debugging DSSSL code, and possibly to interface to some other
# tools that can make use of this.
%.fot: %.sgml $(ALLSGML) html
$(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<
##
## Semi-automatic generation of some text files.
##
JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
LYNX = lynx
INSTALL HISTORY regress_README: % : %.html
$(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | $(LYNX) -force_html -dump -nolist -stdin >$@
INSTALL.html: standalone-install.sgml installation.sgml version.sgml
$(JADE.text) -V nochunks standalone-install.sgml installation.sgml >$@
# remove links to main documentation
HISTORY.html: release.sgml
( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN">'; \
cat $< ) | \
$(PERL) -p -0 -e 's/<link\s+linkend[^>]*>//g' | \
$(PERL) -p -e 's/<\/link>//g' >tempfile_HISTORY.sgml
$(JADE.text) -V nochunks tempfile_HISTORY.sgml >$@
rm tempfile_HISTORY.sgml
regress_README.html: regress.sgml
( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
echo '<!entity % standalone-ignore "IGNORE">'; \
echo '<!entity % standalone-include "INCLUDE"> ]>'; \
cat $< ) >tempfile_regress_README.sgml
$(JADE.text) -V nochunks tempfile_regress_README.sgml >$@
rm tempfile_regress_README.sgml
##
## XSLT processing
##
OSX = osx # (may be called sx or sgml2xml on some systems)
XSLTPROC = xsltproc
postgres.xml: postgres.sgml $(GENERATED_SGML)
$(OSX) -x lower $< | \
sed -e 's/\[\(amp\|copy\|egrave\|gt\|lt\|mdash\|nbsp\|ouml\|pi\|quot\|uuml\) *\]/\&\1;/g' \
-e '1a\' -e '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">' \
>$@
# ' hello Emacs
override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
xslthtml: stylesheet.xsl postgres.xml
$(XSLTPROC) $(XSLTPROCFLAGS) $^
htmlhelp: stylesheet-hh.xsl postgres.xml
$(XSLTPROC) $(XSLTPROCFLAGS) $^
%-A4.fo: stylesheet-fo.xsl %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type A4 -o $@ $^
%-US.fo: stylesheet-fo.xsl %.xml
$(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type USletter -o $@ $^
##
## Experimental Texinfo targets
##
DB2X_TEXIXML = db2x_texixml
DB2X_XSLTPROC = db2x_xsltproc
MAKEINFO = makeinfo
%.texixml: %.xml
$(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
%.texi: %.texixml
$(DB2X_TEXIXML) --encoding=iso-8859-1//TRANSLIT $< --to-stdout >$@
%.info: %.texi
$(MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
# Cancel built-in suffix rules, interfering with PS building
.SUFFIXES:
##
## Check
##
# Quick syntax check without style processing
check: postgres.sgml $(ALLSGML)
$(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
##
## Clean
##
clean distclean maintainer-clean:
# HTML
rm -f HTML.manifest *.html
# man
rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
# print
rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.fot
# index
rm -f HTML.index HTML.index.start $(GENERATED_SGML)
# text
rm -f INSTALL HISTORY regress_README
# XSLT
rm -f postgres.xml htmlhelp.hhp toc.hhc index.hhk *.fo
# Texinfo
rm -f *.texixml *.texi *.info db2texi.refs
ifeq ($(vpath_build), yes)
rm -f stylesheet.css
endif