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@
2000-07-02 17:21:27 +02:00
2000-10-20 23:04:27 +02:00
# Support for VPATH builds
2014-12-04 23:02:02 +01:00
# (PGXS VPATH support is handled separately in pgxs.mk)
i f n d e f P G X S
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
i f n e q ( $( vpath_build ) , y e s )
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
e l s e # 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
e n d i f
2014-12-04 23:02:02 +01:00
e n d i f # 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.
i f n d e f P G X S
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
i f e q "$(findstring pgsql, $(datadir))" ""
i f e q "$(findstring postgres, $(datadir))" ""
override datadir : = $( datadir ) /postgresql
e n d i f
e n d i f
2000-10-08 23:13:27 +02:00
sysconfdir := @sysconfdir@
2004-05-22 02:34:51 +02:00
i f e q "$(findstring pgsql, $(sysconfdir))" ""
i f e q "$(findstring postgres, $(sysconfdir))" ""
override sysconfdir : = $( sysconfdir ) /postgresql
e n d i f
e n d i f
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)
i f e q "$(findstring pgsql, $(pkglibdir))" ""
i f e q "$(findstring postgres, $(pkglibdir))" ""
override pkglibdir : = $( pkglibdir ) /postgresql
e n d i f
e n d i f
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)
i f e q "$(findstring pgsql, $(pkgincludedir))" ""
i f e q "$(findstring postgres, $(pkgincludedir))" ""
override pkgincludedir : = $( pkgincludedir ) /postgresql
e n d i f
e n d i f
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
i f e q "$(findstring pgsql, $(docdir))" ""
i f e q "$(findstring postgres, $(docdir))" ""
override docdir : = $( docdir ) /postgresql
e n d i f
e n d i f
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
e l s e # PGXS case
2007-06-27 00:05:04 +02:00
# Extension makefiles should set PG_CONFIG, but older ones might not
i f n d e f P G _ C O N F I G
2006-07-20 11:30:18 +02:00
PG_CONFIG = pg_config
2007-06-27 00:05:04 +02:00
e n d i f
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
e n d i f # 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
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
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@
2007-04-13 20:50:01 +02:00
with_libxml = @with_libxml@
2007-04-15 14:48:24 +02:00
with_libxslt = @with_libxslt@
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@
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@
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
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
i f d e f P G X S
override CPPFLAGS : = -I $( includedir_server ) -I $( includedir_internal ) $( CPPFLAGS )
e l s e # not PGXS
2001-07-15 13:20:01 +02:00
override CPPFLAGS : = -I $( top_srcdir ) /src /include $( CPPFLAGS )
i f d e f V P A T H
override CPPFLAGS : = -I $( top_builddir ) /src /include $( CPPFLAGS )
e n d i f
2004-07-30 14:26:40 +02:00
e n d i f # 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@
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@
2000-06-27 02:32:06 +02:00
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@
2000-10-21 01:57:34 +02:00
LD = @LD@
with_gnu_ld = @with_gnu_ld@
2000-11-09 19:18:42 +01:00
ld_R_works = @ld_R_works@
2010-07-07 00:03:05 +02:00
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 want -L for libpgport.a and libpgcommon.a to be first in LDFLAGS. We
# also need LDFLAGS to be a "recursively expanded" variable, else adjustments
# to rpathdir don't work right. So we must NOT do LDFLAGS := something,
# meaning this has to be done first and elsewhere we must only do LDFLAGS +=
# something.
2010-07-07 00:03:05 +02:00
i f d e f P G X S
LDFLAGS = -L$( libdir)
e l s e
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
LDFLAGS = -L$( top_builddir) /src/port -L$( top_builddir) /src/common
2010-07-07 00:03:05 +02:00
e n d i f
LDFLAGS += @LDFLAGS@
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
i f n e q ( @ P E R L @ , )
# quoted to protect pathname with spaces
2011-06-16 03:45:23 +02:00
PERL = '@PERL@'
2009-06-23 05:46:00 +02:00
e l s e
PERL = $( missing) perl
e n d i f
2002-05-28 18:57:53 +02:00
perl_archlibexp = @perl_archlibexp@
perl_privlibexp = @perl_privlibexp@
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
2014-04-15 03:33:46 +02:00
# Testing
2015-04-23 14:59:52 +02:00
check : temp -install
.PHONY : temp -install
temp-install :
i f e q ( $( MAKELEVEL ) , 0 )
rm -rf '$(abs_top_builddir)' /tmp_install
2015-04-30 02:34:22 +02:00
$( MAKE) -C '$(top_builddir)' DESTDIR = '$(abs_top_builddir)' /tmp_install install
2015-04-23 14:59:52 +02:00
e n d i f
2015-04-30 02:34:22 +02:00
$( if $( EXTRA_INSTALL) ,for extra in $( EXTRA_INSTALL) ; do $( MAKE) -C '$(top_builddir)' /$$ extra DESTDIR = '$(abs_top_builddir)' /tmp_install install || exit; done )
2015-04-23 14:59:52 +02:00
2014-04-15 03:33:46 +02:00
PROVE = @PROVE@
2014-10-26 14:47:01 +01:00
PG_PROVE_FLAGS = -I $( top_srcdir) /src/test/perl/
2014-04-15 03:33:46 +02:00
PROVE_FLAGS = --verbose
2014-08-15 06:01:14 +02:00
# prepend to path if already set, else just set it
d e f i n e a d d _ t o _ p a t h
2014-10-13 05:33:37 +02:00
$(1) = " $( if $( $( 1) ) ,$( 2) :$$ $( 1) ,$( 2) ) "
2014-08-15 06:01:14 +02:00
e n d e f
# platform-specific environment variable to set shared library path
d e f i n e l d _ l i b r a r y _ p a t h _ v a r
$( if $ ( filter $ ( PORTNAME ) ,darwin ) ,DYLD_LIBRARY_PATH ,$ ( if $ ( filter $ ( PORTNAME ) ,aix ) ,LIBPATH ,LD_LIBRARY_PATH ) )
e n d e f
2015-04-23 14:59:52 +02:00
d e f i n e w i t h _ t e m p _ i n s t a l l
PATH = " $( abs_top_builddir) /tmp_install $( bindir) : $$ PATH " $( call add_to_path,$( ld_library_path_var) ,$( abs_top_builddir) /tmp_install$( libdir) )
e n d e f
2014-11-02 15:14:36 +01:00
i f e q ( $( enable_tap_tests ) , y e s )
2014-04-15 03:33:46 +02:00
d e f i n e p r o v e _ i n s t a l l c h e c k
2014-12-24 16:31:36 +01:00
cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir) : $$PATH " PGPORT ='6$( DEF_PGPORT ) ' top_builddir ='$( CURDIR ) /$( top_builddir ) ' $( PROVE ) $( PG_PROVE_FLAGS ) $( PROVE_FLAGS ) t /*.pl
2014-04-15 03:33:46 +02:00
e n d e f
d e f i n e p r o v e _ c h e c k
2015-04-23 14:59:52 +02:00
c d $( srcdir ) & & TESTDIR = '$(CURDIR)' $( with_temp_install) PGPORT = '6$(DEF_PGPORT)' top_builddir = '$(CURDIR)/$(top_builddir)' $( PROVE) $( PG_PROVE_FLAGS) $( PROVE_FLAGS) t/*.pl
2014-04-15 03:33:46 +02:00
e n d e f
2014-11-02 15:14:36 +01:00
e l s e
prove_installcheck = @echo "TAP tests not enabled"
prove_check = $( prove_installcheck)
e n d i f
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
2009-08-05 00:04:37 +02:00
have_docbook = @have_docbook@
COLLATEINDEX = @COLLATEINDEX@
2014-09-14 02:14:17 +02:00
DBTOEPUB = @DBTOEPUB@
2009-08-05 00:04:37 +02:00
DOCBOOKSTYLE = @DOCBOOKSTYLE@
JADE = @JADE@
NSGMLS = @NSGMLS@
OSX = @OSX@
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@
i f e q ( $( enable_coverage ) , y e s )
# ccache loses .gcno files
export CCACHE_DISABLE = 1
e n d i f
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@
2003-05-11 22:50:53 +02:00
# The HP-UX port makefile, for one, needs access to this symbol
1998-11-29 06:30:25 +01:00
HAVE_POSIX_SIGNALS = @HAVE_POSIX_SIGNALS@
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
i n c l u d e $( top_builddir ) / s r c / M a k e f i l e . p o r t
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
i f e q ( $( enable_rpath ) , y e s )
LDFLAGS += $( rpath)
e n d i f
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
i f d e f P G X S
# some contribs assumes headers and libs are in the source tree...
libpq_srcdir = $( includedir)
libpq_builddir = $( libdir)
e l s e
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
e n d i f
2006-09-11 00:07:02 +02:00
# This macro is for use by libraries linking to libpq. (Because libpgport
# isn't created with the same link flags as libpq, it can't be used.)
2007-02-09 16:56:00 +01:00
libpq = -L$( libpq_builddir) -lpq
2010-11-23 21:27:50 +01:00
2006-09-11 00:07:02 +02:00
# This macro 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
2005-03-25 19:17:14 +01:00
# dependent on changes in libpq's usage of pgport. To do this we link to
# pgport before libpq. This does cause duplicate -lpgport's to appear
# on client link lines.
i f d e f P G X S
2013-10-16 05:03:42 +02:00
libpq_pgport = -L$( libdir) -lpgcommon -lpgport $( libpq)
2005-03-25 19:17:14 +01:00
e l s e
2013-10-16 05:03:42 +02:00
libpq_pgport = -L$( top_builddir) /src/common -lpgcommon -L$( top_builddir) /src/port -lpgport $( libpq)
2005-03-25 19:17:14 +01:00
e n d i f
2014-02-11 18:10:52 +01:00
# Cygwin seems to need ldap libraries to be mentioned here, too
i f e q ( $( PORTNAME ) , c y g w i n )
libpq_pgport += $( LDAP_LIBS_FE)
e n d i f
2014-12-04 13:58:12 +01:00
2002-07-27 22:10:05 +02:00
submake-libpq :
$( MAKE) -C $( libpq_builddir) all
submake-libpgport :
$( 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
.PHONY : submake -libpq submake -libpgport
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
i f n e q ( $( MODULE_big ) , )
CONTRIB_TESTDB_MODULE = contrib_regression_$( MODULE_big)
2013-05-31 03:05:07 +02:00
e l s e
2012-12-11 17:52:45 +01:00
ifneq ( $( MODULES) ,)
CONTRIB_TESTDB_MODULE = contrib_regression_$( MODULES)
else
CONTRIB_TESTDB_MODULE = contrib_regression
endif
e n d i f
2011-02-14 20:52:32 +01:00
2011-04-15 07:42:05 +02:00
i f d e f N O _ L O C A L E
NOLOCALE += --no-locale
e n d i f
pg_regress_locale_flags = $( if $( ENCODING) ,--encoding= $( ENCODING) ) $( NOLOCALE)
2015-04-23 14:59:52 +02:00
pg_regress_check = $( with_temp_install) $( top_builddir) /src/test/regress/pg_regress --inputdir= $( srcdir) --temp-instance= ./tmp_check --bindir= $( pg_regress_locale_flags) $( EXTRA_REGRESS_OPTS)
pg_regress_installcheck = $( top_builddir) /src/test/regress/pg_regress --inputdir= $( srcdir) --bindir= '$(bindir)' $( pg_regress_locale_flags) $( EXTRA_REGRESS_OPTS)
2011-02-14 20:52:32 +01:00
pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
2015-04-23 14:59:52 +02:00
pg_isolation_regress_check = $( with_temp_install) $( top_builddir) /src/test/isolation/pg_isolation_regress --inputdir= $( srcdir) --temp-instance= ./tmp_check --bindir= $( pg_regress_locale_flags) $( EXTRA_REGRESS_OPTS)
pg_isolation_regress_installcheck = $( top_builddir) /src/test/isolation/pg_isolation_regress --inputdir= $( srcdir) $( 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
- i n c l u d e $( top_srcdir ) / s r c / M a k e f i l e . c u s t o m
1997-02-04 09:53:45 +01:00
i f n e q ( $( CUSTOM_INSTALL ) , )
INSTALL = $( CUSTOM_INSTALL)
e n d i f
i f n e q ( $( CUSTOM_CC ) , )
CC = $( CUSTOM_CC)
e n d i f
i f n e q ( $( CUSTOM_COPT ) , )
COPT = $( CUSTOM_COPT)
e n d i f
i f d e f C O P T
2004-12-16 18:48:29 +01:00
CFLAGS += $( COPT)
LDFLAGS += $( COPT)
1997-02-04 09:53:45 +01:00
e n d i f
i f d e f P R O F I L E
2004-12-16 18:48:29 +01:00
CFLAGS += $( PROFILE)
LDFLAGS += $( PROFILE)
1997-02-04 09:53:45 +01:00
e n d i f
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
i f e q ( $( PORTNAME ) , w i n 3 2 )
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
e n d i f
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
i f d e f F L E X
$( 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 )
e l s e
@$( missing) flex $< '$@'
e n d i f
%.c : %.y
$( if $( BISON_CHECK_CMD) ,$( BISON_CHECK_CMD) )
i f d e f B I S O N
$( BISON) $( BISONFLAGS) -o $@ $<
e l s e
@$( missing) bison $< $@
e n d i f
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
i f n d e f P G X S
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
e n d i f # 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.
i f n d e f . V A R I A B L E S
$( error GNU make 3.80 or newer is required . You are using version $ ( MAKE_VERSION ) )
e n d i f
2010-11-12 21:15:16 +01:00
# This function is only for internal use below. It should be called
2010-11-14 18:50:06 +01:00
# using $(eval). It will set up a target so that it recurses into
# a given subdirectory. 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
d e f i n e _ c r e a t e _ r e c u r s i v e _ t a r g e t
2010-11-14 18:50:06 +01:00
.PHONY : $( 1) -$( 2) -recurse
$(1) : $( 1) -$( 2) -recurse
2015-04-23 14:59:52 +02:00
$(1)-$(2)-recurse : $( 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
e n d e f
# 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
i f e q ( $( autodepend ) , y e s )
2000-07-16 16:50:44 +02:00
2000-10-29 17:13:28 +01:00
i f n d e f C O M P I L E . c
COMPILE.c = $( CC) $( CFLAGS) $( CPPFLAGS) -c
e n d i f
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
i f e q ( $( GCC ) , y e s )
# 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
e n d i f # 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)
i f n e q ( , $( Po_files ) )
i n c l u d e $( Po_files )
e n d i f
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
e n d i f # autodepend
2001-06-02 20:25:18 +02:00
##########################################################################
#
# Native language support
i f e q ( $( enable_nls ) , y e s )
i f n e q ( , $( wildcard $ ( srcdir ) /nls .mk ) )
i n c l u d e $( top_srcdir ) / s r c / n l s - g l o b a l . m k
e n d i f # nls.mk
e n d i f # 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
# lcov.info lcov tracefile, built from gcda files in one directory,
# later collected by "make coverage-html"
2008-09-05 14:11:18 +02:00
i f e q ( $( enable_coverage ) , y e s )
# There is a strange interaction between lcov and existing .gcov
# output files. Hence the rm command and the ordering dependency.
gcda_files := $( wildcard *.gcda)
2008-10-03 17:35:17 +02:00
lcov.info : $( gcda_files )
2008-09-05 14:11:18 +02:00
rm -f *.gcov
2014-04-15 03:52:03 +02:00
$( if $^,$( LCOV) -d . -c -o $@ $( LCOVFLAGS) --gcov-tool $( GCOV) )
2008-09-05 14:11:18 +02:00
%.c.gcov : %.gcda | lcov .info
$( GCOV) -b -f -p -o . $( GCOVFLAGS) $* .c >$* .c.gcov.out
2009-08-07 22:50:22 +02:00
coverage : $( gcda_files :.gcda =.c .gcov ) lcov .info
.PHONY : coverage -html
coverage-html : coverage
rm -rf coverage
mkdir coverage
$( GENHTML) --show-details --legend --output-directory= coverage --title= PostgreSQL --num-spaces= 4 --prefix= $( abs_top_srcdir) ` find . -name lcov.info -print`
2008-09-05 14:11:18 +02:00
# hook for clean-up
clean distclean maintainer-clean : clean -coverage
.PHONY : clean -coverage
clean-coverage :
2009-08-07 22:50:22 +02:00
rm -rf coverage
2008-09-05 14:11:18 +02:00
rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out
# User-callable target to reset counts between test runs
coverage-clean :
rm -f ` find . -name '*.gcda' -print`
e n d i f # enable_coverage