aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/cond-token-var.mk
blob: 6e55bd2d552d40b10469d8fa17481469e35bfe8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# $NetBSD: cond-token-var.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
#
# Tests for variables in .if conditions.

DEF=	defined

# A defined variable may appear on either side of the comparison.
.if ${DEF} == ${DEF}
.  info ok
.else
.  error
.endif

# A variable that appears on the left-hand side must be defined.
.if ${UNDEF} == ${DEF}
.  error
.endif

# A variable that appears on the right-hand side must be defined.
.if ${DEF} == ${UNDEF}
.  error
.endif

# A defined variable may appear as an expression of its own.
.if ${DEF}
.endif

# An undefined variable generates a warning.
.if ${UNDEF}
.endif

# The :U modifier turns an undefined variable into an ordinary expression.
.if ${UNDEF:U}
.endif