xref: /freebsd/contrib/bmake/unit-tests/varname-dot-shell.mk (revision dba7b0ef928af88caa38728a73657b837aeeac93)
1*dba7b0efSSimon J. Gerraty# $NetBSD: varname-dot-shell.mk,v 1.7 2021/02/04 21:42:47 rillig Exp $
22c3632d1SSimon J. Gerraty#
32c3632d1SSimon J. Gerraty# Tests for the special .SHELL variable, which contains the shell used for
42c3632d1SSimon J. Gerraty# running the commands.
52c3632d1SSimon J. Gerraty#
62c3632d1SSimon J. Gerraty# This variable is read-only.
72c3632d1SSimon J. Gerraty
8956e45f6SSimon J. Gerraty.MAKEFLAGS: -dcpv
9956e45f6SSimon J. Gerraty
102c3632d1SSimon J. GerratyORIG_SHELL:=	${.SHELL}
112c3632d1SSimon J. Gerraty
122c3632d1SSimon J. Gerraty.SHELL=		overwritten
132c3632d1SSimon J. Gerraty.if ${.SHELL} != ${ORIG_SHELL}
142c3632d1SSimon J. Gerraty.  error
152c3632d1SSimon J. Gerraty.endif
162c3632d1SSimon J. Gerraty
17956e45f6SSimon J. Gerraty# Trying to append to the variable.
18956e45f6SSimon J. Gerraty# Since 2020-10-30 this is prevented.
19956e45f6SSimon J. Gerraty.MAKEFLAGS: .SHELL+=appended
20956e45f6SSimon J. Gerraty.if ${.SHELL} != ${ORIG_SHELL}
21956e45f6SSimon J. Gerraty.  error
22956e45f6SSimon J. Gerraty.endif
23956e45f6SSimon J. Gerraty
242c3632d1SSimon J. Gerraty# Trying to delete the variable.
25*dba7b0efSSimon J. Gerraty# This has no effect since the variable is not defined in the global scope,
26*dba7b0efSSimon J. Gerraty# but in the command-line scope.
272c3632d1SSimon J. Gerraty.undef .SHELL
282c3632d1SSimon J. Gerraty.SHELL=		newly overwritten
292c3632d1SSimon J. Gerraty.if ${.SHELL} != ${ORIG_SHELL}
302c3632d1SSimon J. Gerraty.  error
312c3632d1SSimon J. Gerraty.endif
322c3632d1SSimon J. Gerraty
33956e45f6SSimon J. Gerraty.MAKEFLAGS: -d0
34956e45f6SSimon J. Gerraty
352c3632d1SSimon J. Gerratyall:
36956e45f6SSimon J. Gerraty	@:;
37