1# $NetBSD: varmod-defined.mk,v 1.3 2020/08/25 21:58:08 rillig Exp $ 2# 3# Tests for the :D variable modifier, which returns the given string 4# if the variable is defined. It is closely related to the :U modifier. 5 6DEF= defined 7.undef UNDEF 8 9# Since DEF is defined, the value of the expression is "value", not 10# "defined". 11# 12.if ${DEF:Dvalue} != "value" 13.error 14.endif 15 16# Since UNDEF is not defined, the "value" is ignored. Instead of leaving the 17# expression undefined, it is set to "", exactly to allow the expression to 18# be used in .if conditions. In this place, other undefined expressions 19# would generate an error message. 20# XXX: Ideally the error message would be "undefined variable", but as of 21# 2020-08-25 it is "Malformed conditional". 22# 23.if ${UNDEF:Dvalue} != "" 24.error 25.endif 26 27all: 28 @:; 29