xref: /freebsd/contrib/bmake/unit-tests/depsrc.mk (revision 00698711dee1d990d3db9c41bf58394e589eecfe)
1# $NetBSD: depsrc.mk,v 1.5 2021/12/13 23:38:54 rillig Exp $
2#
3# Tests for special sources (those starting with a dot, followed by
4# uppercase letters) in dependency declarations, such as '.PHONY'.
5
6# TODO: Implementation
7
8# TODO: Test 'target: ${:U.SILENT}'
9
10# Demonstrate when exactly undefined variables are expanded in a dependency
11# declaration.
12target: .PHONY source-${DEFINED_LATER}
13#
14DEFINED_LATER=	later
15#
16source-: .PHONY
17	# This section applies.
18	: 'Undefined variables are expanded directly in the dependency'
19	: 'declaration.  They are not preserved and maybe expanded later.'
20	: 'This is in contrast to local variables such as $${.TARGET}.'
21source-later: .PHONY
22	# This section doesn't apply.
23	: 'Undefined variables are tried to be expanded in a dependency'
24	: 'declaration.  If that fails because the variable is undefined,'
25	: 'the expression is preserved and tried to be expanded later.'
26
27# Sources that look like keywords but are not known are interpreted as
28# ordinary sources.
29target: .UNKNOWN
30
31.UNKNOWN:
32	: Making ${.TARGET} from ${.ALLSRC:S,^$,nothing,W}.
33