xref: /freebsd/contrib/bmake/unit-tests/varname-dot-shell.mk (revision 36d6566e5985030fd2f1100bd9c1387bbe0bd290)
1# $NetBSD: varname-dot-shell.mk,v 1.6 2020/10/30 16:09:56 rillig Exp $
2#
3# Tests for the special .SHELL variable, which contains the shell used for
4# running the commands.
5#
6# This variable is read-only.
7
8.MAKEFLAGS: -dcpv
9
10ORIG_SHELL:=	${.SHELL}
11
12.SHELL=		overwritten
13.if ${.SHELL} != ${ORIG_SHELL}
14.  error
15.endif
16
17# Trying to append to the variable.
18# Since 2020-10-30 this is prevented.
19.MAKEFLAGS: .SHELL+=appended
20.if ${.SHELL} != ${ORIG_SHELL}
21.  error
22.endif
23
24# Trying to delete the variable.
25# This has no effect since the variable is not defined in the global context,
26# but in the command-line context.
27.undef .SHELL
28.SHELL=		newly overwritten
29.if ${.SHELL} != ${ORIG_SHELL}
30.  error
31.endif
32
33.MAKEFLAGS: -d0
34
35all:
36	@:;
37