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/a6b4c6b25f0b
branches:  trunk
changeset: 937585:a6b4c6b25f0b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 22 07:49:44 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/depsrc-use.exp      |   3 +++
 usr.bin/make/unit-tests/depsrc-use.mk       |  24 +++++++++++++++++++-----
 usr.bin/make/unit-tests/depsrc-usebefore.mk |   4 +++-
 3 files changed, 25 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r 151db5a8a7ae -r a6b4c6b25f0b usr.bin/make/unit-tests/depsrc-use.exp
--- a/usr.bin/make/unit-tests/depsrc-use.exp    Sat Aug 22 07:46:18 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-use.exp    Sat Aug 22 07:49:44 2020 +0000
@@ -1,1 +1,4 @@
+first
+second
+directly
 exit status 0
diff -r 151db5a8a7ae -r a6b4c6b25f0b usr.bin/make/unit-tests/depsrc-use.mk
--- a/usr.bin/make/unit-tests/depsrc-use.mk     Sat Aug 22 07:46:18 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-use.mk     Sat Aug 22 07:49:44 2020 +0000
@@ -1,8 +1,22 @@
-# $NetBSD: depsrc-use.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: depsrc-use.mk,v 1.3 2020/08/22 07:49:44 rillig Exp $
 #
-# Tests for the special source .USE in dependency declarations.
+# Tests for the special source .USE in dependency declarations,
+# which allows to append common commands to other targets.
+
+all: action directly
+
+first: .USE
+       @echo first             # Using ${.TARGET} here would expand to "action"
 
-# TODO: Implementation
+second: .USE
+       @echo second
 
-all:
-       @:;
+# It's possible but uncommon to have a .USE target with no commands.
+# This may happen as the result of expanding a .for loop.
+empty: .USE
+
+# It's possible but uncommon to directly make a .USEBEFORE target.
+directly: .USE
+       @echo directly
+
+action: first second empty
diff -r 151db5a8a7ae -r a6b4c6b25f0b usr.bin/make/unit-tests/depsrc-usebefore.mk
--- a/usr.bin/make/unit-tests/depsrc-usebefore.mk       Sat Aug 22 07:46:18 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc-usebefore.mk       Sat Aug 22 07:49:44 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: depsrc-usebefore.mk,v 1.3 2020/08/22 07:46:18 rillig Exp $
+# $NetBSD: depsrc-usebefore.mk,v 1.4 2020/08/22 07:49:44 rillig Exp $
 #
 # Tests for the special source .USEBEFORE in dependency declarations,
 # which allows to prepend common commands to other targets.
@@ -11,6 +11,8 @@
 second: .USEBEFORE
        @echo second
 
+# It's possible but uncommon to have a .USEBEFORE target with no commands.
+# This may happen as the result of expanding a .for loop.
 empty: .USEBEFORE
 
 # It's possible but uncommon to directly make a .USEBEFORE target.



Home | Main Index | Thread Index | Old Index