Dear tech@,

given the following Makefile:

# REGRESS_SETUP vs REGRESS_SETUP_ONCE example

setup:
        @echo setup

setup_once:
        @echo setup_once

test1:
        @echo test1

test2:
        @echo test2

cleanup:
        @echo cleanup

REGRESS_SETUP =         setup
REGRESS_SETUP_ONCE =    setup_once
REGRESS_TARGETS+=       test1 test2
REGRESS_CLEANUP =       cleanup

.include <bsd.regress.mk>

I expected the following output:
pbp$ make regress
setup_once
setup
test1
setup
test2
cleanup

But instead I got:
pbp$ make regress
setup
setup_once
test1
setup
test2
cleanup

The diff below yields the expected result instead.

Index: share/mk/bsd.regress.mk
===================================================================
RCS file: /cvs/src/share/mk/bsd.regress.mk,v
retrieving revision 1.21
diff -u -p -r1.21 bsd.regress.mk
--- share/mk/bsd.regress.mk     17 Jun 2019 17:20:24 -0000      1.21
+++ share/mk/bsd.regress.mk     24 Sep 2020 19:48:11 -0000
@@ -67,16 +67,16 @@ REGRESS_SETUP?=
 REGRESS_SETUP_ONCE?=
 REGRESS_CLEANUP?=
 
-.if !empty(REGRESS_SETUP)
-${REGRESS_TARGETS}: ${REGRESS_SETUP}
-.endif
-
 .if !empty(REGRESS_SETUP_ONCE)
 CLEANFILES+=${REGRESS_SETUP_ONCE:S/^/stamp-/}
 ${REGRESS_TARGETS}: ${REGRESS_SETUP_ONCE:S/^/stamp-/}
 ${REGRESS_SETUP_ONCE:S/^/stamp-/}: .SILENT
        ${MAKE} -C ${.CURDIR} ${@:S/^stamp-//}
        date >$@
+.endif
+
+.if !empty(REGRESS_SETUP)
+${REGRESS_TARGETS}: ${REGRESS_SETUP}
 .endif
 
 regress: .SILENT

Reply via email to