xref: /freebsd/contrib/bmake/unit-tests/varname-make_print_var_on_error.mk (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1# $NetBSD: varname-make_print_var_on_error.mk,v 1.6 2021/02/04 21:33:14 rillig Exp $
2#
3# Tests for the special MAKE_PRINT_VAR_ON_ERROR variable, which prints the
4# values of selected variables on error.
5
6# XXX: As of 2020-10-23, the .ERROR_CMD variable is pointless in compat mode
7# since at the point where it is filled in PrintOnError, the first command in
8# gn->commands has been set to NULL already.  This leaves .ERROR_CMD an empty
9# list.
10#
11# See also:
12#	compat-error.mk
13
14# XXX: As of 2021-02-04, PrintOnError calls Var_Subst with SCOPE_GLOBAL, which
15# does not expand the node-local variables like .TARGET.  This results in the
16# double '${.TARGET}' in the output.
17
18MAKE_PRINT_VAR_ON_ERROR=	.ERROR_TARGET .ERROR_CMD
19
20all:
21	@: before '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
22	echo fail ${.TARGET}; false '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
23	@: after '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
24