xref: /freebsd/contrib/bmake/unit-tests/cond-func-defined.mk (revision 2c3632d14fe37fa35c262ee9fb66835be0a52621)
1*2c3632d1SSimon J. Gerraty# $NetBSD: cond-func-defined.mk,v 1.3 2020/08/20 17:23:43 rillig Exp $
2*2c3632d1SSimon J. Gerraty#
3*2c3632d1SSimon J. Gerraty# Tests for the defined() function in .if conditions.
4*2c3632d1SSimon J. Gerraty
5*2c3632d1SSimon J. GerratyDEF=		defined
6*2c3632d1SSimon J. Gerraty${:UA B}=	variable name with spaces
7*2c3632d1SSimon J. Gerraty
8*2c3632d1SSimon J. Gerraty.if !defined(DEF)
9*2c3632d1SSimon J. Gerraty.error
10*2c3632d1SSimon J. Gerraty.endif
11*2c3632d1SSimon J. Gerraty
12*2c3632d1SSimon J. Gerraty# Horizontal whitespace after the opening parenthesis is ignored.
13*2c3632d1SSimon J. Gerraty.if !defined( 	DEF)
14*2c3632d1SSimon J. Gerraty.error
15*2c3632d1SSimon J. Gerraty.endif
16*2c3632d1SSimon J. Gerraty
17*2c3632d1SSimon J. Gerraty# Horizontal whitespace before the closing parenthesis is ignored.
18*2c3632d1SSimon J. Gerraty.if !defined(DEF 	)
19*2c3632d1SSimon J. Gerraty.error
20*2c3632d1SSimon J. Gerraty.endif
21*2c3632d1SSimon J. Gerraty
22*2c3632d1SSimon J. Gerraty# The argument of a function must not directly contain whitespace.
23*2c3632d1SSimon J. Gerraty.if !defined(A B)
24*2c3632d1SSimon J. Gerraty.error
25*2c3632d1SSimon J. Gerraty.endif
26*2c3632d1SSimon J. Gerraty
27*2c3632d1SSimon J. Gerraty# If necessary, the whitespace can be generated by a variable expression.
28*2c3632d1SSimon J. Gerraty.if !defined(${:UA B})
29*2c3632d1SSimon J. Gerraty.error
30*2c3632d1SSimon J. Gerraty.endif
31*2c3632d1SSimon J. Gerraty
32*2c3632d1SSimon J. Gerratyall:
33*2c3632d1SSimon J. Gerraty	@:;
34