Home | History | Annotate | Line # | Download | only in unit-tests
dep-var.mk revision 1.1
      1  1.1  rillig # $NetBSD: dep-var.mk,v 1.1 2020/08/22 16:51:26 rillig Exp $
      2  1.1  rillig #
      3  1.1  rillig # Tests for variable references in dependency declarations.
      4  1.1  rillig #
      5  1.1  rillig # Uh oh, this feels so strange that probably nobody uses it. But it seems to
      6  1.1  rillig # be the only way to reach the lower half of SuffExpandChildren.
      7  1.1  rillig 
      8  1.1  rillig # XXX: The -dv log says:
      9  1.1  rillig #	Var_Parse: ${UNDEF1} with VARE_UNDEFERR|VARE_WANTRES
     10  1.1  rillig # but no error message is generated for this line.
     11  1.1  rillig # The variable expression ${UNDEF1} simply expands to an empty string.
     12  1.1  rillig all: ${UNDEF1}
     13  1.1  rillig 
     14  1.1  rillig # Using a double dollar in order to circumvent immediate variable expansion
     15  1.1  rillig # feels like unintended behavior.  At least the manual page says nothing at
     16  1.1  rillig # all about defined or undefined variables in dependency lines.
     17  1.1  rillig #
     18  1.1  rillig # At the point where the expression ${DEF2} is expanded, the variable DEF2
     19  1.1  rillig # is defined, so everything's fine.
     20  1.1  rillig all: $${DEF2}
     21  1.1  rillig 
     22  1.1  rillig # This variable is not defined at all.
     23  1.1  rillig # XXX: The -dv log says:
     24  1.1  rillig #	Var_Parse: ${UNDEF3} with VARE_UNDEFERR|VARE_WANTRES
     25  1.1  rillig # but no error message is generated for this line, just like for UNDEF1.
     26  1.1  rillig # The variable expression ${UNDEF3} simply expands to an empty string.
     27  1.1  rillig all: $${UNDEF3}
     28  1.1  rillig 
     29  1.1  rillig UNDEF1=	undef1
     30  1.1  rillig DEF2=	def2
     31  1.1  rillig 
     32  1.1  rillig undef1 def2:
     33  1.1  rillig 	@echo ${.TARGET}
     34