From 8c218dc01b376e7a560d2b7fcbacca532b75fe4b Mon Sep 17 00:00:00 2001 From: nia Date: Sun, 24 May 2020 05:35:51 +0000 Subject: Import bmake- --- devel/bmake/files/unit-tests/cond-late.mk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 devel/bmake/files/unit-tests/cond-late.mk (limited to 'devel/bmake/files/unit-tests/cond-late.mk') diff --git a/devel/bmake/files/unit-tests/cond-late.mk b/devel/bmake/files/unit-tests/cond-late.mk new file mode 100644 index 00000000000..efc6f829133 --- /dev/null +++ b/devel/bmake/files/unit-tests/cond-late.mk @@ -0,0 +1,23 @@ +# $NetBSD: cond-late.mk,v 1.1.1.1 2020/05/24 05:35:53 nia Exp $ +# +# Using the :? modifier, variable expressions can contain conditional +# expressions that are evaluated late. Any variables appearing in these +# conditions are expanded before parsing the condition. This is +# different from many other places. +# +# Because of this, variables that are used in these lazy conditions +# should not contain double-quotes, or the parser will probably fail. +# +# They should also not contain operators like == or <, since these are +# actually interpreted as these operators. This is demonstrated below. +# +# If the order of evaluation were to change to first parse the condition +# and then expand the variables, the output would change from the +# current "yes no" to "yes yes", since both variables are non-empty. + +COND.true= "yes" == "yes" +COND.false= "yes" != "yes" + +all: + @echo ${ ${COND.true} :?yes:no} + @echo ${ ${COND.false} :?yes:no} -- cgit v1.2.3