2021-02-11 01:51:11 +00:00
|
|
|
# $NetBSD: vardebug.mk,v 1.7 2021/02/04 21:42:47 rillig Exp $
|
2020-09-05 16:11:04 +00:00
|
|
|
#
|
|
|
|
# Demonstrates the debugging output for var.c.
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
.MAKEFLAGS: -dv FROM_CMDLINE=
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
VAR= added # VarAdd
|
|
|
|
VAR= overwritten # Var_Set
|
|
|
|
.undef VAR # Var_Delete (found)
|
|
|
|
.undef VAR # Var_Delete (not found)
|
|
|
|
|
|
|
|
# The variable with the empty name cannot be set at all.
|
|
|
|
${:U}= empty name # Var_Set
|
|
|
|
${:U}+= empty name # Var_Append
|
|
|
|
|
|
|
|
FROM_CMDLINE= overwritten # Var_Set (ignored)
|
|
|
|
|
|
|
|
VAR= 1
|
|
|
|
VAR+= 2
|
|
|
|
VAR+= 3
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
.if ${VAR:M[2]} # ModifyWord_Match
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
2020-11-07 19:39:21 +00:00
|
|
|
.if ${VAR:N[2]} # ModifyWord_NoMatch (no debug output)
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
.if ${VAR:S,2,two,} # ParseModifierPart
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${VAR:Q} # VarQuote
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if ${VAR:tu:tl:Q} # ApplyModifiers
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# ApplyModifiers, "Got ..."
|
|
|
|
.if ${:Uvalue:${:UM*e}:Mvalu[e]}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.undef ${:UVAR} # Var_Delete
|
|
|
|
|
|
|
|
# When ApplyModifiers results in an error, this appears in the debug log
|
|
|
|
# as "is error", without surrounding quotes.
|
|
|
|
.if ${:Uvariable:unknown}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# XXX: The error message is "Malformed conditional", which is wrong.
|
|
|
|
# The condition is syntactically fine, it just contains an undefined variable.
|
|
|
|
#
|
|
|
|
# There is a specialized error message for "Undefined variable", but as of
|
|
|
|
# 2020-08-08, that is not covered by any unit tests. It might even be
|
|
|
|
# unreachable.
|
|
|
|
.if ${UNDEFINED}
|
|
|
|
.endif
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
# By default, .SHELL is not defined and thus can be set. As soon as it is
|
2021-02-11 01:51:11 +00:00
|
|
|
# accessed, it is initialized in the command line scope (during VarFind),
|
2020-11-07 19:39:21 +00:00
|
|
|
# where it is set to read-only. Assigning to it is ignored.
|
|
|
|
.MAKEFLAGS: .SHELL=overwritten
|
|
|
|
|
|
|
|
.MAKEFLAGS: -d0
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
all:
|
|
|
|
@:
|