cmd-errors-jobs.mk revision 1.3 1 # $NetBSD: cmd-errors-jobs.mk,v 1.3 2024/04/20 10:18:55 rillig Exp $
2 #
3 # Demonstrate how errors in variable expansions affect whether the commands
4 # are actually executed in jobs mode.
5
6 .MAKEFLAGS: -j1
7
8 all: undefined unclosed-variable unclosed-modifier unknown-modifier end
9
10 # Undefined variables are not an error. They expand to empty strings.
11 # expect: : undefined--eol
12 undefined:
13 : $@-${UNDEFINED}-eol
14
15 # XXX: This command is executed even though it contains parse errors.
16 # expect: make: in target "unclosed-variable": Unclosed variable "UNCLOSED"
17 # expect: : unclosed-variable-
18 unclosed-variable:
19 : $@-${UNCLOSED
20
21 # XXX: This command is executed even though it contains parse errors.
22 # expect: make: Unclosed expression, expecting '}' for "UNCLOSED"
23 # expect: : unclosed-modifier-
24 unclosed-modifier:
25 : $@-${UNCLOSED:
26
27 # XXX: This command is executed even though it contains parse errors.
28 # expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN": Unknown modifier "Z"
29 # expect: : unknown-modifier--eol
30 unknown-modifier:
31 : $@-${UNKNOWN:Z}-eol
32
33 # expect: : end-eol
34 end:
35 : $@-eol
36
37 # XXX: Despite the parse errors, the exit status is 0.
38 # expect: exit status 0
39