aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/varname-dot-alltargets.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/varname-dot-alltargets.mk')
-rw-r--r--unit-tests/varname-dot-alltargets.mk25
1 files changed, 25 insertions, 0 deletions
diff --git a/unit-tests/varname-dot-alltargets.mk b/unit-tests/varname-dot-alltargets.mk
new file mode 100644
index 000000000000..0d16c8e6fef0
--- /dev/null
+++ b/unit-tests/varname-dot-alltargets.mk
@@ -0,0 +1,25 @@
+# $NetBSD: varname-dot-alltargets.mk,v 1.3 2020/08/25 22:51:54 rillig Exp $
+#
+# Tests for the special .ALLTARGETS variable.
+
+.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}