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 undefined vari...
details: https://anonhg.NetBSD.org/src/rev/24814f263ace
branches: trunk
changeset: 958073:24814f263ace
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Dec 22 19:38:44 2020 +0000
description:
make(1): add test for undefined variable in dependency declaration
diffstat:
usr.bin/make/unit-tests/depsrc.exp | 3 +++
usr.bin/make/unit-tests/depsrc.mk | 17 ++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletions(-)
diffs (38 lines):
diff -r 9a5d8e83d21b -r 24814f263ace usr.bin/make/unit-tests/depsrc.exp
--- a/usr.bin/make/unit-tests/depsrc.exp Tue Dec 22 17:50:55 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc.exp Tue Dec 22 19:38:44 2020 +0000
@@ -1,1 +1,4 @@
+: 'Undefined variables are expanded directly in the dependency'
+: 'declaration. They are not preserved and maybe expanded later.'
+: 'This is in contrast to local variables such as ${.TARGET}.'
exit status 0
diff -r 9a5d8e83d21b -r 24814f263ace usr.bin/make/unit-tests/depsrc.mk
--- a/usr.bin/make/unit-tests/depsrc.mk Tue Dec 22 17:50:55 2020 +0000
+++ b/usr.bin/make/unit-tests/depsrc.mk Tue Dec 22 19:38:44 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: depsrc.mk,v 1.3 2020/11/15 20:20:58 rillig Exp $
+# $NetBSD: depsrc.mk,v 1.4 2020/12/22 19:38:44 rillig Exp $
#
# Tests for special sources (those starting with a dot, followed by
# uppercase letters) in dependency declarations, such as .PHONY.
@@ -7,5 +7,20 @@
# TODO: Test 'target: ${:U.SILENT}'
+# Demonstrate when exactly undefined variables are expanded in a dependency
+# declaration.
+target: .PHONY source-${DEFINED_LATER}
+#
+DEFINED_LATER= later
+#
+source-: .PHONY
+ : 'Undefined variables are expanded directly in the dependency'
+ : 'declaration. They are not preserved and maybe expanded later.'
+ : 'This is in contrast to local variables such as $${.TARGET}.'
+source-later: .PHONY
+ : 'Undefined variables are tried to be expanded in a dependency'
+ : 'declaration. If that fails because the variable is undefined,'
+ : 'the expression is preserved and tried to be expanded later.'
+
all:
@:;
Home |
Main Index |
Thread Index |
Old Index