directive-else.mk revision 1.5 1 # $NetBSD: directive-else.mk,v 1.5 2020/11/13 08:35:34 rillig Exp $
2 #
3 # Tests for the .else directive.
4
5 # The .else directive does not take any arguments.
6 # As of 2020-08-29, make doesn't warn about this.
7 .if 0
8 . warning must not be reached
9 .else 123
10 . info ok
11 .endif
12
13 .if 1
14 . info ok
15 .else 123
16 . warning must not be reached
17 .endif
18
19 # An .else without a corresponding .if is an error.
20 .else
21
22 # Accidental extra .else directives are detected too.
23 .if 0
24 . warning must not be reached
25 .else
26 . info ok
27 .else
28 . info After an extra .else, everything is skipped.
29 .endif
30
31 # An .else may have a comment. This comment does not count as an argument,
32 # therefore no parse error.
33 .if 0
34 .else # comment
35 .endif
36
37 # A variable expression does count as an argument, even if it is empty.
38 # XXX: This should be a parse error.
39 .if 0
40 .else ${:U}
41 .endif
42
43 all:
44 @:;
45