diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 95d090e72d..fc81380ad2 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -417,15 +417,19 @@ endef
 ifeq ($(enable_tap_tests),yes)
 
 define prove_installcheck
+touch '$(CURDIR)'/tap_running
 rm -rf '$(CURDIR)'/tmp_check
 $(MKDIR_P) '$(CURDIR)'/tmp_check
 cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
+rm '$(CURDIR)'/tap_running
 endef
 
 define prove_check
+touch '$(CURDIR)'/tap_running
 rm -rf '$(CURDIR)'/tmp_check
 $(MKDIR_P) '$(CURDIR)'/tmp_check
 cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) $(if $(PROVE_TESTS),$(PROVE_TESTS),t/*.pl)
+rm '$(CURDIR)'/tap_running
 endef
 
 else
