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 unified 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
@@ -1,8 +1,10 @@ @@ -1,8 +1,10 @@
1make: "directive-ifmake.mk" line 8: ok: positive condition works 1make: "directive-ifmake.mk" line 8: ok: positive condition works
2make: "directive-ifmake.mk" line 19: ok: negation works 2make: "directive-ifmake.mk" line 19: ok: negation works
3make: "directive-ifmake.mk" line 25: ok: double negation works 3make: "directive-ifmake.mk" line 25: ok: double negation works
4make: "directive-ifmake.mk" line 32: ok: both mentioned 4make: "directive-ifmake.mk" line 32: ok: both mentioned
5make: "directive-ifmake.mk" line 39: ok: only those mentioned 5make: "directive-ifmake.mk" line 39: ok: only those mentioned
 6make: "directive-ifmake.mk" line 49: Targets can even be added at parse time.
6: first 7: first
7: second 8: second
 9: late-target
8exit status 0 10exit status 0

cvs diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-ifmake.mk (expand / switch to unified 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,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: directive-ifmake.mk,v 1.3 2020/08/29 19:07:32 rillig Exp $ 1# $NetBSD: directive-ifmake.mk,v 1.4 2020/08/30 14:25:45 rillig Exp $
2# 2#
3# Tests for the .ifmake directive, which provides a shortcut for asking 3# Tests for the .ifmake directive, which provides a shortcut for asking
4# whether a certain target is requested to be made from the command line. 4# whether a certain target is requested to be made from the command line.
5 5
6# This is the most basic form. 6# This is the most basic form.
7.ifmake first 7.ifmake first
8.info ok: positive condition works 8.info ok: positive condition works
9.else 9.else
10.warning positive condition fails 10.warning positive condition fails
11.endif 11.endif
12 12
13# The not operator works as expected. 13# The not operator works as expected.
14# An alternative interpretation were that this condition is asking whether 14# An alternative interpretation were that this condition is asking whether
@@ -31,15 +31,25 @@ @@ -31,15 +31,25 @@
31.ifmake first && second 31.ifmake first && second
32.info ok: both mentioned 32.info ok: both mentioned
33.else 33.else
34.warning && does not work as expected 34.warning && does not work as expected
35.endif 35.endif
36 36
37# Negation also works in complex conditions. 37# Negation also works in complex conditions.
38.ifmake first && !unmentioned 38.ifmake first && !unmentioned
39.info ok: only those mentioned 39.info ok: only those mentioned
40.else 40.else
41.warning && with ! does not work as expected 41.warning && with ! does not work as expected
42.endif 42.endif
43 43
44first second unmentioned: 44# Using the .MAKEFLAGS special dependency target, arbitrary command
 45# line options can be added at parse time. This means that it is
 46# possible to extend the targets to be made.
 47.MAKEFLAGS: late-target
 48.ifmake late-target
 49.info Targets can even be added at parse time.
 50.else
 51.info No, targets cannot be added at parse time anymore.
 52.endif
 53
 54first second unmentioned late-target:
45 : $@ 55 : $@