diff --git a/elf/Makefile b/elf/Makefile
index 1007a63..e31ab92 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -157,8 +157,8 @@ tests-execstack-yes = tst-execstack tst-execstack-needed tst-execstack-prog
 endif
 endif
 ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)tst-leaks1-mem $(objpfx)tst-leaks1-static-mem \
-		 $(objpfx)noload-mem
+tests-special += $(objpfx)tst-leaks1-mem.out \
+		 $(objpfx)tst-leaks1-static-mem.out $(objpfx)noload-mem.out
 endif
 tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 tlsmod18a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
@@ -665,7 +665,7 @@ $(objpfx)noload: $(objpfx)testobj1.so $(common-objpfx)dlfcn/libdl.so
 LDFLAGS-noload = -rdynamic $(no-as-needed)
 $(objpfx)noload.out: $(objpfx)testobj5.so
 
-$(objpfx)noload-mem: $(objpfx)noload.out
+$(objpfx)noload-mem.out: $(objpfx)noload.out
 	$(common-objpfx)malloc/mtrace $(objpfx)noload.mtrace > $@; \
 	$(evaluate-test)
 noload-ENV = MALLOC_TRACE=$(objpfx)noload.mtrace
@@ -1047,12 +1047,12 @@ CFLAGS-tst-ptrguard1-static.c = -DPTRGUARD_LOCAL
 tst-ptrguard1-static-ARGS = --command "$(objpfx)tst-ptrguard1-static --child"
 
 $(objpfx)tst-leaks1: $(libdl)
-$(objpfx)tst-leaks1-mem: $(objpfx)tst-leaks1.out
+$(objpfx)tst-leaks1-mem.out: $(objpfx)tst-leaks1.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1.mtrace > $@; \
 	$(evaluate-test)
 
 $(objpfx)tst-leaks1-static: $(common-objpfx)dlfcn/libdl.a
-$(objpfx)tst-leaks1-static-mem: $(objpfx)tst-leaks1-static.out
+$(objpfx)tst-leaks1-static-mem.out: $(objpfx)tst-leaks1-static.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks1-static.mtrace > $@; \
 	$(evaluate-test)
 
diff --git a/iconv/Makefile b/iconv/Makefile
index 8728fef..5de04a0 100644
--- a/iconv/Makefile
+++ b/iconv/Makefile
@@ -61,7 +61,7 @@ CPPFLAGS-charmap = -DNOT_IN_libc
 CPPFLAGS-charmap-dir = -DNOT_IN_libc
 
 ifeq ($(run-built-tests),yes)
-xtests-special += test-iconvconfig
+xtests-special += $(objpfx)test-iconvconfig.out
 endif
 
 include ../Rules
