xref: /freebsd/contrib/bmake/unit-tests/varname-make_print_var_on_error.mk (revision 06b9b3e0ad0dc3f0166b3e8f26ced68c271cf527)
1# $NetBSD: varname-make_print_var_on_error.mk,v 1.5 2020/12/13 19:08:20 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 2020-12-13, PrintOnError calls Var_Subst with VAR_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