1# $NetBSD: cond-func-exists.mk,v 1.8 2025/01/10 23:00:38 rillig Exp $ 2# 3# Tests for the exists() function in .if conditions. 4 5.if !exists(.) 6. error 7.endif 8 9# The argument to the function must not be enclosed in quotes. 10# Neither double quotes nor single quotes are allowed. 11.if exists(".") 12. error 13.endif 14 15.if exists('.') 16. error 17.endif 18 19# The only way to escape characters that would otherwise influence the parser 20# is to enclose them in an expression. For function arguments, 21# neither the backslash nor the dollar sign act as escape character. 22.if exists(\.) 23. error 24.endif 25 26.if !exists(${:U.}) 27. error 28.endif 29 30# The argument to the function can have several expressions. 31# See cond-func.mk for the characters that cannot be used directly. 32.if !exists(${.PARSEDIR}/${.PARSEFILE}) 33. error 34.endif 35 36# Whitespace is trimmed on both sides of the function argument. 37.if !exists( . ) 38. error 39.endif 40 41# Expressions in the argument of a function call don't have to be defined. 42.if exists(${UNDEF}) 43. error 44.endif 45 46# The exists function does not really look up the file in the file system, 47# instead it uses a cache that is preloaded very early, before parsing the 48# first makefile. At that time, the file did not exist yet. 49_!= > cond-func-exists.just-created 50.if exists(cond-func-exists.just-created) 51. error 52.endif 53_!= rm cond-func-exists.just-created 54 55all: 56 @:; 57