@@ -72,11 +72,11 @@ $(inst_bindir)/iconv: $(objpfx)iconv_prog $(+force)
 $(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
 $(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o)
 
-.PHONY: test-iconvconfig
-test-iconvconfig: /dev/null $(objpfx)iconvconfig
-	tmp=$(objpfx)gconv-modules.cache.$$$$; \
-	rm -f $$tmp; \
-	$(make-test-out) --output=$$tmp --nostdlib $(inst_gconvdir) && \
-	cmp $$tmp $(inst_gconvdir)/gconv-modules.cache && \
-	rm -f $$tmp; \
+$(objpfx)test-iconvconfig.out: /dev/null $(objpfx)iconvconfig
+	(set -e; \
+	 tmp=$(objpfx)gconv-modules.cache.$$$$; \
+	 rm -f $$tmp; \
+	 $(make-test-out) --output=$$tmp --nostdlib $(inst_gconvdir); \
+	 cmp $$tmp $(inst_gconvdir)/gconv-modules.cache; \
+	 rm -f $$tmp) > $@; \
 	$(evaluate-test)
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index f0d832a..60d8bd3 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -179,7 +179,7 @@ generated-modules := $(gen-8bit-modules) $(gen-8bit-gap-modules) \
 
 generated += $(generated-modules:=.h) $(generated-modules:=.stmp) \
 	     iconv-test.out iconv-rules tst-loading.mtrace	 \
-	     mmtrace-tst-loading tst-tables.out iconv-test.xxx
+	     mtrace-tst-loading.out tst-tables.out iconv-test.xxx
 ifdef objpfx
 generated += gconv-modules
 endif
@@ -269,7 +269,7 @@ ifeq ($(run-built-tests),yes)
 ifeq (yes,$(build-shared))
 tests-special += $(objpfx)iconv-test.out $(objpfx)tst-tables.out
 ifneq (no,$(PERL))
-tests-special += $(objpfx)mtrace-tst-loading
+tests-special += $(objpfx)mtrace-tst-loading.out
 endif
 endif
 endif
@@ -277,7 +277,7 @@ endif
 include ../Rules
 
 tst-loading-ENV = MALLOC_TRACE=$(objpfx)tst-loading.mtrace
-$(objpfx)mtrace-tst-loading: $(objpfx)tst-loading.out
+$(objpfx)mtrace-tst-loading.out: $(objpfx)tst-loading.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-loading.mtrace > $@; \
 	$(evaluate-test)
 
diff --git a/intl/Makefile b/intl/Makefile
index 5676954..f11449d 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -38,7 +38,7 @@ before-compile += $(objpfx)msgs.h
 
 install-others = $(inst_msgcatdir)/locale.alias
 
-generated += msgs.h mtrace-tst-gettext tst-gettext.mtrace
+generated += msgs.h mtrace-tst-gettext.out tst-gettext.mtrace
 generated-dirs += domaindir localedir
 
 ifneq (no,$(BISON))
@@ -58,7 +58,7 @@ tests-special += $(objpfx)tst-gettext4.out $(objpfx)tst-gettext5.out \
 		 $(objpfx)tst-gettext6.out
 endif
 ifneq (no,$(PERL))
-tests-special += $(objpfx)mtrace-tst-gettext
+tests-special += $(objpfx)mtrace-tst-gettext.out
 endif
 endif
 endif
@@ -77,7 +77,7 @@ $(codeset_mo): tstcodeset.po
 	msgfmt -o $@T $<
 	mv -f $@T $@
 
-$(objpfx)mtrace-tst-gettext: $(objpfx)tst-gettext.out
+$(objpfx)mtrace-tst-gettext.out: $(objpfx)tst-gettext.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-gettext.mtrace > $@; \
 	$(evaluate-test)
 $(objpfx)tst-gettext.out: tst-gettext.sh $(objpfx)tst-gettext
diff --git a/localedata/Makefile b/localedata/Makefile
index 5f01b61..e9c0894 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -52,7 +52,7 @@ fmon-tests = n01y12 n02n40 n10y31 n11y41 n12y11 n20n32 n30y20 n41n00 \
 	     y01y10 y02n22 y22n42 y30y21 y32n31 y40y00 y42n21
 
 generated += $(test-input) $(test-output) sort-test.out tst-locale.out \
-	     tst-mbswcs.out tst-leaks.mtrace mtrace-tst-leaks
+	     tst-mbswcs.out tst-leaks.mtrace mtrace-tst-leaks.out
 generated-dirs += $(ld-test-names) tt_TT de_DE.437			\
 		  $(addprefix tstfmon_,$(fmon-tests))			\
 
@@ -79,7 +79,7 @@ tests-static = bug-setlocale1-static
 tests += $(tests-static)
 ifeq (yes,$(build-shared))
 ifneq (no,$(PERL))
-tests-special += $(objpfx)mtrace-tst-leaks
+tests-special += $(objpfx)mtrace-tst-leaks.out
 endif
 endif
 endif
@@ -292,7 +292,7 @@ tst-sscanf-ENV = LOCPATH=$(common-objpfx)localedata
 
 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
 		LOCPATH=$(common-objpfx)localedata
-$(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
+$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
 	$(evaluate-test)
 
diff --git a/misc/Makefile b/misc/Makefile
index c08f95a..53d4c2c 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -69,7 +69,7 @@ routines := brk sbrk sstk ioctl \
 	    listxattr lgetxattr llistxattr lremovexattr lsetxattr \
 	    removexattr setxattr getauxval ifunc-impl-list
 
-generated += tst-error1.mtrace tst-error1-mem
+generated += tst-error1.mtrace tst-error1-mem.out
 
 aux := init-misc
 install-lib := libg.a
@@ -78,7 +78,7 @@ gpl2lgpl := error.c error.h
 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
 	 tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1
 ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)tst-error1-mem
+tests-special += $(objpfx)tst-error1-mem.out
 endif
 
 CFLAGS-select.c = -fexceptions -fasynchronous-unwind-tables
@@ -110,6 +110,6 @@ endif
 
 tst-error1-ENV = MALLOC_TRACE=$(objpfx)tst-error1.mtrace
 tst-error1-ARGS = $(objpfx)tst-error1.out
-$(objpfx)tst-error1-mem: $(objpfx)tst-error1.out
+$(objpfx)tst-error1-mem.out: $(objpfx)tst-error1.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-error1.mtrace > $@; \
 	$(evaluate-test)
diff --git a/nptl/Makefile b/nptl/Makefile
index 9fcf3d6..897ac96 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -368,7 +368,7 @@ xtests-static += tst-setuid1-static
 tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x
 
 ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)tst-stack3-mem $(objpfx)tst-oddstacklimit.out
+tests-special += $(objpfx)tst-stack3-mem.out $(objpfx)tst-oddstacklimit.out
 ifeq ($(build-shared),yes)
 tests-special += $(objpfx)tst-tls6.out $(objpfx)tst-cleanup0-cmp.out \
 		 $(objpfx)tst-cancel-wrappers.out
@@ -466,10 +466,10 @@ tst-atfork2-ENV = MALLOC_TRACE=$(objpfx)tst-atfork2.mtrace
 $(objpfx)tst-atfork2mod.so: $(shared-thread-library)
 
 tst-stack3-ENV = MALLOC_TRACE=$(objpfx)tst-stack3.mtrace
-$(objpfx)tst-stack3-mem: $(objpfx)tst-stack3.out
+$(objpfx)tst-stack3-mem.out: $(objpfx)tst-stack3.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-stack3.mtrace > $@; \
 	$(evaluate-test)
-generated += tst-stack3-mem tst-stack3.mtrace
+generated += tst-stack3-mem.out tst-stack3.mtrace
 
 $(objpfx)tst-cleanup4: $(objpfx)tst-cleanup4aux.o $(shared-thread-library)
 $(objpfx)tst-cleanupx4: $(objpfx)tst-cleanup4aux.o $(shared-thread-library)
diff --git a/posix/Makefile b/posix/Makefile
index 3af936f..83a358e 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -102,16 +102,17 @@ before-compile	:= testcases.h ptestcases.h
 
 # So they get cleaned up.
 generated += $(addprefix wordexp-test-result, 1 2 3 4 5 6 7 8 9 10) \
-	     annexc annexc.out wordexp-tst.out bug-regex2-mem \
-	     bug-regex2.mtrace bug-regex14-mem bug-regex14.mtrace \
-	     bug-regex21-mem bug-regex21.mtrace \
-	     bug-regex31-mem bug-regex31.mtrace \
-	     tst-rxspencer-no-utf8-mem tst-rxspencer-no-utf8.mtrace \
+	     annexc annexc.out wordexp-tst.out bug-regex2-mem.out \
+	     bug-regex2.mtrace bug-regex14-mem.out bug-regex14.mtrace \
+	     bug-regex21-mem.out bug-regex21.mtrace \
+	     bug-regex31-mem.out bug-regex31.mtrace \
+	     tst-rxspencer-no-utf8-mem.out tst-rxspencer-no-utf8.mtrace \
 	     tst-getconf.out \
-	     tst-pcre-mem tst-pcre.mtrace tst-boost-mem tst-boost.mtrace \
-	     bug-ga2.mtrace bug-ga2-mem bug-glob2.mtrace bug-glob2-mem \
-	     tst-vfork3-mem tst-vfork3.mtrace getconf.speclist \
-	     tst-fnmatch-mem tst-fnmatch.mtrace
+	     tst-pcre-mem.out tst-pcre.mtrace tst-boost-mem.out \
+	     tst-boost.mtrace bug-ga2.mtrace bug-ga2-mem.out \
+	     bug-glob2.mtrace bug-glob2-mem.out tst-vfork3-mem.out \
+	     tst-vfork3.mtrace getconf.speclist tst-fnmatch-mem.out \
+	     tst-fnmatch.mtrace
 
 ifeq ($(run-built-tests),yes)
 ifeq (yes,$(build-shared))
