1 1.4 rillig # $NetBSD: varname-make_print_var_on_error-jobs.mk,v 1.4 2023/11/19 22:32:44 rillig Exp $ 2 1.1 rillig # 3 1.1 rillig # Tests for the special MAKE_PRINT_VAR_ON_ERROR variable, which prints the 4 1.1 rillig # values of selected variables on error. 5 1.1 rillig # 6 1.4 rillig # The variable .ERROR_CMD contains all commands of the target, with 7 1.1 rillig # expressions expanded, just as they were printed to the shell command file. 8 1.1 rillig # 9 1.1 rillig # The commands in .ERROR_CMD are space-separated. Since each command usually 10 1.1 rillig # contains spaces as well, this value is only intended as a first hint to what 11 1.1 rillig # happened. For more details, use the debug options -de, -dj, -dl, -dn, -dx. 12 1.2 rillig # 13 1.2 rillig # See also: 14 1.2 rillig # compat-error.mk 15 1.2 rillig 16 1.3 rillig # XXX: As of 2021-02-04, PrintOnError calls Var_Subst with SCOPE_GLOBAL, which 17 1.2 rillig # does not expand the node-local variables like .TARGET. This results in the 18 1.2 rillig # double '${.TARGET}' in the output. 19 1.1 rillig 20 1.1 rillig # As of 2020-10-23, .ERROR_CMD only works in parallel mode. 21 1.1 rillig .MAKEFLAGS: -j1 22 1.1 rillig 23 1.1 rillig MAKE_PRINT_VAR_ON_ERROR= .ERROR_TARGET .ERROR_CMD 24 1.1 rillig 25 1.1 rillig all: 26 1.2 rillig @: before '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}' 27 1.2 rillig echo fail ${.TARGET}; false '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}' 28 1.2 rillig @: after '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}' 29