xref: /freebsd/contrib/bmake/unit-tests/varname-make_print_var_on_error.mk (revision dba7b0ef928af88caa38728a73657b837aeeac93)
1*dba7b0efSSimon J. Gerraty# $NetBSD: varname-make_print_var_on_error.mk,v 1.6 2021/02/04 21:33:14 rillig Exp $
22c3632d1SSimon J. Gerraty#
3956e45f6SSimon J. Gerraty# Tests for the special MAKE_PRINT_VAR_ON_ERROR variable, which prints the
4956e45f6SSimon J. Gerraty# values of selected variables on error.
52c3632d1SSimon J. Gerraty
6956e45f6SSimon J. Gerraty# XXX: As of 2020-10-23, the .ERROR_CMD variable is pointless in compat mode
7956e45f6SSimon J. Gerraty# since at the point where it is filled in PrintOnError, the first command in
8956e45f6SSimon J. Gerraty# gn->commands has been set to NULL already.  This leaves .ERROR_CMD an empty
9956e45f6SSimon J. Gerraty# list.
1006b9b3e0SSimon J. Gerraty#
1106b9b3e0SSimon J. Gerraty# See also:
1206b9b3e0SSimon J. Gerraty#	compat-error.mk
1306b9b3e0SSimon J. Gerraty
14*dba7b0efSSimon J. Gerraty# XXX: As of 2021-02-04, PrintOnError calls Var_Subst with SCOPE_GLOBAL, which
1506b9b3e0SSimon J. Gerraty# does not expand the node-local variables like .TARGET.  This results in the
1606b9b3e0SSimon J. Gerraty# double '${.TARGET}' in the output.
17956e45f6SSimon J. Gerraty
18956e45f6SSimon J. GerratyMAKE_PRINT_VAR_ON_ERROR=	.ERROR_TARGET .ERROR_CMD
192c3632d1SSimon J. Gerraty
202c3632d1SSimon J. Gerratyall:
2106b9b3e0SSimon J. Gerraty	@: before '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
2206b9b3e0SSimon J. Gerraty	echo fail ${.TARGET}; false '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
2306b9b3e0SSimon J. Gerraty	@: after '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
24