1 #----------------------------------------------------------------------------
3 # PostgreSQL documentation makefile
5 # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.110 2008/11/04 14:58:22 petere Exp $
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)
40 # docbook2man generates man pages from docbook refentry source code.
41 D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl
44 GENERATED_SGML = bookindex.sgml version.sgml \
45 features-supported.sgml features-unsupported.sgml
47 ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
50 CATALOG = -c $(DOCBOOKSTYLE)/catalog
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 # Note: try "make SPFLAGS=-wxml" to catch a lot of other dubious constructs,
57 # in particular < and & that haven't been made into entities. It's far too
58 # noisy to turn on by default, unfortunately.
59 override SPFLAGS += -wall -wno-unused-param -wno-empty -wfully-tagged
65 .PHONY: html man draft clean
67 DEFAULTSECTION = $(sqlmansect_dummy)
69 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'
71 man: postgres.sgml $(ALLSGML)
72 $(NSGMLS) $(NSGMLS_FLAGS) $(SGMLINCLUDE) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
73 # One more time, to resolve cross-references
74 $(NSGMLS) $(NSGMLS_FLAGS) $(SGMLINCLUDE) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
75 $(fix_man_xrefs) *.1 *.$(DEFAULTSECTION)
76 $(mkinstalldirs) man1 man$(DEFAULTSECTION)
78 mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
87 # The draft target creates HTML output in draft mode
88 draft : JADEFLAGS += -V draft-mode
92 # Re-run this target until HTML.index does not change
93 @cmp -s HTML.index.start HTML.index || $(MAKE) $@
95 # This is run for all output formats because we need bookindex.sgml
96 html-output: postgres.sgml $(ALLSGML) stylesheet.dsl
98 $(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $<
99 ifeq ($(vpath_build), yes)
100 @cp $(srcdir)/stylesheet.css .
103 COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
105 # bookindex.sgml is required so there is a proper index for all output formats
106 bookindex.sgml: HTML.index
107 # create a dummy bookindex.html
108 test -s HTML.index || $(COLLATEINDEX) -o $@ -N
109 # If HTML.index is valid, create a valid bookindex.sgml.
110 test ! -s HTML.index || $(COLLATEINDEX) -i 'bookindex' -o $@ $<
111 # save copy of HTML.index for later comparison
112 @cp HTML.index HTML.index.start
114 # HTML.index is used to create bookindex.sgml
116 # create an empty HTML.index if it does not exist
117 @$(if $(wildcard HTML.index), , touch HTML.index)
119 version.sgml: $(top_builddir)/src/Makefile.global
121 echo "<!entity version \"$(VERSION)\">"; \
122 echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
125 features-supported.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 YES $^ > $@
128 features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
129 $(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
137 # RTF to allow minor editing for hardcopy
138 %.rtf: %.sgml $(ALLSGML) html
139 $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print postgres.sgml
142 # Regular TeX and pdfTeX have slightly differing requirements, so we
143 # need to distinguish the path we're taking.
145 JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/stylesheet.dsl -t tex -V tex-backend -i output-print
147 %-A4.tex-ps: %.sgml $(ALLSGML) html
148 $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $<
150 %-US.tex-ps: %.sgml $(ALLSGML) html
151 $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $<
153 %-A4.tex-pdf: %.sgml $(ALLSGML) html
154 $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $<
156 %-US.tex-pdf: %.sgml $(ALLSGML) html
157 $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $<
161 # multiple runs are necessary to create proper intra-document links
166 # PostScript from TeX
168 $(error Invalid target; use postgres-A4.ps or postgres-US.ps as targets)
174 $(error Invalid target; use postgres-A4.pdf or postgres-US.pdf as targets)
177 @rm -f $*.aux $*.log $*.out
178 # multiple runs are necessary to create proper intra-document links
184 # This generates an XML version of the flow-object tree. It's useful
185 # for debugging DSSSL code, and possibly to interface to some other
186 # tools that can make use of this.
187 %.fot: %.sgml $(ALLSGML) html
188 $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<
192 ## Semi-automatic generation of some text files.
195 JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
198 INSTALL HISTORY regress_README: % : %.html
199 $(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | $(LYNX) -force_html -dump -nolist -stdin >$@
201 INSTALL.html: standalone-install.sgml installation.sgml version.sgml
202 $(JADE.text) -V nochunks standalone-install.sgml installation.sgml >$@
204 # remove links to main documentation
205 HISTORY.html: release.sgml
206 ( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN">'; \
208 $(PERL) -p -0 -e 's/<link\s+linkend[^>]*>//g' | \
209 $(PERL) -p -e 's/<\/link>//g' >tempfile_HISTORY.sgml
210 $(JADE.text) -V nochunks tempfile_HISTORY.sgml >$@
211 rm tempfile_HISTORY.sgml
213 regress_README.html: regress.sgml
214 ( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
215 echo '<!entity % standalone-ignore "IGNORE">'; \
216 echo '<!entity % standalone-include "INCLUDE"> ]>'; \
217 cat $< ) >tempfile_regress_README.sgml
218 $(JADE.text) -V nochunks tempfile_regress_README.sgml >$@
219 rm tempfile_regress_README.sgml
226 OSX = osx # (may be called sx or sgml2xml on some systems)
229 postgres.xml: postgres.sgml $(GENERATED_SGML)
230 $(OSX) -D. -x lower $< | \
231 $(PERL) -p -e 's/\[(amp|copy|egrave|gt|lt|mdash|nbsp|ouml|pi|quot|uuml) *\]/\&\1;/g;' \
232 -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;' \
236 override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
238 xslthtml: stylesheet.xsl postgres.xml
239 $(XSLTPROC) $(XSLTPROCFLAGS) $^
241 htmlhelp: stylesheet-hh.xsl postgres.xml
242 $(XSLTPROC) $(XSLTPROCFLAGS) $^
244 %-A4.fo: stylesheet-fo.xsl %.xml
245 $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type A4 -o $@ $^
247 %-US.fo: stylesheet-fo.xsl %.xml
248 $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type USletter -o $@ $^
252 ## Experimental Texinfo targets
255 DB2X_TEXIXML = db2x_texixml
256 DB2X_XSLTPROC = db2x_xsltproc
260 $(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
263 $(DB2X_TEXIXML) --encoding=iso-8859-1//TRANSLIT $< --to-stdout >$@
266 $(MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
268 # Cancel built-in suffix rules, interfering with PS building
273 ## Experimental man page building through docbook2x
276 # called docbook2man on non-Debian
277 DOCBOOK2MAN = docbook2x-man
279 manx: postgres.xml stylesheet-man.xsl
280 $(DOCBOOK2MAN) -s $(srcdir)/stylesheet-man.xsl --string-param default-manpage-section=$(DEFAULTSECTION) $<
281 $(mkinstalldirs) man1 man$(DEFAULTSECTION)
283 mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
290 # Quick syntax check without style processing
291 check: postgres.sgml $(ALLSGML)
292 $(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
299 clean distclean maintainer-clean:
301 rm -f HTML.manifest *.html
303 rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
305 rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.fot
307 rm -f HTML.index HTML.index.start $(GENERATED_SGML)
309 rm -f INSTALL HISTORY regress_README
311 rm -f postgres.xml htmlhelp.hhp toc.hhc index.hhk *.fo
313 rm -f *.texixml *.texi *.info db2texi.refs
314 ifeq ($(vpath_build), yes)