diff --git a/GNUmakefile.in b/GNUmakefile.in
index 56a42ada0fab87f23cd1441fc2cfb90d45fb6e58..5262d0ef789c0fdcec6850092c0752d388adac67 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -1,7 +1,7 @@
 #
 # PostgreSQL top level makefile
 #
-# $PostgreSQL: pgsql/GNUmakefile.in,v 1.50 2009/01/15 01:53:49 momjian Exp $
+# $PostgreSQL: pgsql/GNUmakefile.in,v 1.51 2009/08/07 20:50:21 petere Exp $
 #
 
 subdir =
@@ -20,7 +20,7 @@ install:
 	$(MAKE) -C config $@
 	@echo "PostgreSQL installation complete."
 
-installdirs uninstall:
+installdirs uninstall coverage:
 	$(MAKE) -C doc $@
 	$(MAKE) -C src $@
 	$(MAKE) -C config $@
@@ -61,25 +61,6 @@ GNUmakefile: GNUmakefile.in $(top_builddir)/config.status
 	./config.status $@
 
 
-##########################################################################
-
-coverage:
-	$(MAKE) -C src/backend $@
-
-.PHONY: coverage-html
-coverage-html: coverage
-	rm -rf coverage
-	mkdir coverage
-	$(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir)/src `find src/backend -name lcov.info -print`
-
-ifeq ($(enable_coverage),yes)
-clean distclean maintainer-clean: clean-coverage-local
-.PHONY: clean-coverage-local
-clean-coverage-local:
-	rm -rf coverage
-endif
-
-
 ##########################################################################
 
 distdir	= postgresql-$(VERSION)
diff --git a/contrib/Makefile b/contrib/Makefile
index e840c8ce6a2e3536f468dca4b170221bb1a748f9..85cabd8618aab973ca400fea66229b40f52daa22 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -1,10 +1,10 @@
-# $PostgreSQL: pgsql/contrib/Makefile,v 1.87 2009/03/25 23:20:01 tgl Exp $
+# $PostgreSQL: pgsql/contrib/Makefile,v 1.88 2009/08/07 20:50:21 petere Exp $
 
 subdir = contrib
 top_builddir = ..
 include $(top_builddir)/src/Makefile.global
 
-WANTED_DIRS = \
+SUBDIRS = \
 		adminpack	\
 		auto_explain	\
 		btree_gin	\
@@ -42,15 +42,15 @@ WANTED_DIRS = \
 		vacuumlo
 
 ifeq ($(with_openssl),yes)
-WANTED_DIRS += sslinfo
+SUBDIRS += sslinfo
 endif
 
 ifeq ($(with_ossp_uuid),yes)
-WANTED_DIRS += uuid-ossp
+SUBDIRS += uuid-ossp
 endif
 
 ifeq ($(with_libxml),yes)
-WANTED_DIRS += xml2
+SUBDIRS += xml2
 endif
 
 # Missing:
@@ -58,13 +58,13 @@ endif
 
 
 all install installdirs uninstall distprep clean distclean maintainer-clean:
-	@for dir in $(WANTED_DIRS); do \
+	@for dir in $(SUBDIRS); do \
 		$(MAKE) -C $$dir $@ || exit; \
 	done
 
 # We'd like check operations to run all the subtests before failing.
 check installcheck:
-	@CHECKERR=0; for dir in $(WANTED_DIRS); do \
+	@CHECKERR=0; for dir in $(SUBDIRS); do \
 		$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
 	done; \
 	exit $$CHECKERR
diff --git a/doc/src/sgml/regress.sgml b/doc/src/sgml/regress.sgml
index 4c6fb5c5691ed0ea20250ec04ffd74f5b099ec15..29d320c919c7b6de4da3f354ea877a574c977a8f 100644
--- a/doc/src/sgml/regress.sgml
+++ b/doc/src/sgml/regress.sgml
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.63 2009/04/27 16:27:36 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/regress.sgml,v 1.64 2009/08/07 20:50:21 petere Exp $ -->
 
  <chapter id="regress">
   <title id="regress-title">Regression Tests</title>
@@ -476,6 +476,7 @@ gmake coverage-html
 </screen>
     Then point your HTML browser
     to <filename>coverage/index.html</filename>.
+    The <command>gmake</command> commands also work in subdirectories.
    </para>
 
    <para>
diff --git a/src/Makefile b/src/Makefile
index 7b00776c4bdbc197ae3a6014e4a7b7565b536080..8c869573bf6efe2e21572cd00718a58f0e2217b0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/Makefile,v 1.45 2009/02/24 10:06:32 petere Exp $
+# $PostgreSQL: pgsql/src/Makefile,v 1.46 2009/08/07 20:50:22 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -73,5 +73,14 @@ distclean maintainer-clean:
 	$(MAKE) -C test/thread $@
 	rm -f Makefile.port Makefile.global
 
