1 # $NetBSD: dir.mk,v 1.9 2021/01/23 10:48:49 rillig Exp $
5 .MAKEFLAGS: -m / # hide /usr/share/mk from the debug log
7 # Dependency lines may use braces for expansion.
8 # See DirExpandCurly for the implementation.
11 # XXX: The above dependency line is parsed as a single node named
12 # "{one,two,three}". There are no individual targets "one", "two", "three"
13 # yet. The node exists but is not a target since it never appeared
14 # on the left-hand side of a dependency operator. However, it is listed
15 # in .ALLTARGETS (which lists all nodes, not only targets).
19 .if target({one,two,three})
22 .if ${.ALLTARGETS:M{one,two,three}} != "{one,two,three}"
33 # The braces may start in the middle of a word.
43 # Nested braces work as expected since 2020-07-31 19:06 UTC.
44 # They had been broken at least since 2003-01-01, probably even longer.
45 all: {{thi,fou}r,fif}teen
54 # There may be multiple brace groups side by side.
55 all: {pre-,}{patch,configure}
57 pre-patch patch pre-configure configure:
60 # Empty pieces are allowed in the braces.
61 all: {fetch,extract}{,-post}
63 fetch fetch-post extract extract-post:
66 # The expansions may have duplicates.
67 # When the source of the dependency line is expanded later, each of the
68 # expanded words will be the same.
69 all: dup-{1,1,1,1,1,1,1}
74 # Other than in Bash, the braces are also expanded if there is no comma.
75 all: {{{{{{{{{{single-word}}}}}}}}}}
80 # Demonstrate debug logging for filename expansion, especially curly braces.
82 # The below line does not call SearchPath_Expand yet.
83 # It is expanded only when necessary, that is, when the 'debug' target is
85 debug: {{thi,fou}r,fif}twen
86 # Therefore, keep the debug logging active.
88 .PHONY: one two three four five six
89 .PHONY: thirteen fourteen fifteen
91 .PHONY: pre-patch patch pre-configure configure
92 .PHONY: fetch fetch-post extract extract-post
93 .PHONY: dup-1 single-word