Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for the special so...



details:   https://anonhg.NetBSD.org/src/rev/e54785c57d5c
branches:  trunk
changeset: 975116:e54785c57d5c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 22 07:46:18 2020 +0000

description:
make(1): add test for the special source .USEBEFORE

diffstat:

 usr.bin/make/unit-tests/depsrc-usebefore.exp |   3 +++
 usr.bin/make/unit-tests/depsrc-usebefore.mk  |  22 +++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 64ff91e36895 -r e54785c57d5c usr.bin/make/unit-tests/depsrc-usebefore.exp
--- a/usr.bin/make/unit-tests/depsrc-usebefore.exp      Sat Aug 22 07:26:34 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-usebefore.exp      Sat Aug 22 07:46:18 2020 +0000
@@ -1,1 +1,4 @@
+first
+second
+directly
 exit status 0
diff -r 64ff91e36895 -r e54785c57d5c usr.bin/make/unit-tests/depsrc-usebefore.mk
--- a/usr.bin/make/unit-tests/depsrc-usebefore.mk       Sat Aug 22 07:26:34 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-usebefore.mk       Sat Aug 22 07:46:18 2020 +0000
@@ -1,8 +1,20 @@
-# $NetBSD: depsrc-usebefore.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-usebefore.mk,v 1.3 2020/08/22 07:46:18 rillig Exp $
 #
-# Tests for the special source .USEBEFORE in dependency declarations.
+# Tests for the special source .USEBEFORE in dependency declarations,
+# which allows to prepend common commands to other targets.
+
+all: action directly
+
+first: .USEBEFORE
+       @echo first             # Using ${.TARGET} here would expand to "action"
 
-# TODO: Implementation
+second: .USEBEFORE
+       @echo second
+
+empty: .USEBEFORE
 
-all:
-       @:;
+# It's possible but uncommon to directly make a .USEBEFORE target.
+directly: .USEBEFORE
+       @echo directly
+
+action: second first empty



Home | Main Index | Thread Index | Old Index