2004-07-30 14:26:40 +02:00
|
|
|
# PGXS: PostgreSQL extensions makefile
|
|
|
|
|
2010-11-23 21:27:50 +01:00
|
|
|
# src/makefiles/pgxs.mk
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
# This file contains generic rules to build many kinds of simple
|
|
|
|
# extension modules. You only need to set a few variables and include
|
|
|
|
# this file, the rest will be done here.
|
|
|
|
#
|
|
|
|
# Use the following layout for your Makefile:
|
|
|
|
#
|
|
|
|
# [variable assignments, see below]
|
|
|
|
#
|
2007-06-27 00:05:04 +02:00
|
|
|
# PG_CONFIG = pg_config
|
|
|
|
# PGXS := $(shell $(PG_CONFIG) --pgxs)
|
2004-07-30 14:26:40 +02:00
|
|
|
# include $(PGXS)
|
|
|
|
#
|
2014-11-20 04:21:54 +01:00
|
|
|
# [custom rules, rarely necessary]
|
|
|
|
#
|
2010-01-04 17:34:11 +01:00
|
|
|
# Set one of these three variables to specify what is built:
|
2004-07-30 14:26:40 +02:00
|
|
|
#
|
2011-02-08 22:08:41 +01:00
|
|
|
# MODULES -- list of shared-library objects to be built from source files
|
|
|
|
# with same stem (do not include library suffixes in this list)
|
|
|
|
# MODULE_big -- a shared library to build from multiple source files
|
2010-01-04 17:34:11 +01:00
|
|
|
# (list object files in OBJS)
|
2011-02-08 22:08:41 +01:00
|
|
|
# PROGRAM -- an executable program to build (list object files in OBJS)
|
2010-01-04 17:34:11 +01:00
|
|
|
#
|
|
|
|
# The following variables can also be set:
|
|
|
|
#
|
2011-02-08 22:08:41 +01:00
|
|
|
# EXTENSION -- name of extension (there must be a $EXTENSION.control file)
|
2011-02-12 04:53:43 +01:00
|
|
|
# MODULEDIR -- subdirectory of $PREFIX/share into which DATA and DOCS files
|
|
|
|
# should be installed (if not set, default is "extension" if EXTENSION
|
|
|
|
# is set, or "contrib" if not)
|
2010-01-04 17:34:11 +01:00
|
|
|
# DATA -- random files to install into $PREFIX/share/$MODULEDIR
|
|
|
|
# DATA_built -- random files to install into $PREFIX/share/$MODULEDIR,
|
2004-07-30 14:26:40 +02:00
|
|
|
# which need to be built first
|
2007-10-16 18:00:00 +02:00
|
|
|
# DATA_TSEARCH -- random files to install into $PREFIX/share/tsearch_data
|
2010-01-04 17:34:11 +01:00
|
|
|
# DOCS -- random files to install under $PREFIX/doc/$MODULEDIR
|
2004-07-30 14:26:40 +02:00
|
|
|
# SCRIPTS -- script files (not binaries) to install into $PREFIX/bin
|
|
|
|
# SCRIPTS_built -- script files (not binaries) to install into $PREFIX/bin,
|
|
|
|
# which need to be built first
|
2018-07-31 20:58:39 +02:00
|
|
|
# HEADERS -- files to install into $(includedir_server)/$MODULEDIR/$MODULE_big
|
2018-09-07 14:51:30 +02:00
|
|
|
# HEADERS_built -- as above but built first (but NOT cleaned)
|
2018-07-31 20:58:39 +02:00
|
|
|
# HEADERS_$(MODULE) -- files to install into
|
|
|
|
# $(includedir_server)/$MODULEDIR/$MODULE; the value of $MODULE must be
|
|
|
|
# listed in MODULES or MODULE_big
|
2018-09-07 14:51:30 +02:00
|
|
|
# HEADERS_built_$(MODULE) -- as above but built first (also NOT cleaned)
|
2004-07-30 14:26:40 +02:00
|
|
|
# REGRESS -- list of regression test cases (without suffix)
|
2011-08-24 21:16:17 +02:00
|
|
|
# REGRESS_OPTS -- additional switches to pass to pg_regress
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
# TAP_TESTS -- switch to enable TAP tests
|
|
|
|
# ISOLATION -- list of isolation test cases
|
|
|
|
# ISOLATION_OPTS -- additional switches to pass to pg_isolation_regress
|
2021-05-27 13:58:13 +02:00
|
|
|
# NO_INSTALL -- don't define an install target, useful for test modules
|
|
|
|
# that don't need their build products to be installed
|
2016-11-14 23:53:07 +01:00
|
|
|
# NO_INSTALLCHECK -- don't define an installcheck target, useful e.g. if
|
|
|
|
# tests require special configuration, or don't use pg_regress
|
2004-07-30 14:26:40 +02:00
|
|
|
# EXTRA_CLEAN -- extra files to remove in 'make clean'
|
2019-02-03 09:48:09 +01:00
|
|
|
# PG_CPPFLAGS -- will be prepended to CPPFLAGS
|
|
|
|
# PG_CFLAGS -- will be appended to CFLAGS
|
|
|
|
# PG_CXXFLAGS -- will be appended to CXXFLAGS
|
|
|
|
# PG_LDFLAGS -- will be prepended to LDFLAGS
|
2004-07-30 14:26:40 +02:00
|
|
|
# PG_LIBS -- will be added to PROGRAM link line
|
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches in
link command lines, such that -L switches referring to external directories
could come before those referring to directories within the build tree.
This made it possible to accidentally link a system-supplied library, for
example /usr/lib/libpq.so, in place of the one built in the build tree.
Hilarity ensued, the more so the older the system-supplied library is.
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
and the main LDFLAGS variable, both of which are "recursively expanded"
so that they can be incrementally adjusted by different makefiles.
Establish a policy that -L switches for directories in the build tree
must always be added to LDFLAGS_INTERNAL, while -L switches for external
directories must always be added to LDFLAGS. This is sufficient to
ensure a safe search order. For simplicity, we typically also put -l
switches for the respective libraries into those same variables.
(Traditional make usage would have us put -l switches into LIBS, but
cleaning that up is a project for another day, as there's no clear
need for it.)
This turns out to also require separating SHLIB_LINK into two variables,
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
switches go into which variable. And likewise for PG_LIBS.
Although this change might appear to affect external users of pgxs.mk,
I think it doesn't; they shouldn't have any need to touch the _INTERNAL
variables.
In passing, tweak src/common/Makefile so that the value of CPPFLAGS
recorded in pg_config lacks "-DFRONTEND" and the recorded value of
LDFLAGS lacks "-L../../../src/common". Both of those things are
mistakes, apparently introduced during prior code rearrangements,
as old versions of pg_config don't print them. In general we don't
want anything that's specific to the src/common subdirectory to
appear in those outputs.
This is certainly a bug fix, but in view of the lack of field
complaints, I'm unsure whether it's worth the risk of back-patching.
In any case it seems wise to see what the buildfarm makes of it first.
Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
2018-04-03 22:26:05 +02:00
|
|
|
# PG_LIBS_INTERNAL -- same, for references to libraries within build tree
|
2004-07-30 14:26:40 +02:00
|
|
|
# SHLIB_LINK -- will be added to MODULE_big link line
|
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches in
link command lines, such that -L switches referring to external directories
could come before those referring to directories within the build tree.
This made it possible to accidentally link a system-supplied library, for
example /usr/lib/libpq.so, in place of the one built in the build tree.
Hilarity ensued, the more so the older the system-supplied library is.
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
and the main LDFLAGS variable, both of which are "recursively expanded"
so that they can be incrementally adjusted by different makefiles.
Establish a policy that -L switches for directories in the build tree
must always be added to LDFLAGS_INTERNAL, while -L switches for external
directories must always be added to LDFLAGS. This is sufficient to
ensure a safe search order. For simplicity, we typically also put -l
switches for the respective libraries into those same variables.
(Traditional make usage would have us put -l switches into LIBS, but
cleaning that up is a project for another day, as there's no clear
need for it.)
This turns out to also require separating SHLIB_LINK into two variables,
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
switches go into which variable. And likewise for PG_LIBS.
Although this change might appear to affect external users of pgxs.mk,
I think it doesn't; they shouldn't have any need to touch the _INTERNAL
variables.
In passing, tweak src/common/Makefile so that the value of CPPFLAGS
recorded in pg_config lacks "-DFRONTEND" and the recorded value of
LDFLAGS lacks "-L../../../src/common". Both of those things are
mistakes, apparently introduced during prior code rearrangements,
as old versions of pg_config don't print them. In general we don't
want anything that's specific to the src/common subdirectory to
appear in those outputs.
This is certainly a bug fix, but in view of the lack of field
complaints, I'm unsure whether it's worth the risk of back-patching.
In any case it seems wise to see what the buildfarm makes of it first.
Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
2018-04-03 22:26:05 +02:00
|
|
|
# SHLIB_LINK_INTERNAL -- same, for references to libraries within build tree
|
2007-06-27 00:05:04 +02:00
|
|
|
# PG_CONFIG -- path to pg_config program for the PostgreSQL installation
|
|
|
|
# to build against (typically just "pg_config" to use the first one in
|
|
|
|
# your PATH)
|
2004-07-30 14:26:40 +02:00
|
|
|
#
|
|
|
|
# Better look at some of the existing uses for examples...
|
|
|
|
|
|
|
|
ifndef PGXS
|
|
|
|
ifndef NO_PGXS
|
|
|
|
$(error pgxs error: makefile variable PGXS or NO_PGXS must be set)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
ifdef PGXS
|
2018-04-10 18:41:51 +02:00
|
|
|
|
|
|
|
# External extensions must assume generated headers are available
|
|
|
|
NO_GENERATED_HEADERS=yes
|
|
|
|
# The temp-install rule won't work, either
|
|
|
|
NO_TEMP_INSTALL=yes
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
# We assume that we are in src/makefiles/, so top is ...
|
2004-10-06 10:50:02 +02:00
|
|
|
top_builddir := $(dir $(PGXS))../..
|
2004-07-30 14:26:40 +02:00
|
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
|
2012-03-30 19:36:49 +02:00
|
|
|
# These might be set in Makefile.global, but if they were not found
|
|
|
|
# during the build of PostgreSQL, supply default values so that users
|
|
|
|
# of pgxs can use the variables.
|
|
|
|
ifeq ($(BISON),)
|
|
|
|
BISON = bison
|
|
|
|
endif
|
|
|
|
ifeq ($(FLEX),)
|
|
|
|
FLEX = flex
|
|
|
|
endif
|
2018-04-10 18:41:51 +02:00
|
|
|
|
|
|
|
endif # PGXS
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
|
2010-01-05 04:56:52 +01:00
|
|
|
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)
|
2004-07-30 14:26:40 +02:00
|
|
|
|
Default to hidden visibility for extension libraries where possible
Until now postgres built extension libraries with global visibility, i.e.
exporting all symbols. On the one platform where that behavior is not
natively available, namely windows, we emulate it by analyzing the input files
to the shared library and exporting all the symbols therein.
Not exporting all symbols is actually desirable, as it can improve loading
speed, reduces the likelihood of symbol conflicts and can improve intra
extension library function call performance. It also makes the non-windows
builds more similar to windows builds.
Additionally, with meson implementing the export-all-symbols behavior for
windows, turns out to be more verbose than desirable.
This patch adds support for hiding symbols by default and, to counteract that,
explicit symbol visibility annotation for compilers that support
__attribute__((visibility("default"))) and -fvisibility=hidden. That is
expected to be most, if not all, compilers except msvc (for which we already
support explicit symbol export annotations).
Now that extension library symbols are explicitly exported, we don't need to
export all symbols on windows anymore, hence remove that behavior from
src/tools/msvc. The supporting code can't be removed, as we still need to
export all symbols from the main postgres binary.
Author: Andres Freund <andres@anarazel.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
2022-07-18 02:49:51 +02:00
|
|
|
# See equivalent block in Makefile.shlib
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef MODULES
|
Default to hidden visibility for extension libraries where possible
Until now postgres built extension libraries with global visibility, i.e.
exporting all symbols. On the one platform where that behavior is not
natively available, namely windows, we emulate it by analyzing the input files
to the shared library and exporting all the symbols therein.
Not exporting all symbols is actually desirable, as it can improve loading
speed, reduces the likelihood of symbol conflicts and can improve intra
extension library function call performance. It also makes the non-windows
builds more similar to windows builds.
Additionally, with meson implementing the export-all-symbols behavior for
windows, turns out to be more verbose than desirable.
This patch adds support for hiding symbols by default and, to counteract that,
explicit symbol visibility annotation for compilers that support
__attribute__((visibility("default"))) and -fvisibility=hidden. That is
expected to be most, if not all, compilers except msvc (for which we already
support explicit symbol export annotations).
Now that extension library symbols are explicitly exported, we don't need to
export all symbols on windows anymore, hence remove that behavior from
src/tools/msvc. The supporting code can't be removed, as we still need to
export all symbols from the main postgres binary.
Author: Andres Freund <andres@anarazel.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
2022-07-18 02:49:51 +02:00
|
|
|
override LDFLAGS_SL += $(CFLAGS_SL_MODULE)
|
|
|
|
override CFLAGS += $(CFLAGS_SL) $(CFLAGS_SL_MODULE)
|
|
|
|
override CXXFLAGS += $(CFLAGS_SL) $(CXXFLAGS_SL_MODULE)
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
|
2010-01-04 17:34:11 +01:00
|
|
|
ifdef MODULEDIR
|
2011-02-12 04:53:43 +01:00
|
|
|
datamoduledir := $(MODULEDIR)
|
|
|
|
docmoduledir := $(MODULEDIR)
|
2018-07-31 20:58:39 +02:00
|
|
|
incmoduledir := $(MODULEDIR)
|
2010-01-04 17:34:11 +01:00
|
|
|
else
|
2011-02-12 04:53:43 +01:00
|
|
|
ifdef EXTENSION
|
|
|
|
datamoduledir := extension
|
|
|
|
docmoduledir := extension
|
2018-07-31 20:58:39 +02:00
|
|
|
incmoduledir := extension
|
2011-02-12 04:53:43 +01:00
|
|
|
else
|
|
|
|
datamoduledir := contrib
|
|
|
|
docmoduledir := contrib
|
2018-07-31 20:58:39 +02:00
|
|
|
incmoduledir := contrib
|
2011-02-12 04:53:43 +01:00
|
|
|
endif
|
2010-01-04 17:34:11 +01:00
|
|
|
endif
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef PG_CPPFLAGS
|
|
|
|
override CPPFLAGS := $(PG_CPPFLAGS) $(CPPFLAGS)
|
|
|
|
endif
|
2019-02-03 09:48:09 +01:00
|
|
|
ifdef PG_CFLAGS
|
|
|
|
override CFLAGS := $(CFLAGS) $(PG_CFLAGS)
|
|
|
|
endif
|
|
|
|
ifdef PG_CXXFLAGS
|
|
|
|
override CXXFLAGS := $(CXXFLAGS) $(PG_CXXFLAGS)
|
|
|
|
endif
|
|
|
|
ifdef PG_LDFLAGS
|
|
|
|
override LDFLAGS := $(PG_LDFLAGS) $(LDFLAGS)
|
|
|
|
endif
|
2004-07-30 14:26:40 +02:00
|
|
|
|
2018-09-07 14:51:30 +02:00
|
|
|
# logic for HEADERS_* stuff
|
|
|
|
|
2018-09-05 23:01:21 +02:00
|
|
|
# get list of all names used with or without built_ prefix
|
|
|
|
# note that use of HEADERS_built_foo will get both "foo" and "built_foo",
|
|
|
|
# we cope with that later when filtering this list against MODULES.
|
|
|
|
# If someone wants to name a module "built_foo", they can do that and it
|
|
|
|
# works, but if they have MODULES = foo built_foo then they will need to
|
|
|
|
# force building of all headers and use HEADERS_built_foo and
|
|
|
|
# HEADERS_built_built_foo.
|
2018-07-31 20:58:39 +02:00
|
|
|
HEADER_alldirs := $(patsubst HEADERS_%,%,$(filter HEADERS_%, $(.VARIABLES)))
|
2018-09-05 23:01:21 +02:00
|
|
|
HEADER_alldirs += $(patsubst HEADERS_built_%,%,$(filter HEADERS_built_%, $(.VARIABLES)))
|
|
|
|
|
|
|
|
# collect all names of built headers to use as a dependency
|
2018-09-07 14:51:30 +02:00
|
|
|
HEADER_allbuilt :=
|
2018-07-31 20:58:39 +02:00
|
|
|
|
|
|
|
ifdef MODULE_big
|
2018-09-07 14:51:30 +02:00
|
|
|
|
|
|
|
# we can unconditionally add $(MODULE_big) here, because we will strip it
|
|
|
|
# back out below if it turns out not to actually define any headers.
|
2018-07-31 20:58:39 +02:00
|
|
|
HEADER_dirs := $(MODULE_big)
|
2018-09-05 23:01:21 +02:00
|
|
|
HEADER_unbuilt_$(MODULE_big) = $(HEADERS)
|
|
|
|
HEADER_built_$(MODULE_big) = $(HEADERS_built)
|
|
|
|
HEADER_allbuilt += $(HEADERS_built)
|
2018-09-07 14:51:30 +02:00
|
|
|
# treat "built" as an exclusion below as well as "built_foo"
|
|
|
|
HEADER_xdirs := built built_$(MODULE_big)
|
|
|
|
|
|
|
|
else # not MODULE_big, so check MODULES
|
|
|
|
|
|
|
|
# HEADERS is an error in the absence of MODULE_big to provide a dir name
|
2018-07-31 20:58:39 +02:00
|
|
|
ifdef HEADERS
|
|
|
|
$(error HEADERS requires MODULE_big to be set)
|
|
|
|
endif
|
2018-09-05 23:01:21 +02:00
|
|
|
# make list of modules that have either HEADERS_foo or HEADERS_built_foo
|
|
|
|
HEADER_dirs := $(foreach m,$(MODULES),$(if $(filter $(m) built_$(m),$(HEADER_alldirs)),$(m)))
|
2018-09-07 14:51:30 +02:00
|
|
|
# make list of conflicting names to exclude
|
|
|
|
HEADER_xdirs := $(addprefix built_,$(HEADER_dirs))
|
|
|
|
|
|
|
|
endif # MODULE_big or MODULES
|
|
|
|
|
|
|
|
# HEADERS_foo requires that "foo" is in MODULES as a sanity check
|
|
|
|
ifneq (,$(filter-out $(HEADER_dirs) $(HEADER_xdirs),$(HEADER_alldirs)))
|
|
|
|
$(error $(patsubst %,HEADERS_%,$(filter-out $(HEADER_dirs) $(HEADER_xdirs),$(HEADER_alldirs))) defined with no module)
|
|
|
|
endif
|
|
|
|
|
2018-09-05 23:01:21 +02:00
|
|
|
# assign HEADER_unbuilt_foo and HEADER_built_foo, but make sure
|
|
|
|
# that "built" takes precedence in the case of conflict, by removing
|
|
|
|
# conflicting module names when matching the unbuilt name
|
2018-09-07 14:51:30 +02:00
|
|
|
$(foreach m,$(filter-out $(HEADER_xdirs),$(HEADER_dirs)),$(eval HEADER_unbuilt_$(m) += $$(HEADERS_$(m))))
|
|
|
|
$(foreach m,$(HEADER_dirs),$(eval HEADER_built_$(m) += $$(HEADERS_built_$(m))))
|
|
|
|
$(foreach m,$(HEADER_dirs),$(eval HEADER_allbuilt += $$(HEADERS_built_$(m))))
|
2018-07-31 20:58:39 +02:00
|
|
|
|
2018-09-07 14:51:30 +02:00
|
|
|
# expand out the list of headers for each dir, attaching source prefixes
|
|
|
|
header_file_list = $(HEADER_built_$(1)) $(addprefix $(srcdir)/,$(HEADER_unbuilt_$(1)))
|
|
|
|
$(foreach m,$(HEADER_dirs),$(eval HEADER_files_$(m) := $$(call header_file_list,$$(m))))
|
|
|
|
|
|
|
|
# note that the caller's HEADERS* vars have all been expanded now, and
|
|
|
|
# later changes will have no effect.
|
|
|
|
|
|
|
|
# remove entries in HEADER_dirs that produced an empty list of files,
|
|
|
|
# to ensure we don't try and install them
|
|
|
|
HEADER_dirs := $(foreach m,$(HEADER_dirs),$(if $(strip $(HEADER_files_$(m))),$(m)))
|
2018-07-31 20:58:39 +02:00
|
|
|
|
|
|
|
# Functions for generating install/uninstall commands; the blank lines
|
|
|
|
# before the "endef" are required, don't lose them
|
|
|
|
# $(call install_headers,dir,headers)
|
|
|
|
define install_headers
|
|
|
|
$(MKDIR_P) '$(DESTDIR)$(includedir_server)/$(incmoduledir)/$(1)/'
|
2018-09-05 23:01:21 +02:00
|
|
|
$(INSTALL_DATA) $(2) '$(DESTDIR)$(includedir_server)/$(incmoduledir)/$(1)/'
|
2018-07-31 20:58:39 +02:00
|
|
|
|
|
|
|
endef
|
|
|
|
# $(call uninstall_headers,dir,headers)
|
|
|
|
define uninstall_headers
|
|
|
|
rm -f $(addprefix '$(DESTDIR)$(includedir_server)/$(incmoduledir)/$(1)'/, $(notdir $(2)))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2018-09-07 14:51:30 +02:00
|
|
|
# end of HEADERS_* stuff
|
|
|
|
|
2018-07-31 20:58:39 +02:00
|
|
|
|
2018-09-05 23:01:21 +02:00
|
|
|
all: $(PROGRAM) $(DATA_built) $(HEADER_allbuilt) $(SCRIPTS_built) $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .control, $(EXTENSION))
|
2004-07-30 14:26:40 +02:00
|
|
|
|
2018-03-28 22:19:08 +02:00
|
|
|
ifeq ($(with_llvm), yes)
|
|
|
|
all: $(addsuffix .bc, $(MODULES)) $(patsubst %.o,%.bc, $(OBJS))
|
|
|
|
endif
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef MODULE_big
|
|
|
|
# shared library parameters
|
|
|
|
NAME = $(MODULE_big)
|
|
|
|
|
|
|
|
include $(top_srcdir)/src/Makefile.shlib
|
|
|
|
|
|
|
|
all: all-lib
|
|
|
|
endif # MODULE_big
|
|
|
|
|
|
|
|
|
2021-05-27 13:58:13 +02:00
|
|
|
ifndef NO_INSTALL
|
|
|
|
|
2014-11-20 04:26:32 +01:00
|
|
|
install: all installdirs
|
2013-07-01 18:53:05 +02:00
|
|
|
ifneq (,$(EXTENSION))
|
2014-11-20 04:26:32 +01:00
|
|
|
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(addsuffix .control, $(EXTENSION))) '$(DESTDIR)$(datadir)/extension/'
|
|
|
|
endif # EXTENSION
|
2013-07-01 18:53:05 +02:00
|
|
|
ifneq (,$(DATA)$(DATA_built))
|
2014-11-20 04:26:32 +01:00
|
|
|
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) $(DATA_built) '$(DESTDIR)$(datadir)/$(datamoduledir)/'
|
|
|
|
endif # DATA
|
2013-07-01 18:53:05 +02:00
|
|
|
ifneq (,$(DATA_TSEARCH))
|
2014-11-20 04:26:32 +01:00
|
|
|
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA_TSEARCH)) '$(DESTDIR)$(datadir)/tsearch_data/'
|
|
|
|
endif # DATA_TSEARCH
|
|
|
|
ifdef MODULES
|
|
|
|
$(INSTALL_SHLIB) $(addsuffix $(DLSUFFIX), $(MODULES)) '$(DESTDIR)$(pkglibdir)/'
|
2018-03-28 22:19:08 +02:00
|
|
|
ifeq ($(with_llvm), yes)
|
|
|
|
$(foreach mod, $(MODULES), $(call install_llvm_module,$(mod),$(mod).bc))
|
|
|
|
endif # with_llvm
|
2014-11-20 04:26:32 +01:00
|
|
|
endif # MODULES
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef DOCS
|
2005-08-12 23:02:25 +02:00
|
|
|
ifdef docdir
|
2014-11-20 04:26:32 +01:00
|
|
|
$(INSTALL_DATA) $(addprefix $(srcdir)/, $(DOCS)) '$(DESTDIR)$(docdir)/$(docmoduledir)/'
|
2005-08-12 23:02:25 +02:00
|
|
|
endif # docdir
|
2004-07-30 14:26:40 +02:00
|
|
|
endif # DOCS
|
2014-11-20 04:26:32 +01:00
|
|
|
ifdef PROGRAM
|
|
|
|
$(INSTALL_PROGRAM) $(PROGRAM)$(X) '$(DESTDIR)$(bindir)'
|
|
|
|
endif # PROGRAM
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef SCRIPTS
|
2014-11-20 04:26:32 +01:00
|
|
|
$(INSTALL_SCRIPT) $(addprefix $(srcdir)/, $(SCRIPTS)) '$(DESTDIR)$(bindir)/'
|
2004-07-30 14:26:40 +02:00
|
|
|
endif # SCRIPTS
|
2014-11-20 04:26:32 +01:00
|
|
|
ifdef SCRIPTS_built
|
|
|
|
$(INSTALL_SCRIPT) $(SCRIPTS_built) '$(DESTDIR)$(bindir)/'
|
|
|
|
endif # SCRIPTS_built
|
2018-09-07 14:51:30 +02:00
|
|
|
ifneq (,$(strip $(HEADER_dirs)))
|
|
|
|
$(foreach dir,$(HEADER_dirs),$(call install_headers,$(dir),$(HEADER_files_$(dir))))
|
2018-07-31 20:58:39 +02:00
|
|
|
endif # HEADERS
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef MODULE_big
|
2018-03-28 22:19:08 +02:00
|
|
|
ifeq ($(with_llvm), yes)
|
|
|
|
$(call install_llvm_module,$(MODULE_big),$(OBJS))
|
|
|
|
endif # with_llvm
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
install: install-lib
|
|
|
|
endif # MODULE_big
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
installdirs:
|
2012-12-01 22:04:39 +01:00
|
|
|
ifneq (,$(EXTENSION))
|
|
|
|
$(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
|
|
|
|
endif
|
2004-07-30 14:26:40 +02:00
|
|
|
ifneq (,$(DATA)$(DATA_built))
|
2010-01-04 17:34:11 +01:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(datadir)/$(datamoduledir)'
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
2007-10-16 18:00:00 +02:00
|
|
|
ifneq (,$(DATA_TSEARCH))
|
2009-08-27 00:24:44 +02:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(datadir)/tsearch_data'
|
2007-10-16 18:00:00 +02:00
|
|
|
endif
|
2008-04-07 16:15:58 +02:00
|
|
|
ifneq (,$(MODULES))
|
2009-08-27 00:24:44 +02:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
ifdef DOCS
|
2005-08-12 23:02:25 +02:00
|
|
|
ifdef docdir
|
2010-01-04 17:34:11 +01:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(docdir)/$(docmoduledir)'
|
2005-08-12 23:02:25 +02:00
|
|
|
endif # docdir
|
|
|
|
endif # DOCS
|
2004-07-30 14:26:40 +02:00
|
|
|
ifneq (,$(PROGRAM)$(SCRIPTS)$(SCRIPTS_built))
|
2009-08-27 00:24:44 +02:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(bindir)'
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef MODULE_big
|
|
|
|
installdirs: installdirs-lib
|
|
|
|
endif # MODULE_big
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
uninstall:
|
2011-02-12 04:53:43 +01:00
|
|
|
ifneq (,$(EXTENSION))
|
|
|
|
rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(addsuffix .control, $(EXTENSION))))
|
|
|
|
endif
|
|
|
|
ifneq (,$(DATA)$(DATA_built))
|
|
|
|
rm -f $(addprefix '$(DESTDIR)$(datadir)/$(datamoduledir)'/, $(notdir $(DATA) $(DATA_built)))
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
2007-10-16 18:00:00 +02:00
|
|
|
ifneq (,$(DATA_TSEARCH))
|
2010-01-04 17:34:11 +01:00
|
|
|
rm -f $(addprefix '$(DESTDIR)$(datadir)/tsearch_data'/, $(notdir $(DATA_TSEARCH)))
|
2007-10-16 18:00:00 +02:00
|
|
|
endif
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef MODULES
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -f $(addprefix '$(DESTDIR)$(pkglibdir)'/, $(addsuffix $(DLSUFFIX), $(MODULES)))
|
2018-03-28 22:19:08 +02:00
|
|
|
ifeq ($(with_llvm), yes)
|
|
|
|
$(foreach mod, $(MODULES), $(call uninstall_llvm_module,$(mod)))
|
|
|
|
endif # with_llvm
|
|
|
|
endif # MODULES
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef DOCS
|
2010-01-04 17:34:11 +01:00
|
|
|
rm -f $(addprefix '$(DESTDIR)$(docdir)/$(docmoduledir)'/, $(DOCS))
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
ifdef PROGRAM
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -f '$(DESTDIR)$(bindir)/$(PROGRAM)$(X)'
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
ifdef SCRIPTS
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, $(SCRIPTS))
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
ifdef SCRIPTS_built
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -f $(addprefix '$(DESTDIR)$(bindir)'/, $(SCRIPTS_built))
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
2018-09-07 14:51:30 +02:00
|
|
|
ifneq (,$(strip $(HEADER_dirs)))
|
|
|
|
$(foreach dir,$(HEADER_dirs),$(call uninstall_headers,$(dir),$(HEADER_files_$(dir))))
|
2018-07-31 20:58:39 +02:00
|
|
|
endif # HEADERS
|
2004-07-30 14:26:40 +02:00
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef MODULE_big
|
2018-03-28 22:19:08 +02:00
|
|
|
ifeq ($(with_llvm), yes)
|
|
|
|
$(call uninstall_llvm_module,$(MODULE_big))
|
|
|
|
endif # with_llvm
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
uninstall: uninstall-lib
|
|
|
|
endif # MODULE_big
|
|
|
|
|
2021-05-27 13:58:13 +02:00
|
|
|
else # NO_INSTALL
|
|
|
|
|
|
|
|
# Need this so that temp-install builds artifacts not meant for
|
|
|
|
# installation (Normally, check should depend on all, but we don't do
|
|
|
|
# that because of parallel make risk (dbf2ec1a1c0).)
|
|
|
|
install: all
|
|
|
|
|
|
|
|
endif # NO_INSTALL
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
ifdef MODULES
|
2018-03-28 22:19:08 +02:00
|
|
|
rm -f $(addsuffix $(DLSUFFIX), $(MODULES)) $(addsuffix .o, $(MODULES)) $(if $(PGFILEDESC),$(WIN32RES)) \
|
|
|
|
$(addsuffix .bc, $(MODULES))
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
ifdef DATA_built
|
|
|
|
rm -f $(DATA_built)
|
|
|
|
endif
|
|
|
|
ifdef SCRIPTS_built
|
|
|
|
rm -f $(SCRIPTS_built)
|
|
|
|
endif
|
|
|
|
ifdef PROGRAM
|
|
|
|
rm -f $(PROGRAM)$(X)
|
|
|
|
endif
|
|
|
|
ifdef OBJS
|
2018-03-28 22:19:08 +02:00
|
|
|
rm -f $(OBJS) $(patsubst %.o,%.bc, $(OBJS))
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
ifdef EXTRA_CLEAN
|
2011-11-27 21:42:32 +01:00
|
|
|
rm -rf $(EXTRA_CLEAN)
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|
|
|
|
ifdef REGRESS
|
|
|
|
# things created by various check targets
|
2011-02-14 20:52:32 +01:00
|
|
|
rm -rf $(pg_regress_clean_files)
|
2004-07-30 14:26:40 +02:00
|
|
|
ifeq ($(PORTNAME), win)
|
|
|
|
rm -f regress.def
|
|
|
|
endif
|
|
|
|
endif # REGRESS
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
ifdef TAP_TESTS
|
|
|
|
rm -rf tmp_check/
|
|
|
|
endif
|
|
|
|
ifdef ISOLATION
|
|
|
|
rm -rf output_iso/ tmp_check_iso/
|
|
|
|
endif
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
ifdef MODULE_big
|
|
|
|
clean: clean-lib
|
|
|
|
endif
|
|
|
|
|
Remove distprep
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
2023-11-06 14:51:52 +01:00
|
|
|
distclean: clean
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
ifdef REGRESS
|
|
|
|
|
2019-04-04 02:06:01 +02:00
|
|
|
REGRESS_OPTS += --dbname=$(CONTRIB_TESTDB)
|
2005-09-27 19:43:31 +02:00
|
|
|
|
2008-10-03 10:00:16 +02:00
|
|
|
# When doing a VPATH build, must copy over the data files so that the
|
|
|
|
# driver script can find them. We have to use an absolute path for
|
|
|
|
# the targets, because otherwise make will try to locate the missing
|
|
|
|
# files using VPATH, and will find them in $(srcdir), but the point
|
|
|
|
# here is that we want to copy them from $(srcdir) to the build
|
|
|
|
# directory.
|
|
|
|
|
|
|
|
ifdef VPATH
|
|
|
|
abs_builddir := $(shell pwd)
|
|
|
|
test_files_src := $(wildcard $(srcdir)/data/*.data)
|
|
|
|
test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
|
|
|
|
|
|
|
|
all: $(test_files_build)
|
|
|
|
$(test_files_build): $(abs_builddir)/%: $(srcdir)/%
|
2013-07-01 18:53:05 +02:00
|
|
|
$(MKDIR_P) $(dir $@)
|
2008-10-03 10:00:16 +02:00
|
|
|
ln -s $< $@
|
|
|
|
endif # VPATH
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
endif # REGRESS
|
2008-10-03 10:00:16 +02:00
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
.PHONY: submake
|
|
|
|
submake:
|
2005-09-27 19:43:31 +02:00
|
|
|
ifndef PGXS
|
2006-07-19 04:37:00 +02:00
|
|
|
$(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
$(MAKE) -C $(top_builddir)/src/test/isolation all
|
2005-09-27 19:43:31 +02:00
|
|
|
endif
|
2004-07-30 14:26:40 +02:00
|
|
|
|
2019-04-04 02:06:01 +02:00
|
|
|
ifdef ISOLATION
|
|
|
|
ISOLATION_OPTS += --dbname=$(ISOLATION_TESTDB)
|
|
|
|
endif
|
|
|
|
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
# Standard rules to run regression tests including multiple test suites.
|
|
|
|
# Runs against an installed postmaster.
|
2016-11-14 23:53:07 +01:00
|
|
|
ifndef NO_INSTALLCHECK
|
2011-07-25 16:51:02 +02:00
|
|
|
installcheck: submake $(REGRESS_PREP)
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
ifdef REGRESS
|
2011-02-14 20:52:32 +01:00
|
|
|
$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
|
2016-11-14 23:53:07 +01:00
|
|
|
endif
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
ifdef ISOLATION
|
|
|
|
$(pg_isolation_regress_installcheck) $(ISOLATION_OPTS) $(ISOLATION)
|
|
|
|
endif
|
|
|
|
ifdef TAP_TESTS
|
|
|
|
$(prove_installcheck)
|
|
|
|
endif
|
|
|
|
endif # NO_INSTALLCHECK
|
2004-07-30 14:26:40 +02:00
|
|
|
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
# Runs independently of any installation
|
2011-04-25 21:21:37 +02:00
|
|
|
ifdef PGXS
|
2004-07-30 14:26:40 +02:00
|
|
|
check:
|
2011-04-25 21:21:37 +02:00
|
|
|
@echo '"$(MAKE) check" is not supported.'
|
|
|
|
@echo 'Do "$(MAKE) install", then "$(MAKE) installcheck" instead.'
|
|
|
|
else
|
2015-04-30 02:34:22 +02:00
|
|
|
check: submake $(REGRESS_PREP)
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
ifdef REGRESS
|
2015-04-23 14:59:52 +02:00
|
|
|
$(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
|
2018-08-28 23:26:09 +02:00
|
|
|
endif
|
Add PGXS options to control TAP and isolation tests, take two
The following options are added for extensions:
- TAP_TESTS, to allow an extention to run TAP tests which are the ones
present in t/*.pl. A subset of tests can always be run with the
existing PROVE_TESTS for developers.
- ISOLATION, to define a list of isolation tests.
- ISOLATION_OPTS, to pass custom options to isolation_tester.
A couple of custom Makefile rules have been accumulated across the tree
to cover the lack of facility in PGXS for a couple of releases when
using those test suites, which are all now replaced with the new flags,
without reducing the test coverage. Note that tests of contrib/bloom/
are not enabled yet, as those are proving unstable in the buildfarm.
Author: Michael Paquier
Reviewed-by: Adam Berlin, Álvaro Herrera, Tom Lane, Nikolay Shaplov,
Arthur Zakirov
Discussion: https://postgr.es/m/20180906014849.GG2726@paquier.xyz
2018-12-03 01:27:35 +01:00
|
|
|
ifdef ISOLATION
|
|
|
|
$(pg_isolation_regress_check) $(ISOLATION_OPTS) $(ISOLATION)
|
|
|
|
endif
|
|
|
|
ifdef TAP_TESTS
|
|
|
|
$(prove_check)
|
|
|
|
endif
|
|
|
|
endif # PGXS
|
2015-04-23 14:59:52 +02:00
|
|
|
|
2018-08-28 23:26:09 +02:00
|
|
|
ifndef NO_TEMP_INSTALL
|
2018-12-31 22:54:38 +01:00
|
|
|
checkprep: EXTRA_INSTALL+=$(subdir)
|
2011-04-25 21:21:37 +02:00
|
|
|
endif
|
2004-07-30 14:26:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
# STANDARD RULES
|
|
|
|
|
|
|
|
ifneq (,$(MODULES)$(MODULE_big))
|
|
|
|
%.sql: %.sql.in
|
|
|
|
sed 's,MODULE_PATHNAME,$$libdir/$*,g' $< >$@
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef PROGRAM
|
|
|
|
$(PROGRAM): $(OBJS)
|
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches in
link command lines, such that -L switches referring to external directories
could come before those referring to directories within the build tree.
This made it possible to accidentally link a system-supplied library, for
example /usr/lib/libpq.so, in place of the one built in the build tree.
Hilarity ensued, the more so the older the system-supplied library is.
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
and the main LDFLAGS variable, both of which are "recursively expanded"
so that they can be incrementally adjusted by different makefiles.
Establish a policy that -L switches for directories in the build tree
must always be added to LDFLAGS_INTERNAL, while -L switches for external
directories must always be added to LDFLAGS. This is sufficient to
ensure a safe search order. For simplicity, we typically also put -l
switches for the respective libraries into those same variables.
(Traditional make usage would have us put -l switches into LIBS, but
cleaning that up is a project for another day, as there's no clear
need for it.)
This turns out to also require separating SHLIB_LINK into two variables,
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
switches go into which variable. And likewise for PG_LIBS.
Although this change might appear to affect external users of pgxs.mk,
I think it doesn't; they shouldn't have any need to touch the _INTERNAL
variables.
In passing, tweak src/common/Makefile so that the value of CPPFLAGS
recorded in pg_config lacks "-DFRONTEND" and the recorded value of
LDFLAGS lacks "-L../../../src/common". Both of those things are
mistakes, apparently introduced during prior code rearrangements,
as old versions of pg_config don't print them. In general we don't
want anything that's specific to the src/common subdirectory to
appear in those outputs.
This is certainly a bug fix, but in view of the lack of field
complaints, I'm unsure whether it's worth the risk of back-patching.
In any case it seems wise to see what the buildfarm makes of it first.
Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
2018-04-03 22:26:05 +02:00
|
|
|
$(CC) $(CFLAGS) $(OBJS) $(PG_LIBS_INTERNAL) $(LDFLAGS) $(LDFLAGS_EX) $(PG_LIBS) $(LIBS) -o $@$(X)
|
2004-07-30 14:26:40 +02:00
|
|
|
endif
|