+coverage:
+	$(MAKE) -C timezone $@
+	$(MAKE) -C backend $@
+	$(MAKE) -C backend/utils/mb/conversion_procs $@
+	$(MAKE) -C backend/snowball $@
+	$(MAKE) -C interfaces $@
+	$(MAKE) -C bin $@
+	$(MAKE) -C pl $@
+
 
 .PHONY: install-local installdirs-local uninstall-local
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 04f3b1a7dd8872350ac689c2135feb99d2d5ba4f..441de314873a6ff5823419d260224f94eb91e46c 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,5 +1,5 @@
 # -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.255 2009/08/04 22:04:37 petere Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.256 2009/08/07 20:50:22 petere Exp $
 
 #------------------------------------------------------------------------------
 # All PostgreSQL makefiles include this file and use the variables it sets,
@@ -617,12 +617,22 @@ lcov.info: $(gcda_files)
 %.c.gcov: %.gcda | lcov.info
 	$(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out
 
+coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
+	$(if $(SUBDIRS),for dir in $(SUBDIRS); do $(MAKE) -C $$dir coverage || exit; done)
+
+.PHONY: coverage-html
+coverage-html: coverage
+	rm -rf coverage
+	mkdir coverage
+	$(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print`
+
 
 # hook for clean-up
 clean distclean maintainer-clean: clean-coverage
 
 .PHONY: clean-coverage
 clean-coverage:
+	rm -rf coverage
 	rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out
 
 
diff --git a/src/backend/common.mk b/src/backend/common.mk
index c617c672765762e7ad5061408f1000440d8c5506..f4de2fe53d5c17953a5be15665935007f7629723 100644
--- a/src/backend/common.mk
+++ b/src/backend/common.mk
@@ -1,7 +1,7 @@
 #
 # Common make rules for backend
 #
-# $PostgreSQL: pgsql/src/backend/common.mk,v 1.8 2008/09/05 12:11:18 petere Exp $
+# $PostgreSQL: pgsql/src/backend/common.mk,v 1.9 2009/08/07 20:50:22 petere Exp $
 #
 
 # When including this file, set OBJS to the object files created in
@@ -46,9 +46,3 @@ ifdef SUBDIRS
 	for dir in $(SUBDIRS); do $(MAKE) -C $$dir clean || exit; done
 endif
 	rm -f $(subsysfilename) $(OBJS)
-
-
-coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
-ifdef SUBDIRS
-	for dir in $(SUBDIRS); do $(MAKE) -C $$dir coverage || exit; done
-endif
diff --git a/src/backend/utils/mb/conversion_procs/Makefile b/src/backend/utils/mb/conversion_procs/Makefile
index 2d0b37564a0aa58be28ee17e658b382291d433e4..17b5f7150354281e921428396f1094b7b612f4db 100644
--- a/src/backend/utils/mb/conversion_procs/Makefile
+++ b/src/backend/utils/mb/conversion_procs/Makefile
@@ -4,7 +4,7 @@
 #    Makefile for utils/mb/conversion_procs
 #
 # IDENTIFICATION
-#    $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.21 2009/02/10 19:29:39 petere Exp $
+#    $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.22 2009/08/07 20:50:22 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -17,7 +17,7 @@ SQLSCRIPT = conversion_create.sql
 # This file can be placed as src/test/regress/conversion.sql
 REGRESSION_SCRIPT = conversion.sql
 
-DIRS = \
+SUBDIRS = \
 	ascii_and_mic cyrillic_and_mic euc_cn_and_mic euc_jp_and_sjis \
 	euc_kr_and_mic euc_tw_and_big5 latin2_and_win1250 latin_and_mic \
 	utf8_and_ascii utf8_and_big5 utf8_and_cyrillic utf8_and_euc_cn \
@@ -162,7 +162,7 @@ CONVERSIONS = \
 		shift_jis_2004_to_euc_jis_2004 SHIFT_JIS_2004 EUC_JIS_2004 shift_jis_2004_to_euc_jis_2004 euc_jis_2004_and_shift_jis_2004
 
 all: $(SQLSCRIPT)
-	@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
+	@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
 
 $(SQLSCRIPT): Makefile
 ifeq ($(enable_shared), yes)
@@ -205,16 +205,16 @@ $(REGRESSION_SCRIPT): Makefile
 
 install: $(SQLSCRIPT) installdirs
 	$(INSTALL_DATA) $(SQLSCRIPT) '$(DESTDIR)$(datadir)'
-	@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
+	@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
 
 installdirs:
 	$(mkinstalldirs) '$(DESTDIR)$(datadir)' '$(DESTDIR)$(pkglibdir)'
 
 uninstall:
 	rm -f '$(DESTDIR)$(datadir)/$(SQLSCRIPT)'
-	@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
+	@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
 
 clean distclean maintainer-clean:
 	rm -f $(SQLSCRIPT)
-	@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
+	@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
 
diff --git a/src/bin/Makefile b/src/bin/Makefile
index e49325277137d5061be37d9d8ec01f45e8380874..1fa4dfd2842f38b03f5bcc0f37842883a499a01a 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -5,7 +5,7 @@
 # Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
 # Portions Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/bin/Makefile,v 1.54 2009/01/01 17:23:53 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/Makefile,v 1.55 2009/08/07 20:50:22 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -13,11 +13,11 @@ subdir = src/bin
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
 
-DIRS = initdb pg_ctl pg_dump \
+SUBDIRS = initdb pg_ctl pg_dump \
 	psql scripts pg_config pg_controldata pg_resetxlog
 ifeq ($(PORTNAME), win32)
-DIRS+=pgevent
+SUBDIRS+=pgevent
 endif
 
 all install installdirs uninstall distprep clean distclean maintainer-clean:
-	@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
+	@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
diff --git a/src/interfaces/Makefile b/src/interfaces/Makefile
index dd57c18c3edc8456a1a54e3e18a2e642e120b863..09ca0c2bb894a2622bc36b075c58022e60680c5d 100644
--- a/src/interfaces/Makefile
+++ b/src/interfaces/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/interfaces/Makefile,v 1.56 2008/03/18 16:24:50 petere Exp $
+# $PostgreSQL: pgsql/src/interfaces/Makefile,v 1.57 2009/08/07 20:50:22 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -12,7 +12,7 @@ subdir = src/interfaces
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
 
-DIRS = libpq ecpg 
+SUBDIRS = libpq ecpg
 
 all install installdirs uninstall distprep clean distclean maintainer-clean:
-	@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
+	@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
diff --git a/src/pl/Makefile b/src/pl/Makefile
index fa06459a9b51aa8d9c715b1190568d48374428dc..cfaeddea9f9557324acf1156e5db6d560c9cc29e 100644
--- a/src/pl/Makefile
+++ b/src/pl/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/pl/Makefile,v 1.27 2008/03/18 16:24:50 petere Exp $
+# $PostgreSQL: pgsql/src/pl/Makefile,v 1.28 2009/08/07 20:50:22 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -12,26 +12,26 @@ subdir = src/pl
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global
 
-DIRS = plpgsql
+SUBDIRS = plpgsql
 
 ifeq ($(with_perl), yes)
-DIRS += plperl
+SUBDIRS += plperl
 endif
 
 ifeq ($(with_python), yes)
-DIRS += plpython
+SUBDIRS += plpython
 endif
 
 ifeq ($(with_tcl), yes)
-DIRS += tcl
+SUBDIRS += tcl
 endif
 
 all install installdirs uninstall distprep clean distclean maintainer-clean:
-	@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
+	@for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@ || exit; done
 
 # We'd like check operations to run all the subtests before failing.
 check installcheck:
-	@CHECKERR=0; for dir in $(DIRS); do \
+	@CHECKERR=0; for dir in $(SUBDIRS); do \
 		$(MAKE) -C $$dir $@ || CHECKERR=$$?; \
 	done; \
 	exit $$CHECKERR
diff --git a/src/pl/plpgsql/Makefile b/src/pl/plpgsql/Makefile
index 2f1298c2582a84cd15495d77f2133ab26dfeb1a1..0c5dd72f2d8a3961c554ca9187b61e88a1f17b03 100644
--- a/src/pl/plpgsql/Makefile
+++ b/src/pl/plpgsql/Makefile
@@ -4,7 +4,7 @@
 #
 # Copyright (c) 1994, Regents of the University of California
 #
-# $PostgreSQL: pgsql/src/pl/plpgsql/Makefile,v 1.9 2008/03/18 16:24:50 petere Exp $
+# $PostgreSQL: pgsql/src/pl/plpgsql/Makefile,v 1.10 2009/08/07 20:50:22 petere Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -12,5 +12,5 @@ subdir = src/pl/plpgsql
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
-all install installdirs uninstall distprep clean distclean maintainer-clean:
+all install installdirs uninstall distprep clean distclean maintainer-clean coverage:
 	$(MAKE) -C src $@
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index dfc29ea84448d1029ad7a099fb1ec0a97979fdad..6359f1861e57fb451b1cee353d9e5e79826ab06d 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -3,7 +3,7 @@ package Mkvcbuild;
 #
 # Package that generates build files for msvc build
 #
-# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.41 2009/07/16 17:43:52 tgl Exp $
+# $PostgreSQL: pgsql/src/tools/msvc/Mkvcbuild.pm,v 1.42 2009/08/07 20:50:22 petere Exp $
 #
 use Carp;
 use Win32;
@@ -321,7 +321,7 @@ sub mkvcbuild
 
     $mf = Project::read_file('src\backend\utils\mb\conversion_procs\Makefile');
     $mf =~ s{\\s*[\r\n]+}{}mg;
-    $mf =~ m{DIRS\s*=\s*(.*)$}m || die 'Could not match in conversion makefile' . "\n";
+    $mf =~ m{SUBDIRS\s*=\s*(.*)$}m || die 'Could not match in conversion makefile' . "\n";
     foreach my $sub (split /\s+/,$1)
     {
         my $mf = Project::read_file('src\backend\utils\mb\conversion_procs\\' . $sub . '\Makefile');