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 tests/make: test target '.DEFAULT'



details:   https://anonhg.NetBSD.org/src/rev/9060013a8e5d
branches:  trunk
changeset: 1026596:9060013a8e5d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Dec 01 23:56:29 2021 +0000

description:
tests/make: test target '.DEFAULT'

diffstat:

 usr.bin/make/unit-tests/deptgt-default.exp |   1 +
 usr.bin/make/unit-tests/deptgt-default.mk  |  17 +++++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 93771b2ecd46 -r 9060013a8e5d usr.bin/make/unit-tests/deptgt-default.exp
--- a/usr.bin/make/unit-tests/deptgt-default.exp        Wed Dec 01 23:15:38 2021 +0000
+++ b/usr.bin/make/unit-tests/deptgt-default.exp        Wed Dec 01 23:56:29 2021 +0000
@@ -1,1 +1,2 @@
+Default command is making 'not-a-target' from 'not-a-target'.
 exit status 0
diff -r 93771b2ecd46 -r 9060013a8e5d usr.bin/make/unit-tests/deptgt-default.mk
--- a/usr.bin/make/unit-tests/deptgt-default.mk Wed Dec 01 23:15:38 2021 +0000
+++ b/usr.bin/make/unit-tests/deptgt-default.mk Wed Dec 01 23:56:29 2021 +0000
@@ -1,8 +1,17 @@
-# $NetBSD: deptgt-default.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: deptgt-default.mk,v 1.3 2021/12/01 23:56:29 rillig Exp $
 #
-# Tests for the special target .DEFAULT in dependency declarations.
+# Tests for the special target .DEFAULT in dependency declarations, which
+# attaches its associated commands to all targets that don't specify any way
+# to create them.
+
+all: test-default not-a-target
 
-# TODO: Implementation
+test-default: .PHONY
+
+has-commands: .PHONY
+       @echo 'Making ${.TARGET} from ${.IMPSRC}.'
+
+.DEFAULT: dependency-is-ignored
+       @echo "Default command is making '${.TARGET}' from '${.IMPSRC}'."
 
 all:
-       @:;



Home | Main Index | Thread Index | Old Index