Skip to content

Commit 4e4b900

Browse files
committed
Fix SHLIB_PREREQS use in contrib, allowing PGXS builds
dblink and postgres_fdw use SHLIB_PREREQS = submake-libpq to build libpq first. This doesn't work in a PGXS build, because there is no libpq to build. So just omit setting SHLIB_PREREQS in this case. Note that PGXS users can still use SHLIB_PREREQS (although it is not documented). The problem here is only that contrib modules can be built in-tree or using PGXS, and the prerequisite is only applicable in the former case. Commit 6697aa2 previously attempted to address this by creating a somewhat fake submake-libpq target in Makefile.global. That was not the right fix, and it was also done in a nonportable way, so revert that.
1 parent 3e2dc97 commit 4e4b900

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

contrib/dblink/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ MODULE_big = dblink
44
OBJS = dblink.o
55
PG_CPPFLAGS = -I$(libpq_srcdir)
66
SHLIB_LINK = $(libpq)
7-
SHLIB_PREREQS = submake-libpq
87

98
EXTENSION = dblink
109
DATA = dblink--1.1.sql dblink--1.0--1.1.sql dblink--unpackaged--1.0.sql
@@ -21,6 +20,7 @@ PG_CONFIG = pg_config
2120
PGXS := $(shell $(PG_CONFIG) --pgxs)
2221
include $(PGXS)
2322
else
23+
SHLIB_PREREQS = submake-libpq
2424
subdir = contrib/dblink
2525
top_builddir = ../..
2626
include $(top_builddir)/src/Makefile.global

contrib/postgres_fdw/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ OBJS = postgres_fdw.o option.o deparse.o connection.o
55

66
PG_CPPFLAGS = -I$(libpq_srcdir)
77
SHLIB_LINK = $(libpq)
8-
SHLIB_PREREQS = submake-libpq
98

109
EXTENSION = postgres_fdw
1110
DATA = postgres_fdw--1.0.sql
@@ -20,6 +19,7 @@ PG_CONFIG = pg_config
2019
PGXS := $(shell $(PG_CONFIG) --pgxs)
2120
include $(PGXS)
2221
else
22+
SHLIB_PREREQS = submake-libpq
2323
subdir = contrib/postgres_fdw
2424
top_builddir = ../..
2525
include $(top_builddir)/src/Makefile.global

src/Makefile.global.in

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -456,23 +456,13 @@ ifeq ($(PORTNAME),cygwin)
456456
libpq_pgport += $(LDAP_LIBS_FE)
457457
endif
458458

459-
# If PGXS is not defined, build libpq and libpgport dependencies as required.
460-
# If the build is with PGXS, then these are supposed to be already built and
461-
# installed, and we just ensure that the expected files exist.
462-
ifndef PGXS
459+
463460
submake-libpq:
464461
$(MAKE) -C $(libpq_builddir) all
465-
else
466-
submake-libpq: $(libdir)/libpq.so ;
467-
endif
468462

469-
ifndef PGXS
470463
submake-libpgport:
471464
$(MAKE) -C $(top_builddir)/src/port all
472465
$(MAKE) -C $(top_builddir)/src/common all
473-
else
474-
submake-libpgport: $(libdir)/libpgport.a $(libdir)/libpgcommon.a ;
475-
endif
476466

477467
.PHONY: submake-libpq submake-libpgport
478468

0 commit comments

Comments
 (0)