 contrib/sepgsql/Makefile |    9 ++++++---
 src/makefiles/pgxs.mk    |    4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/contrib/sepgsql/Makefile b/contrib/sepgsql/Makefile
index c83b2e3..baf0a1e 100644
--- a/contrib/sepgsql/Makefile
+++ b/contrib/sepgsql/Makefile
@@ -5,9 +5,8 @@ OBJS = hooks.o selinux.o uavc.o label.o dml.o \
 	schema.o relation.o proc.o
 DATA_built = sepgsql.sql
 
-REGRESS = label dml misc
-REGRESS_PREP = check_selinux_environment
-REGRESS_OPTS = --launcher $(top_builddir)/contrib/sepgsql/launcher
+SEPGSQL_REGRESS = label dml misc
+SEPGSQL_REGRESS_OPTS = --launcher $(top_builddir)/contrib/sepgsql/launcher
 
 EXTRA_CLEAN = -r tmp *.pp sepgsql-regtest.if sepgsql-regtest.fc
 
@@ -23,6 +22,10 @@ include $(top_srcdir)/contrib/contrib-global.mk
 endif
 
 SHLIB_LINK += -lselinux
+SEPGSQL_REGRESS_OPTS += --dbname=$(CONTRIB_TESTDB)
 
 check_selinux_environment:
 	@$(top_builddir)/contrib/sepgsql/chkselinuxenv "$(bindir)" "$(datadir)"
+
+sepgsql-checkinstall: check_selinux_environment
+	$(pg_regress_installcheck) $(SEPGSQL_REGRESS_OPTS) $(SEPGSQL_REGRESS)
diff --git a/src/makefiles/pgxs.mk b/src/makefiles/pgxs.mk
index 84a296a..8b089e7 100644
--- a/src/makefiles/pgxs.mk
+++ b/src/makefiles/pgxs.mk
@@ -256,7 +256,7 @@ ifndef PGXS
 endif
 
 # against installed postmaster
-installcheck: submake $(REGRESS_PREP)
+installcheck: submake
 	$(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
 
 ifdef PGXS
@@ -264,7 +264,7 @@ check:
 	@echo '"$(MAKE) check" is not supported.'
 	@echo 'Do "$(MAKE) install", then "$(MAKE) installcheck" instead.'
 else
-check: all submake $(REGRESS_PREP)
+check: all submake
 	$(pg_regress_check) --extra-install=$(subdir) $(REGRESS_OPTS) $(REGRESS)
 endif
 endif # REGRESS
