mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
A PostgreSQL release tarball contains a number of prebuilt files, in particular files produced by bison, flex, perl, and well as html and man documentation. We have done this consistent with established practice at the time to not require these tools for building from a tarball. Some of these tools were hard to get, or get the right version of, from time to time, and shipping the prebuilt output was a convenience to users. Now this has at least two problems: One, we have to make the build system(s) work in two modes: Building from a git checkout and building from a tarball. This is pretty complicated, but it works so far for autoconf/make. It does not currently work for meson; you can currently only build with meson from a git checkout. Making meson builds work from a tarball seems very difficult or impossible. One particular problem is that since meson requires a separate build directory, we cannot make the build update files like gram.h in the source tree. So if you were to build from a tarball and update gram.y, you will have a gram.h in the source tree and one in the build tree, but the way things work is that the compiler will always use the one in the source tree. So you cannot, for example, make any gram.y changes when building from a tarball. This seems impossible to fix in a non-horrible way. Second, there is increased interest nowadays in precisely tracking the origin of software. We can reasonably track contributions into the git tree, and users can reasonably track the path from a tarball to packages and downloads and installs. But what happens between the git tree and the tarball is obscure and in some cases non-reproducible. The solution for both of these issues is to get rid of the step that adds prebuilt files to the tarball. The tarball now only contains what is in the git tree (*). Getting the additional build dependencies is no longer a problem nowadays, and the complications to keep these dual build modes working are significant. And of course we want to get the meson build system working universally. This commit removes the make distprep target altogether. The make dist target continues to do its job, it just doesn't call distprep anymore. (*) - The tarball also contains the INSTALL file that is built at make dist time, but not by distprep. This is unchanged for now. The make maintainer-clean target, whose job it is to remove the prebuilt files in addition to what make distclean does, is now just an alias to make distprep. (In practice, it is probably obsolete given that git clean is available.) The following programs are now hard build requirements in configure (they were already required by meson.build): - bison - flex - perl Reviewed-by: Michael Paquier <michael@paquier.xyz> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
308 lines
8.0 KiB
Makefile
308 lines
8.0 KiB
Makefile
#----------------------------------------------------------------------------
|
|
#
|
|
# PostgreSQL documentation makefile
|
|
#
|
|
# doc/src/sgml/Makefile
|
|
#
|
|
#----------------------------------------------------------------------------
|
|
|
|
# This makefile is for building and installing the documentation.
|
|
# In Git-based trees these files
|
|
# 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:
|
|
|
|
# We don't need the tree-wide headers or install support here.
|
|
NO_GENERATED_HEADERS=yes
|
|
NO_TEMP_INSTALL=yes
|
|
|
|
subdir = doc/src/sgml
|
|
top_builddir = ../../..
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
|
|
all: html man
|
|
|
|
|
|
ifndef DBTOEPUB
|
|
DBTOEPUB = $(missing) dbtoepub
|
|
endif
|
|
|
|
ifndef FOP
|
|
FOP = $(missing) fop
|
|
endif
|
|
|
|
XMLINCLUDE = --path . --path $(srcdir)
|
|
|
|
ifdef XMLLINT
|
|
XMLLINT := $(XMLLINT) --nonet
|
|
else
|
|
XMLLINT = $(missing) xmllint
|
|
endif
|
|
|
|
ifdef XSLTPROC
|
|
XSLTPROC := $(XSLTPROC) --nonet
|
|
else
|
|
XSLTPROC = $(missing) xsltproc
|
|
endif
|
|
|
|
override XSLTPROCFLAGS += --stringparam pg.version '$(VERSION)'
|
|
|
|
|
|
GENERATED_SGML = version.sgml \
|
|
features-supported.sgml features-unsupported.sgml errcodes-table.sgml \
|
|
keywords-table.sgml wait_event_types.sgml
|
|
|
|
ALLSGML := $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml) $(GENERATED_SGML)
|
|
|
|
ALL_IMAGES := $(wildcard $(srcdir)/images/*.svg)
|
|
|
|
|
|
# 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 $<
|
|
|
|
|
|
##
|
|
## Man pages
|
|
##
|
|
|
|
man: man-stamp
|
|
|
|
man-stamp: stylesheet-man.xsl postgres-full.xml
|
|
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_MAN_FLAGS) $^
|
|
touch $@
|
|
|
|
|
|
##
|
|
## common files
|
|
##
|
|
|
|
# Technically, this should depend on Makefile.global, but then
|
|
# version.sgml would need to be rebuilt after every configure run. So
|
|
# this is cheating a bit, but it will achieve the goal of updating the
|
|
# version number when it changes.
|
|
version.sgml: $(top_srcdir)/configure
|
|
{ \
|
|
echo "<!ENTITY version \"$(VERSION)\">"; \
|
|
echo "<!ENTITY majorversion \"$(MAJORVERSION)\">"; \
|
|
} > $@
|
|
|
|
features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
|
|
$(PERL) $(srcdir)/mk_feature_tables.pl YES $^ > $@
|
|
|
|
features-unsupported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt
|
|
$(PERL) $(srcdir)/mk_feature_tables.pl NO $^ > $@
|
|
|
|
errcodes-table.sgml: $(top_srcdir)/src/backend/utils/errcodes.txt generate-errcodes-table.pl
|
|
$(PERL) $(srcdir)/generate-errcodes-table.pl $< > $@
|
|
|
|
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) > $@
|
|
|
|
wait_event_types.sgml: $(top_srcdir)/src/backend/utils/activity/wait_event_names.txt $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl
|
|
$(PERL) $(top_srcdir)/src/backend/utils/activity/generate-wait_event_types.pl --docs $<
|
|
|
|
##
|
|
## Generation of some text files.
|
|
##
|
|
|
|
ICONV = iconv
|
|
PANDOC = pandoc
|
|
|
|
INSTALL: % : %.html
|
|
$(PANDOC) -t plain -o $@.tmp $<
|
|
$(ICONV) -f utf8 -t us-ascii//TRANSLIT $@.tmp > $@
|
|
rm $@.tmp
|
|
|
|
INSTALL.html: %.html : stylesheet-text.xsl %.xml
|
|
$(XMLLINT) --noout --valid $*.xml
|
|
$(XSLTPROC) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $^ >$@
|
|
|
|
INSTALL.xml: standalone-profile.xsl standalone-install.xml postgres-full.xml
|
|
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) --xinclude $(wordlist 1,2,$^) >$@
|
|
|
|
|
|
##
|
|
## HTML
|
|
##
|
|
|
|
ifeq ($(STYLE),website)
|
|
XSLTPROC_HTML_FLAGS += --param website.stylesheet 1
|
|
endif
|
|
|
|
html: html-stamp
|
|
|
|
html-stamp: stylesheet.xsl postgres-full.xml $(ALL_IMAGES)
|
|
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) $(wordlist 1,2,$^)
|
|
touch $@
|
|
|
|
# single-page HTML
|
|
postgres.html: stylesheet-html-nochunk.xsl postgres-full.xml $(ALL_IMAGES)
|
|
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_HTML_FLAGS) -o $@ $(wordlist 1,2,$^)
|
|
|
|
# single-page text
|
|
postgres.txt: postgres.html
|
|
$(PANDOC) -t plain -o $@ $<
|
|
|
|
|
|
##
|
|
## Print
|
|
##
|
|
|
|
postgres.pdf:
|
|
$(error Invalid target; use postgres-A4.pdf or postgres-US.pdf as targets)
|
|
|
|
XSLTPROC_FO_FLAGS += --stringparam img.src.path '$(srcdir)/'
|
|
|
|
%-A4.fo: stylesheet-fo.xsl %-full.xml
|
|
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type A4 -o $@ $^
|
|
|
|
%-US.fo: stylesheet-fo.xsl %-full.xml
|
|
$(XSLTPROC) $(XMLINCLUDE) $(XSLTPROCFLAGS) $(XSLTPROC_FO_FLAGS) --stringparam paper.type USletter -o $@ $^
|
|
|
|
%.pdf: %.fo $(ALL_IMAGES)
|
|
$(FOP) -fo $< -pdf $@
|
|
|
|
|
|
##
|
|
## EPUB
|
|
##
|
|
|
|
epub: postgres.epub
|
|
postgres.epub: postgres-full.xml $(ALL_IMAGES)
|
|
ifeq ($(vpath_build),yes)
|
|
$(MKDIR_P) images
|
|
cp $(ALL_IMAGES) images/
|
|
endif
|
|
$(DBTOEPUB) -o $@ $<
|
|
|
|
|
|
##
|
|
## Experimental Texinfo targets
|
|
##
|
|
|
|
DB2X_TEXIXML = db2x_texixml
|
|
DB2X_XSLTPROC = db2x_xsltproc
|
|
MAKEINFO = makeinfo
|
|
|
|
%.texixml: %-full.xml
|
|
$(DB2X_XSLTPROC) -s texi -g output-file=$(basename $@) $< -o $@
|
|
|
|
%.texi: %.texixml
|
|
$(DB2X_TEXIXML) --encoding=utf-8 $< --to-stdout > $@
|
|
|
|
%.info: %.texi
|
|
$(MAKEINFO) --enable-encoding --no-split --no-validate $< -o $@
|
|
|
|
|
|
##
|
|
## Check
|
|
##
|
|
|
|
# Quick syntax check without style processing
|
|
check: postgres.sgml $(ALLSGML) check-tabs
|
|
$(XMLLINT) $(XMLINCLUDE) --noout --valid $<
|
|
|
|
|
|
##
|
|
## Install
|
|
##
|
|
|
|
install: install-html install-man
|
|
|
|
installdirs:
|
|
$(MKDIR_P) '$(DESTDIR)$(htmldir)'/html $(addprefix '$(DESTDIR)$(mandir)'/man, 1 3 $(sqlmansectnum))
|
|
|
|
# If the install used a man directory shared with other applications, this will remove all files.
|
|
uninstall:
|
|
rm -f '$(DESTDIR)$(htmldir)/html/'* $(addprefix '$(DESTDIR)$(mandir)'/man, 1/* 3/* $(sqlmansectnum)/*)
|
|
|
|
|
|
## Install html
|
|
|
|
install-html: html installdirs
|
|
cp -R $(call vpathsearch,html) '$(DESTDIR)$(htmldir)'
|
|
|
|
|
|
## Install man
|
|
|
|
install-man: man installdirs
|
|
|
|
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.
|
|
#
|
|
ifeq ($(sqlmansectnum),7)
|
|
install-man:
|
|
cp -R $(foreach dir,man1 man3 man7,$(call vpathsearch,$(dir))) '$(DESTDIR)$(mandir)'
|
|
|
|
else # 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'
|
|
|
|
man: fixed-man-stamp
|
|
|
|
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
|
|
|
|
install-man:
|
|
cp -R $(foreach dir,man1 man3 man$(sqlmansectnum),fixedman/$(dir)) '$(DESTDIR)$(mandir)'
|
|
|
|
clean: clean-man
|
|
.PHONY: clean-man
|
|
clean-man:
|
|
rm -rf fixedman/ fixed-man-stamp
|
|
|
|
endif # sqlmansectnum != 7
|
|
|
|
# tabs are harmless, but it is best to avoid them in SGML files
|
|
check-tabs:
|
|
@( ! grep ' ' $(wildcard $(srcdir)/*.sgml $(srcdir)/ref/*.sgml $(srcdir)/*.xsl) ) || (echo "Tabs appear in SGML/XML files" 1>&2; exit 1)
|
|
|
|
##
|
|
## Clean
|
|
##
|
|
|
|
# This allows removing some files from the distribution tarballs while
|
|
# keeping the dependencies satisfied.
|
|
.SECONDARY: $(GENERATED_SGML)
|
|
.SECONDARY: postgres-full.xml
|
|
.SECONDARY: INSTALL.html INSTALL.xml
|
|
.SECONDARY: postgres-A4.fo postgres-US.fo
|
|
|
|
clean:
|
|
# text --- these are shipped, but not in this directory
|
|
rm -f INSTALL
|
|
rm -f INSTALL.html INSTALL.xml
|
|
# single-page output
|
|
rm -f postgres.html postgres.txt
|
|
# print
|
|
rm -f *.fo *.pdf
|
|
# generated SGML files
|
|
rm -f $(GENERATED_SGML)
|
|
rm -f postgres-full.xml
|
|
# EPUB
|
|
rm -f postgres.epub
|
|
# Texinfo
|
|
rm -f *.texixml *.texi *.info db2texi.refs
|
|
|
|
distclean: clean
|
|
# HTML
|
|
rm -fr html/ html-stamp
|
|
# man
|
|
rm -rf man1/ man3/ man7/ man-stamp
|