Module Name:    src
Committed By:   rillig
Date:           Sun Dec 12 10:33:03 UTC 2021

Modified Files:
        src/usr.bin/make: Makefile

Log Message:
make: only define target report-coverage if USE_COVERAGE is yes

Without USE_COVERAGE, GCOV was undefined, the '2>&1' passed all error
messages to GCOV_PERL, when then discarded them.  If the error messages
had been left on stderr, the error message 'sh: arch.o.gcda: not found'
would have been a clear indicator of the actual cause of an empty
coverage report.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/usr.bin/make/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/Makefile
diff -u src/usr.bin/make/Makefile:1.117 src/usr.bin/make/Makefile:1.118
--- src/usr.bin/make/Makefile:1.117	Sun Nov 28 18:58:58 2021
+++ src/usr.bin/make/Makefile	Sun Dec 12 10:33:03 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.117 2021/11/28 18:58:58 rillig Exp $
+#	$NetBSD: Makefile,v 1.118 2021/12/12 10:33:03 rillig Exp $
 #	@(#)Makefile	5.2 (Berkeley) 12/28/90
 
 PROG=	make
@@ -187,12 +187,14 @@ test-coverage: .PHONY
 	@env USE_COVERAGE=yes COPTS="-O0 -ggdb" USER_CPPFLAGS="-DCLEANUP" \
 		sh -c 'make -s all -j8 && make -s test'
 
+.if ${USE_COVERAGE} == "yes"
 report-coverage: .PHONY
 	@echo 'covered  uncovered  file'
-	@${GCOV} ${GCOV_OPTS} *.gcda 2>&1 \
+	@${GCOV} ${GCOV_OPTS} *.gcda \
 	| perl -ne ${GCOV_PERL:Q} \
 	| sort -nr
 	@sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov
+.endif
 
 .include <bsd.prog.mk>
 .include <bsd.subdir.mk>

Reply via email to