"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "unit-tests/cond-late.mk" between
bmake-20201101.tar.gz and bmake-20201117.tar.gz

About: bmake a BSD make tool (derived from NetBSD’s make).

cond-late.mk  (bmake-20201101):cond-late.mk  (bmake-20201117)
# $NetBSD: cond-late.mk,v 1.2 2020/07/25 20:37:46 rillig Exp $ # $NetBSD: cond-late.mk,v 1.3 2020/11/15 14:07:53 rillig Exp $
# #
# Using the :? modifier, variable expressions can contain conditional # Using the :? modifier, variable expressions can contain conditional
# expressions that are evaluated late. Any variables appearing in these # expressions that are evaluated late, at expansion time.
#
# Any variables appearing in these
# conditions are expanded before parsing the condition. This is # conditions are expanded before parsing the condition. This is
# different from many other places. # different from many other places.
# #
# Because of this, variables that are used in these lazy conditions # Because of this, variables that are used in these lazy conditions
# should not contain double-quotes, or the parser will probably fail. # should not contain double-quotes, or the parser will probably fail.
# #
# They should also not contain operators like == or <, since these are # They should also not contain operators like == or <, since these are
# actually interpreted as these operators. This is demonstrated below. # 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.
all: cond-literal all: cond-literal
COND.true= "yes" == "yes" COND.true= "yes" == "yes"
COND.false= "yes" != "yes" COND.false= "yes" != "yes"
# 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-literal: cond-literal:
@echo ${ ${COND.true} :?yes:no} @echo ${ ${COND.true} :?yes:no}
@echo ${ ${COND.false} :?yes:no} @echo ${ ${COND.false} :?yes:no}
VAR+= ${${UNDEF} != "no":?:} VAR+= ${${UNDEF} != "no":?:}
.if empty(VAR:Mpattern) .if empty(VAR:Mpattern)
.endif .endif
 End of changes. 4 change blocks. 
5 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)