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 make(1): extend test for .ifmake and...



details:   https://anonhg.NetBSD.org/src/rev/9f6ea3c32d3a
branches:  trunk
changeset: 943304:9f6ea3c32d3a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 30 14:25:45 2020 +0000

description:
make(1): extend test for .ifmake and .MAKEFLAGS

diffstat:

 usr.bin/make/unit-tests/directive-ifmake.exp |   2 ++
 usr.bin/make/unit-tests/directive-ifmake.mk  |  14 ++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r a886e3b111e9 -r 9f6ea3c32d3a usr.bin/make/unit-tests/directive-ifmake.exp
--- a/usr.bin/make/unit-tests/directive-ifmake.exp      Sun Aug 30 14:11:42 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-ifmake.exp      Sun Aug 30 14:25:45 2020 +0000
@@ -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
diff -r a886e3b111e9 -r 9f6ea3c32d3a usr.bin/make/unit-tests/directive-ifmake.mk
--- a/usr.bin/make/unit-tests/directive-ifmake.mk       Sun Aug 30 14:11:42 2020 +0000
+++ b/usr.bin/make/unit-tests/directive-ifmake.mk       Sun Aug 30 14:25:45 2020 +0000
@@ -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:
        : $@



Home | Main Index | Thread Index | Old Index