| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: directive-include-guard.mk,v 1.2 2023/06/18 19:16:51 rillig Exp $ | | 1 | # $NetBSD: directive-include-guard.mk,v 1.3 2023/06/18 19:30:31 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for multiple-inclusion guards in makefiles. | | 3 | # Tests for multiple-inclusion guards in makefiles. |
4 | # | | 4 | # |
5 | # A file that is guarded by a multiple-inclusion guard has the following form: | | 5 | # A file that is guarded by a multiple-inclusion guard has the following form: |
6 | # | | 6 | # |
7 | # .ifndef GUARD_NAME | | 7 | # .ifndef GUARD_NAME |
8 | # GUARD_NAME= # any value | | 8 | # GUARD_NAME= # any value |
9 | # ... | | 9 | # ... |
10 | # .endif | | 10 | # .endif |
11 | # | | 11 | # |
12 | # When such a file is included for the second time, it has no effect, as all | | 12 | # When such a file is included for the second time, it has no effect, as all |
13 | # its content is skipped. | | 13 | # its content is skipped. |
14 | # | | 14 | # |
| @@ -20,29 +20,29 @@ | | | @@ -20,29 +20,29 @@ |
20 | | | 20 | |
21 | # This is the canonical form of a multiple-inclusion guard. | | 21 | # This is the canonical form of a multiple-inclusion guard. |
22 | INCS+= guarded-ifndef | | 22 | INCS+= guarded-ifndef |
23 | LINES.guarded-ifndef= \ | | 23 | LINES.guarded-ifndef= \ |
24 | '.ifndef GUARDED_IFNDEF' \ | | 24 | '.ifndef GUARDED_IFNDEF' \ |
25 | 'GUARDED_IFNDEF=' \ | | 25 | 'GUARDED_IFNDEF=' \ |
26 | '.endif' | | 26 | '.endif' |
27 | | | 27 | |
28 | # Comments and empty lines have no influence on the multiple-inclusion guard. | | 28 | # Comments and empty lines have no influence on the multiple-inclusion guard. |
29 | INCS+= comments | | 29 | INCS+= comments |
30 | LINES.comments= \ | | 30 | LINES.comments= \ |
31 | '\# comment' \ | | 31 | '\# comment' \ |
32 | '' \ | | 32 | '' \ |
33 | '.ifndef GUARD' \ | | 33 | '.ifndef COMMENTS' \ |
34 | '\# comment' \ | | 34 | '\# comment' \ |
35 | 'GUARD=\#comment' \ | | 35 | 'COMMENTS=\#comment' \ |
36 | '.endif' \ | | 36 | '.endif' \ |
37 | '\# comment' | | 37 | '\# comment' |
38 | | | 38 | |
39 | # An alternative form uses the 'defined' function. It is more verbose than | | 39 | # An alternative form uses the 'defined' function. It is more verbose than |
40 | # the canonical form. There are other possible forms as well, such as with a | | 40 | # the canonical form. There are other possible forms as well, such as with a |
41 | # triple negation, but these are not recognized as they are not common. | | 41 | # triple negation, but these are not recognized as they are not common. |
42 | INCS+= guarded-if | | 42 | INCS+= guarded-if |
43 | LINES.guarded-if= \ | | 43 | LINES.guarded-if= \ |
44 | '.if !defined(GUARDED_IF)' \ | | 44 | '.if !defined(GUARDED_IF)' \ |
45 | 'GUARDED_IF=' \ | | 45 | 'GUARDED_IF=' \ |
46 | '.endif' | | 46 | '.endif' |
47 | | | 47 | |
48 | # Triple negation is so uncommon that it's not recognized. | | 48 | # Triple negation is so uncommon that it's not recognized. |