xref: /freebsd/contrib/bmake/unit-tests/varmod-sun-shell1.mk (revision c60f6422ffae3ea85e7b10bad950ad27c463af18)
1*c60f6422SSimon J. Gerraty# $NetBSD: varmod-sun-shell1.mk,v 1.1 2025/11/12 22:14:08 sjg Exp $
2*c60f6422SSimon J. Gerraty#
3*c60f6422SSimon J. Gerraty# Tests for the :sh1 variable modifier, which runs the shell command
4*c60f6422SSimon J. Gerraty# given by the variable value only on first reference and caches its output.
5*c60f6422SSimon J. Gerraty#
6*c60f6422SSimon J. Gerraty# This modifier has been added on 2025-11-11
7*c60f6422SSimon J. Gerraty#
8*c60f6422SSimon J. Gerraty# See also:
9*c60f6422SSimon J. Gerraty#	ApplyModifier_SunShell1
10*c60f6422SSimon J. Gerraty
11*c60f6422SSimon J. GerratyANSWER= echo 42; (exit 13)
12*c60f6422SSimon J. GerratyTHE_ANSWER= ${ANSWER:sh1}
13*c60f6422SSimon J. Gerraty
14*c60f6422SSimon J. Gerraty# first reference will warn
15*c60f6422SSimon J. Gerraty.MAKEFLAGS: -dv			# to see the "Capturing" debug output
16*c60f6422SSimon J. Gerraty# expect+1: warning: Command "echo 42; (exit 13)" exited with status 13
17*c60f6422SSimon J. Gerraty_:=	${THE_ANSWER}
18*c60f6422SSimon J. Gerraty.MAKEFLAGS: -d0
19*c60f6422SSimon J. Gerraty
20*c60f6422SSimon J. Gerraty# subsequent references will not, since we do not execute a command
21*c60f6422SSimon J. Gerraty.if ${THE_ANSWER} != "42"
22*c60f6422SSimon J. Gerraty.  error
23*c60f6422SSimon J. Gerraty.endif
24*c60f6422SSimon J. Gerraty
25*c60f6422SSimon J. Gerratyall:
26