xref: /freebsd/contrib/bmake/unit-tests/varname-dot-shell.mk (revision f7c32ed617858bcd22f8d1b03199099d50125721)
1# $NetBSD: varname-dot-shell.mk,v 1.7 2021/02/04 21:42:47 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 scope,
26# but in the command-line scope.
27.undef .SHELL
28.SHELL=		newly overwritten
29.if ${.SHELL} != ${ORIG_SHELL}
30.  error
31.endif
32
33.MAKEFLAGS: -d0
34
35all:
36	@:;
37