xref: /freebsd/contrib/bmake/unit-tests/shell-csh.mk (revision b0c40a00a67f611868fc0f10bde6b28eb75931be)
1*b0c40a00SSimon J. Gerraty# $NetBSD: shell-csh.mk,v 1.8 2021/04/04 09:58:51 rillig Exp $
2956e45f6SSimon J. Gerraty#
3956e45f6SSimon J. Gerraty# Tests for using a C shell for running the commands.
4956e45f6SSimon J. Gerraty
506b9b3e0SSimon J. GerratyCSH!=	which csh 2> /dev/null || true
6956e45f6SSimon J. Gerraty
7956e45f6SSimon J. Gerraty# The shell path must be an absolute path.
8956e45f6SSimon J. Gerraty# This is only obvious in parallel mode since in compat mode,
9956e45f6SSimon J. Gerraty# simple commands are executed via execve directly.
10956e45f6SSimon J. Gerraty.if ${CSH} != ""
11956e45f6SSimon J. Gerraty.SHELL: name="csh" path="${CSH}"
12956e45f6SSimon J. Gerraty.endif
13956e45f6SSimon J. Gerraty
1406b9b3e0SSimon J. Gerraty# In parallel mode, the shell->noPrint command is filtered from
15*b0c40a00SSimon J. Gerraty# the output, rather naively (in PrintOutput).
16956e45f6SSimon J. Gerraty#
17956e45f6SSimon J. Gerraty# Until 2020-10-03, the output in parallel mode was garbled because
18956e45f6SSimon J. Gerraty# the definition of the csh had been wrong since 1993 at least.
19956e45f6SSimon J. Gerraty.MAKEFLAGS: -j1
20956e45f6SSimon J. Gerraty
21956e45f6SSimon J. Gerratyall:
22956e45f6SSimon J. Gerraty.if ${CSH} != ""
23956e45f6SSimon J. Gerraty	# This command is both printed and executed.
24956e45f6SSimon J. Gerraty	echo normal
25956e45f6SSimon J. Gerraty
26956e45f6SSimon J. Gerraty	# This command is only executed.
27956e45f6SSimon J. Gerraty	@echo hidden
28956e45f6SSimon J. Gerraty
29956e45f6SSimon J. Gerraty	# This command is both printed and executed.
30956e45f6SSimon J. Gerraty	+echo always
31956e45f6SSimon J. Gerraty
32956e45f6SSimon J. Gerraty	# This command is both printed and executed.
33956e45f6SSimon J. Gerraty	-echo ignore errors
34956e45f6SSimon J. Gerraty
35956e45f6SSimon J. Gerraty	# In the C shell, "unset verbose" is set as the noPrint command.
36956e45f6SSimon J. Gerraty	# Therefore it is filtered from the output, rather naively.
37956e45f6SSimon J. Gerraty	@echo 'They chatted in the sunset verbosely.'
38956e45f6SSimon J. Gerraty.else
39956e45f6SSimon J. Gerraty	@sed '$$d' ${MAKEFILE:.mk=.exp}	# This is cheated.
40956e45f6SSimon J. Gerraty.endif
41