Module Name:    src
Committed By:   rillig
Date:           Tue Aug 25 22:51:54 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: varname-dot-alltargets.exp
            varname-dot-alltargets.mk

Log Message:
make(1): add test for the .ALLTARGETS special variable


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
    src/usr.bin/make/unit-tests/varname-dot-alltargets.exp
cvs rdiff -u -r1.2 -r1.3 \
    src/usr.bin/make/unit-tests/varname-dot-alltargets.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/unit-tests/varname-dot-alltargets.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-alltargets.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-alltargets.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-alltargets.exp:1.1	Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/varname-dot-alltargets.exp	Tue Aug 25 22:51:54 2020
@@ -1 +1,4 @@
+
+first second source
+first second source all .END
 exit status 0

Index: src/usr.bin/make/unit-tests/varname-dot-alltargets.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-alltargets.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-alltargets.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-alltargets.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-alltargets.mk	Tue Aug 25 22:51:54 2020
@@ -1,8 +1,25 @@
-# $NetBSD: varname-dot-alltargets.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-alltargets.mk,v 1.3 2020/08/25 22:51:54 rillig Exp $
 #
 # Tests for the special .ALLTARGETS variable.
 
-# TODO: Implementation
+.MAIN: all
+
+TARGETS_1:=	${.ALLTARGETS}
+
+first second: source
+
+TARGETS_2:=	${.ALLTARGETS}
 
 all:
-	@:;
+	# Since the tests are run with the -r option, no targets are
+	# defined at the beginning.
+	@echo ${TARGETS_1}
+
+	# Only first and second are "real" targets.
+	# The .ALLTARGETS variable is not about targets though, but
+	# about all nodes, therefore source is also included.
+	@echo ${TARGETS_2}
+
+	# Interestingly, the .END target is also implicitly defined at
+	# this point.
+	@echo ${.ALLTARGETS}

Reply via email to