@@ -123,13 +124,13 @@ endif
 # XXX Please note that for now we ignore the result of this test.
 tests-special += $(objpfx)annexc.out
 ifeq ($(run-built-tests),yes)
-tests-special += $(objpfx)bug-regex2-mem $(objpfx)bug-regex14-mem \
-		 $(objpfx)bug-regex21-mem $(objpfx)bug-regex31-mem \
-		 $(objpfx)tst-rxspencer-no-utf8-mem $(objpfx)tst-pcre-mem \
-		 $(objpfx)tst-boost-mem $(objpfx)tst-getconf.out \
-		 $(objpfx)bug-glob2-mem $(objpfx)tst-vfork3-mem \
-		 $(objpfx)tst-fnmatch-mem
-xtests-special += $(objpfx)bug-ga2-mem
+tests-special += $(objpfx)bug-regex2-mem.out $(objpfx)bug-regex14-mem.out \
+		 $(objpfx)bug-regex21-mem.out $(objpfx)bug-regex31-mem.out \
+		 $(objpfx)tst-rxspencer-no-utf8-mem.out $(objpfx)tst-pcre-mem.out \
+		 $(objpfx)tst-boost-mem.out $(objpfx)tst-getconf.out \
+		 $(objpfx)bug-glob2-mem.out $(objpfx)tst-vfork3-mem.out \
+		 $(objpfx)tst-fnmatch-mem.out
+xtests-special += $(objpfx)bug-ga2-mem.out
 endif
 
 include ../Rules
@@ -251,37 +252,37 @@ $(objpfx)annexc: annexc.c
 
 tst-fnmatch-ENV += MALLOC_TRACE=$(objpfx)tst-fnmatch.mtrace
 
-$(objpfx)tst-fnmatch-mem: $(objpfx)tst-fnmatch.out
+$(objpfx)tst-fnmatch-mem.out: $(objpfx)tst-fnmatch.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-fnmatch.mtrace > $@; \
 	$(evaluate-test)
 
 bug-regex2-ENV = MALLOC_TRACE=$(objpfx)bug-regex2.mtrace
 
-$(objpfx)bug-regex2-mem: $(objpfx)bug-regex2.out
+$(objpfx)bug-regex2-mem.out: $(objpfx)bug-regex2.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-regex2.mtrace > $@; \
 	$(evaluate-test)
 
 bug-regex14-ENV = MALLOC_TRACE=$(objpfx)bug-regex14.mtrace
 
-$(objpfx)bug-regex14-mem: $(objpfx)bug-regex14.out
+$(objpfx)bug-regex14-mem.out: $(objpfx)bug-regex14.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-regex14.mtrace > $@; \
 	$(evaluate-test)
 
 bug-regex21-ENV = MALLOC_TRACE=$(objpfx)bug-regex21.mtrace
 
-$(objpfx)bug-regex21-mem: $(objpfx)bug-regex21.out
+$(objpfx)bug-regex21-mem.out: $(objpfx)bug-regex21.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-regex21.mtrace > $@; \
 	$(evaluate-test)
 
 bug-regex31-ENV = MALLOC_TRACE=$(objpfx)bug-regex31.mtrace
 
-$(objpfx)bug-regex31-mem: $(objpfx)bug-regex31.out
+$(objpfx)bug-regex31-mem.out: $(objpfx)bug-regex31.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-regex31.mtrace > $@; \
 	$(evaluate-test)
 
 tst-vfork3-ENV = MALLOC_TRACE=$(objpfx)tst-vfork3.mtrace
 
