1998-03-01 21:44:37 +01:00
#----------------------------------------------------------------------------
#
2003-03-25 17:15:44 +01:00
# PostgreSQL documentation makefile
1998-03-01 21:44:37 +01:00
#
2010-09-20 22:08:53 +02:00
# doc/src/sgml/Makefile
1998-03-01 21:44:37 +01:00
#
#----------------------------------------------------------------------------
1998-03-01 09:18:09 +01:00
2009-08-10 00:47:59 +02:00
# This makefile is for building and installing the documentation.
# When a release tarball is created, the documentation files are
2010-09-22 20:10:28 +02:00
# prepared using the distprep target. In Git-based trees these files
2009-08-10 00:47:59 +02:00
# don't exist, unless explicitly built, so we skip the installation in
# that case.
# Make "html" the default target, since that is what most people tend
# to want to use.
html :
2018-04-09 22:42:02 +02:00
# We don't need the tree-wide headers or install support here.
NO_GENERATED_HEADERS = yes
2015-05-12 18:30:50 +02:00
NO_TEMP_INSTALL = yes
2000-08-31 18:12:35 +02:00
subdir = doc/src/sgml
top_builddir = ../../..
2000-11-05 22:04:07 +01:00
i n c l u d e $( top_builddir ) / s r c / M a k e f i l e . g l o b a l
2000-08-31 18:12:35 +02:00
2009-08-10 00:47:59 +02:00
2013-10-11 03:53:34 +02:00
all : html man
2010-03-30 02:10:46 +02:00
2013-10-11 03:53:34 +02:00
distprep : html distprep -man
2009-08-10 00:47:59 +02:00
1998-03-01 21:44:37 +01:00
2014-09-14 02:14:17 +02:00
i f n d e f D B T O E P U B
DBTOEPUB = $( missing) dbtoepub
e n d i f
2017-04-07 04:03:52 +02:00
i f n d e f F O P
FOP = $( missing) fop
2000-11-05 22:04:07 +01:00
e n d i f
2017-04-07 04:03:52 +02:00
2023-04-05 06:10:46 +02:00
XMLINCLUDE = --path . --path $( srcdir)
1998-07-29 08:29:04 +02:00
Stop recommending auto-download of DTD files, and indeed disable it.
It appears no longer possible to build the SGML docs without a local
installation of the DocBook DTD, because sourceforge.net now only
permits HTTPS access, and no common version of xsltproc supports that.
Hence, remove the bits of our documentation suggesting that that's
possible or useful.
In fact, we might as well add the --nonet option to the build recipes
automatically, for a bit of extra security.
Also fix our documentation-tool-installation recipes for macOS to
ensure that xmllint and xsltproc are pulled in from MacPorts or
Homebrew. The previous recipes assumed you could use the
Apple-supplied versions of these tools; which still works, except that
you'd need to set an environment variable to ensure that they would
find DTD files provided by those package managers. Simpler and easier
to just recommend pulling in the additional packages.
In HEAD, also document how to build docs using Meson, and adjust
"ninja docs" to just build the HTML docs, for consistency with the
default behavior of doc/src/sgml/Makefile.
In a fit of neatnik-ism, I also made the ordering of the package
lists match the order in which the tools are described at the head
of the appendix.
Aleksander Alekseev, Peter Eisentraut, Tom Lane
Discussion: https://postgr.es/m/CAJ7c6TO8Aro2nxg=EQsVGiSDe-TstP4EsSvDHd7DSRsP40PgGA@mail.gmail.com
2023-02-08 23:15:23 +01:00
i f d e f X M L L I N T
XMLLINT := $( XMLLINT) --nonet
e l s e
doc: Check DocBook XML validity during the build
Building the documentation with XSLT does not check the DTD, like a
DSSSL build would. One can often get away with having invalid XML, but
the stylesheets might then create incorrect output, as they are not
designed to handle that. Therefore, check the validity of the XML
against the DTD, using xmllint, during the build.
Add xmllint detection to configure, and add some documentation.
xmllint comes with libxml2, which is already in use, but it might be in
a separate package, such as libxml2-utils on Debian.
Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
2014-10-21 20:46:38 +02:00
XMLLINT = $( missing) xmllint
e n d i f
Stop recommending auto-download of DTD files, and indeed disable it.
It appears no longer possible to build the SGML docs without a local
installation of the DocBook DTD, because sourceforge.net now only
permits HTTPS access, and no common version of xsltproc supports that.
Hence, remove the bits of our documentation suggesting that that's
possible or useful.
In fact, we might as well add the --nonet option to the build recipes
automatically, for a bit of extra security.
Also fix our documentation-tool-installation recipes for macOS to
ensure that xmllint and xsltproc are pulled in from MacPorts or
Homebrew. The previous recipes assumed you could use the
Apple-supplied versions of these tools; which still works, except that
you'd need to set an environment variable to ensure that they would
find DTD files provided by those package managers. Simpler and easier
to just recommend pulling in the additional packages.
In HEAD, also document how to build docs using Meson, and adjust
"ninja docs" to just build the HTML docs, for consistency with the
default behavior of doc/src/sgml/Makefile.
In a fit of neatnik-ism, I also made the ordering of the package
lists match the order in which the tools are described at the head
of the appendix.
Aleksander Alekseev, Peter Eisentraut, Tom Lane
Discussion: https://postgr.es/m/CAJ7c6TO8Aro2nxg=EQsVGiSDe-TstP4EsSvDHd7DSRsP40PgGA@mail.gmail.com
2023-02-08 23:15:23 +01:00
i f d e f X S L T P R O C
XSLTPROC := $( XSLTPROC) --nonet
e l s e
2014-09-14 02:14:17 +02:00
XSLTPROC = $( missing) xsltproc
2008-11-26 12:26:54 +01:00
e n d i f
2009-08-05 00:04:37 +02:00
o v e r r i d e XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
1999-08-06 15:46:17 +02:00
1998-03-01 21:44:37 +01:00
2017-04-07 04:03:52 +02:00
GENERATED_SGML = version.sgml \
2019-05-07 15:29:39 +02:00
features-supported.sgml features-unsupported.sgml errcodes-table.sgml \
keywords-table.sgml
2003-01-15 00:19:34 +01:00
ALLSGML := $( wildcard $( srcdir) /*.sgml $( srcdir) /ref/*.sgml) $( GENERATED_SGML)
1999-08-06 15:46:17 +02:00
2019-03-27 22:57:43 +01:00
ALL_IMAGES := $( wildcard $( srcdir) /images/*.svg)
2017-04-07 04:03:52 +02:00
2022-09-14 17:55:22 +02:00
# Run validation only once, common to all subsequent targets. While
# we're at it, also resolve all entities (that is, copy all included
# files into one big file). This helps tools that don't understand
# vpath builds (such as dbtoepub).
postgres-full.xml : postgres .sgml $( ALLSGML )
$( XMLLINT) $( XMLINCLUDE) --output $@ --noent --valid $<
2000-11-05 22:04:07 +01:00
##
## Man pages
##
1998-03-01 21:44:37 +01:00
2010-03-30 02:10:46 +02:00
man distprep-man : man -stamp
1998-03-01 21:44:37 +01:00
2022-09-14 17:55:22 +02:00
man-stamp : stylesheet -man .xsl postgres -full .xml
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_MAN_FLAGS) $^
2009-08-05 00:04:37 +02:00
touch $@
1998-03-01 21:44:37 +01:00
2000-11-05 22:04:07 +01:00
##
2017-04-07 04:03:52 +02:00
## common files
2000-11-05 22:04:07 +01:00
##
2009-08-17 23:29:30 +02:00
# Technically, this should depend on Makefile.global, but then
# version.sgml would need to be rebuilt after every configure run,
# even in distribution tarballs. So this is cheating a bit, but it
# will achieve the goal of updating the version number when it
# changes.
2009-08-28 22:26:19 +02:00
version.sgml : $( top_srcdir ) /configure
2002-10-12 18:34:28 +02:00
{ \
2011-04-04 22:07:53 +02:00
echo " <!ENTITY version \" $( VERSION) \"> " ; \
echo " <!ENTITY majorversion \" $( MAJORVERSION) \"> " ; \
2010-06-12 17:42:44 +02:00
} > $@
2002-10-12 18:34:28 +02:00
2009-08-28 22:26:19 +02:00
features-supported.sgml : $( top_srcdir ) /src /backend /catalog /sql_feature_packages .txt $( top_srcdir ) /src /backend /catalog /sql_features .txt
2003-01-15 00:19:34 +01:00
$( PERL) $( srcdir) /mk_feature_tables.pl YES $^ > $@
2009-08-28 22:26:19 +02:00
features-unsupported.sgml : $( top_srcdir ) /src /backend /catalog /sql_feature_packages .txt $( top_srcdir ) /src /backend /catalog /sql_features .txt
2003-01-15 00:19:34 +01:00
$( PERL) $( srcdir) /mk_feature_tables.pl NO $^ > $@
2011-02-04 04:32:49 +01:00
errcodes-table.sgml : $( top_srcdir ) /src /backend /utils /errcodes .txt generate -errcodes -table .pl
$( PERL) $( srcdir) /generate-errcodes-table.pl $< > $@
1998-03-01 21:44:37 +01:00
2019-05-07 15:29:39 +02:00
keywords-table.sgml : $( top_srcdir ) /src /include /parser /kwlist .h $( wildcard $ ( srcdir ) /keywords /sql *.txt ) generate -keywords -table .pl
$( PERL) $( srcdir) /generate-keywords-table.pl $( srcdir) > $@
2001-11-09 00:46:29 +01:00
2000-11-05 22:04:07 +01:00
##
2017-02-27 16:44:59 +01:00
## Generation of some text files.
2000-11-05 22:04:07 +01:00
##
2000-10-17 17:26:40 +02:00
2011-06-19 22:27:56 +02:00
ICONV = iconv
2019-01-11 12:02:48 +01:00
PANDOC = pandoc
2014-02-11 02:48:04 +01:00
INSTALL : % : %.html
2019-01-13 10:50:36 +01:00
$( PANDOC) -t plain -o $@ .tmp $<
$( ICONV) -f utf8 -t us-ascii//TRANSLIT $@ .tmp > $@
rm $@ .tmp
2000-07-21 02:44:13 +02:00
2017-02-27 16:44:59 +01:00
INSTALL.html : %.html : stylesheet -text .xsl %.xml
$( XMLLINT) --noout --valid $* .xml
$( XSLTPROC) $( XSLTPROCFLAGS) $( XSLTPROC_HTML_FLAGS) $^ >$@
2022-09-14 17:55:22 +02:00
INSTALL.xml : standalone -profile .xsl standalone -install .xml postgres -full .xml
2017-11-23 15:39:47 +01:00
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) --xinclude $( wordlist 1,2,$^) >$@
2004-01-13 19:45:19 +01:00
2017-04-07 04:03:52 +02:00
##
## HTML
##
2013-11-29 04:45:08 +01:00
i f e q ( $( STYLE ) , w e b s i t e )
XSLTPROC_HTML_FLAGS += --param website.stylesheet 1
e n d i f
2016-11-08 18:00:00 +01:00
html : html -stamp
2012-11-13 03:42:25 +01:00
2022-09-14 17:55:22 +02:00
html-stamp : stylesheet .xsl postgres -full .xml $( ALL_IMAGES )
2017-11-23 15:39:47 +01:00
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_HTML_FLAGS) $( wordlist 1,2,$^)
2012-11-13 03:42:25 +01:00
touch $@
2004-01-13 19:45:19 +01:00
2017-04-07 04:03:52 +02:00
# single-page HTML
2022-09-14 17:55:22 +02:00
postgres.html : stylesheet -html -nochunk .xsl postgres -full .xml $( ALL_IMAGES )
2017-11-23 15:39:47 +01:00
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_HTML_FLAGS) -o $@ $( wordlist 1,2,$^)
2017-04-07 04:03:52 +02:00
# single-page text
postgres.txt : postgres .html
2019-03-27 21:12:10 +01:00
$( PANDOC) -t plain -o $@ $<
2017-04-07 04:03:52 +02:00
##
## Print
##
postgres.pdf :
$( error Invalid target; use postgres-A4.pdf or postgres-US.pdf as targets)
2019-08-19 10:30:47 +02:00
XSLTPROC_FO_FLAGS += --stringparam img.src.path '$(srcdir)/'
2022-09-14 17:55:22 +02:00
%-A4.fo : stylesheet -fo .xsl %-full .xml
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ $^
2006-12-10 21:46:03 +01:00
2022-09-14 17:55:22 +02:00
%-US.fo : stylesheet -fo .xsl %-full .xml
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $^
2004-11-23 17:27:59 +01:00
2019-03-27 22:57:43 +01:00
%.pdf : %.fo $( ALL_IMAGES )
2017-04-07 04:03:52 +02:00
$( FOP) -fo $< -pdf $@
2013-09-11 16:20:27 +02:00
2017-04-07 04:03:52 +02:00
##
## EPUB
##
2013-09-11 16:20:27 +02:00
2013-02-14 05:12:21 +01:00
epub : postgres .epub
2022-09-14 17:55:22 +02:00
postgres.epub : postgres -full .xml $( ALL_IMAGES )
i f e q ( $( vpath_build ) , y e s )
$( MKDIR_P) images
cp $( ALL_IMAGES) images/
e n d i f
2019-02-21 15:39:37 +01:00
$( DBTOEPUB) -o $@ $<
2013-02-14 05:12:21 +01:00
2006-12-10 02:53:15 +01:00
2006-10-03 23:13:17 +02:00
##
## Experimental Texinfo targets
##
DB2X_TEXIXML = db2x_texixml
DB2X_XSLTPROC = db2x_xsltproc
MAKEINFO = makeinfo
2022-09-14 17:55:22 +02:00
%.texixml : %-full .xml
2006-10-05 04:04:32 +02:00
$( DB2X_XSLTPROC) -s texi -g output-file= $( basename $@ ) $< -o $@
2006-10-03 23:13:17 +02:00
2006-12-10 02:53:15 +01:00
%.texi : %.texixml
2021-08-27 18:15:57 +02:00
$( DB2X_TEXIXML) --encoding= utf-8 $< --to-stdout > $@
2006-12-10 02:53:15 +01:00
%.info : %.texi
$( MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
2004-01-13 19:45:19 +01:00
2000-11-05 22:04:07 +01:00
##
## Check
##
# Quick syntax check without style processing
2017-04-07 04:03:52 +02:00
check : postgres .sgml $( ALLSGML ) check -tabs
2017-11-23 15:39:47 +01:00
$( XMLLINT) $( XMLINCLUDE) --noout --valid $<
2000-11-05 22:04:07 +01:00
2009-08-10 00:47:59 +02:00
##
## Install
##
2016-10-11 17:26:04 +02:00
install : install -html install -man
2009-08-10 00:47:59 +02:00
installdirs :
2009-08-27 00:24:44 +02:00
$( MKDIR_P) '$(DESTDIR)$(htmldir)' /html $( addprefix '$(DESTDIR)$(mandir)' /man, 1 3 $( sqlmansectnum) )
2009-08-10 00:47:59 +02:00
2015-05-07 16:26:08 +02:00
# If the install used a man directory shared with other applications, this will remove all files.
2009-08-10 00:47:59 +02:00
uninstall :
rm -f '$(DESTDIR)$(htmldir)/html/' * $( addprefix '$(DESTDIR)$(mandir)' /man, 1/* 3/* $( sqlmansectnum) /*)
## Install html
install-html : html installdirs
2009-08-28 22:26:19 +02:00
cp -R $( call vpathsearch,html) '$(DESTDIR)$(htmldir)'
2009-08-10 00:47:59 +02:00
## Install man
2009-08-11 23:53:06 +02:00
install-man : man installdirs
2009-08-10 00:47:59 +02:00
sqlmansect ?= 7
sqlmansectnum = $( shell expr X'$(sqlmansect)' : X'\([0-9]\)' )
# Before we install the man pages, we massage the section numbers to
# follow the local conventions.
#
i f e q ( $( sqlmansectnum ) , 7 )
install-man :
2009-08-28 22:26:19 +02:00
cp -R $( foreach dir,man1 man3 man7,$( call vpathsearch,$( dir) ) ) '$(DESTDIR)$(mandir)'
2009-08-10 00:47:59 +02:00
e l s e # sqlmansectnum != 7
fix_sqlmansectnum = sed -e '/^\.TH/s/"7"/"$(sqlmansect)"/' \
-e 's/\\fR(7)/\\fR($(sqlmansectnum))/g' \
-e '1s/^\.so man7/.so man$(sqlmansectnum)/g;1s/^\(\.so.*\)\.7$$/\1.$(sqlmansect)/g'
2010-04-02 16:02:49 +02:00
man : fixed -man -stamp
2009-08-10 00:47:59 +02:00
2010-04-02 16:02:49 +02:00
fixed-man-stamp : man -stamp
@$( MKDIR_P) $( addprefix fixedman/,man1 man3 man$( sqlmansectnum) )
for file in $( call vpathsearch,man1) /*.1; do $( fix_sqlmansectnum) $$ file >fixedman/man1/` basename $$ file` || exit; done
for file in $( call vpathsearch,man3) /*.3; do $( fix_sqlmansectnum) $$ file >fixedman/man3/` basename $$ file` || exit; done
for file in $( call vpathsearch,man7) /*.7; do $( fix_sqlmansectnum) $$ file >fixedman/man$( sqlmansectnum) /` basename $$ file | sed s/\. 7$$ /.$( sqlmansect) /` || exit; done
2009-08-10 00:47:59 +02:00
2010-04-02 16:02:49 +02:00
install-man :
cp -R $( foreach dir,man1 man3 man$( sqlmansectnum) ,fixedman/$( dir) ) '$(DESTDIR)$(mandir)'
2009-08-10 00:47:59 +02:00
clean : clean -man
.PHONY : clean -man
clean-man :
2010-04-02 16:02:49 +02:00
rm -rf fixedman/ fixed-man-stamp
2009-08-10 00:47:59 +02:00
e n d i f # sqlmansectnum != 7
2010-02-05 20:31:18 +01:00
# tabs are harmless, but it is best to avoid them in SGML files
2010-02-05 15:51:50 +01:00
check-tabs :
2017-11-09 23:00:53 +01:00
@( ! grep ' ' $( wildcard $( srcdir) /*.sgml $( srcdir) /ref/*.sgml $( srcdir) /*.xsl) ) || ( echo "Tabs appear in SGML/XML files" 1>& 2; exit 1)
2009-08-10 00:47:59 +02:00
2000-11-05 22:04:07 +01:00
##
## Clean
##
2009-08-12 00:21:51 +02:00
# This allows removing some files from the distribution tarballs while
# keeping the dependencies satisfied.
2017-11-23 15:39:47 +01:00
.SECONDARY : $( GENERATED_SGML )
2022-09-14 17:55:22 +02:00
.SECONDARY : postgres -full .xml
2017-02-27 16:44:59 +01:00
.SECONDARY : INSTALL .html INSTALL .xml
2017-04-07 04:03:52 +02:00
.SECONDARY : postgres -A 4.fo postgres -US .fo
2009-08-12 00:21:51 +02:00
2009-08-15 03:56:35 +02:00
clean :
# text --- these are shipped, but not in this directory
2014-02-11 02:48:04 +01:00
rm -f INSTALL
2017-02-27 16:44:59 +01:00
rm -f INSTALL.html INSTALL.xml
2010-06-12 23:40:31 +02:00
# single-page output
rm -f postgres.html postgres.txt
2000-11-05 22:04:07 +01:00
# print
2017-04-07 04:03:52 +02:00
rm -f *.fo *.pdf
# generated SGML files
rm -f $( GENERATED_SGML)
2022-09-14 17:55:22 +02:00
rm -f postgres-full.xml
2013-02-14 05:12:21 +01:00
# EPUB
rm -f postgres.epub
2006-10-03 23:13:17 +02:00
# Texinfo
2009-10-06 22:00:44 +02:00
rm -f *.texixml *.texi *.info db2texi.refs
distclean : clean
2009-08-15 03:56:35 +02:00
maintainer-clean : distclean
2009-10-06 02:54:26 +02:00
# HTML
rm -fr html/ html-stamp
# man
rm -rf man1/ man3/ man7/ man-stamp