diff --git a/contrib/dblink/Makefile b/contrib/dblink/Makefile
index f5ab1641dbd752690290c38b2260ecef07aa37c4..b8d515716d0bbc2d1121caa6599fafa3c6cd8f69 100644
--- a/contrib/dblink/Makefile
+++ b/contrib/dblink/Makefile
@@ -4,7 +4,6 @@ MODULE_big = dblink
 OBJS	= dblink.o $(WIN32RES)
 PG_CPPFLAGS = -I$(libpq_srcdir)
 SHLIB_LINK = $(libpq)
-SHLIB_PREREQS = submake-libpq
 
 EXTENSION = dblink
 DATA = dblink--1.1.sql dblink--1.0--1.1.sql dblink--unpackaged--1.0.sql
@@ -19,6 +18,7 @@ PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
 include $(PGXS)
 else
+SHLIB_PREREQS = submake-libpq
 subdir = contrib/dblink
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
diff --git a/contrib/postgres_fdw/Makefile b/contrib/postgres_fdw/Makefile
index a9e380d6be4bc0c489150efc212f28135b3d3cb8..d2b98e10f3a5e455886e6c605ae6e0bad5930799 100644
--- a/contrib/postgres_fdw/Makefile
+++ b/contrib/postgres_fdw/Makefile
@@ -6,7 +6,6 @@ PGFILEDESC = "postgres_fdw - foreign data wrapper for PostgreSQL"
 
 PG_CPPFLAGS = -I$(libpq_srcdir)
 SHLIB_LINK = $(libpq)
-SHLIB_PREREQS = submake-libpq
 
 EXTENSION = postgres_fdw
 DATA = postgres_fdw--1.0.sql
@@ -18,6 +17,7 @@ PG_CONFIG = pg_config
 PGXS := $(shell $(PG_CONFIG) --pgxs)
 include $(PGXS)
 else
+SHLIB_PREREQS = submake-libpq
 subdir = contrib/postgres_fdw
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 63ff50b1dca7b2f720a5f26d65d083cf0ef1098b..a78f4d34f89a5eeedb8bc9e6c8442e9424f10e4f 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -458,23 +458,13 @@ ifeq ($(PORTNAME),cygwin)
 libpq_pgport += $(LDAP_LIBS_FE)
 endif
 
-# If PGXS is not defined, build libpq and libpgport dependencies as required.
-# If the build is with PGXS, then these are supposed to be already built and
-# installed, and we just ensure that the expected files exist.
-ifndef PGXS
+
 submake-libpq:
 	$(MAKE) -C $(libpq_builddir) all
-else
-submake-libpq: $(libdir)/libpq.so ;
-endif
 
-ifndef PGXS
 submake-libpgport:
 	$(MAKE) -C $(top_builddir)/src/port all
 	$(MAKE) -C $(top_builddir)/src/common all
-else
-submake-libpgport: $(libdir)/libpgport.a $(libdir)/libpgcommon.a ;
-endif
 
 .PHONY: submake-libpq submake-libpgport