1 # $NetBSD: vardebug.mk,v 1.18 2025/03/29 19:08:52 rillig Exp $ 2 # 3 # Demonstrates the debugging output for var.c. 4 5 .MAKEFLAGS: -dv FROM_CMDLINE= 6 7 # expect: Global: VAR = added 8 VAR= added # VarAdd 9 # expect: Global: VAR = overwritten 10 VAR= overwritten # Var_Set 11 # expect: Global: delete VAR 12 .undef VAR 13 # expect: Global: ignoring delete 'VAR' as it is not found 14 .undef VAR 15 16 # The variable with the empty name cannot be set at all. 17 # expect: Global: ignoring ' = empty name' as the variable name '${:U}' expands to empty 18 ${:U}= empty name # Var_Set 19 # expect: Global: ignoring ' += empty name' as the variable name '${:U}' expands to empty 20 ${:U}+= empty name # Var_Append 21 22 FROM_CMDLINE= overwritten # Var_Set (ignored) 23 24 # expect: Global: VAR = 1 25 VAR= 1 26 # expect: Global: VAR = 1 2 27 VAR+= 2 28 # expect: Global: VAR = 1 2 3 29 VAR+= 3 30 31 # expect: Pattern for ':M' is "[2]" 32 # expect: Result of ${VAR:M[2]} is "2" 33 .if ${VAR:M[2]} # ModifyWord_Match 34 .endif 35 # expect: Pattern for ':N' is "[2]" 36 # expect: Result of ${VAR:N[2]} is "1 3" 37 .if ${VAR:N[2]} # ModifyWord_NoMatch 38 .endif 39 40 .if ${VAR:S,2,two,} # ParseModifierPart 41 .endif 42 43 # expect: Result of ${VAR:Q} is "1\ 2\ 3" 44 .if ${VAR:Q} # VarQuote 45 .endif 46 47 .if ${VAR:tu:tl:Q} # ApplyModifiers 48 .endif 49 50 # ApplyModifiers, "Got ..." 51 # expect: Result of ${:Mvalu[e]} is "value" (eval, defined) 52 .if ${:Uvalue:${:UM*e}:Mvalu[e]} 53 .endif 54 55 # expect: Global: delete VAR 56 .undef ${:UVAR} # Var_Delete 57 58 # expect+1: Unknown modifier ":unknown" 59 .if ${:Uvariable:unknown} 60 .endif 61 62 # expect+1: Variable "UNDEFINED" is undefined 63 .if ${UNDEFINED} 64 .endif 65 66 # By default, .SHELL is not defined and thus can be set. As soon as it is 67 # accessed, it is initialized in the command line scope (during VarFind), 68 # where it is set to read-only. Assigning to it is ignored. 69 # expect: Command: ignoring '.SHELL = overwritten' as it is read-only 70 .MAKEFLAGS: .SHELL=overwritten 71 72 DYN = ${:U$@} $@ ${@} 73 # expect: Global: DYN = $(.TARGET) $(.TARGET) ${@} 74 DYN := ${DYN} 75 76 .MAKEFLAGS: -d0 77