]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/cond-late.mk
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / cond-late.mk
1 # $NetBSD: cond-late.mk,v 1.1 2020/04/29 23:15:21 rillig Exp $
2 #
3 # Using the :? modifier, variable expressions can contain conditional
4 # expressions that are evaluated late.  Any variables appearing in these
5 # conditions are expanded before parsing the condition.  This is
6 # different from many other places.
7 #
8 # Because of this, variables that are used in these lazy conditions
9 # should not contain double-quotes, or the parser will probably fail.
10 #
11 # They should also not contain operators like == or <, since these are
12 # actually interpreted as these operators. This is demonstrated below.
13 #
14 # If the order of evaluation were to change to first parse the condition
15 # and then expand the variables, the output would change from the
16 # current "yes no" to "yes yes", since both variables are non-empty.
17
18 COND.true=      "yes" == "yes"
19 COND.false=     "yes" != "yes"
20
21 all:
22         @echo ${ ${COND.true} :?yes:no}
23         @echo ${ ${COND.false} :?yes:no}