Sun Aug 30 14:25:45 2020 UTC ()
make(1): extend test for .ifmake and .MAKEFLAGS


(rillig)
diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-ifmake.exp
diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-ifmake.mk

cvs diff -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-ifmake.exp (expand / switch to context diff)
--- src/usr.bin/make/unit-tests/directive-ifmake.exp 2020/08/29 19:07:32 1.2
+++ src/usr.bin/make/unit-tests/directive-ifmake.exp 2020/08/30 14:25:45 1.3
@@ -3,6 +3,8 @@
 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

cvs diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-ifmake.mk (expand / switch to context diff)
--- src/usr.bin/make/unit-tests/directive-ifmake.mk 2020/08/29 19:07:32 1.3
+++ src/usr.bin/make/unit-tests/directive-ifmake.mk 2020/08/30 14:25:45 1.4
@@ -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:
 	: $@