1# $NetBSD: cond-func-defined.mk,v 1.7 2020/11/15 14:07:53 rillig Exp $ 2# 3# Tests for the defined() function in .if conditions. 4 5DEF= defined 6${:UA B}= variable name with spaces 7 8.if !defined(DEF) 9. error 10.endif 11 12# Horizontal whitespace (space tab) after the opening parenthesis is ignored. 13.if !defined( DEF) 14. error 15.endif 16 17# Horizontal whitespace (space tab) before the closing parenthesis is ignored. 18.if !defined(DEF ) 19. error 20.endif 21 22# The argument of a function must not directly contain whitespace. 23.if !defined(A B) 24. error 25.endif 26 27# If necessary, the whitespace can be generated by a variable expression. 28.if !defined(${:UA B}) 29. error 30.endif 31 32# Parse error: missing closing parenthesis; see ParseFuncArg. 33.if defined(DEF 34. error 35.else 36. error 37.endif 38 39# Variables from .for loops are not defined. 40# See directive-for.mk for more details. 41.for var in value 42. if defined(var) 43. error 44. else 45. info In .for loops, variable expressions for the loop variables are 46. info substituted at evaluation time. There is no actual variable 47. info involved, even if it feels like it. 48. endif 49.endfor 50 51all: 52 @:; 53