Home | History | Annotate | Line # | Download | only in unit-tests
      1 # $NetBSD: opt-debug-var.mk,v 1.5 2025/01/11 21:21:33 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-loud)
     33 # expect+1: Variable "U" is undefined
     34 .if $U
     35 .endif
     36 
     37 # An expression for a target-specific variable with a single-character name.
     38 # expect: Var_Parse: $< (eval-defined-loud)
     39 # expect+1: Variable "<" is undefined
     40 .if $<
     41 .endif
     42 
     43 
     44 .MAKEFLAGS: -d0
     45