cond-late.mk revision 1.1
11.1Srillig# $NetBSD: cond-late.mk,v 1.1 2020/04/29 23:15:21 rillig Exp $ 21.1Srillig# 31.1Srillig# Using the :? modifier, variable expressions can contain conditional 41.1Srillig# expressions that are evaluated late. Any variables appearing in these 51.1Srillig# conditions are expanded before parsing the condition. This is 61.1Srillig# different from many other places. 71.1Srillig# 81.1Srillig# Because of this, variables that are used in these lazy conditions 91.1Srillig# should not contain double-quotes, or the parser will probably fail. 101.1Srillig# 111.1Srillig# They should also not contain operators like == or <, since these are 121.1Srillig# actually interpreted as these operators. This is demonstrated below. 131.1Srillig# 141.1Srillig# If the order of evaluation were to change to first parse the condition 151.1Srillig# and then expand the variables, the output would change from the 161.1Srillig# current "yes no" to "yes yes", since both variables are non-empty. 171.1Srillig 181.1SrilligCOND.true= "yes" == "yes" 191.1SrilligCOND.false= "yes" != "yes" 201.1Srillig 211.1Srilligall: 221.1Srillig @echo ${ ${COND.true} :?yes:no} 231.1Srillig @echo ${ ${COND.false} :?yes:no} 24