1*dba15655Srillig# $NetBSD: varmod-shell.mk,v 1.7 2022/01/10 20:32:29 rillig Exp $ 21fb97e4bSrillig# 31d3d5a74Srillig# Tests for the ':!cmd!' variable modifier, which runs the shell command 41d3d5a74Srillig# given by the variable modifier and returns its output. 5e43bb48dSrillig# 6fdde8306Srillig# This modifier has been added on 2000-04-29. 7fdde8306Srillig# 8fdde8306Srillig# See also: 9fdde8306Srillig# ApplyModifier_ShellCommand 101fb97e4bSrillig 11fdde8306Srillig# The command to be run is enclosed between exclamation marks. 12fdde8306Srillig# The previous value of the expression is irrelevant for this modifier. 13fdde8306Srillig# The :!cmd! modifier turns an undefined expression into a defined one. 14fdde8306Srillig.if ${:!echo word!} != "word" 15fdde8306Srillig. error 16fdde8306Srillig.endif 17fdde8306Srillig 18fdde8306Srillig# If the command exits with non-zero, an error message is printed. 19fdde8306Srillig# XXX: Processing continues as usual though. 20fdde8306Srillig# 21fced1acdSrillig# Between 2000-04-29 and 2020-11-17, the error message mentioned the previous 22fdde8306Srillig# value of the expression (which is usually an empty string) instead of the 23*dba15655Srillig# command that was executed. 24fdde8306Srillig.if ${:!echo word; false!} != "word" 25fdde8306Srillig. error 26fdde8306Srillig.endif 27fdde8306Srillig.if ${:Uprevious value:!echo word; false!} != "word" 28fdde8306Srillig. error 29fdde8306Srillig.endif 30fdde8306Srillig 31*dba15655Srillig 32*dba15655Srillig.MAKEFLAGS: -dv # to see the actual command 33*dba15655Srillig_:= ${:!echo word; ${:Ufalse}!} 34*dba15655Srillig.MAKEFLAGS: -d0 35*dba15655Srillig 361fb97e4bSrilligall: 37