1# $NetBSD: vardebug.mk,v 1.3 2020/08/08 14:28:46 rillig Exp $ 2# 3# Demonstrates the debugging output for var.c. 4 5RELEVANT= yes 6 7VAR= added # VarAdd 8VAR= overwritten # Var_Set 9.undef VAR # Var_Delete (found) 10.undef VAR # Var_Delete (not found) 11 12# The variable with the empty name cannot be set at all. 13${:U}= empty name # Var_Set 14${:U}+= empty name # Var_Append 15 16FROM_CMDLINE= overwritten # Var_Set (ignored) 17 18VAR= 1 19VAR+= 2 20VAR+= 3 21 22.if ${VAR:M[2]} # VarMatch 23.endif 24.if ${VAR:N[2]} # VarNoMatch (no debug output) 25.endif 26 27.if ${VAR:S,2,two,} # VarGetPattern 28.endif 29 30.if ${VAR:Q} # VarQuote 31.endif 32 33.if ${VAR:tu:tl:Q} # ApplyModifiers 34.endif 35 36# ApplyModifiers, "Got ..." 37.if ${:Uvalue:${:UM*e}:Mvalu[e]} 38.endif 39 40.undef ${:UVAR} # Var_Delete 41 42# When ApplyModifiers results in an error, this appears in the debug log 43# as "is error", without surrounding quotes. 44.if ${:Uvariable:unknown} 45.endif 46 47# XXX: The error message is "Malformed conditional", which is wrong. 48# The condition is syntactically fine, it just contains an undefined variable. 49# 50# There is a specialized error message for "Undefined variable", but as of 51# 2020-08-08, that is not covered by any unit tests. It might even be 52# unreachable. 53.if ${UNDEFINED} 54.endif 55 56RELEVANT= no 57 58all: 59 @: 60