aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/cond-func-commands.mk
blob: d193587cd2c1eba022a788f297c69e8516262e14 (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
35
36
37
38
39
40
41
42
# $NetBSD: cond-func-commands.mk,v 1.6 2025/01/10 23:00:38 rillig Exp $
#
# Tests for the commands() function in .if conditions.

.MAIN: all

# At this point, the target 'target' does not exist yet, therefore it cannot
# have commands.  Sounds obvious, but good to know that it is really so.
.if commands(target)
.  error
.endif

target:

# Now the target exists, but it still has no commands.
.if commands(target)
.  error
.endif

target:
	# not a command

# Even after the comment, the target still has no commands.
.if commands(target)
.  error
.endif

target:
	@:;

# Finally the target has commands.
.if !commands(target)
.  error
.endif

# Expressions in the argument of a function call don't have to be defined.
.if commands(${UNDEF})
.  error
.endif

all:
	@:;