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