2020-11-20 03:54:37 +00:00
|
|
|
# $NetBSD: cond-func-commands.mk,v 1.5 2020/11/15 14:07:53 rillig Exp $
|
2020-09-05 16:11:04 +00:00
|
|
|
#
|
|
|
|
# Tests for the commands() function in .if conditions.
|
|
|
|
|
|
|
|
.MAIN: all
|
|
|
|
|
2020-11-20 03:54:37 +00:00
|
|
|
# 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.
|
2020-09-05 16:11:04 +00:00
|
|
|
.if commands(target)
|
2020-11-07 19:39:21 +00:00
|
|
|
. error
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
target:
|
|
|
|
|
|
|
|
# Now the target exists, but it still has no commands.
|
|
|
|
.if commands(target)
|
2020-11-07 19:39:21 +00:00
|
|
|
. error
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
target:
|
|
|
|
# not a command
|
|
|
|
|
|
|
|
# Even after the comment, the target still has no commands.
|
|
|
|
.if commands(target)
|
2020-11-07 19:39:21 +00:00
|
|
|
. error
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
target:
|
|
|
|
@:;
|
|
|
|
|
|
|
|
# Finally the target has commands.
|
|
|
|
.if !commands(target)
|
2020-11-07 19:39:21 +00:00
|
|
|
. error
|
2020-09-05 16:11:04 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
all:
|
|
|
|
@:;
|