varmod-sun-shell1.mk revision 1.1
11.1Ssjg# $NetBSD: varmod-sun-shell1.mk,v 1.1 2025/11/12 22:14:08 sjg Exp $
21.1Ssjg#
31.1Ssjg# Tests for the :sh1 variable modifier, which runs the shell command
41.1Ssjg# given by the variable value only on first reference and caches its output.
51.1Ssjg#
61.1Ssjg# This modifier has been added on 2025-11-11
71.1Ssjg#
81.1Ssjg# See also:
91.1Ssjg#	ApplyModifier_SunShell1
101.1Ssjg
111.1SsjgANSWER= echo 42; (exit 13)
121.1SsjgTHE_ANSWER= ${ANSWER:sh1}
131.1Ssjg
141.1Ssjg# first reference will warn
151.1Ssjg.MAKEFLAGS: -dv			# to see the "Capturing" debug output
161.1Ssjg# expect+1: warning: Command "echo 42; (exit 13)" exited with status 13
171.1Ssjg_:=	${THE_ANSWER}
181.1Ssjg.MAKEFLAGS: -d0
191.1Ssjg
201.1Ssjg# subsequent references will not, since we do not execute a command
211.1Ssjg.if ${THE_ANSWER} != "42"
221.1Ssjg.  error
231.1Ssjg.endif
241.1Ssjg
251.1Ssjgall:
26