varname-empty.mk revision 1.1
1# $NetBSD: varname-empty.mk,v 1.1 2020/08/22 20:23:14 rillig Exp $
2#
3# Tests for the special variable with the empty name.
4#
5# The variable "" is not supposed to be assigned any value.
6# This is because it is heavily used in the .for loop expansion,
7# as well as to generate arbitrary strings, as in ${:Ufallback}.
8
9# Oops.
10!=	echo 'value'
11
12# The .for loop expands the expression ${i} to ${:U1}, ${:U2} and so on.
13# This only works if the variable with the empty name is guaranteed to
14# be undefined.
15.for i in 1 2 3
16NUMBERS+=	${i}
17.endfor
18
19all:
20	@echo ${:Ufallback}
21	@echo ${NUMBERS}
22