1 #----------------------------------------------------------------------------
3 # PostgreSQL documentation makefile
5 # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.105 2007/12/15 10:28:21 momjian 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 override SPFLAGS += -wall -wno-unused-param -wno-empty -wfully-tagged
62 .PHONY: html man draft clean
64 DEFAULTSECTION = $(sqlmansect_dummy)
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'
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)
75 mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
84 # The draft target creates HTML output in draft mode
85 draft : JADEFLAGS += -V draft-mode
89 # Re-run this target until HTML.index does not change
90 @cmp -s HTML.index.start HTML.index || $(MAKE) $@
92 # This is run for all output formats because we need bookindex.sgml
93 html-output: postgres.sgml $(ALLSGML) stylesheet.dsl
95 $(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $<
96 ifeq ($(vpath_build), yes)
97 @cp $(srcdir)/stylesheet.css .
100 COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
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
111 # HTML.index is used to create bookindex.sgml
113 # create an empty HTML.index if it does not exist
114 @$(if $(wildcard HTML.index), , touch HTML.index)
116 version.sgml: $(top_builddir)/src/Makefile.global
118 echo "<!entity version \"$(VERSION)\">"; \
119 echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
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 $^ > $@
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 $^ > $@
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
139 # Regular TeX and pdfTeX have slightly differing requirements, so we
140 # need to distinguish the path we're taking.
142 JADE.tex.call = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d $(srcdir)/stylesheet.dsl -t tex -V tex-backend -i output-print
144 %-A4.tex-ps: %.sgml $(ALLSGML) html
145 $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=A4 -o $@ $<
147 %-US.tex-ps: %.sgml $(ALLSGML) html
148 $(JADE.tex.call) -V texdvi-output -V '%paper-type%'=USletter -o $@ $<
150 %-A4.tex-pdf: %.sgml $(ALLSGML) html
151 $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=A4 -o $@ $<
153 %-US.tex-pdf: %.sgml $(ALLSGML) html
154 $(JADE.tex.call) -V texpdf-output -V '%paper-type%'=USletter -o $@ $<
158 # multiple runs are necessary to create proper intra-document links
163 # PostScript from TeX
165 $(error Invalid target; use postgres-A4.ps or postgres-US.ps as targets)
171 $(error Invalid target; use postgres-A4.pdf or postgres-US.pdf as targets)
174 @rm -f $*.aux $*.log $*.out
175 # multiple runs are necessary to create proper intra-document links
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 $@ $<
189 ## Semi-automatic generation of some text files.
192 JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
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 >$@
198 INSTALL.html: standalone-install.sgml installation.sgml version.sgml
199 $(JADE.text) -V nochunks standalone-install.sgml installation.sgml >$@
201 # remove links to main documentation
202 HISTORY.html: release.sgml
203 ( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN">'; \
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
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
223 OSX = osx # (may be called sx or sgml2xml on some systems)
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">' \
233 override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
235 xslthtml: stylesheet.xsl postgres.xml
236 $(XSLTPROC) $(XSLTPROCFLAGS) $^
238 htmlhelp: stylesheet-hh.xsl postgres.xml
239 $(XSLTPROC) $(XSLTPROCFLAGS) $^
241 %-A4.fo: stylesheet-fo.xsl %.xml
242 $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type A4 -o $@ $^
244 %-US.fo: stylesheet-fo.xsl %.xml
245 $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam paper.type USletter -o $@ $^
249 ## Experimental Texinfo targets
252 DB2X_TEXIXML = db2x_texixml
253 DB2X_XSLTPROC = db2x_xsltproc
257 $(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
260 $(DB2X_TEXIXML) --encoding=iso-8859-1//TRANSLIT $< --to-stdout >$@
263 $(MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
265 # Cancel built-in suffix rules, interfering with PS building
273 # Quick syntax check without style processing
274 check: postgres.sgml $(ALLSGML)
275 $(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
282 clean distclean maintainer-clean:
284 rm -f HTML.manifest *.html
286 rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
288 rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.fot
290 rm -f HTML.index HTML.index.start $(GENERATED_SGML)
292 rm -f INSTALL HISTORY regress_README
294 rm -f postgres.xml htmlhelp.hhp toc.hhc index.hhk *.fo
296 rm -f *.texixml *.texi *.info db2texi.refs
297 ifeq ($(vpath_build), yes)