1# $NetBSD: varname-make_stack_trace.mk,v 1.1 2025/06/13 03:51:18 rillig Exp $ 2# 3# Tests for the MAKE_STACK_TRACE environment variable, which controls whether 4# to print inter-process stack traces that are useful to narrow down where an 5# erroneous expression comes from. 6# 7# While inter-process stack traces are useful to narrow down errors, they are 8# disabled by default since the stack trace is stored in an environment 9# variable and a stack trace can grow large depending on the shell commands in 10# the sub-make processes. The space used for the stack traces would compete 11# with the space for the command line arguments, and long command lines are 12# already written to a temporary file by Cmd_Exec to not overwhelm this space. 13 14all: .PHONY 15 @${MAKE} -f ${MAKEFILE} disabled-compat || : 16 @${MAKE} -f ${MAKEFILE} -j1 disabled-parallel || : 17 @MAKE_STACK_TRACE=yes ${MAKE} -f ${MAKEFILE} enabled-compat || : 18 @MAKE_STACK_TRACE=yes ${MAKE} -f ${MAKEFILE} -j1 enabled-parallel || : 19 20# expect-not: in target "disabled-compat" 21disabled-compat: .PHONY 22 @${MAKE} -f ${MAKEFILE} provoke-error 23 24# expect-not: in target "disabled-parallel" 25disabled-parallel: .PHONY 26 @${MAKE} -f ${MAKEFILE} provoke-error 27 28# expect: in target "enabled-compat" 29enabled-compat: .PHONY 30 @${MAKE} -f ${MAKEFILE} provoke-error 31 32# expect: in target "enabled-parallel" 33enabled-parallel: .PHONY 34 @${MAKE} -f ${MAKEFILE} provoke-error 35 36provoke-error: .PHONY 37 @echo ${:Z} 38