xref: /freebsd/contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.mk (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1# $NetBSD: varname-make_print_var_on_error-jobs.mk,v 1.3 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# The variable .ERROR_CMD contains all commands of the target, with variable
7# expressions expanded, just as they were printed to the shell command file.
8#
9# The commands in .ERROR_CMD are space-separated.  Since each command usually
10# contains spaces as well, this value is only intended as a first hint to what
11# happened.  For more details, use the debug options -de, -dj, -dl, -dn, -dx.
12#
13# See also:
14#	compat-error.mk
15
16# XXX: As of 2021-02-04, PrintOnError calls Var_Subst with SCOPE_GLOBAL, which
17# does not expand the node-local variables like .TARGET.  This results in the
18# double '${.TARGET}' in the output.
19
20# As of 2020-10-23, .ERROR_CMD only works in parallel mode.
21.MAKEFLAGS: -j1
22
23MAKE_PRINT_VAR_ON_ERROR=	.ERROR_TARGET .ERROR_CMD
24
25all:
26	@: before '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
27	echo fail ${.TARGET}; false '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
28	@: after '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
29