aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/directive-ifdef.mk
blob: 12f3648e8b2c3c42e70ccb604f88430214a26f52 (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
# $NetBSD: directive-ifdef.mk,v 1.4 2021/01/21 23:03:41 rillig Exp $
#
# Tests for the .ifdef directive.

# TODO: Implementation

DEFINED=	defined

# It looks redundant to have a call to defined() in an .ifdef, but it's
# possible.  The .ifdef only affects plain symbols, not function calls.
.ifdef defined(DEFINED)
.  info Function calls in .ifdef are possible.
.else
.  error
.endif

# String literals are handled the same in all variants of the .if directive.
# They evaluate to true if they are not empty.  Whitespace counts as non-empty
# as well.
.ifdef ""
.  error
.else
.  info String literals are tested for emptiness.
.endif

.ifdef " "
.  info String literals are tested for emptiness.  Whitespace is non-empty.
.else
.  error
.endif

all:
	@:;