Home | History | Annotate | Line # | Download | only in unit-tests
opt-debug-var.mk revision 1.4
      1 # $NetBSD: opt-debug-var.mk,v 1.4 2025/01/10 23:00:38 rillig Exp $
      2 #
      3 # Tests for the -dv command line option, which adds debug logging about
      4 # variable assignment and evaluation.
      5 
      6 .MAKEFLAGS: -dv
      7 
      8 # expect: Global: ASSIGNED = value
      9 ASSIGNED=	value
     10 
     11 # TODO: Explain why the empty assignment "Global: SUBST = " is needed.
     12 # expect: Global: SUBST = # (empty)
     13 # expect: Global: SUBST = value
     14 SUBST:=		value
     15 
     16 .if defined(ASSIGNED)
     17 .endif
     18 
     19 # The usual form of expressions is ${VAR}.  The form $(VAR) is used
     20 # less often as it can be visually confused with the shell construct for
     21 # capturing the output of a subshell, which looks the same.
     22 #
     23 # In conditions, a call to the function 'empty' is syntactically similar to
     24 # the form $(VAR), only that the initial '$' is the 'y' of 'empty'.
     25 #
     26 # expect: Var_Parse: y(ASSIGNED) (eval)
     27 .if !empty(ASSIGNED)
     28 .endif
     29 
     30 
     31 # An expression for a variable with a single-character ordinary name.
     32 # expect: Var_Parse: $U (eval-defined)
     33 # FIXME: Replace "Malformed" with "Undefined variable".
     34 # expect+1: Malformed conditional '$U'
     35 .if $U
     36 .endif
     37 
     38 # An expression for a target-specific variable with a single-character name.
     39 # expect: Var_Parse: $< (eval-defined)
     40 # FIXME: Replace "Malformed" with "Undefined variable".
     41 # expect+1: Malformed conditional '$<'
     42 .if $<
     43 .endif
     44 
     45 
     46 .MAKEFLAGS: -d0
     47