diff --git a/GNUmakefile.in b/GNUmakefile.in
index dc76a5d11dd88e4c921964c840517a6d93dde3b9..973fef54fb3664017cb68e1284d5c2b58eb5fda3 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -63,7 +63,7 @@ distclean maintainer-clean:
 	@rm -rf autom4te.cache/
 	rm -f config.cache config.log config.status GNUmakefile
 
-check check-tests installcheck installcheck-parallel installcheck-tests:
+check check-tests installcheck installcheck-parallel installcheck-tests: submake-generated-headers
 	$(MAKE) -C src/test/regress $@
 
 $(call recurse,check-world,src/test src/pl src/interfaces/ecpg contrib src/bin,check)
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 95d090e72dadea29c694306cc5adb67ce8311009..91d7cb83dcbb167e2b47d6567441bc4775fdcd05 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -355,11 +355,11 @@ BZIP2	= bzip2
 # available before building, but we don't want parallel makes all trying
 # to build the same headers.  These rules, together with the recursion rules
 # below, ensure that we update the generated headers once, if needed,
-# at the top level of any "make all/install/check" request.  If a particular
-# subdirectory knows this isn't needed in itself or its children, it can set
-# NO_GENERATED_HEADERS.
+# at the top level of any "make all/install/check/installcheck" request.
+# If a particular subdirectory knows this isn't needed in itself or its
+# children, it can set NO_GENERATED_HEADERS.
 
-all install check: submake-generated-headers
+all install check installcheck: submake-generated-headers
 
 .PHONY: submake-generated-headers
 
@@ -806,8 +806,8 @@ $(error GNU make 3.80 or newer is required.  You are using version $(MAKE_VERSIO
 endif
 
 # This function is only for internal use below.  It should be called
-# using $(eval).  It will set up a target so that it recurses into
-# a given subdirectory.  For the tree-wide all/install/check cases,
+# using $(eval).  It will set up a target so that it recurses into a
+# given subdirectory.  For the tree-wide all/install/check/installcheck cases,
 # ensure we do our one-time tasks before recursing (see targets above).
 # Note that to avoid a nasty bug in make 3.80,
 # this function has to avoid using any complicated constructs (like
@@ -820,7 +820,7 @@ endif
 define _create_recursive_target
 .PHONY: $(1)-$(2)-recurse
 $(1): $(1)-$(2)-recurse
-$(1)-$(2)-recurse: $(if $(filter all install check, $(3)), submake-generated-headers) $(if $(filter check, $(3)), temp-install)
+$(1)-$(2)-recurse: $(if $(filter all install check installcheck, $(3)), submake-generated-headers) $(if $(filter check, $(3)), temp-install)
 	$$(MAKE) -C $(2) $(3)
 endef
 # Note that the use of $$ on the last line above is important; we want