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