aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varmod-ifelse.mk
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2021-01-14 06:21:37 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2021-01-14 06:21:37 +0000
commit06b9b3e0ad0dc3f0166b3e8f26ced68c271cf527 (patch)
tree92a02f1874a5dacc12b39edd184602d24888baad /contrib/bmake/unit-tests/varmod-ifelse.mk
parent0495ed398c4f64013bab2327eb13a303e1f90c13 (diff)
parent8e11a9b4250be3c3379c45fa820bff78d99d5946 (diff)
downloadsrc-06b9b3e0ad0dc3f0166b3e8f26ced68c271cf527.tar.gz
src-06b9b3e0ad0dc3f0166b3e8f26ced68c271cf527.zip
Merge bmake-20210110
Quite a lot of churn on style, but lots of good work refactoring complicated functions and lots more unit-tests. Thanks mostly to rillig at NetBSD Some interesting entries from ChangeLog o .MAKE.{UID,GID} represent uid and gid running make. o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable checks in InitObjdir. Explicit .OBJDIR target always allows read-only directory. o add more unit tests for META MODE Merge commit '8e11a9b4250be3c3379c45fa820bff78d99d5946' into main Change-Id: I464fd4c013067f0915671c1ccc96d2d8090b2b9c
Diffstat (limited to 'contrib/bmake/unit-tests/varmod-ifelse.mk')
-rw-r--r--contrib/bmake/unit-tests/varmod-ifelse.mk20
1 files changed, 19 insertions, 1 deletions
diff --git a/contrib/bmake/unit-tests/varmod-ifelse.mk b/contrib/bmake/unit-tests/varmod-ifelse.mk
index ea94dc875e4d..5e0ad04584be 100644
--- a/contrib/bmake/unit-tests/varmod-ifelse.mk
+++ b/contrib/bmake/unit-tests/varmod-ifelse.mk
@@ -1,4 +1,4 @@
-# $NetBSD: varmod-ifelse.mk,v 1.6 2020/11/12 00:29:55 rillig Exp $
+# $NetBSD: varmod-ifelse.mk,v 1.8 2020/12/10 16:47:42 rillig Exp $
#
# Tests for the ${cond:?then:else} variable modifier, which evaluates either
# the then-expression or the else-expression, depending on the condition.
@@ -93,5 +93,23 @@ COND:= ${${UNDEF} == "":?bad-assign:bad-assign}
.endif
.MAKEFLAGS: -d0
+# As of 2020-12-10, the variable "name" is first expanded, and the result of
+# this expansion is then taken as the condition. To force the variable
+# expression in the condition to be evaluated at exactly the right point,
+# the '$' of the intended '${VAR}' escapes from the parser in form of the
+# expression ${:U\$}. Because of this escaping, the variable "name" and thus
+# the condition ends up as "${VAR} == value", just as intended.
+#
+# This hack does not work for variables from .for loops since these are
+# expanded at parse time to their corresponding ${:Uvalue} expressions.
+# Making the '$' of the '${VAR}' expression indirect hides this expression
+# from the parser of the .for loop body. See SubstVarLong.
+.MAKEFLAGS: -dc
+VAR= value
+.if ${ ${:U\$}{VAR} == value :?ok:bad} != "ok"
+. error
+.endif
+.MAKEFLAGS: -d0
+
all:
@:;