xref: /freebsd/contrib/bmake/unit-tests/cond-func-target.mk (revision 6a7405f5a6b639682cacf01e35d561411ff556aa)
1# $NetBSD: cond-func-target.mk,v 1.5 2025/01/10 23:00:38 rillig Exp $
2#
3# Tests for the target() function in .if conditions.
4
5.MAIN: all
6
7# The target "target" does not exist yet.
8.if target(target)
9.  error
10.endif
11
12target:
13
14# The target exists, even though it does not have any commands.
15.if !target(target)
16.  error
17.endif
18
19target:
20	# not a command
21
22# Adding a comment to an existing target does not change whether the target
23# is defined or not.
24.if !target(target)
25.  error
26.endif
27
28target:
29	@:;
30
31# Adding a command to an existing target does not change whether the target
32# is defined or not.
33.if !target(target)
34.  error
35.endif
36
37# Expressions in the argument of a function call don't have to be defined.
38.if target(${UNDEF})
39.  error
40.endif
41
42all:
43	@:;
44