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
2017-11-23 15:39:47 +01:00
XMLINCLUDE = --path .
1998-07-29 08:29:04 +02:00
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
i f n d e f X M L L I N T
XMLLINT = $( missing) xmllint
e n d i f
2009-08-05 00:04:37 +02:00
i f n d e f X S L T P R O C
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
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
2017-11-23 15:39:47 +01:00
man-stamp : stylesheet -man .xsl postgres .sgml $( ALLSGML )
$( XMLLINT) $( XMLINCLUDE) --noout --valid $( word 2,$^)
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_MAN_FLAGS) $( wordlist 1,2,$^)
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) $^ >$@
2017-11-23 15:39:47 +01:00
INSTALL.xml : standalone -profile .xsl standalone -install .xml postgres .sgml $( ALLSGML )
$( 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
2019-03-27 22:57:43 +01:00
html-stamp : stylesheet .xsl postgres .sgml $( ALLSGML ) $( ALL_IMAGES )
2017-11-23 15:39:47 +01:00
$( XMLLINT) $( XMLINCLUDE) --noout --valid $( word 2,$^)
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_HTML_FLAGS) $( wordlist 1,2,$^)
2019-03-27 22:57:43 +01:00
cp $( ALL_IMAGES) html/
2012-11-13 03:42:25 +01:00
cp $( srcdir) /stylesheet.css html/
touch $@
2004-01-13 19:45:19 +01:00
2019-03-27 22:03:10 +01:00
htmlhelp : htmlhelp -stamp
2019-03-27 22:57:43 +01:00
htmlhelp-stamp : stylesheet -hh .xsl postgres .sgml $( ALLSGML ) $( ALL_IMAGES )
2017-11-23 15:39:47 +01:00
$( XMLLINT) $( XMLINCLUDE) --noout --valid $( word 2,$^)
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( wordlist 1,2,$^)
2019-03-27 22:57:43 +01:00
cp $( ALL_IMAGES) htmlhelp/
2019-03-27 22:03:10 +01:00
cp $( srcdir) /stylesheet.css htmlhelp/
touch $@
2006-12-10 17:01:06 +01:00
2017-04-07 04:03:52 +02:00
# single-page HTML
2019-03-27 22:57:43 +01:00
postgres.html : stylesheet -html -nochunk .xsl postgres .sgml $( ALLSGML ) $( ALL_IMAGES )
2017-11-23 15:39:47 +01:00
$( XMLLINT) $( XMLINCLUDE) --noout --valid $( word 2,$^)
$( 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)/'
2017-11-23 15:39:47 +01:00
%-A4.fo : stylesheet -fo .xsl %.sgml $( ALLSGML )
$( XMLLINT) $( XMLINCLUDE) --noout --valid $( word 2,$^)
2019-08-19 10:30:47 +02:00
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ $( wordlist 1,2,$^)
2006-12-10 21:46:03 +01:00
2017-11-23 15:39:47 +01:00
%-US.fo : stylesheet -fo .xsl %.sgml $( ALLSGML )
$( XMLLINT) $( XMLINCLUDE) --noout --valid $( word 2,$^)
2019-08-19 10:30:47 +02:00
$( XSLTPROC) $( XMLINCLUDE) $( XSLTPROCFLAGS) $( XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $( wordlist 1,2,$^)
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
2019-03-27 22:57:43 +01:00
postgres.epub : postgres .sgml $( ALLSGML ) $( ALL_IMAGES )
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) --noout --valid $<
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
2017-11-23 15:39:47 +01:00
%.texixml : %.sgml $( ALLSGML )
$( XMLLINT) --noout --valid $<
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 )
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)
# HTML Help
2019-03-27 22:03:10 +01:00
rm -rf htmlhelp/ htmlhelp-stamp
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