Home | History | Annotate | Line # | Download | only in unit-tests
opt-debug-var.mk revision 1.3
      1  1.3  rillig # $NetBSD: opt-debug-var.mk,v 1.3 2023/11/19 21:47:52 rillig Exp $
      2  1.1  rillig #
      3  1.1  rillig # Tests for the -dv command line option, which adds debug logging about
      4  1.1  rillig # variable assignment and evaluation.
      5  1.1  rillig 
      6  1.2  rillig .MAKEFLAGS: -dv
      7  1.1  rillig 
      8  1.2  rillig # expect: Global: ASSIGNED = value
      9  1.2  rillig ASSIGNED=	value
     10  1.2  rillig 
     11  1.2  rillig # TODO: Explain why the empty assignment "Global: SUBST = " is needed.
     12  1.2  rillig # expect: Global: SUBST = value
     13  1.2  rillig SUBST:=		value
     14  1.2  rillig 
     15  1.2  rillig .if defined(ASSIGNED)
     16  1.2  rillig .endif
     17  1.2  rillig 
     18  1.3  rillig # The usual form of expressions is ${VAR}.  The form $(VAR) is used
     19  1.2  rillig # less often as it can be visually confused with the shell construct for
     20  1.2  rillig # capturing the output of a subshell, which looks the same.
     21  1.2  rillig #
     22  1.2  rillig # In conditions, a call to the function 'empty' is syntactically similar to
     23  1.2  rillig # the form $(VAR), only that the initial '$' is the 'y' of 'empty'.
     24  1.2  rillig #
     25  1.2  rillig # expect: Var_Parse: y(ASSIGNED) (eval)
     26  1.2  rillig .if !empty(ASSIGNED)
     27  1.2  rillig .endif
     28  1.2  rillig 
     29  1.2  rillig .MAKEFLAGS: -d0
     30  1.2  rillig 
     31  1.2  rillig all: .PHONY
     32