summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2015-07-30 20:48:41 -0400
committerNoah Misch <noah@leadboat.com>2015-07-30 20:49:22 -0400
commit0efa0f62d2f8572e109134f80169aa4224da1b8a (patch)
treef15344804af6e4fe3bfbc9cccb1b3275b81adc2f /src
parent3b4a9dbfa5339405f7f78639b83bfb563603cfe3 (diff)
Consolidate makefile code for setting top_srcdir, srcdir and VPATH.
Responsibility was formerly split between Makefile.global and pgxs.mk. As a result of commit b58233c71b93a32fcab7219585cafc25a27eb769, in the PGXS case, these variables were unset while parsing Makefile.global and callees. Inclusion of Makefile.custom did not work from PGXS, and the subtle difference seemed like a recipe for future bugs. Back-patch to 9.4, where that commit first appeared.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.global.in21
-rw-r--r--src/makefiles/pgxs.mk15
2 files changed, 18 insertions, 18 deletions
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 18c653bd210..13d4aa371e1 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -40,9 +40,24 @@ VERSION = @PACKAGE_VERSION@
MAJORVERSION = @PG_MAJORVERSION@
VERSION_NUM = @PG_VERSION_NUM@
-# Support for VPATH builds
-# (PGXS VPATH support is handled separately in pgxs.mk)
-ifndef PGXS
+# 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
vpath_build = @vpath_build@
abs_top_srcdir = @abs_top_srcdir@
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index 60cccddb72b..2cc7699824c 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -61,21 +61,6 @@ ifdef PGXS
top_builddir := $(dir $(PGXS))../..
include $(top_builddir)/src/Makefile.global
-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
-
# These might be set in Makefile.global, but if they were not found
# during the build of PostgreSQL, supply default values so that users
# of pgxs can use the variables.