xref: /src/contrib/bmake/unit-tests/shell-ksh.mk (revision 0b46a53a2f50b5ab0f4598104119a049b9c42cc9)
14f8f2bc2SSimon J. Gerraty# $NetBSD: shell-ksh.mk,v 1.2 2025/06/05 21:56:54 rillig Exp $
2302da1a3SSimon J. Gerraty#
34f8f2bc2SSimon J. Gerraty# Tests for using a Korn shell for running the commands.
4302da1a3SSimon J. Gerraty
54f8f2bc2SSimon J. GerratyKSH!=	which ksh 2> /dev/null || true
64f8f2bc2SSimon J. Gerraty
74f8f2bc2SSimon J. Gerraty# The shell path must be an absolute path.
84f8f2bc2SSimon J. Gerraty# This is only obvious in parallel mode since in compat mode,
94f8f2bc2SSimon J. Gerraty# simple commands are executed via execvp directly.
104f8f2bc2SSimon J. Gerraty.if ${KSH} != ""
114f8f2bc2SSimon J. Gerraty.SHELL: name="ksh" path="${KSH}"
124f8f2bc2SSimon J. Gerraty.endif
134f8f2bc2SSimon J. Gerraty
144f8f2bc2SSimon J. Gerraty# In parallel mode, the shell->noPrint command is filtered from
154f8f2bc2SSimon J. Gerraty# the output, rather naively (in PrintOutput).
164f8f2bc2SSimon J. Gerraty.MAKEFLAGS: -j1
17302da1a3SSimon J. Gerraty
18302da1a3SSimon J. Gerratyall:
194f8f2bc2SSimon J. Gerraty.if ${KSH} != ""
204f8f2bc2SSimon J. Gerraty	# This command is both printed and executed.
214f8f2bc2SSimon J. Gerraty	echo normal
224f8f2bc2SSimon J. Gerraty
234f8f2bc2SSimon J. Gerraty	# This command is only executed.
244f8f2bc2SSimon J. Gerraty	@echo hidden
254f8f2bc2SSimon J. Gerraty
264f8f2bc2SSimon J. Gerraty	# This command is both printed and executed.
274f8f2bc2SSimon J. Gerraty	+echo always
284f8f2bc2SSimon J. Gerraty
294f8f2bc2SSimon J. Gerraty	# This command is both printed and executed.
304f8f2bc2SSimon J. Gerraty	-echo ignore errors
314f8f2bc2SSimon J. Gerraty
324f8f2bc2SSimon J. Gerraty	# In the Korn shell, "set +v" is set as the noPrint command.
334f8f2bc2SSimon J. Gerraty	# Therefore, it is filtered from the output, rather naively.
344f8f2bc2SSimon J. Gerraty# FIXME: Don't assume a newline character in PrintFilteredOutput.
354f8f2bc2SSimon J. Gerraty# expect: The "is filtered out.
364f8f2bc2SSimon J. Gerraty	@echo 'The "set +v" is filtered out.'
374f8f2bc2SSimon J. Gerraty.else
384f8f2bc2SSimon J. Gerraty	@sed '$$d' ${MAKEFILE:.mk=.exp}	# This is cheated.
394f8f2bc2SSimon J. Gerraty.endif
40