sh-dots.mk revision 1.4 1 # $NetBSD: sh-dots.mk,v 1.4 2023/11/19 21:47:52 rillig Exp $
2 #
3 # Tests for the special shell command line "...", which does not run the
4 # commands below it but appends them to the list of commands that are run
5 # at the end.
6
7 .MAKEFLAGS: -d0 # switch stdout to being line-buffered
8
9 all: first hidden repeated commented indirect indirect-space
10
11 # The ${.TARGET} correctly expands to the target name, even though the
12 # commands are run separately from the main commands.
13 first:
14 @echo first ${.TARGET}
15 ...
16 @echo first delayed ${.TARGET}
17
18 # The dots cannot be prefixed by the usual @-+ characters.
19 # They must be written exactly as dots.
20 hidden: .IGNORE
21 @echo hidden ${.TARGET}
22 @...
23 @echo hidden delayed ${.TARGET}
24
25 # Since the shell command lines don't recognize '#' as comment character,
26 # the "..." is not interpreted specially here.
27 commented: .IGNORE
28 @echo commented ${.TARGET}
29 ... # Run the below commands later
30 @echo commented delayed ${.TARGET}
31
32 # The dots don't have to be written literally, they can also come from an
33 # expression.
34 indirect:
35 @echo indirect regular
36 ${:U...}
37 @echo indirect deferred
38
39 # If the dots are followed by a space, that space is part of the command and
40 # thus does not defer the command below it.
41 indirect-space: .IGNORE
42 @echo indirect-space regular
43 ${:U... }
44 @echo indirect-space deferred
45
46
47 # The "..." can appear more than once, even though that doesn't make sense.
48 # The second "..." is a no-op.
49 repeated: .IGNORE
50 @echo repeated ${.TARGET}
51 ...
52 @echo repeated delayed ${.TARGET}
53 ...
54 @echo repeated delayed twice ${.TARGET}
55