1# $NetBSD: cond-func-exists.mk,v 1.6 2020/11/30 20:12:29 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 a variable 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 variable 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# The exists function does not really look up the file in the file system,
42# instead it uses a cache that is preloaded very early, before parsing the
43# first makefile.  At that time, the file did not exist yet.
44_!=	> cond-func-exists.just-created
45.if exists(cond-func-exists.just-created)
46.  error
47.endif
48_!=	rm cond-func-exists.just-created
49
50all:
51	@:;
52