1 # $NetBSD: sh-dots.mk,v 1.3 2020/10/25 22:04:24 rillig Exp $
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
7 .MAKEFLAGS: -d0 # switch stdout to being line-buffered
9 all: first hidden repeated commented indirect indirect-space
11 # The ${.TARGET} correctly expands to the target name, even though the
12 # commands are run separately from the main commands.
14 @echo first ${.TARGET}
16 @echo first delayed ${.TARGET}
18 # The dots cannot be prefixed by the usual @-+ characters.
19 # They must be written exactly as dots.
21 @echo hidden ${.TARGET}
23 @echo hidden delayed ${.TARGET}
25 # Since the shell command lines don't recognize '#' as comment character,
26 # the "..." is not interpreted specially here.
28 @echo commented ${.TARGET}
29 ... # Run the below commands later
30 @echo commented delayed ${.TARGET}
32 # The dots don't have to be written literally, they can also come from a
33 # variable expression.
35 @echo indirect regular
37 @echo indirect deferred
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
44 @echo indirect-space deferred
47 # The "..." can appear more than once, even though that doesn't make sense.
48 # The second "..." is a no-op.
50 @echo repeated ${.TARGET}
52 @echo repeated delayed ${.TARGET}
54 @echo repeated delayed twice ${.TARGET}