-$(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
+$(objpfx)tst-vfork3-mem.out: $(objpfx)tst-vfork3.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-vfork3.mtrace > $@; \
 	$(evaluate-test)
 
@@ -289,18 +290,18 @@ $(objpfx)tst-vfork3-mem: $(objpfx)tst-vfork3.out
 # tst-rxspencer-no-utf8.mtrace, since otherwise the file has almost
 # 100M and takes very long time to process.
 tst-rxspencer-no-utf8-ENV += MALLOC_TRACE=$(objpfx)tst-rxspencer-no-utf8.mtrace
-$(objpfx)tst-rxspencer-no-utf8-mem: $(objpfx)tst-rxspencer-no-utf8.out
+$(objpfx)tst-rxspencer-no-utf8-mem.out: $(objpfx)tst-rxspencer-no-utf8.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-rxspencer-no-utf8.mtrace \
 				      > $@; \
 	$(evaluate-test)
 
 tst-pcre-ENV = MALLOC_TRACE=$(objpfx)tst-pcre.mtrace
-$(objpfx)tst-pcre-mem: $(objpfx)tst-pcre.out
+$(objpfx)tst-pcre-mem.out: $(objpfx)tst-pcre.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-pcre.mtrace > $@; \
 	$(evaluate-test)
 
 tst-boost-ENV = MALLOC_TRACE=$(objpfx)tst-boost.mtrace
-$(objpfx)tst-boost-mem: $(objpfx)tst-boost.out
+$(objpfx)tst-boost-mem.out: $(objpfx)tst-boost.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-boost.mtrace > $@; \
 	$(evaluate-test)
 
@@ -308,7 +309,7 @@ $(objpfx)tst-getconf.out: tst-getconf.sh $(objpfx)getconf
 	$(SHELL) $< $(common-objpfx) '$(built-program-cmd)'; \
 	$(evaluate-test)
 
-$(objpfx)bug-ga2-mem: $(objpfx)bug-ga2.out
+$(objpfx)bug-ga2-mem.out: $(objpfx)bug-ga2.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-ga2.mtrace > $@; \
 	$(evaluate-test)
 
@@ -316,7 +317,7 @@ bug-ga2-ENV = MALLOC_TRACE=$(objpfx)bug-ga2.mtrace
 
 bug-glob2-ENV = MALLOC_TRACE=$(objpfx)bug-glob2.mtrace
 
-$(objpfx)bug-glob2-mem: $(objpfx)bug-glob2.out
+$(objpfx)bug-glob2-mem.out: $(objpfx)bug-glob2.out
 	$(common-objpfx)malloc/mtrace $(objpfx)bug-glob2.mtrace > $@; \
 	$(evaluate-test)
 
diff --git a/resolv/Makefile b/resolv/Makefile
index 4ce7619..22575e5 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -33,7 +33,7 @@ routines := herror inet_addr inet_ntop inet_pton nsap_addr res_init \
 tests = tst-aton tst-leaks tst-inet_ntop
 xtests = tst-leaks2
 
-generate := mtrace-tst-leaks tst-leaks.mtrace tst-leaks2.mtrace
+generate := mtrace-tst-leaks.out tst-leaks.mtrace tst-leaks2.mtrace
 
 extra-libs := libresolv libnss_dns
 ifeq ($(have-thread-library),yes)
@@ -66,13 +66,13 @@ endif
 
 ifeq ($(run-built-tests),yes)
 ifneq (no,$(PERL))
-tests-special += $(objpfx)mtrace-tst-leaks
-xtests-special += $(objpfx)mtrace-tst-leaks2
+tests-special += $(objpfx)mtrace-tst-leaks.out
+xtests-special += $(objpfx)mtrace-tst-leaks2.out
 endif
 endif
 
-generated += mtrace-tst-leaks tst-leaks.mtrace \
-	     mtrace-tst-leaks2 tst-leaks2.mtrace
+generated += mtrace-tst-leaks.out tst-leaks.mtrace \
+	     mtrace-tst-leaks2.out tst-leaks2.mtrace
 
 include ../Rules
 
@@ -100,11 +100,11 @@ $(objpfx)ga_test: $(objpfx)libanl.so $(shared-thread-library)
 
 $(objpfx)tst-leaks: $(objpfx)libresolv.so
 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace
-$(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
+$(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
 	$(evaluate-test)
 
 tst-leaks2-ENV = MALLOC_TRACE=$(objpfx)tst-leaks2.mtrace
-$(objpfx)mtrace-tst-leaks2: $(objpfx)tst-leaks2.out
+$(objpfx)mtrace-tst-leaks2.out: $(objpfx)tst-leaks2.out
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks2.mtrace > $@; \
 	$(evaluate-test)
