1 # $NetBSD: modts.mk,v 1.7 2020/10/24 08:50:17 rillig Exp $
6 FU_mod-ts= a / b / cool
11 all: mod-ts mod-ts-space
13 # Use print or printf iff they are builtin.
14 # XXX note that this causes problems, when make decides
15 # there is no need to use a shell, so avoid where possible.
16 .if ${(type print) 2> /dev/null || echo:L:sh:Mbuiltin} != ""
18 .elif ${(type printf) 2> /dev/null || echo:L:sh:Mbuiltin} != ""
25 @${PRINT} 'LIST:tx="${LIST:tx}"'
26 @${PRINT} 'LIST:ts/x:tu="${LIST:ts\X:tu}"'
27 @${PRINT} 'FU_$@="${FU_${@:ts}:ts}"'
28 @${PRINT} 'FU_$@:ts:T="${FU_${@:ts}:ts:T}" == cool?'
29 @${PRINT} 'B.$${AAA:ts}="${B.${AAA:ts}}" == Baaa?'
32 # After the :ts modifier, the whole string is interpreted as a single
33 # word since all spaces have been replaced with x.
34 @${PRINT} ':ts :S => '${aa bb aa bb aa bb:L:tsx:S,b,B,:Q}
36 # The :ts modifier also applies to word separators that are added
38 @${PRINT} ':ts :S space => '${a ababa c:L:tsx:S,b, ,g:Q}
39 @${PRINT} ':ts :S space :M => '${a ababa c:L:tsx:S,b, ,g:M*:Q}
41 # Not all modifiers behave this way though. Some of them always use
42 # a space as word separator instead of the :ts separator.
43 # This seems like an oversight during implementation.
44 @${PRINT} ':ts :S => '${a ababa c:L:tsx:S,b, ,g:Q}
45 @${PRINT} ':ts :S :@ => '${a ababa c:L:tsx:S,b, ,g:@v@${v}@:Q}
47 # A final :M* modifier applies the :ts separator again, though.
48 @${PRINT} ':ts :S :@ :M => '${a ababa c:L:tsx:S,b, ,g:@v@${v}@:M*:Q}