2000-10-08 23:13:27 +02:00
|
|
|
# -*-makefile-*-
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/Makefile.global.in
|
2014-04-15 03:49:57 +02:00
|
|
|
# @configure_input@
|
2000-08-31 18:12:35 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# All PostgreSQL makefiles include this file and use the variables it sets,
|
|
|
|
# which in turn are put here by the configure script. There is no need for
|
|
|
|
# users to edit this file -- if it turns out to be necessary then that's a
|
|
|
|
# bug.
|
1997-02-04 09:53:45 +01:00
|
|
|
#
|
2000-08-31 18:12:35 +02:00
|
|
|
# A makefile that includes this file needs to set the variable `subdir' to
|
|
|
|
# the relative path from the top to itself and `top_builddir' to the relative
|
|
|
|
# path from itself to the top before including this file. (The "top" is the
|
|
|
|
# parent directory of the directory this file is in.)
|
|
|
|
#------------------------------------------------------------------------------
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# Meta configuration
|
|
|
|
|
2013-09-11 20:34:28 +02:00
|
|
|
standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck init-po update-po
|
2011-07-03 19:55:02 +02:00
|
|
|
# these targets should recurse even into subdirectories not being built:
|
|
|
|
standard_always_targets = distprep clean distclean maintainer-clean
|
2010-11-12 21:15:16 +01:00
|
|
|
|
2013-09-11 20:34:28 +02:00
|
|
|
.PHONY: $(standard_targets) install-strip html man installcheck-parallel maintainer-check
|
2000-10-08 23:13:27 +02:00
|
|
|
|
|
|
|
# make `all' the default target
|
|
|
|
all:
|
|
|
|
|
2000-09-08 20:29:28 +02:00
|
|
|
# Delete target files if the command fails after it has
|
|
|
|
# started to update the file.
|
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
|
2012-11-01 04:33:35 +01:00
|
|
|
# Never delete any intermediate files automatically.
|
|
|
|
.SECONDARY:
|
|
|
|
|
2000-07-02 17:21:27 +02:00
|
|
|
# PostgreSQL version number
|
2002-03-29 18:32:55 +01:00
|
|
|
VERSION = @PACKAGE_VERSION@
|
2008-12-11 08:34:09 +01:00
|
|
|
MAJORVERSION = @PG_MAJORVERSION@
|
2015-07-02 23:24:36 +02:00
|
|
|
VERSION_NUM = @PG_VERSION_NUM@
|
2000-07-02 17:21:27 +02:00
|
|
|
|
2015-07-31 02:48:41 +02:00
|
|
|
# Set top_srcdir, srcdir, and VPATH.
|
|
|
|
ifdef PGXS
|
|
|
|
top_srcdir = $(top_builddir)
|
|
|
|
|
|
|
|
# If VPATH is set or Makefile is not in current directory we are building
|
|
|
|
# the extension with VPATH so we set the variable here.
|
|
|
|
ifdef VPATH
|
|
|
|
srcdir = $(VPATH)
|
|
|
|
else
|
|
|
|
ifeq ($(CURDIR),$(dir $(firstword $(MAKEFILE_LIST))))
|
|
|
|
srcdir = .
|
|
|
|
VPATH =
|
|
|
|
else
|
|
|
|
srcdir = $(dir $(firstword $(MAKEFILE_LIST)))
|
|
|
|
VPATH = $(srcdir)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
else # not PGXS
|
2002-03-29 18:32:55 +01:00
|
|
|
vpath_build = @vpath_build@
|
2015-04-23 14:59:52 +02:00
|
|
|
abs_top_builddir = @abs_top_builddir@
|
2000-10-20 23:04:27 +02:00
|
|
|
abs_top_srcdir = @abs_top_srcdir@
|
2000-07-09 15:14:19 +02:00
|
|
|
|
2002-03-29 18:32:55 +01:00
|
|
|
ifneq ($(vpath_build),yes)
|
2000-10-20 23:04:27 +02:00
|
|
|
top_srcdir = $(top_builddir)
|
2000-06-27 02:32:06 +02:00
|
|
|
srcdir = .
|
2002-03-29 18:32:55 +01:00
|
|
|
else # vpath_build = yes
|
2000-10-20 23:04:27 +02:00
|
|
|
top_srcdir = $(abs_top_srcdir)
|
2000-06-27 02:32:06 +02:00
|
|
|
srcdir = $(top_srcdir)/$(subdir)
|
|
|
|
VPATH = $(srcdir)
|
2000-10-20 23:04:27 +02:00
|
|
|
endif
|
2014-12-04 23:02:02 +01:00
|
|
|
endif # not PGXS
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2010-05-13 13:49:48 +02:00
|
|
|
vpathsearch = `for f in $(addsuffix /$(1),$(subst :, ,. $(VPATH))); do test -r $$f && echo $$f && break; done`
|
|
|
|
|
2002-03-29 18:32:55 +01:00
|
|
|
# Saved arguments from configure
|
|
|
|
configure_args = @configure_args@
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
|
|
|
|
##########################################################################
|
1997-02-04 09:53:45 +01:00
|
|
|
#
|
2000-10-08 23:13:27 +02:00
|
|
|
# Installation directories
|
2004-05-22 02:34:51 +02:00
|
|
|
#
|
|
|
|
# These are set by the equivalent --xxxdir configure options. We
|
|
|
|
# append "postgresql" to some of them, if the string does not already
|
|
|
|
# contain "pgsql" or "postgres", in order to avoid directory clutter.
|
2005-09-27 19:39:35 +02:00
|
|
|
#
|
|
|
|
# In a PGXS build, we cannot use the values inserted into Makefile.global
|
|
|
|
# by configure, since the installation tree may have been relocated.
|
|
|
|
# Instead get the path values from pg_config.
|
|
|
|
|
|
|
|
ifndef PGXS
|
|
|
|
|
2008-02-17 17:36:43 +01:00
|
|
|
# Note that prefix, exec_prefix, and datarootdir aren't defined in a PGXS build;
|
2005-09-27 19:39:35 +02:00
|
|
|
# makefiles may only use the derived variables such as bindir.
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
prefix := @prefix@
|
|
|
|
exec_prefix := @exec_prefix@
|
2008-02-17 17:36:43 +01:00
|
|
|
datarootdir := @datarootdir@
|
1998-10-30 05:54:06 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
bindir := @bindir@
|
2000-03-08 02:58:46 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
datadir := @datadir@
|
2004-05-22 02:34:51 +02:00
|
|
|
ifeq "$(findstring pgsql, $(datadir))" ""
|
|
|
|
ifeq "$(findstring postgres, $(datadir))" ""
|
|
|
|
override datadir := $(datadir)/postgresql
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
sysconfdir := @sysconfdir@
|
2004-05-22 02:34:51 +02:00
|
|
|
ifeq "$(findstring pgsql, $(sysconfdir))" ""
|
|
|
|
ifeq "$(findstring postgres, $(sysconfdir))" ""
|
|
|
|
override sysconfdir := $(sysconfdir)/postgresql
|
|
|
|
endif
|
|
|
|
endif
|
2000-10-08 23:13:27 +02:00
|
|
|
|
|
|
|
libdir := @libdir@
|
2005-09-27 19:39:35 +02:00
|
|
|
|
2004-05-22 02:34:51 +02:00
|
|
|
pkglibdir = $(libdir)
|
|
|
|
ifeq "$(findstring pgsql, $(pkglibdir))" ""
|
|
|
|
ifeq "$(findstring postgres, $(pkglibdir))" ""
|
|
|
|
override pkglibdir := $(pkglibdir)/postgresql
|
|
|
|
endif
|
|
|
|
endif
|
2000-10-08 23:13:27 +02:00
|
|
|
|
|
|
|
includedir := @includedir@
|
2005-09-27 19:39:35 +02:00
|
|
|
|
2004-05-22 02:34:51 +02:00
|
|
|
pkgincludedir = $(includedir)
|
|
|
|
ifeq "$(findstring pgsql, $(pkgincludedir))" ""
|
|
|
|
ifeq "$(findstring postgres, $(pkgincludedir))" ""
|
|
|
|
override pkgincludedir := $(pkgincludedir)/postgresql
|
|
|
|
endif
|
|
|
|
endif
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
mandir := @mandir@
|
2000-06-27 02:32:06 +02:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
docdir := @docdir@
|
2004-05-22 02:34:51 +02:00
|
|
|
ifeq "$(findstring pgsql, $(docdir))" ""
|
|
|
|
ifeq "$(findstring postgres, $(docdir))" ""
|
|
|
|
override docdir := $(docdir)/postgresql
|
|
|
|
endif
|
|
|
|
endif
|
2008-02-17 17:36:43 +01:00
|
|
|
|
|
|
|
htmldir := @htmldir@
|
2000-06-27 02:32:06 +02:00
|
|
|
|
2001-06-02 20:25:18 +02:00
|
|
|
localedir := @localedir@
|
2001-05-25 16:28:58 +02:00
|
|
|
|
2005-09-27 19:39:35 +02:00
|
|
|
else # PGXS case
|
|
|
|
|
2007-06-27 00:05:04 +02:00
|
|
|
# Extension makefiles should set PG_CONFIG, but older ones might not
|
|
|
|
ifndef PG_CONFIG
|
2006-07-20 11:30:18 +02:00
|
|
|
PG_CONFIG = pg_config
|
2007-06-27 00:05:04 +02:00
|
|
|
endif
|
2006-07-20 11:30:18 +02:00
|
|
|
|
|
|
|
bindir := $(shell $(PG_CONFIG) --bindir)
|
|
|
|
datadir := $(shell $(PG_CONFIG) --sharedir)
|
|
|
|
sysconfdir := $(shell $(PG_CONFIG) --sysconfdir)
|
|
|
|
libdir := $(shell $(PG_CONFIG) --libdir)
|
|
|
|
pkglibdir := $(shell $(PG_CONFIG) --pkglibdir)
|
|
|
|
includedir := $(shell $(PG_CONFIG) --includedir)
|
|
|
|
pkgincludedir := $(shell $(PG_CONFIG) --pkgincludedir)
|
|
|
|
mandir := $(shell $(PG_CONFIG) --mandir)
|
|
|
|
docdir := $(shell $(PG_CONFIG) --docdir)
|
|
|
|
localedir := $(shell $(PG_CONFIG) --localedir)
|
2005-09-27 19:39:35 +02:00
|
|
|
|
|
|
|
endif # PGXS
|
|
|
|
|
|
|
|
# These derived path variables aren't separately configurable.
|
|
|
|
|
|
|
|
includedir_server = $(pkgincludedir)/server
|
|
|
|
includedir_internal = $(pkgincludedir)/internal
|
2004-07-30 14:26:40 +02:00
|
|
|
pgxsdir = $(pkglibdir)/pgxs
|
2018-03-28 22:19:08 +02:00
|
|
|
bitcodedir = $(pkglibdir)/bitcode
|
2004-07-30 14:26:40 +02:00
|
|
|
|
1998-10-06 07:42:58 +02:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
##########################################################################
|
1997-02-04 09:53:45 +01:00
|
|
|
#
|
2000-10-08 23:13:27 +02:00
|
|
|
# Features
|
1997-02-04 09:53:45 +01:00
|
|
|
#
|
2000-10-08 23:13:27 +02:00
|
|
|
# Records the choice of the various --enable-xxx and --with-xxx options.
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2017-03-23 20:25:34 +01:00
|
|
|
with_icu = @with_icu@
|
2000-10-08 23:13:27 +02:00
|
|
|
with_perl = @with_perl@
|
|
|
|
with_python = @with_python@
|
|
|
|
with_tcl = @with_tcl@
|
2005-07-06 01:13:57 +02:00
|
|
|
with_openssl = @with_openssl@
|
2011-01-24 02:44:48 +01:00
|
|
|
with_selinux = @with_selinux@
|
2015-11-17 12:46:17 +01:00
|
|
|
with_systemd = @with_systemd@
|
2018-03-05 20:42:11 +01:00
|
|
|
with_gssapi = @with_gssapi@
|
|
|
|
with_krb_srvnam = @with_krb_srvnam@
|
2018-03-03 07:29:51 +01:00
|
|
|
with_ldap = @with_ldap@
|
2007-04-13 20:50:01 +02:00
|
|
|
with_libxml = @with_libxml@
|
2007-04-15 14:48:24 +02:00
|
|
|
with_libxslt = @with_libxslt@
|
2018-03-21 01:26:25 +01:00
|
|
|
with_llvm = @with_llvm@
|
2007-08-20 10:53:12 +02:00
|
|
|
with_system_tzdata = @with_system_tzdata@
|
2014-05-28 01:42:08 +02:00
|
|
|
with_uuid = @with_uuid@
|
2005-07-06 01:13:57 +02:00
|
|
|
with_zlib = @with_zlib@
|
2000-10-28 01:59:39 +02:00
|
|
|
enable_rpath = @enable_rpath@
|
2001-06-02 20:25:18 +02:00
|
|
|
enable_nls = @enable_nls@
|
2002-03-05 18:55:23 +01:00
|
|
|
enable_debug = @enable_debug@
|
2006-07-24 18:32:45 +02:00
|
|
|
enable_dtrace = @enable_dtrace@
|
2008-09-05 14:11:18 +02:00
|
|
|
enable_coverage = @enable_coverage@
|
2014-11-02 15:14:36 +01:00
|
|
|
enable_tap_tests = @enable_tap_tests@
|
2003-12-20 00:29:15 +01:00
|
|
|
enable_thread_safety = @enable_thread_safety@
|
Replace PostmasterRandom() with a stronger source, second attempt.
This adds a new routine, pg_strong_random() for generating random bytes,
for use in both frontend and backend. At the moment, it's only used in
the backend, but the upcoming SCRAM authentication patches need strong
random numbers in libpq as well.
pg_strong_random() is based on, and replaces, the existing implementation
in pgcrypto. It can acquire strong random numbers from a number of sources,
depending on what's available:
- OpenSSL RAND_bytes(), if built with OpenSSL
- On Windows, the native cryptographic functions are used
- /dev/urandom
Unlike the current pgcrypto function, the source is chosen by configure.
That makes it easier to test different implementations, and ensures that
we don't accidentally fall back to a less secure implementation, if the
primary source fails. All of those methods are quite reliable, it would be
pretty surprising for them to fail, so we'd rather find out by failing
hard.
If no strong random source is available, we fall back to using erand48(),
seeded from current timestamp, like PostmasterRandom() was. That isn't
cryptographically secure, but allows us to still work on platforms that
don't have any of the above stronger sources. Because it's not very secure,
the built-in implementation is only used if explicitly requested with
--disable-strong-random.
This replaces the more complicated Fortuna algorithm we used to have in
pgcrypto, which is unfortunate, but all modern platforms have /dev/urandom,
so it doesn't seem worth the maintenance effort to keep that. pgcrypto
functions that require strong random numbers will be disabled with
--disable-strong-random.
Original patch by Magnus Hagander, tons of further work by Michael Paquier
and me.
Discussion: https://www.postgresql.org/message-id/CAB7nPqRy3krN8quR9XujMVVHYtXJ0_60nqgVc6oUk8ygyVkZsA@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/CAB7nPqRWkNYRRPJA7-cF+LfroYV10pvjdz6GNvxk-Eee9FypKA@mail.gmail.com
2016-12-05 12:42:59 +01:00
|
|
|
enable_strong_random = @enable_strong_random@
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2001-07-10 18:33:02 +02:00
|
|
|
python_includespec = @python_includespec@
|
2004-10-11 21:32:19 +02:00
|
|
|
python_libdir = @python_libdir@
|
2001-05-12 19:49:32 +02:00
|
|
|
python_libspec = @python_libspec@
|
2004-10-11 21:32:19 +02:00
|
|
|
python_additional_libs = @python_additional_libs@
|
2009-12-15 23:59:55 +01:00
|
|
|
python_majorversion = @python_majorversion@
|
2004-10-06 11:20:41 +02:00
|
|
|
python_version = @python_version@
|
2000-06-27 02:32:06 +02:00
|
|
|
|
2000-07-09 15:14:19 +02:00
|
|
|
krb_srvtab = @krb_srvtab@
|
|
|
|
|
2017-03-23 20:25:34 +01:00
|
|
|
ICU_CFLAGS = @ICU_CFLAGS@
|
|
|
|
ICU_LIBS = @ICU_LIBS@
|
|
|
|
|
2002-05-24 20:10:17 +02:00
|
|
|
TCLSH = @TCLSH@
|
|
|
|
TCL_LIBS = @TCL_LIBS@
|
|
|
|
TCL_LIB_SPEC = @TCL_LIB_SPEC@
|
2002-12-30 18:19:54 +01:00
|
|
|
TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
|
2002-05-24 20:10:17 +02:00
|
|
|
TCL_SHARED_BUILD = @TCL_SHARED_BUILD@
|
|
|
|
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
|
|
|
|
|
2004-04-23 20:15:55 +02:00
|
|
|
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
|
|
|
|
PTHREAD_LIBS = @PTHREAD_LIBS@
|
2003-05-27 18:36:50 +02:00
|
|
|
|
2018-03-21 01:26:25 +01:00
|
|
|
LLVM_CONFIG = @LLVM_CONFIG@
|
|
|
|
LLVM_BINPATH = @LLVM_BINPATH@
|
|
|
|
CLANG = @CLANG@
|
|
|
|
BITCODE_CFLAGS = @BITCODE_CFLAGS@
|
|
|
|
BITCODE_CXXFLAGS = @BITCODE_CXXFLAGS@
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
##########################################################################
|
1997-02-04 09:53:45 +01:00
|
|
|
#
|
2000-10-08 23:13:27 +02:00
|
|
|
# Programs and flags
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
# Compilers
|
2000-06-27 02:32:06 +02:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
CPP = @CPP@
|
|
|
|
CPPFLAGS = @CPPFLAGS@
|
2004-07-30 14:26:40 +02:00
|
|
|
|
2017-08-10 02:28:49 +02:00
|
|
|
override CPPFLAGS := $(ICU_CFLAGS) $(CPPFLAGS)
|
2017-06-12 21:57:22 +02:00
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
ifdef PGXS
|
|
|
|
override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
|
|
|
|
else # not PGXS
|
2001-07-15 13:20:01 +02:00
|
|
|
override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
|
|
|
|
ifdef VPATH
|
|
|
|
override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
|
|
|
|
endif
|
2004-07-30 14:26:40 +02:00
|
|
|
endif # not PGXS
|
2000-10-08 23:13:27 +02:00
|
|
|
|
2000-10-20 23:04:27 +02:00
|
|
|
CC = @CC@
|
|
|
|
GCC = @GCC@
|
2008-10-29 17:06:47 +01:00
|
|
|
SUN_STUDIO_CC = @SUN_STUDIO_CC@
|
2018-03-20 23:41:15 +01:00
|
|
|
CXX = @CXX@
|
2000-10-20 23:04:27 +02:00
|
|
|
CFLAGS = @CFLAGS@
|
2013-04-30 07:59:26 +02:00
|
|
|
CFLAGS_VECTOR = @CFLAGS_VECTOR@
|
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 16:05:03 +02:00
|
|
|
CFLAGS_SSE42 = @CFLAGS_SSE42@
|
Use ARMv8 CRC instructions where available.
ARMv8 introduced special CPU instructions for calculating CRC-32C. Use
them, when available, for speed.
Like with the similar Intel CRC instructions, several factors affect
whether the instructions can be used. The compiler intrinsics for them must
be supported by the compiler, and the instructions must be supported by the
target architecture. If the compilation target architecture does not
support the instructions, but adding "-march=armv8-a+crc" makes them
available, then we compile the code with a runtime check to determine if
the host we're running on supports them or not.
For the runtime check, use glibc getauxval() function. Unfortunately,
that's not very portable, but I couldn't find any more portable way to do
it. If getauxval() is not available, the CRC instructions will still be
used if the target architecture supports them without any additional
compiler flags, but the runtime check will not be available.
Original patch by Yuqi Gu, heavily modified by me. Reviewed by Andres
Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/HE1PR0801MB1323D171938EABC04FFE7FA9E3110%40HE1PR0801MB1323.eurprd08.prod.outlook.com
2018-04-04 11:22:45 +02:00
|
|
|
CFLAGS_ARMV8_CRC32C = @CFLAGS_ARMV8_CRC32C@
|
2018-03-20 23:41:15 +01:00
|
|
|
CXXFLAGS = @CXXFLAGS@
|
2000-06-27 02:32:06 +02:00
|
|
|
|
2018-03-21 01:26:25 +01:00
|
|
|
LLVM_CPPFLAGS = @LLVM_CPPFLAGS@
|
|
|
|
LLVM_CFLAGS = @LLVM_CFLAGS@
|
|
|
|
LLVM_CXXFLAGS = @LLVM_CXXFLAGS@
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
# Kind-of compilers
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2008-08-29 15:02:33 +02:00
|
|
|
BISON = @BISON@
|
|
|
|
BISONFLAGS = @BISONFLAGS@ $(YFLAGS)
|
2000-08-28 13:53:23 +02:00
|
|
|
FLEX = @FLEX@
|
|
|
|
FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
|
2006-07-24 18:32:45 +02:00
|
|
|
DTRACE = @DTRACE@
|
|
|
|
DTRACEFLAGS = @DTRACEFLAGS@
|
2009-01-05 11:25:59 +01:00
|
|
|
ZIC = @ZIC@
|
2000-10-08 23:13:27 +02:00
|
|
|
|
|
|
|
# Linking
|
|
|
|
|
2008-12-07 09:36:22 +01:00
|
|
|
AR = @AR@
|
|
|
|
DLLTOOL = @DLLTOOL@
|
|
|
|
DLLWRAP = @DLLWRAP@
|
2000-10-08 23:13:27 +02:00
|
|
|
LIBS = @LIBS@
|
2006-09-09 05:15:40 +02:00
|
|
|
LDAP_LIBS_FE = @LDAP_LIBS_FE@
|
|
|
|
LDAP_LIBS_BE = @LDAP_LIBS_BE@
|
2014-05-28 01:42:08 +02:00
|
|
|
UUID_LIBS = @UUID_LIBS@
|
|
|
|
UUID_EXTRA_OBJS = @UUID_EXTRA_OBJS@
|
2018-03-21 01:26:25 +01:00
|
|
|
LLVM_LIBS=@LLVM_LIBS@
|
2000-10-21 01:57:34 +02:00
|
|
|
LD = @LD@
|
|
|
|
with_gnu_ld = @with_gnu_ld@
|
2010-07-07 00:03:05 +02:00
|
|
|
|
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
|
|
|
# It's critical that within LDFLAGS, all -L switches pointing to build-tree
|
|
|
|
# directories come before any -L switches pointing to external directories.
|
|
|
|
# Otherwise it's possible for, e.g., a platform-provided copy of libpq.so
|
|
|
|
# to get linked in place of the one we've built. Therefore we adopt the
|
|
|
|
# convention that the first component of LDFLAGS is an extra variable
|
|
|
|
# LDFLAGS_INTERNAL, and -L and -l switches for PG's own libraries must be
|
|
|
|
# put into LDFLAGS_INTERNAL, so they will appear ahead of those for external
|
|
|
|
# libraries.
|
|
|
|
#
|
|
|
|
# We need LDFLAGS and LDFLAGS_INTERNAL to be "recursively expanded" variables,
|
|
|
|
# else adjustments to, e.g., rpathdir don't work right. So we must NOT do
|
|
|
|
# "LDFLAGS := something" anywhere, ditto for LDFLAGS_INTERNAL.
|
|
|
|
# These initial assignments must be "=" type, and elsewhere we must only do
|
|
|
|
# "LDFLAGS += something" or "LDFLAGS_INTERNAL += something".
|
2010-07-07 00:03:05 +02:00
|
|
|
ifdef PGXS
|
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
|
|
|
LDFLAGS_INTERNAL = -L$(libdir)
|
2010-07-07 00:03:05 +02:00
|
|
|
else
|
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
|
|
|
LDFLAGS_INTERNAL = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
|
2010-07-07 00:03:05 +02:00
|
|
|
endif
|
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
|
|
|
LDFLAGS = $(LDFLAGS_INTERNAL) @LDFLAGS@
|
2010-07-07 00:03:05 +02:00
|
|
|
|
2010-07-05 20:54:38 +02:00
|
|
|
LDFLAGS_EX = @LDFLAGS_EX@
|
2010-07-07 00:03:05 +02:00
|
|
|
# LDFLAGS_SL might have already been assigned by calling makefile
|
|
|
|
LDFLAGS_SL += @LDFLAGS_SL@
|
2000-10-08 23:13:27 +02:00
|
|
|
LDREL = -r
|
|
|
|
LDOUT = -o
|
|
|
|
RANLIB = @RANLIB@
|
2008-12-07 09:36:22 +01:00
|
|
|
WINDRES = @WINDRES@
|
2000-09-27 17:17:57 +02:00
|
|
|
X = @EXEEXT@
|
2000-06-27 02:32:06 +02:00
|
|
|
|
2010-11-23 21:27:50 +01:00
|
|
|
# Perl
|
2001-08-27 00:28:04 +02:00
|
|
|
|
2009-06-23 05:46:00 +02:00
|
|
|
ifneq (@PERL@,)
|
|
|
|
# quoted to protect pathname with spaces
|
2011-06-16 03:45:23 +02:00
|
|
|
PERL = '@PERL@'
|
2009-06-23 05:46:00 +02:00
|
|
|
else
|
|
|
|
PERL = $(missing) perl
|
|
|
|
endif
|
2002-05-28 18:57:53 +02:00
|
|
|
perl_archlibexp = @perl_archlibexp@
|
|
|
|
perl_privlibexp = @perl_privlibexp@
|
Still further rethinking of build changes for macOS Mojave.
To avoid the sorts of problems complained of by Jakob Egger, it'd be
best if configure didn't emit any references to the sysroot path at all.
In the case of PL/Tcl, we can do that just by keeping our hands off the
TCL_INCLUDE_SPEC string altogether. In the case of PL/Perl, we need to
substitute -iwithsysroot for -I in the compile commands, which is easily
handled if we change to using a configure output variable that includes
the switch not only the directory name. Since PL/Tcl and PL/Python
already do it like that, this seems like good consistency cleanup anyway.
Hence, this replaces the advice given to Perl-related extensions in commit
5e2217131; instead of writing "-I$(perl_archlibexp)/CORE", they should
just write "$(perl_includespec)". (The old way continues to work, but not
on recent macOS.)
It's still the case that configure needs to be aware of the sysroot
path internally, but that's cleaner than what we had before.
As before, back-patch to all supported versions.
Discussion: https://postgr.es/m/20840.1537850987@sss.pgh.pa.us
2018-10-18 20:55:23 +02:00
|
|
|
perl_includespec = @perl_includespec@
|
PL/Perl portability fix: absorb relevant -D switches from Perl.
The Perl documentation is very clear that stuff calling libperl should
be built with the compiler switches shown by Perl's $Config{ccflags}.
We'd been ignoring that up to now, and mostly getting away with it,
but recent Perl versions contain ABI compatibility cross-checks that
fail on some builds because of this omission. In particular the
sizeof(PerlInterpreter) can come out different due to some fields being
added or removed; which means we have a live ABI hazard that we'd better
fix rather than continuing to sweep it under the rug.
However, it still seems like a bad idea to just absorb $Config{ccflags}
verbatim. In some environments Perl was built with a different compiler
that doesn't even use the same switch syntax. -D switch syntax is pretty
universal though, and absorbing Perl's -D switches really ought to be
enough to fix the problem.
Furthermore, Perl likes to inject stuff like -D_LARGEFILE_SOURCE and
-D_FILE_OFFSET_BITS=64 into $Config{ccflags}, which affect libc ABIs on
platforms where they're relevant. Adopting those seems dangerous too.
It's unclear whether a build wherein Perl and Postgres have different ideas
of sizeof(off_t) etc would work, or whether anyone would care about making
it work. But it's dead certain that having different stdio ABIs in
core Postgres and PL/Perl will not work; we've seen that movie before.
Therefore, let's also ignore -D switches for symbols beginning with
underscore. The symbols that we actually need to import should be the ones
mentioned in perl.h's PL_bincompat_options stanza, and none of those start
with underscore, so this seems likely to work. (If it turns out not to
work everywhere, we could consider intersecting the symbols mentioned in
PL_bincompat_options with the -D switches. But that will be much more
complicated, so let's try this way first.)
This will need to be back-patched, but first let's see what the
buildfarm makes of it.
Ashutosh Sharma, some adjustments by me
Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
2017-07-28 20:25:28 +02:00
|
|
|
perl_embed_ccflags = @perl_embed_ccflags@
|
2002-05-28 18:57:53 +02:00
|
|
|
perl_embed_ldflags = @perl_embed_ldflags@
|
2001-08-27 00:28:04 +02:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
# Miscellaneous
|
|
|
|
|
|
|
|
AWK = @AWK@
|
|
|
|
LN_S = @LN_S@
|
2001-06-02 20:25:18 +02:00
|
|
|
MSGFMT = @MSGFMT@
|
2013-09-11 20:34:28 +02:00
|
|
|
MSGFMT_FLAGS = @MSGFMT_FLAGS@
|
2001-06-02 20:25:18 +02:00
|
|
|
MSGMERGE = @MSGMERGE@
|
2000-10-08 23:13:27 +02:00
|
|
|
PYTHON = @PYTHON@
|
|
|
|
TAR = @TAR@
|
2001-06-02 20:25:18 +02:00
|
|
|
XGETTEXT = @XGETTEXT@
|
2000-10-08 23:13:27 +02:00
|
|
|
|
2001-09-18 01:00:27 +02:00
|
|
|
GZIP = gzip
|
|
|
|
BZIP2 = bzip2
|
|
|
|
|
2018-04-09 22:42:02 +02:00
|
|
|
|
|
|
|
# Tree-wide build support
|
|
|
|
|
|
|
|
# Just about every code subdirectory wants to have the generated headers
|
|
|
|
# available before building, but we don't want parallel makes all trying
|
|
|
|
# to build the same headers. These rules, together with the recursion rules
|
|
|
|
# below, ensure that we update the generated headers once, if needed,
|
2018-07-31 00:04:39 +02:00
|
|
|
# at the top level of any "make all/install/check/installcheck" request.
|
|
|
|
# If a particular subdirectory knows this isn't needed in itself or its
|
|
|
|
# children, it can set NO_GENERATED_HEADERS.
|
2018-04-09 22:42:02 +02:00
|
|
|
|
2018-07-31 00:04:39 +02:00
|
|
|
all install check installcheck: submake-generated-headers
|
2018-04-09 22:42:02 +02:00
|
|
|
|
|
|
|
.PHONY: submake-generated-headers
|
|
|
|
|
|
|
|
submake-generated-headers:
|
|
|
|
ifndef NO_GENERATED_HEADERS
|
|
|
|
ifeq ($(MAKELEVEL),0)
|
|
|
|
$(MAKE) -C $(top_builddir)/src/backend generated-headers
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2014-04-15 03:33:46 +02:00
|
|
|
# Testing
|
|
|
|
|
2018-04-09 22:42:02 +02:00
|
|
|
# In much the same way as above, these rules ensure that we build a temp
|
|
|
|
# install tree just once in any recursive "make check". The additional test
|
|
|
|
# on abs_top_builddir prevents doing anything foolish to the root directory.
|
|
|
|
|
2015-04-23 14:59:52 +02:00
|
|
|
check: temp-install
|
|
|
|
|
|
|
|
.PHONY: temp-install
|
2018-04-09 22:42:02 +02:00
|
|
|
|
2018-04-11 19:18:50 +02:00
|
|
|
temp-install: | submake-generated-headers
|
2015-05-12 18:30:50 +02:00
|
|
|
ifndef NO_TEMP_INSTALL
|
2015-09-28 16:47:05 +02:00
|
|
|
ifneq ($(abs_top_builddir),)
|
2015-04-23 14:59:52 +02:00
|
|
|
ifeq ($(MAKELEVEL),0)
|
|
|
|
rm -rf '$(abs_top_builddir)'/tmp_install
|
2015-07-23 15:44:20 +02:00
|
|
|
$(MKDIR_P) '$(abs_top_builddir)'/tmp_install/log
|
|
|
|
$(MAKE) -C '$(top_builddir)' DESTDIR='$(abs_top_builddir)'/tmp_install install >'$(abs_top_builddir)'/tmp_install/log/install.log 2>&1
|
2015-04-23 14:59:52 +02:00
|
|
|
endif
|
2015-07-23 15:44:20 +02:00
|
|
|
$(if $(EXTRA_INSTALL),for extra in $(EXTRA_INSTALL); do $(MAKE) -C '$(top_builddir)'/$$extra DESTDIR='$(abs_top_builddir)'/tmp_install install >>'$(abs_top_builddir)'/tmp_install/log/install.log || exit; done)
|
2015-05-12 17:01:25 +02:00
|
|
|
endif
|
2015-09-28 16:47:05 +02:00
|
|
|
endif
|
2015-04-23 14:59:52 +02:00
|
|
|
|
2014-04-15 03:33:46 +02:00
|
|
|
PROVE = @PROVE@
|
2016-10-07 20:48:21 +02:00
|
|
|
# There are common routines in src/test/perl, and some test suites have
|
|
|
|
# extra perl modules in their own directory.
|
|
|
|
PG_PROVE_FLAGS = -I $(top_srcdir)/src/test/perl/ -I $(srcdir)
|
2017-05-12 17:11:49 +02:00
|
|
|
# User-supplied prove flags such as --verbose can be provided in PROVE_FLAGS.
|
2017-06-10 16:19:06 +02:00
|
|
|
PROVE_FLAGS =
|
2014-04-15 03:33:46 +02:00
|
|
|
|
2014-08-15 06:01:14 +02:00
|
|
|
# prepend to path if already set, else just set it
|
|
|
|
define add_to_path
|
2014-10-13 05:33:37 +02:00
|
|
|
$(1)="$(if $($(1)),$(2):$$$(1),$(2))"
|
2014-08-15 06:01:14 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
# platform-specific environment variable to set shared library path
|
|
|
|
define ld_library_path_var
|
Fix cross-shlib linking in temporary installs on HPUX 10.
Turns out this has been broken for years and we'd not noticed. The one
case that was getting exercised in the buildfarm, or probably anywhere
else, was postgres_fdw.sl's reference to libpq.sl; and it turns out that
that was always going to libpq.sl in the actual installation directory
not the temporary install. We'd not noticed because the buildfarm script
does "make install" before it tests contrib. However, the recent addition
of a logical-replication test to the core regression scripts resulted in
trying to use libpqwalreceiver.sl before "make install" happens, and that
failed for lack of finding libpq.sl, as shown by failures on buildfarm
members gaur and pademelon.
There are two changes needed to fix it: the magic environment variable to
specify shlib search path at runtime is SHLIB_PATH not LD_LIBRARY_PATH,
and the shlib link command needs to specify the +s switch else the library
will not honor SHLIB_PATH.
I'm not quite sure why buildfarm members anole and gharial (HPUX 11) didn't
show the same failure. Consulting man pages on the web says that HPUX 11
honors both LD_LIBRARY_PATH and SHLIB_PATH, which would explain half of it,
and the rather confusing wording I've been able to find suggests that +s
might effectively be the default in HPUX 11. But it seems at least as
likely that there's just a libpq.so installed in /usr/lib on that machine;
as long as it's not too ancient, that would satisfy the test. In any case
I do not think this patch will break HPUX 11.
At the moment I don't see a need to back-patch this, since it only matters
for testing purposes, not to mention that HPUX 10 is probably dead in the
real world anyway.
2017-01-21 21:15:39 +01:00
|
|
|
$(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,$(if $(filter $(PORTNAME),hpux),SHLIB_PATH,LD_LIBRARY_PATH)))
|
2014-08-15 06:01:14 +02:00
|
|
|
endef
|
|
|
|
|
2015-04-23 14:59:52 +02:00
|
|
|
define with_temp_install
|
|
|
|
PATH="$(abs_top_builddir)/tmp_install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(abs_top_builddir)/tmp_install$(libdir))
|
|
|
|
endef
|
|
|
|
|
2014-11-02 15:14:36 +01:00
|
|
|
ifeq ($(enable_tap_tests),yes)
|
|
|
|
|
2014-04-15 03:33:46 +02:00
|
|
|
define prove_installcheck
|
2017-09-05 18:22:33 +02:00
|
|
|
rm -rf '$(CURDIR)'/tmp_check
|
|
|
|
$(MKDIR_P) '$(CURDIR)'/tmp_check
|
2016-11-14 18:00:00 +01:00
|
|
|
cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
2014-04-15 03:33:46 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define prove_check
|
2017-09-05 18:22:33 +02:00
|
|
|
rm -rf '$(CURDIR)'/tmp_check
|
|
|
|
$(MKDIR_P) '$(CURDIR)'/tmp_check
|
2016-11-14 18:00:00 +01:00
|
|
|
cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
|
2014-04-15 03:33:46 +02:00
|
|
|
endef
|
|
|
|
|
2014-11-02 15:14:36 +01:00
|
|
|
else
|
|
|
|
prove_installcheck = @echo "TAP tests not enabled"
|
|
|
|
prove_check = $(prove_installcheck)
|
|
|
|
endif
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
# Installation.
|
|
|
|
|
2012-06-28 19:05:36 +02:00
|
|
|
install_bin = @install_bin@
|
2012-06-27 12:40:51 +02:00
|
|
|
install_sh = $(SHELL) $(top_srcdir)/config/install-sh -c
|
2012-06-28 19:05:36 +02:00
|
|
|
INSTALL = $(if $(use_install_sh),$(install_sh),$(if $(install_bin),$(install_bin),$(install_sh)))
|
2000-10-08 23:13:27 +02:00
|
|
|
|
2005-03-26 00:22:54 +01:00
|
|
|
INSTALL_SCRIPT_MODE = 755
|
|
|
|
INSTALL_DATA_MODE = 644
|
2002-04-10 18:45:25 +02:00
|
|
|
INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
|
2005-03-26 00:22:54 +01:00
|
|
|
INSTALL_SCRIPT = $(INSTALL) -m $(INSTALL_SCRIPT_MODE)
|
|
|
|
INSTALL_DATA = $(INSTALL) -m $(INSTALL_DATA_MODE)
|
2002-04-10 18:45:25 +02:00
|
|
|
INSTALL_STLIB = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
|
|
|
|
INSTALL_SHLIB = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
|
2001-03-10 11:38:59 +01:00
|
|
|
# Override in Makefile.port if necessary
|
|
|
|
INSTALL_SHLIB_OPTS = -m 755
|
2000-10-08 23:13:27 +02:00
|
|
|
|
2009-08-27 00:24:44 +02:00
|
|
|
MKDIR_P = @MKDIR_P@
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
missing = $(SHELL) $(top_srcdir)/config/missing
|
1997-02-04 09:53:45 +01:00
|
|
|
|
2002-04-10 18:45:25 +02:00
|
|
|
STRIP = @STRIP@
|
|
|
|
STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
|
|
|
|
STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
|
|
|
|
|
2000-11-05 22:04:07 +01:00
|
|
|
# Documentation
|
|
|
|
|
2014-09-14 02:14:17 +02:00
|
|
|
DBTOEPUB = @DBTOEPUB@
|
2017-04-07 04:03:52 +02:00
|
|
|
FOP = @FOP@
|
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 = @XMLLINT@
|
2009-08-05 00:04:37 +02:00
|
|
|
XSLTPROC = @XSLTPROC@
|
2000-11-05 22:04:07 +01:00
|
|
|
|
2008-09-05 14:11:18 +02:00
|
|
|
# Code coverage
|
|
|
|
|
|
|
|
GCOV = @GCOV@
|
|
|
|
LCOV = @LCOV@
|
|
|
|
GENHTML = @GENHTML@
|
|
|
|
|
|
|
|
ifeq ($(enable_coverage),yes)
|
|
|
|
# ccache loses .gcno files
|
|
|
|
export CCACHE_DISABLE = 1
|
|
|
|
endif
|
|
|
|
|
2001-02-07 21:13:27 +01:00
|
|
|
# Feature settings
|
|
|
|
|
|
|
|
DEF_PGPORT = @default_port@
|
2001-06-02 20:25:18 +02:00
|
|
|
WANTED_LANGUAGES = @WANTED_LANGUAGES@
|
2001-02-07 21:13:27 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
|
|
|
|
##########################################################################
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
|
|
|
# Additional platform-specific settings
|
|
|
|
#
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
# Name of the "template"
|
1998-10-19 02:00:51 +02:00
|
|
|
PORTNAME= @PORTNAME@
|
2000-09-29 19:17:41 +02:00
|
|
|
|
2009-01-05 10:54:13 +01:00
|
|
|
build_os = @build_os@
|
|
|
|
|
2000-09-29 19:17:41 +02:00
|
|
|
host_tuple = @host@
|
|
|
|
host_os = @host_os@
|
|
|
|
host_cpu = @host_cpu@
|
1998-10-19 02:00:51 +02:00
|
|
|
|
2003-09-07 05:36:03 +02:00
|
|
|
# Make HAVE_IPV6 available for initdb script creation
|
|
|
|
HAVE_IPV6= @HAVE_IPV6@
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
# This is mainly for use on FreeBSD, where we have both a.out and elf
|
|
|
|
# systems now. May be applicable to other systems to?
|
|
|
|
ELF_SYSTEM= @ELF_SYS@
|
|
|
|
|
2006-10-08 19:15:34 +02:00
|
|
|
# Backend stack size limit has to be hard-wired on Windows (it's in bytes)
|
|
|
|
WIN32_STACK_RLIMIT=4194304
|
|
|
|
|
2010-12-26 16:34:47 +01:00
|
|
|
# Set if we have a working win32 crashdump header
|
|
|
|
have_win32_dbghelp = @have_win32_dbghelp@
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
# Pull in platform-specific magic
|
2000-08-31 18:12:35 +02:00
|
|
|
include $(top_builddir)/src/Makefile.port
|
1997-03-25 08:16:36 +01:00
|
|
|
|
2004-11-19 01:41:39 +01:00
|
|
|
# Set up rpath if enabled. By default it will point to our libdir,
|
|
|
|
# but individual Makefiles can force other rpath paths if needed.
|
|
|
|
rpathdir = $(libdir)
|
|
|
|
|
2000-10-28 01:59:39 +02:00
|
|
|
ifeq ($(enable_rpath), yes)
|
|
|
|
LDFLAGS += $(rpath)
|
|
|
|
endif
|
2000-10-08 23:13:27 +02:00
|
|
|
|
2002-07-27 22:10:05 +02:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# Some variables needed to find some client interfaces
|
|
|
|
|
2004-08-20 22:13:10 +02:00
|
|
|
ifdef PGXS
|
|
|
|
# some contribs assumes headers and libs are in the source tree...
|
|
|
|
libpq_srcdir = $(includedir)
|
|
|
|
libpq_builddir = $(libdir)
|
|
|
|
else
|
2000-10-08 23:13:27 +02:00
|
|
|
libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
|
|
|
|
libpq_builddir = $(top_builddir)/src/interfaces/libpq
|
2004-08-20 22:13:10 +02:00
|
|
|
endif
|
|
|
|
|
2018-09-28 20:28:19 +02:00
|
|
|
# How to link to libpq. (This macro may be used as-is by backend extensions.
|
|
|
|
# Client-side code should go through libpq_pgport or libpq_pgport_shlib,
|
|
|
|
# instead.)
|
2007-02-09 16:56:00 +01:00
|
|
|
libpq = -L$(libpq_builddir) -lpq
|
2010-11-23 21:27:50 +01:00
|
|
|
|
2018-09-28 20:28:19 +02:00
|
|
|
# libpq_pgport is for use by client executables (not libraries) that use libpq.
|
Create libpgcommon, and move pg_malloc et al to it
libpgcommon is a new static library to allow sharing code among the
various frontend programs and backend; this lets us eliminate duplicate
implementations of common routines. We avoid libpgport, because that's
intended as a place for porting issues; per discussion, it seems better
to keep them separate.
The first use case, and the only implemented by this patch, is pg_malloc
and friends, which many frontend programs were already using.
At the same time, we can use this to provide palloc emulation functions
for the frontend; this way, some palloc-using files in the backend can
also be used by the frontend cleanly. To do this, we change palloc() in
the backend to be a function instead of a macro on top of
MemoryContextAlloc(). This was previously believed to cause loss of
performance, but this implementation has been tweaked by Tom and Andres
so that on modern compilers it provides a slight improvement over the
previous one.
This lets us clean up some places that were already with
localized hacks.
Most of the pg_malloc/palloc changes in this patch were authored by
Andres Freund. Zoltán Böszörményi also independently provided a form of
that. libpgcommon infrastructure was authored by Álvaro.
2013-02-12 14:33:40 +01:00
|
|
|
# We force clients to pull symbols from the non-shared libraries libpgport
|
|
|
|
# and libpgcommon rather than pulling some libpgport symbols from libpq just
|
|
|
|
# because libpq uses those functions too. This makes applications less
|
2018-09-28 20:28:19 +02:00
|
|
|
# dependent on changes in libpq's usage of pgport (on platforms where we
|
|
|
|
# don't have symbol export control for libpq). To do this we link to
|
2005-03-25 19:17:14 +01:00
|
|
|
# pgport before libpq. This does cause duplicate -lpgport's to appear
|
2018-09-28 20:28:19 +02:00
|
|
|
# on client link lines, since that also appears in $(LIBS).
|
|
|
|
# libpq_pgport_shlib is the same idea, but for use in client shared libraries.
|
2005-03-25 19:17:14 +01:00
|
|
|
ifdef PGXS
|
2013-10-16 05:03:42 +02:00
|
|
|
libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq)
|
2018-09-28 20:28:19 +02:00
|
|
|
libpq_pgport_shlib = -L$(libdir) -lpgcommon_shlib -lpgport_shlib $(libpq)
|
2005-03-25 19:17:14 +01:00
|
|
|
else
|
2013-10-16 05:03:42 +02:00
|
|
|
libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
|
2018-09-28 20:28:19 +02:00
|
|
|
libpq_pgport_shlib = -L$(top_builddir)/src/common -lpgcommon_shlib -L$(top_builddir)/src/port -lpgport_shlib $(libpq)
|
2005-03-25 19:17:14 +01:00
|
|
|
endif
|
|
|
|
|
2014-02-11 18:10:52 +01:00
|
|
|
# Cygwin seems to need ldap libraries to be mentioned here, too
|
|
|
|
ifeq ($(PORTNAME),cygwin)
|
|
|
|
libpq_pgport += $(LDAP_LIBS_FE)
|
|
|
|
endif
|
|
|
|
|
2014-12-04 13:58:12 +01:00
|
|
|
|
2016-07-01 21:08:55 +02:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# Commonly used submake targets
|
|
|
|
|
2018-04-11 19:18:50 +02:00
|
|
|
submake-libpq: | submake-generated-headers
|
2002-07-27 22:10:05 +02:00
|
|
|
$(MAKE) -C $(libpq_builddir) all
|
|
|
|
|
2018-04-10 22:14:55 +02:00
|
|
|
submake-libpgport: | submake-generated-headers
|
2002-07-27 22:10:05 +02:00
|
|
|
$(MAKE) -C $(top_builddir)/src/port all
|
Create libpgcommon, and move pg_malloc et al to it
libpgcommon is a new static library to allow sharing code among the
various frontend programs and backend; this lets us eliminate duplicate
implementations of common routines. We avoid libpgport, because that's
intended as a place for porting issues; per discussion, it seems better
to keep them separate.
The first use case, and the only implemented by this patch, is pg_malloc
and friends, which many frontend programs were already using.
At the same time, we can use this to provide palloc emulation functions
for the frontend; this way, some palloc-using files in the backend can
also be used by the frontend cleanly. To do this, we change palloc() in
the backend to be a function instead of a macro on top of
MemoryContextAlloc(). This was previously believed to cause loss of
performance, but this implementation has been tweaked by Tom and Andres
so that on modern compilers it provides a slight improvement over the
previous one.
This lets us clean up some places that were already with
localized hacks.
Most of the pg_malloc/palloc changes in this patch were authored by
Andres Freund. Zoltán Böszörményi also independently provided a form of
that. libpgcommon infrastructure was authored by Álvaro.
2013-02-12 14:33:40 +01:00
|
|
|
$(MAKE) -C $(top_builddir)/src/common all
|
2002-07-27 22:10:05 +02:00
|
|
|
|
2018-04-10 22:14:55 +02:00
|
|
|
submake-libpgfeutils: | submake-generated-headers
|
2016-03-24 20:55:44 +01:00
|
|
|
$(MAKE) -C $(top_builddir)/src/port all
|
|
|
|
$(MAKE) -C $(top_builddir)/src/common all
|
|
|
|
$(MAKE) -C $(top_builddir)/src/fe_utils all
|
|
|
|
|
2018-04-09 22:42:02 +02:00
|
|
|
.PHONY: submake-libpq submake-libpgport submake-libpgfeutils
|
2002-07-27 22:10:05 +02:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
|
2011-02-14 20:52:32 +01:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# Testing support
|
|
|
|
|
|
|
|
PL_TESTDB = pl_regression
|
|
|
|
CONTRIB_TESTDB = contrib_regression
|
2012-12-11 17:52:45 +01:00
|
|
|
ifneq ($(MODULE_big),)
|
|
|
|
CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULE_big)
|
2013-05-31 03:05:07 +02:00
|
|
|
else
|
2012-12-11 17:52:45 +01:00
|
|
|
ifneq ($(MODULES),)
|
|
|
|
CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULES)
|
|
|
|
else
|
|
|
|
CONTRIB_TESTDB_MODULE = contrib_regression
|
|
|
|
endif
|
|
|
|
endif
|
2011-02-14 20:52:32 +01:00
|
|
|
|
2011-04-15 07:42:05 +02:00
|
|
|
ifdef NO_LOCALE
|
|
|
|
NOLOCALE += --no-locale
|
|
|
|
endif
|
|
|
|
|
2016-02-27 18:28:21 +01:00
|
|
|
# file with extra config for temp build
|
|
|
|
TEMP_CONF =
|
|
|
|
ifdef TEMP_CONFIG
|
|
|
|
TEMP_CONF += --temp-config=$(TEMP_CONFIG)
|
|
|
|
endif
|
|
|
|
|
2011-04-15 07:42:05 +02:00
|
|
|
pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
|
2017-03-14 23:56:17 +01:00
|
|
|
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ tmp_check_iso/ log/ output_iso/
|
|
|
|
|
|
|
|
pg_regress_check = \
|
|
|
|
$(with_temp_install) \
|
|
|
|
$(top_builddir)/src/test/regress/pg_regress \
|
|
|
|
--temp-instance=./tmp_check \
|
|
|
|
--inputdir=$(srcdir) \
|
2017-03-16 03:03:29 +01:00
|
|
|
--bindir= \
|
2017-03-14 23:56:17 +01:00
|
|
|
$(TEMP_CONF) \
|
2017-03-16 03:03:29 +01:00
|
|
|
$(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
2017-03-14 23:56:17 +01:00
|
|
|
pg_regress_installcheck = \
|
|
|
|
$(top_builddir)/src/test/regress/pg_regress \
|
|
|
|
--inputdir=$(srcdir) \
|
2017-03-16 03:03:29 +01:00
|
|
|
--bindir='$(bindir)' \
|
|
|
|
$(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
2017-03-14 23:56:17 +01:00
|
|
|
|
|
|
|
pg_isolation_regress_check = \
|
|
|
|
$(with_temp_install) \
|
|
|
|
$(top_builddir)/src/test/isolation/pg_isolation_regress \
|
|
|
|
--temp-instance=./tmp_check_iso \
|
|
|
|
--inputdir=$(srcdir) --outputdir=output_iso \
|
2017-03-16 03:03:29 +01:00
|
|
|
--bindir= \
|
2017-03-14 23:56:17 +01:00
|
|
|
$(TEMP_CONF) \
|
2017-03-16 03:03:29 +01:00
|
|
|
$(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
2017-03-14 23:56:17 +01:00
|
|
|
pg_isolation_regress_installcheck = \
|
|
|
|
$(top_builddir)/src/test/isolation/pg_isolation_regress \
|
2017-05-14 00:13:17 +02:00
|
|
|
--inputdir=$(srcdir) --outputdir=output_iso \
|
2017-03-16 03:03:29 +01:00
|
|
|
--bindir='$(bindir)' \
|
2017-03-14 23:56:17 +01:00
|
|
|
$(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
|
2011-02-14 20:52:32 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
##########################################################################
|
1997-03-25 08:16:36 +01:00
|
|
|
#
|
2000-10-08 23:13:27 +02:00
|
|
|
# Customization
|
1997-03-25 08:16:36 +01:00
|
|
|
#
|
1997-04-12 12:33:10 +02:00
|
|
|
# This includes your local customizations if Makefile.custom exists
|
|
|
|
# in the source directory. This file doesn't exist in the original
|
|
|
|
# distribution so that it doesn't get overwritten when you upgrade.
|
2000-10-08 23:13:27 +02:00
|
|
|
#
|
|
|
|
# NOTE: Makefile.custom is from the pre-Autoconf days of PostgreSQL.
|
|
|
|
# You are liable to shoot yourself in the foot if you use it without
|
|
|
|
# knowing exactly what you're doing. The preferred (and more
|
|
|
|
# reliable) method is to communicate what you want to do to the
|
|
|
|
# configure script, and leave the makefiles alone.
|
1997-03-25 08:16:36 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
-include $(top_srcdir)/src/Makefile.custom
|
1997-02-04 09:53:45 +01:00
|
|
|
|
|
|
|
ifneq ($(CUSTOM_INSTALL),)
|
|
|
|
INSTALL= $(CUSTOM_INSTALL)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(CUSTOM_CC),)
|
|
|
|
CC= $(CUSTOM_CC)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(CUSTOM_COPT),)
|
|
|
|
COPT= $(CUSTOM_COPT)
|
|
|
|
endif
|
|
|
|
|
2017-02-17 22:11:02 +01:00
|
|
|
#
|
|
|
|
# These variables are meant to be set in the environment of "make"
|
|
|
|
# to add flags to whatever configure picked. Unlike the ones above,
|
|
|
|
# they are documented.
|
|
|
|
#
|
1997-02-04 09:53:45 +01:00
|
|
|
ifdef COPT
|
2004-12-16 18:48:29 +01:00
|
|
|
CFLAGS += $(COPT)
|
|
|
|
LDFLAGS += $(COPT)
|
1997-02-04 09:53:45 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef PROFILE
|
2004-12-16 18:48:29 +01:00
|
|
|
CFLAGS += $(PROFILE)
|
|
|
|
LDFLAGS += $(PROFILE)
|
1997-02-04 09:53:45 +01:00
|
|
|
endif
|
2000-06-27 02:32:06 +02:00
|
|
|
|
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
##########################################################################
|
|
|
|
#
|
2005-08-02 21:02:32 +02:00
|
|
|
# substitute implementations of C library routines (see src/port/)
|
2010-07-07 00:03:05 +02:00
|
|
|
# note we already included -L.../src/port in LDFLAGS above
|
2000-10-08 23:13:27 +02:00
|
|
|
|
2007-09-29 00:25:49 +02:00
|
|
|
LIBOBJS = @LIBOBJS@
|
2002-07-27 22:10:05 +02:00
|
|
|
|
Use Intel SSE 4.2 CRC instructions where available.
Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.
Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)
Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
2015-04-14 16:05:03 +02:00
|
|
|
# files needed for the chosen CRC-32C implementation
|
|
|
|
PG_CRC32C_OBJS = @PG_CRC32C_OBJS@
|
|
|
|
|
2013-10-18 03:52:54 +02:00
|
|
|
LIBS := -lpgcommon -lpgport $(LIBS)
|
2002-03-13 01:05:06 +01:00
|
|
|
|
2014-10-22 04:55:43 +02:00
|
|
|
# to make ws2_32.lib the last library
|
Briefly,
* configure + Makefile changes
* shared memory attaching in EXEC_BACKEND case (+ minor fix for apparent
cygwin bug under cygwin/EXEC_BACKEND case only)
* PATH env var separator differences
* missing win32 rand functions added
* placeholder replacements for sync etc under port.h
To those who are really interested, and there are a few of you: the attached
patch + file will allow the source base to be compiled (and, for some
definition, "run") under MingW, with the following caveats (I wanted to
first properly fix all but the last of these, but y'all won't quit asking
for a patch :-):
* child death: SIGCHLD not yet sent, so as a minimum, you'll need to
put in some sort of delay after StartupDatabase, and handle setting
StartupPID to 0 etc (ie. the stuff the reaper() signal function is supposed
to do)
* dirmod.c: comment out the elog calls
* dfmgr.c: some hackage required to substitute_libpath_macro
* slru/xact.c: comment out the errno checking after the readdir
(fixed by next version of MingW)
Again, this is only if you *really* want to see postgres compile and start,
and is a nice leg-up for working on the other Win32 TODO list items. Just
don't expect too much else from it at this point...
Claudio Natoli
2004-02-02 01:11:31 +01:00
|
|
|
ifeq ($(PORTNAME),win32)
|
2014-10-22 04:55:43 +02:00
|
|
|
LIBS += -lws2_32
|
Briefly,
* configure + Makefile changes
* shared memory attaching in EXEC_BACKEND case (+ minor fix for apparent
cygwin bug under cygwin/EXEC_BACKEND case only)
* PATH env var separator differences
* missing win32 rand functions added
* placeholder replacements for sync etc under port.h
To those who are really interested, and there are a few of you: the attached
patch + file will allow the source base to be compiled (and, for some
definition, "run") under MingW, with the following caveats (I wanted to
first properly fix all but the last of these, but y'all won't quit asking
for a patch :-):
* child death: SIGCHLD not yet sent, so as a minimum, you'll need to
put in some sort of delay after StartupDatabase, and handle setting
StartupPID to 0 etc (ie. the stuff the reaper() signal function is supposed
to do)
* dirmod.c: comment out the elog calls
* dfmgr.c: some hackage required to substitute_libpath_macro
* slru/xact.c: comment out the errno checking after the readdir
(fixed by next version of MingW)
Again, this is only if you *really* want to see postgres compile and start,
and is a nice leg-up for working on the other Win32 TODO list items. Just
don't expect too much else from it at this point...
Claudio Natoli
2004-02-02 01:11:31 +01:00
|
|
|
endif
|
|
|
|
|
2002-07-19 19:35:11 +02:00
|
|
|
# Not really standard libc functions, used by the backend.
|
2002-03-13 01:05:06 +01:00
|
|
|
TAS = @TAS@
|
2000-06-27 02:32:06 +02:00
|
|
|
|
2000-07-16 16:50:44 +02:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
##########################################################################
|
|
|
|
#
|
2001-09-18 01:00:27 +02:00
|
|
|
# Global targets and rules
|
|
|
|
|
2012-10-11 12:57:04 +02:00
|
|
|
%.c: %.l
|
|
|
|
ifdef FLEX
|
|
|
|
$(FLEX) $(if $(FLEX_NO_BACKUP),-b) $(FLEXFLAGS) -o'$@' $<
|
|
|
|
@$(if $(FLEX_NO_BACKUP),if [ `wc -l <lex.backup` -eq 1 ]; then rm lex.backup; else echo "Scanner requires backup; see lex.backup." 1>&2; exit 1; fi)
|
2017-02-19 22:41:51 +01:00
|
|
|
$(if $(FLEX_FIX_WARNING),$(PERL) $(top_srcdir)/src/tools/fix-old-flex-code.pl '$@')
|
2012-10-11 12:57:04 +02:00
|
|
|
else
|
|
|
|
@$(missing) flex $< '$@'
|
|
|
|
endif
|
|
|
|
|
|
|
|
%.c: %.y
|
|
|
|
$(if $(BISON_CHECK_CMD),$(BISON_CHECK_CMD))
|
|
|
|
ifdef BISON
|
|
|
|
$(BISON) $(BISONFLAGS) -o $@ $<
|
|
|
|
else
|
|
|
|
@$(missing) bison $< $@
|
|
|
|
endif
|
|
|
|
|
2009-02-19 11:32:30 +01:00
|
|
|
%.i: %.c
|
|
|
|
$(CPP) $(CPPFLAGS) -o $@ $<
|
|
|
|
|
2001-09-18 01:00:27 +02:00
|
|
|
%.gz: %
|
2009-11-03 22:28:10 +01:00
|
|
|
$(GZIP) --best -c $< >$@
|
2001-09-18 01:00:27 +02:00
|
|
|
|
|
|
|
%.bz2: %
|
2009-11-03 22:28:10 +01:00
|
|
|
$(BZIP2) -c $< >$@
|
2000-07-19 18:30:27 +02:00
|
|
|
|
2012-02-02 19:24:38 +01:00
|
|
|
# Direct builds of foo.c -> foo are disabled to avoid generating
|
|
|
|
# *.dSYM junk on Macs. All builds should normally go through the
|
|
|
|
# foo.c -> foo.o -> foo steps. This also ensures that dependency
|
|
|
|
# tracking (see below) is used.
|
|
|
|
%: %.c
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
ifndef PGXS
|
|
|
|
|
2000-07-19 18:30:27 +02:00
|
|
|
# Remake Makefile.global from Makefile.global.in if the latter
|
|
|
|
# changed. In order to trigger this rule, the including file must
|
|
|
|
# write `include $(top_builddir)/src/Makefile.global', not some
|
|
|
|
# shortcut thereof.
|
2000-07-16 16:50:44 +02:00
|
|
|
$(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
|
2002-03-29 18:32:55 +01:00
|
|
|
cd $(top_builddir) && ./config.status src/Makefile.global
|
2000-07-16 16:50:44 +02:00
|
|
|
|
2001-08-24 16:07:50 +02:00
|
|
|
# Remake pg_config.h from pg_config.h.in if the latter changed.
|
|
|
|
# config.status will not change the timestamp on pg_config.h if it
|
2000-07-19 18:30:27 +02:00
|
|
|
# doesn't change, so as to avoid recompiling the entire tree
|
2000-12-29 21:39:09 +01:00
|
|
|
# unnecessarily. Therefore we make config.status update a timestamp file
|
2012-04-24 04:43:09 +02:00
|
|
|
# stamp-h every time it runs, so that we don't trigger this rule every time.
|
|
|
|
# (We do trigger the null rule for stamp-h to pg_config.h every time; so it's
|
2012-05-07 20:28:38 +02:00
|
|
|
# important for that rule to be empty!)
|
2000-07-19 18:30:27 +02:00
|
|
|
#
|
|
|
|
# Of course you need to turn on dependency tracking to get any
|
2001-08-24 16:07:50 +02:00
|
|
|
# dependencies on pg_config.h.
|
2012-05-07 20:28:38 +02:00
|
|
|
$(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h ;
|
2000-12-29 21:39:09 +01:00
|
|
|
|
2001-08-24 16:07:50 +02:00
|
|
|
$(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
|
2002-03-29 18:32:55 +01:00
|
|
|
cd $(top_builddir) && ./config.status src/include/pg_config.h
|
2000-07-19 18:30:27 +02:00
|
|
|
|
2012-10-08 03:52:07 +02:00
|
|
|
# Also remake pg_config_ext.h from pg_config_ext.h.in, same logic as above.
|
|
|
|
$(top_builddir)/src/include/pg_config_ext.h: $(top_builddir)/src/include/stamp-ext-h ;
|
|
|
|
|
|
|
|
$(top_builddir)/src/include/stamp-ext-h: $(top_srcdir)/src/include/pg_config_ext.h.in $(top_builddir)/config.status
|
|
|
|
cd $(top_builddir) && ./config.status src/include/pg_config_ext.h
|
|
|
|
|
2010-11-23 21:27:50 +01:00
|
|
|
# Also remake ecpg_config.h from ecpg_config.h.in if the latter changed, same
|
2009-01-22 23:27:13 +01:00
|
|
|
# logic as above.
|
2012-05-07 20:28:38 +02:00
|
|
|
$(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h: $(top_builddir)/src/interfaces/ecpg/include/stamp-h ;
|
2009-01-22 23:27:13 +01:00
|
|
|
|
|
|
|
$(top_builddir)/src/interfaces/ecpg/include/stamp-h: $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h.in $(top_builddir)/config.status
|
2006-08-23 14:01:53 +02:00
|
|
|
cd $(top_builddir) && ./config.status src/interfaces/ecpg/include/ecpg_config.h
|
|
|
|
|
2000-07-19 18:30:27 +02:00
|
|
|
# When configure changes, rerun configure with the same options as
|
|
|
|
# last time. To change configure, you need to run autoconf manually.
|
2000-07-16 16:50:44 +02:00
|
|
|
$(top_builddir)/config.status: $(top_srcdir)/configure
|
|
|
|
cd $(top_builddir) && ./config.status --recheck
|
|
|
|
|
2004-07-30 14:26:40 +02:00
|
|
|
endif # not PGXS
|
|
|
|
|
2000-07-16 16:50:44 +02:00
|
|
|
|
2002-04-10 18:45:25 +02:00
|
|
|
install-strip:
|
2012-06-27 12:40:51 +02:00
|
|
|
# install-strip always uses install-sh, so that strip options can be
|
|
|
|
# passed.
|
|
|
|
$(MAKE) use_install_sh=yes \
|
|
|
|
INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
|
2002-04-10 18:45:25 +02:00
|
|
|
INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
|
|
|
|
INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
|
|
|
|
INSTALL_STRIP_FLAG=-s \
|
|
|
|
install
|
|
|
|
|
|
|
|
|
2010-11-12 21:15:16 +01:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# Recursive make support
|
|
|
|
# ----------------------
|
|
|
|
# Instead of recursing through subdirectories with a for loop or
|
|
|
|
# repeated $(MAKE) -C whatever calls, this is a little smarter: it
|
|
|
|
# allows parallel make across directories and lets make -k and -q work
|
|
|
|
# correctly.
|
|
|
|
|
2010-11-14 18:50:06 +01:00
|
|
|
# We need the $(eval) function and order-only prerequisites, which are
|
|
|
|
# available in GNU make 3.80. That also happens to be the version
|
|
|
|
# where the .VARIABLES variable was introduced, so this is a simple check.
|
|
|
|
ifndef .VARIABLES
|
|
|
|
$(error GNU make 3.80 or newer is required. You are using version $(MAKE_VERSION))
|
|
|
|
endif
|
|
|
|
|
2010-11-12 21:15:16 +01:00
|
|
|
# This function is only for internal use below. It should be called
|
2018-07-31 00:04:39 +02:00
|
|
|
# using $(eval). It will set up a target so that it recurses into a
|
|
|
|
# given subdirectory. For the tree-wide all/install/check/installcheck cases,
|
2018-04-09 22:42:02 +02:00
|
|
|
# ensure we do our one-time tasks before recursing (see targets above).
|
|
|
|
# Note that to avoid a nasty bug in make 3.80,
|
2010-11-15 07:00:48 +01:00
|
|
|
# this function has to avoid using any complicated constructs (like
|
|
|
|
# multiple targets on a line) and also not contain any lines that expand
|
|
|
|
# to more than about 200 bytes. This is why we make it apply to just one
|
|
|
|
# subdirectory at a time, rather than to a list of subdirectories.
|
2010-11-12 21:15:16 +01:00
|
|
|
# $1: target name, e.g., all
|
2010-11-14 18:50:06 +01:00
|
|
|
# $2: subdir name
|
2010-11-12 21:15:16 +01:00
|
|
|
# $3: target to run in subdir, usually same as $1
|
|
|
|
define _create_recursive_target
|
2010-11-14 18:50:06 +01:00
|
|
|
.PHONY: $(1)-$(2)-recurse
|
|
|
|
$(1): $(1)-$(2)-recurse
|
2018-07-31 00:04:39 +02:00
|
|
|
$(1)-$(2)-recurse: $(if $(filter all install check installcheck, $(3)), submake-generated-headers) $(if $(filter check, $(3)), temp-install)
|
2010-11-14 18:50:06 +01:00
|
|
|
$$(MAKE) -C $(2) $(3)
|
2010-11-12 21:15:16 +01:00
|
|
|
endef
|
|
|
|
# Note that the use of $$ on the last line above is important; we want
|
2010-11-14 18:50:06 +01:00
|
|
|
# $(MAKE) to be evaluated when the rule is run, not when the $(eval) is run
|
|
|
|
# to create the rule. This is necessary to get make -q working.
|
2010-11-12 21:15:16 +01:00
|
|
|
|
2010-11-14 18:50:06 +01:00
|
|
|
# Call this function in a makefile that needs to recurse into subdirectories.
|
|
|
|
# In the normal case all arguments can be defaulted.
|
2010-11-12 21:15:16 +01:00
|
|
|
# $1: targets to make recursive (defaults to list of standard targets)
|
|
|
|
# $2: list of subdirs (defaults to SUBDIRS variable)
|
2010-11-14 18:50:06 +01:00
|
|
|
# $3: target to run in subdir (defaults to current element of $1)
|
|
|
|
recurse = $(foreach target,$(if $1,$1,$(standard_targets)),$(foreach subdir,$(if $2,$2,$(SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target))))))
|
2010-11-12 21:15:16 +01:00
|
|
|
|
2011-07-03 19:55:02 +02:00
|
|
|
# If a makefile's list of SUBDIRS varies depending on configuration, then
|
|
|
|
# any subdirectories excluded from SUBDIRS should instead be added to
|
|
|
|
# ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse.
|
|
|
|
# This ensures that distprep, distclean, etc will apply to all subdirectories.
|
|
|
|
# In the normal case all arguments will be defaulted.
|
|
|
|
# $1: targets to make recursive (defaults to standard_always_targets)
|
|
|
|
# $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable)
|
|
|
|
# $3: target to run in subdir (defaults to current element of $1)
|
|
|
|
recurse_always = $(foreach target,$(if $1,$1,$(standard_always_targets)),$(foreach subdir,$(if $2,$2,$(ALWAYS_SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target))))))
|
|
|
|
|
2010-11-12 21:15:16 +01:00
|
|
|
|
2000-10-08 23:13:27 +02:00
|
|
|
##########################################################################
|
|
|
|
#
|
2000-07-16 16:50:44 +02:00
|
|
|
# Automatic dependency generation
|
|
|
|
# -------------------------------
|
|
|
|
# When we configure with --enable-depend then we override the default
|
|
|
|
# compilation rule with the magic below. While or after creating the
|
|
|
|
# actual output file we also create a dependency list for the .c file.
|
|
|
|
# Next time we invoke make we will have top-notch information about
|
|
|
|
# whether this file needs to be updated. The dependency files are kept
|
|
|
|
# in the .deps subdirectory of each directory.
|
|
|
|
|
|
|
|
autodepend = @autodepend@
|
|
|
|
|
2000-09-08 20:29:28 +02:00
|
|
|
ifeq ($(autodepend), yes)
|
2000-07-16 16:50:44 +02:00
|
|
|
|
2000-10-29 17:13:28 +01:00
|
|
|
ifndef COMPILE.c
|
|
|
|
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
|
|
|
|
endif
|
|
|
|
|
2018-03-20 23:41:15 +01:00
|
|
|
ifndef COMPILE.cc
|
|
|
|
COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
|
|
|
|
endif
|
|
|
|
|
2000-07-16 16:50:44 +02:00
|
|
|
DEPDIR = .deps
|
2000-10-29 17:13:28 +01:00
|
|
|
|
2000-07-16 16:50:44 +02:00
|
|
|
ifeq ($(GCC), yes)
|
|
|
|
|
|
|
|
# GCC allows us to create object and dependency file in one invocation.
|
|
|
|
%.o : %.c
|
2006-07-22 00:37:37 +02:00
|
|
|
@if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
|
|
|
|
$(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
|
2000-07-16 16:50:44 +02:00
|
|
|
|
2018-03-20 23:41:15 +01:00
|
|
|
%.o : %.cpp
|
|
|
|
@if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
|
|
|
|
$(COMPILE.cc) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
|
|
|
|
|
2000-07-16 16:50:44 +02:00
|
|
|
endif # GCC
|
|
|
|
|
|
|
|
# Include all the dependency files generated for the current
|
2013-04-13 04:45:51 +02:00
|
|
|
# directory. Note that make would complain if include was called with
|
|
|
|
# no arguments.
|
|
|
|
Po_files := $(wildcard $(DEPDIR)/*.Po)
|
|
|
|
ifneq (,$(Po_files))
|
|
|
|
include $(Po_files)
|
|
|
|
endif
|
2000-07-16 16:50:44 +02:00
|
|
|
|
|
|
|
# hook for clean-up
|
2000-07-22 03:48:53 +02:00
|
|
|
clean distclean maintainer-clean: clean-deps
|
2000-07-16 16:50:44 +02:00
|
|
|
|
|
|
|
.PHONY: clean-deps
|
|
|
|
clean-deps:
|
2006-07-22 00:37:37 +02:00
|
|
|
@rm -rf $(DEPDIR)
|
2000-07-16 16:50:44 +02:00
|
|
|
|
|
|
|
endif # autodepend
|
2001-06-02 20:25:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# Native language support
|
|
|
|
|
|
|
|
ifeq ($(enable_nls), yes)
|
|
|
|
ifneq (,$(wildcard $(srcdir)/nls.mk))
|
|
|
|
|
|
|
|
include $(top_srcdir)/src/nls-global.mk
|
|
|
|
|
|
|
|
endif # nls.mk
|
|
|
|
endif # enable_nls
|
2008-09-05 14:11:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# Coverage
|
|
|
|
|
2008-10-03 17:35:17 +02:00
|
|
|
# Explanation of involved files:
|
|
|
|
# foo.c source file
|
|
|
|
# foo.o object file
|
|
|
|
# foo.gcno gcov graph (a.k.a. "notes") file, created at compile time
|
|
|
|
# (by gcc -ftest-coverage)
|
|
|
|
# foo.gcda gcov data file, created when the program is run (for
|
|
|
|
# programs compiled with gcc -fprofile-arcs)
|
|
|
|
# foo.c.gcov gcov output file with coverage information, created by
|
|
|
|
# gcov from foo.gcda (by "make coverage")
|
|
|
|
# foo.c.gcov.out stdout captured when foo.c.gcov is created, mildly
|
|
|
|
# interesting
|
2017-08-11 05:33:47 +02:00
|
|
|
# lcov_test.info
|
|
|
|
# lcov tracefile, built from gcda files in one directory,
|
2008-10-03 17:35:17 +02:00
|
|
|
# later collected by "make coverage-html"
|
2017-08-11 05:33:47 +02:00
|
|
|
# lcov_base.info
|
|
|
|
# tracefile for zero counters for every file, so that
|
|
|
|
# even files that are not touched by tests are counted
|
|
|
|
# for the overall coverage rate
|
2008-10-03 17:35:17 +02:00
|
|
|
|
2008-09-05 14:11:18 +02:00
|
|
|
ifeq ($(enable_coverage), yes)
|
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
# make coverage -- text output
|
2008-09-05 14:11:18 +02:00
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
local_gcda_files = $(wildcard *.gcda)
|
2008-09-05 14:11:18 +02:00
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
coverage: $(local_gcda_files:.gcda=.c.gcov)
|
2008-09-05 14:11:18 +02:00
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
%.c.gcov: %.gcda
|
2008-09-05 14:11:18 +02:00
|
|
|
$(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out
|
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
# make coverage-html -- HTML output via lcov
|
2009-08-07 22:50:22 +02:00
|
|
|
|
|
|
|
.PHONY: coverage-html
|
2017-08-11 05:33:47 +02:00
|
|
|
coverage-html: coverage-html-stamp
|
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
GENHTML_FLAGS = -q --legend
|
2017-08-11 05:33:47 +02:00
|
|
|
GENHTML_TITLE = PostgreSQL $(VERSION)
|
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
coverage-html-stamp: lcov_base.info lcov_test.info
|
2009-08-07 22:50:22 +02:00
|
|
|
rm -rf coverage
|
2017-10-14 17:40:54 +02:00
|
|
|
$(GENHTML) $(GENHTML_FLAGS) -o coverage --title='$(GENHTML_TITLE)' --num-spaces=4 $(if $(filter no,$(vpath_build)),--prefix='$(abs_top_srcdir)') $^
|
2017-08-11 05:33:47 +02:00
|
|
|
touch $@
|
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
LCOV += --gcov-tool $(GCOV)
|
2017-08-11 05:33:47 +02:00
|
|
|
LCOVFLAGS = -q --no-external
|
2017-08-11 05:33:47 +02:00
|
|
|
|
|
|
|
all_gcno_files = $(shell find . -name '*.gcno' -print)
|
|
|
|
|
|
|
|
lcov_base.info: $(all_gcno_files)
|
2017-08-11 05:33:47 +02:00
|
|
|
$(LCOV) $(LCOVFLAGS) -c -i -d . -d $(srcdir) -o $@
|
2017-08-11 05:33:47 +02:00
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
all_gcda_files = $(shell find . -name '*.gcda' -print)
|
|
|
|
|
2017-08-11 05:33:47 +02:00
|
|
|
lcov_test.info: $(all_gcda_files)
|
2017-08-11 05:33:47 +02:00
|
|
|
$(LCOV) $(LCOVFLAGS) -c -d . -d $(srcdir) -o $@
|
2009-08-07 22:50:22 +02:00
|
|
|
|
2008-09-05 14:11:18 +02:00
|
|
|
|
|
|
|
# hook for clean-up
|
|
|
|
clean distclean maintainer-clean: clean-coverage
|
|
|
|
|
|
|
|
.PHONY: clean-coverage
|
|
|
|
clean-coverage:
|
2017-08-11 05:33:47 +02:00
|
|
|
rm -rf coverage coverage-html-stamp
|
2017-08-11 05:33:47 +02:00
|
|
|
rm -f *.gcda *.gcno lcov*.info *.gcov .*.gcov *.gcov.out
|
2008-09-05 14:11:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
# User-callable target to reset counts between test runs
|
|
|
|
coverage-clean:
|
|
|
|
rm -f `find . -name '*.gcda' -print`
|
|
|
|
|
|
|
|
endif # enable_coverage
|
Support for optimizing and emitting code in LLVM JIT provider.
This commit introduces the ability to actually generate code using
LLVM. In particular, this adds:
- Ability to emit code both in heavily optimized and largely
unoptimized fashion
- Batching facility to allow functions to be defined in small
increments, but optimized and emitted in executable form in larger
batches (for performance and memory efficiency)
- Type and function declaration synchronization between runtime
generated code and normal postgres code. This is critical to be able
to access struct fields etc.
- Developer oriented jit_dump_bitcode GUC, for inspecting / debugging
the generated code.
- per JitContext statistics of number of functions, time spent
generating code, optimizing, and emitting it. This will later be
employed for EXPLAIN support.
This commit doesn't yet contain any code actually generating
functions. That'll follow in later commits.
Documentation for GUCs added, and for JIT in general, will be added in
later commits.
Author: Andres Freund, with contributions by Pierre Ducroquet
Testing-By: Thomas Munro, Peter Eisentraut
Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
2018-03-22 19:05:22 +01:00
|
|
|
|
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# LLVM support
|
|
|
|
#
|
|
|
|
|
|
|
|
ifndef COMPILE.c.bc
|
|
|
|
# -Wno-ignored-attributes added so gnu_printf doesn't trigger
|
|
|
|
# warnings, when the main binary is compiled with C.
|
|
|
|
COMPILE.c.bc = $(CLANG) -Wno-ignored-attributes $(BITCODE_CFLAGS) $(CPPFLAGS) -flto=thin -emit-llvm -c
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef COMPILE.cxx.bc
|
|
|
|
COMPILE.cxx.bc = $(CLANG) -xc++ -Wno-ignored-attributes $(BITCODE_CXXFLAGS) $(CPPFLAGS) -flto=thin -emit-llvm -c
|
|
|
|
endif
|
|
|
|
|
|
|
|
%.bc : %.c
|
|
|
|
$(COMPILE.c.bc) -o $@ $<
|
|
|
|
|
|
|
|
%.bc : %.cpp
|
|
|
|
$(COMPILE.cxx.bc) -o $@ $<
|
2018-03-28 22:19:08 +02:00
|
|
|
|
|
|
|
# Install LLVM bitcode module (for JITing).
|
|
|
|
#
|
|
|
|
# The arguments are:
|
|
|
|
# $(1) name of the module (e.g. an extension's name or postgres for core code)
|
|
|
|
# $(2) source objects, with .o suffix
|
|
|
|
#
|
|
|
|
# The many INSTALL_DATA invocations aren't particularly fast, it'd be
|
|
|
|
# good if we could coalesce them, but I didn't find a good way.
|
2018-04-28 20:45:39 +02:00
|
|
|
#
|
|
|
|
# Note: blank line at end of macro is necessary to let it be used in foreach
|
2018-04-28 20:02:57 +02:00
|
|
|
define install_llvm_module
|
|
|
|
$(MKDIR_P) '$(DESTDIR)${bitcodedir}/$(1)'
|
|
|
|
$(MKDIR_P) $(sort $(dir $(addprefix '$(DESTDIR)${bitcodedir}'/$(1)/, $(2))))
|
|
|
|
$(foreach obj, ${2}, $(INSTALL_DATA) $(patsubst %.o,%.bc, $(obj)) '$(DESTDIR)${bitcodedir}'/$(1)/$(dir $(obj))
|
2018-03-28 22:19:08 +02:00
|
|
|
)
|
2018-04-28 20:02:57 +02:00
|
|
|
cd '$(DESTDIR)${bitcodedir}' && $(LLVM_BINPATH)/llvm-lto -thinlto -thinlto-action=thinlink -o $(1).index.bc $(addprefix $(1)/,$(patsubst %.o,%.bc, $(2)))
|
2018-04-28 20:45:39 +02:00
|
|
|
|
2018-03-28 22:19:08 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Uninstall LLVM bitcode module.
|
|
|
|
#
|
|
|
|
# The arguments are:
|
|
|
|
# $(1) name of the module (e.g. an extension's name or postgres for core code)
|
|
|
|
#
|
|
|
|
# This intentionally doesn't use the explicit installed file list,
|
|
|
|
# seems too likely to change regularly.
|
|
|
|
define uninstall_llvm_module
|
2018-04-28 20:02:57 +02:00
|
|
|
rm -rf '$(DESTDIR)${bitcodedir}/$(1)/'
|
|
|
|
rm -f '$(DESTDIR)${bitcodedir}/$(1).index.bc'
|
2018-04-28 20:45:39 +02:00
|
|
|
|
2018-03-28 22:19:08 +02:00
|
|
|
endef
|