2021-02-11 01:51:11 +00:00
|
|
|
# $NetBSD: varname-dot-shell.mk,v 1.7 2021/02/04 21:42:47 rillig Exp $
|
2020-09-05 16:11:04 +00:00
|
|
|
#
|
|
|
|
# Tests for the special .SHELL variable, which contains the shell used for
|
|
|
|
# running the commands.
|
|
|
|
#
|
|
|
|
# This variable is read-only.
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
.MAKEFLAGS: -dcpv
|
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
ORIG_SHELL:= ${.SHELL}
|
|
|
|
|
|
|
|
.SHELL= overwritten
|
|
|
|
.if ${.SHELL} != ${ORIG_SHELL}
|
2020-11-07 19:39:21 +00:00
|
|
|
. error
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# Trying to append to the variable.
|
|
|
|
# Since 2020-10-30 this is prevented.
|
|
|
|
.MAKEFLAGS: .SHELL+=appended
|
|
|
|
.if ${.SHELL} != ${ORIG_SHELL}
|
|
|
|
. error
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
# Trying to delete the variable.
|
2021-02-11 01:51:11 +00:00
|
|
|
# This has no effect since the variable is not defined in the global scope,
|
|
|
|
# but in the command-line scope.
|
2020-09-05 16:11:04 +00:00
|
|
|
.undef .SHELL
|
|
|
|
.SHELL= newly overwritten
|
|
|
|
.if ${.SHELL} != ${ORIG_SHELL}
|
2020-11-07 19:39:21 +00:00
|
|
|
. error
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
.MAKEFLAGS: -d0
|
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
all:
|
2020-11-07 19:39:21 +00:00
|
|
|
@:;
|