aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/varmod-shell.mk
blob: d449709cee0f4fb856726700d4a70ee397146488 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# $NetBSD: varmod-shell.mk,v 1.7 2022/01/10 20:32:29 rillig Exp $
#
# Tests for the ':!cmd!' variable modifier, which runs the shell command
# given by the variable modifier and returns its output.
#
# This modifier has been added on 2000-04-29.
#
# See also:
#	ApplyModifier_ShellCommand

# The command to be run is enclosed between exclamation marks.
# The previous value of the expression is irrelevant for this modifier.
# The :!cmd! modifier turns an undefined expression into a defined one.
.if ${:!echo word!} != "word"
.  error
.endif

# If the command exits with non-zero, an error message is printed.
# XXX: Processing continues as usual though.
#
# Between 2000-04-29 and 2020-11-17, the error message mentioned the previous
# value of the expression (which is usually an empty string) instead of the
# command that was executed.
.if ${:!echo word; false!} != "word"
.  error
.endif
.if ${:Uprevious value:!echo word; false!} != "word"
.  error
.endif


.MAKEFLAGS: -dv			# to see the actual command
_:=	${:!echo word; ${:Ufalse}!}
.MAKEFLAGS: -d0

all: