xref: /freebsd/contrib/bmake/unit-tests/cond-func-commands.mk (revision e2eeea75eb8b6dd50c1298067a0655880d186734)
1# $NetBSD: cond-func-commands.mk,v 1.5 2020/11/15 14:07:53 rillig Exp $
2#
3# Tests for the commands() function in .if conditions.
4
5.MAIN: all
6
7# At this point, the target 'target' does not exist yet, therefore it cannot
8# have commands.  Sounds obvious, but good to know that it is really so.
9.if commands(target)
10.  error
11.endif
12
13target:
14
15# Now the target exists, but it still has no commands.
16.if commands(target)
17.  error
18.endif
19
20target:
21	# not a command
22
23# Even after the comment, the target still has no commands.
24.if commands(target)
25.  error
26.endif
27
28target:
29	@:;
30
31# Finally the target has commands.
32.if !commands(target)
33.  error
34.endif
35
36all:
37	@:;
38