1 #----------------------------------------------------------------------------
3 # PostgreSQL documentation makefile
5 # $PostgreSQL: pgsql/doc/src/sgml/Makefile,v 1.80 2006/10/07 23:48:52 momjian Exp $
7 #----------------------------------------------------------------------------
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
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)
43 # docbook2man generates man pages from docbook refentry source code.
44 D2MSCRIPT= $(D2MDIR)/docbook2man-spec.pl
47 GENERATED_SGML = bookindex.sgml version.sgml \
48 features-supported.sgml features-unsupported.sgml
50 ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
53 CATALOG = -c $(DOCBOOKSTYLE)/catalog
56 # Enable draft mode during development
57 ifneq (,$(findstring devel, $(VERSION)))
58 override JADEFLAGS += -V draft-mode
61 # Enable some extra warnings
62 override SPFLAGS += -wall -wno-unused-param -wno-empty
70 DEFAULTSECTION := $(sqlmansect_dummy)
72 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-]*\]}{the documentation}g'
74 man: postgres.sgml $(ALLSGML)
75 $(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
76 # One more time, to resolve cross-references
77 $(NSGMLS) $(NSGMLS_FLAGS) $< | $(SGMLSPL) $(D2MSCRIPT) --lowercase --section $(DEFAULTSECTION) --date "`date '+%Y-%m-%d'`"
78 $(fix_man_xrefs) *.1 *.$(DEFAULTSECTION)
79 $(mkinstalldirs) man1 man$(DEFAULTSECTION)
81 mv *.$(DEFAULTSECTION) man$(DEFAULTSECTION)/
92 html: postgres.sgml $(ALLSGML) stylesheet.dsl
94 $(JADE) $(JADEFLAGS) $(SPFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-html -t sgml $<
95 ifeq ($(vpath_build), yes)
96 @cp $(srcdir)/stylesheet.css .
100 COLLATEINDEX := LC_ALL=C $(PERL) $(COLLATEINDEX) -f -g
102 ifeq (,$(wildcard HTML.index))
104 $(COLLATEINDEX) -o $@ -N
106 bookindex.sgml: HTML.index
107 $(COLLATEINDEX) -i 'bookindex' -o $@ $<
110 version.sgml: $(top_builddir)/src/Makefile.global
112 echo "<!entity version \"$(VERSION)\">"; \
113 echo "<!entity majorversion \"`expr $(VERSION) : '\([0-9][0-9]*\.[0-9][0-9]*\)'`\">"; \
116 features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
117 $(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@
119 features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
120 $(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
127 # RTF to allow minor editing for hardcopy
129 %.rtf: %.sgml $(ALLSGML) stylesheet.dsl
130 $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t rtf -V rtf-backend -i output-print $<
133 # Regular TeX and pdfTeX have slightly differing requirements, so we
134 # need to distinguish the path we're taking.
136 %.tex-ps: %.sgml $(ALLSGML) stylesheet.dsl
137 $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texdvi-output -o $@ $<
139 %.tex-pdf: %.sgml $(ALLSGML) stylesheet.dsl
140 $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t tex -V tex-backend -i output-print -V texpdf-output -o $@ $<
148 # Postscript from TeX
153 @rm -f $*.aux $*.log $*.out
159 # This generates an XML version of the flow-object tree. It's useful
160 # for debugging DSSSL code, and possibly to interface to some other
161 # tools that can make use of this.
162 %.fot: %.sgml $(ALLSGML) stylesheet.dsl
163 $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -t fot -i output-print -o $@ $<
169 cp $(srcdir)/../graphics/$@ .
179 ## Semi-automatic generation of some text files.
182 JADE.text = $(JADE) $(JADEFLAGS) $(SGMLINCLUDE) $(CATALOG) -d stylesheet.dsl -i output-text -t sgml
185 INSTALL HISTORY regress_README: % : %.html
186 $(PERL) -p -e 's/<H(1|2)$$/<H\1 align=center/g' $< | $(LYNX) -force_html -dump -nolist -stdin >$@
188 INSTALL.html: standalone-install.sgml installation.sgml version.sgml
189 $(JADE.text) -V nochunks standalone-install.sgml installation.sgml >$@
191 # remove links to main documentation
192 HISTORY.html: release.sgml
193 ( echo '<!doctype appendix PUBLIC "-//OASIS//DTD DocBook V4.2//EN">'; \
195 $(PERL) -p -0 -e 's/<link\s+linkend[^>]*>//g' | \
196 $(PERL) -p -e 's/<\/link>//g' >tempfile_HISTORY.sgml
197 $(JADE.text) -V nochunks tempfile_HISTORY.sgml >$@
198 rm tempfile_HISTORY.sgml
200 regress_README.html: regress.sgml
201 ( echo '<!doctype chapter PUBLIC "-//OASIS//DTD DocBook V4.2//EN" ['; \
202 echo '<!entity % standalone-ignore "IGNORE">'; \
203 echo '<!entity % standalone-include "INCLUDE"> ]>'; \
204 cat $< ) >tempfile_regress_README.sgml
205 $(JADE.text) -V nochunks tempfile_regress_README.sgml >$@
206 rm tempfile_regress_README.sgml
210 ## Experimental XML stuff
213 OSX = osx # (may be called sx or sgml2xml on some systems)
216 postgres.xml: postgres.sgml $(GENERATED_SGML)
217 $(OSX) -x lower $< | \
218 sed -e 's/\[\(amp\|copy\|egrave\|gt\|lt\|mdash\|nbsp\|ouml\|pi\|quot\|uuml\) *\]/\&\1;/g' \
219 -e '1a\' -e '<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">' \
222 testxml: stylesheet.xsl postgres.xml
223 $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam pg.version '$(VERSION)' $^
225 htmlhelp: stylesheet-hh.xsl postgres.xml
226 $(XSLTPROC) $(XSLTPROCFLAGS) --stringparam pg.version '$(VERSION)' $^
229 ## Experimental Texinfo targets
232 DB2X_TEXIXML = db2x_texixml
233 DB2X_XSLTPROC = db2x_xsltproc
236 postgres.texixml: postgres.xml
237 $(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
239 postgres.texi: postgres.texixml
240 $(DB2X_TEXIXML) --encoding=iso-8859-1//TRANSLIT $< \
243 postgres.info: postgres.texi
244 $(MAKEINFO) --enable-encoding --no-split \
245 --no-validate $< -o $@
251 # Quick syntax check without style processing
252 check: postgres.sgml $(ALLSGML)
253 $(NSGMLS) $(SPFLAGS) $(SGMLINCLUDE) -s $<
260 clean distclean maintainer-clean:
262 rm -f HTML.manifest *.html *.gif
264 rm -rf *.1 *.$(DEFAULTSECTION) man1 man$(DEFAULTSECTION) manpage.refs manpage.links manpage.log
266 rm -f *.rtf *.tex-ps *.tex-pdf *.dvi *.aux *.log *.ps *.pdf *.out *.eps *.fot
268 rm -f HTML.index $(GENERATED_SGML)
270 rm -f INSTALL HISTORY regress_README
272 rm -f postgres.xml htmlhelp.hhp toc.hhc index.hhk
274 rm -f *.texixml *.texi *.info db2texi.refs