]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/vardebug.mk
Update to bmake-20201101
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / vardebug.mk
1 # $NetBSD: vardebug.mk,v 1.6 2020/10/31 13:15:10 rillig Exp $
2 #
3 # Demonstrates the debugging output for var.c.
4
5 .MAKEFLAGS: -dv FROM_CMDLINE=
6
7 VAR=            added           # VarAdd
8 VAR=            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
16 FROM_CMDLINE=   overwritten     # Var_Set (ignored)
17
18 VAR=            1
19 VAR+=           2
20 VAR+=           3
21
22 .if ${VAR:M[2]}                 # ModifyWord_Match
23 .endif
24 .if ${VAR:N[2]}                 # ModifyWord_NoMatch (no debug output)
25 .endif
26
27 .if ${VAR:S,2,two,}             # ParseModifierPart
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
56 # By default, .SHELL is not defined and thus can be set.  As soon as it is
57 # accessed, it is initialized in the command line context (during VarFind),
58 # where it is set to read-only.  Assigning to it is ignored.
59 .MAKEFLAGS: .SHELL=overwritten
60
61 .MAKEFLAGS: -d0
62
63 all:
64         @: