Module Name: src
Committed By: rillig
Date: Sun Aug 30 14:25:45 UTC 2020
Modified Files:
src/usr.bin/make/unit-tests: directive-ifmake.exp directive-ifmake.mk
Log Message:
make(1): extend test for .ifmake and .MAKEFLAGS
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-ifmake.exp
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-ifmake.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/directive-ifmake.exp
diff -u src/usr.bin/make/unit-tests/directive-ifmake.exp:1.2 src/usr.bin/make/unit-tests/directive-ifmake.exp:1.3
--- src/usr.bin/make/unit-tests/directive-ifmake.exp:1.2 Sat Aug 29 19:07:32 2020
+++ src/usr.bin/make/unit-tests/directive-ifmake.exp Sun Aug 30 14:25:45 2020
@@ -3,6 +3,8 @@ make: "directive-ifmake.mk" line 19: ok:
make: "directive-ifmake.mk" line 25: ok: double negation works
make: "directive-ifmake.mk" line 32: ok: both mentioned
make: "directive-ifmake.mk" line 39: ok: only those mentioned
+make: "directive-ifmake.mk" line 49: Targets can even be added at parse time.
: first
: second
+: late-target
exit status 0
Index: src/usr.bin/make/unit-tests/directive-ifmake.mk
diff -u src/usr.bin/make/unit-tests/directive-ifmake.mk:1.3 src/usr.bin/make/unit-tests/directive-ifmake.mk:1.4
--- src/usr.bin/make/unit-tests/directive-ifmake.mk:1.3 Sat Aug 29 19:07:32 2020
+++ src/usr.bin/make/unit-tests/directive-ifmake.mk Sun Aug 30 14:25:45 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-ifmake.mk,v 1.3 2020/08/29 19:07:32 rillig Exp $
+# $NetBSD: directive-ifmake.mk,v 1.4 2020/08/30 14:25:45 rillig Exp $
#
# Tests for the .ifmake directive, which provides a shortcut for asking
# whether a certain target is requested to be made from the command line.
@@ -41,5 +41,15 @@
.warning && with ! does not work as expected
.endif
-first second unmentioned:
+# Using the .MAKEFLAGS special dependency target, arbitrary command
+# line options can be added at parse time. This means that it is
+# possible to extend the targets to be made.
+.MAKEFLAGS: late-target
+.ifmake late-target
+.info Targets can even be added at parse time.
+.else
+.info No, targets cannot be added at parse time anymore.
+.endif
+
+first second unmentioned late-target:
: $@