1 #----------------------------------------------------------------------------
3 # PostgreSQL documentation makefile
7 #----------------------------------------------------------------------------
10 top_builddir
= ..
/..
/..
11 include $(top_builddir
)/src
/Makefile.global
14 .PRECIOUS
: %-A4.tex-ps
%-US.tex-ps
%-A4.tex-pdf
%-US.tex-pdf
17 COLLATEINDEX
= $(DOCBOOKSTYLE
)/bin
/collateindex.pl
23 SGMLINCLUDE
= -D
$(srcdir)
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
28 ifeq ($(vpath_build
), yes
)
41 DOCBOOK2MAN
= docbook2man_is_missing
44 # docbook2man generates man pages from docbook refentry source code.
45 D2MSCRIPT
= $(D2MDIR
)/docbook2man-spec.pl
46 D2MLINKS
= $(D2MDIR
)/docbook2man-spec_makelinks
49 GENERATED_SGML
= bookindex.sgml version.sgml \
50 features-supported.sgml features-unsupported.sgml
52 ALLSGML
:= $(wildcard $(srcdir)/*.sgml
$(srcdir)/ref
/*.sgml
) $(GENERATED_SGML
)
55 CATALOG
= -c
$(DOCBOOKSTYLE
)/catalog
58 # Enable some extra warnings
59 # -wfully-tagged needed to throw a warning on missing tags
60 # for older tool chains, 2007-08-31
61 # Note: try "make SPFLAGS=-wxml" to catch a lot of other dubious constructs,
62 # in particular < and & that haven't been made into entities. It's far too
63 # noisy to turn on by default, unfortunately.
64 override SPFLAGS
+= -wall
-wno-unused-param
-wno-empty
-wfully-tagged
70 .PHONY
: html man draft
clean
74 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'
75 lowercase
= tr
'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'
77 man
: postgres.sgml
$(ALLSGML
)
78 $(NSGMLS
) $(NSGMLS_FLAGS
) $(SGMLINCLUDE
) $< |
$(SGMLSPL
) $(D2MSCRIPT
) --lowercase
--section
$(DEFAULTSECTION
) --date
"`date '+%Y-%m-%d'`"
79 # One more time, to resolve cross-references
80 $(NSGMLS
) $(NSGMLS_FLAGS
) $(SGMLINCLUDE
) $< |
$(SGMLSPL
) $(D2MSCRIPT
) --lowercase
--section
$(DEFAULTSECTION
) --date
"`date '+%Y-%m-%d'`"
81 $(fix_man_xrefs
) *.1 *.7
82 $(mkinstalldirs
) man1 man7
83 $(D2MLINKS
) < manpage.links
86 rm *.
$(DEFAULTSECTION
)
87 # manpage.links doesn't handle lowercase, needs fixups
88 cd man7
&& for file in
`awk '{ print $$2 }' ../manpage.links`; do
$(lowercase
) <$$file >`echo $$file | $(lowercase)` && rm $$file || exit
; done
97 # The draft target creates HTML output in draft mode
98 draft
: JADEFLAGS
+= -V draft-mode
102 # Re-run this target until HTML.index does not change
103 @cmp
-s HTML.index.start HTML.index ||
$(MAKE
) $@
105 # This is run for all output formats because we need bookindex.sgml
106 html-output
: postgres.sgml
$(ALLSGML
) stylesheet.dsl
108 $(JADE
) $(JADEFLAGS
) $(SPFLAGS
) $(SGMLINCLUDE
) $(CATALOG
) -d stylesheet.dsl
-i output-html
-t sgml
$<
109 ifeq ($(vpath_build
), yes
)
110 @cp
$(srcdir)/stylesheet.css .
113 COLLATEINDEX
:= LC_ALL
=C
$(PERL
) $(COLLATEINDEX
) -f
-g
115 # bookindex.sgml is required so there is a proper index for all output formats
116 bookindex.sgml
: HTML.index
117 # create a dummy bookindex.html
118 test -s HTML.index ||
$(COLLATEINDEX
) -o
$@
-N
119 # If HTML.index is valid, create a valid bookindex.sgml.
120 test ! -s HTML.index ||
$(COLLATEINDEX
) -i
'bookindex' -o
$@
$<
121 # save copy of HTML.index for later comparison
122 @cp HTML.index HTML.index.start
124 # HTML.index is used to create bookindex.sgml
126 # create an empty HTML.index if it does not exist
127 @
$(if
$(wildcard HTML.index
), , touch HTML.index
)
129 version.sgml
: $(top_builddir
)/src
/Makefile.global
131 echo
"<!entity version \"$(VERSION)\">"; \
132 echo
"<!entity majorversion \"$(MAJORVERSION)\">"; \
135 features-supported.sgml
: $(top_srcdir
)/src
/backend
/catalog
/sql_feature_packages.txt
$(top_srcdir
)/src
/backend
/catalog
/sql_features.txt
136 $(PERL
) $(srcdir)/mk_feature_tables.pl YES
$^
> $@
138 features-unsupported.sgml
: $(top_srcdir
)/src
/backend
/catalog
/sql_feature_packages.txt
$(top_srcdir
)/src
/backend
/catalog
/sql_features.txt
139 $(PERL
) $(srcdir)/mk_feature_tables.pl NO
$^
> $@
147 # RTF to allow minor editing for hardcopy
148 %.rtf
: %.sgml
$(ALLSGML
) html
149 $(JADE
) $(JADEFLAGS
) $(SGMLINCLUDE
) $(CATALOG
) -d stylesheet.dsl
-t rtf
-V rtf-backend
-i output-print postgres.sgml
152 # Regular TeX and pdfTeX have slightly differing requirements, so we
153 # need to distinguish the path we're taking.
155 JADE.
tex.call
= $(JADE
) $(JADEFLAGS
) $(SGMLINCLUDE
) $(CATALOG
) -d
$(srcdir)/stylesheet.dsl
-t
tex -V tex-backend
-i output-print
157 %-A4.tex-ps
: %.sgml
$(ALLSGML
) html
158 $(JADE.
tex.call
) -V texdvi-output
-V
'%paper-type%'=A4
-o
$@
$<
160 %-US.tex-ps
: %.sgml
$(ALLSGML
) html
161 $(JADE.
tex.call
) -V texdvi-output
-V
'%paper-type%'=USletter
-o
$@
$<
163 %-A4.tex-pdf
: %.sgml
$(ALLSGML
) html
164 $(JADE.
tex.call
) -V texpdf-output
-V
'%paper-type%'=A4
-o
$@
$<
166 %-US.tex-pdf
: %.sgml
$(ALLSGML
) html
167 $(JADE.
tex.call
) -V texpdf-output
-V
'%paper-type%'=USletter
-o
$@
$<
171 # multiple runs are necessary to create proper intra-document links
176 # PostScript from TeX
178 $(error Invalid target
; use postgres-A4.ps or postgres-US.ps
as targets
)
184 $(error Invalid target
; use postgres-A4.pdf or postgres-US.pdf
as targets
)
187 @
rm -f
$*.aux
$*.log
$*.out
188 # multiple runs are necessary to create proper intra-document links
194 # This generates an XML version of the flow-object tree. It's useful
195 # for debugging DSSSL code, and possibly to interface to some other
196 # tools that can make use of this.
197 %.fot
: %.sgml
$(ALLSGML
) html
198 $(JADE
) $(JADEFLAGS
) $(SGMLINCLUDE
) $(CATALOG
) -d stylesheet.dsl
-t fot
-i output-print
-o
$@
$<
202 ## Semi-automatic generation of some text files.
205 JADE.text
= $(JADE
) $(JADEFLAGS
) $(SGMLINCLUDE
) $(CATALOG
) -d stylesheet.dsl
-i output-text
-t sgml
208 INSTALL HISTORY regress_README
: % : %.html
209 $(PERL
) -p
-e
's/<H(1|2)$$/<H\1 align=center/g' $< |
$(LYNX
) -force_html
-dump
-nolist
-stdin
>$@
211 INSTALL.html
: standalone-install.sgml installation.sgml version.sgml
212 $(JADE.text
) -V nochunks standalone-install.sgml installation.sgml
>$@
214 HISTORY.html
: generate_history.pl
$(wildcard $(srcdir)/release
*.sgml
)
215 $(PERL
) $< "$(srcdir)" release.sgml
>tempfile_HISTORY.sgml
216 $(JADE.text
) -V nochunks tempfile_HISTORY.sgml
>$@
217 rm tempfile_HISTORY.sgml
219 regress_README.html
: regress.sgml
220 ( echo
'<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
221 echo
'<!entity % standalone-ignore "IGNORE">'; \
222 echo
'<!entity % standalone-include "INCLUDE"> ]>'; \
223 cat
$< ) >tempfile_regress_README.sgml
224 $(JADE.text
) -V nochunks tempfile_regress_README.sgml
>$@
225 rm tempfile_regress_README.sgml
232 OSX
= osx
# (may be called sx or sgml2xml on some systems)
235 postgres.xml
: postgres.sgml
$(GENERATED_SGML
)
236 $(OSX
) -D.
-x lower
$< | \
237 $(PERL
) -p
-e
's/\[(amp|copy|egrave|gt|lt|mdash|nbsp|ouml|pi|quot|uuml) *\]/\&\1;/g;' \
238 -e
'$$_ .= qq{<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">\n} if $$. == 1;' \
242 override XSLTPROCFLAGS
+= --stringparam pg.version
'$(VERSION)'
244 xslthtml
: stylesheet.xsl postgres.xml
245 $(XSLTPROC
) $(XSLTPROCFLAGS
) $^
247 htmlhelp
: stylesheet-hh.xsl postgres.xml
248 $(XSLTPROC
) $(XSLTPROCFLAGS
) $^
250 %-A4.fo
: stylesheet-fo.xsl
%.xml
251 $(XSLTPROC
) $(XSLTPROCFLAGS
) --stringparam paper.type A4
-o
$@
$^
253 %-US.fo
: stylesheet-fo.xsl
%.xml
254 $(XSLTPROC
) $(XSLTPROCFLAGS
) --stringparam paper.type USletter
-o
$@
$^
258 ## Experimental Texinfo targets
261 DB2X_TEXIXML
= db2x_texixml
262 DB2X_XSLTPROC
= db2x_xsltproc
266 $(DB2X_XSLTPROC
) -s texi
-g output-file
=$(basename $@
) $< -o
$@
269 $(DB2X_TEXIXML
) --encoding
=iso-8859-1
//TRANSLIT
$< --to-stdout
>$@
272 $(MAKEINFO
) --enable-encoding
--no-split
--no-validate
$< -o
$@
274 # Cancel built-in suffix rules, interfering with PS building
279 ## Experimental man page building through docbook2x
282 manx
: postgres.xml stylesheet-man.xsl
283 $(DOCBOOK2MAN
) --solinks
-s
$(srcdir)/stylesheet-man.xsl
--string-param default-manpage-section
=$(DEFAULTSECTION
) $<
284 $(mkinstalldirs
) man1 man7
287 rm *.
$(DEFAULTSECTION
)
294 # Quick syntax check without style processing
295 check: postgres.sgml
$(ALLSGML
)
296 $(NSGMLS
) $(SPFLAGS
) $(SGMLINCLUDE
) -s
$<
303 clean distclean maintainer-clean
:
305 rm -f HTML.manifest
*.html
307 rm -rf
*.1 *.7 *.
$(DEFAULTSECTION
) man1 man7 manpage.refs manpage.links manpage.log
309 rm -f
*.rtf
*.tex-ps
*.tex-pdf
*.
dvi *.aux
*.log
*.ps
*.pdf
*.out
*.fot
311 rm -f HTML.index HTML.index.start
$(GENERATED_SGML
)
313 rm -f INSTALL HISTORY regress_README
315 rm -f postgres.xml htmlhelp.hhp toc.hhc index.hhk
*.fo
317 rm -f
*.texixml
*.texi
*.
info db2texi.refs
318 ifeq ($(vpath_build
), yes
)