Subject: Re: [PATCH v3] Makefile: add a prerequisite to the coverage-report target

From: Junio C Hamano <[email-masked]>
Date: Wed, 13 Apr 2022 22:16:10 -0700

Elia Pinto <[email-masked]> writes:

> @@ -3421,13 +3422,18 @@ coverage-compile:
>  coverage-test: coverage-clean-results coverage-compile
>  	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \
>  		DEFAULT_TEST_TARGET=test -j1 test
> +	touch coverage-test.made
> +
> +coverage-test.made:
> +	@make coverage-test
> +	touch coverage-test.made

As this target runs "$(MAKE) coverage-test", at the end of which the
.made file is touched anyway, I wonder if we need the second line
here.

I just tried to run this sequence:

    $ make distclean
    $ make coverage-report
    $ make coverage-report
    $ make coverage-test

without the "touch" in the recipe for the coverage-test.made target,
and it behaved as I expected them to, i.e.

    * got an pristine tree
    * built, ran tests and showed report
    * showed report without building or running testing
    * cleared the gcov files, ran tests and showed report

So, perhaps this patch on top?

Thanks.

 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git i/Makefile w/Makefile
index fa8cc86276..72ae7fa886 100644
--- i/Makefile
+++ w/Makefile
@@ -3416,8 +3416,7 @@ coverage-test: coverage-clean-results coverage-compile
 	touch coverage-test.made
 
 coverage-test.made:
-	@make coverage-test
-	touch coverage-test.made
+	$(MAKE) coverage-test
 
 coverage-prove: coverage-clean-results coverage-compile
 	$(MAKE) CFLAGS="$(COVERAGE_CFLAGS)" LDFLAGS="$(COVERAGE_LDFLAGS)" \