| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: directive-include.mk,v 1.7 2021/12/03 22:48:07 rillig Exp $ | | 1 | # $NetBSD: directive-include.mk,v 1.8 2021/12/14 00:38:32 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for the .include directive, which includes another file. | | 3 | # Tests for the .include directive, which includes another file. |
4 | | | 4 | |
5 | # TODO: Implementation | | 5 | # TODO: Implementation |
6 | | | 6 | |
7 | .MAKEFLAGS: -dc | | 7 | .MAKEFLAGS: -dc |
8 | | | 8 | |
9 | # All included files are recorded in the variable .MAKE.MAKEFILES. | | 9 | # All included files are recorded in the variable .MAKE.MAKEFILES. |
10 | # In this test, only the basenames of the files are compared since | | 10 | # In this test, only the basenames of the files are compared since |
11 | # the directories can differ. | | 11 | # the directories can differ. |
12 | .include "/dev/null" | | 12 | .include "/dev/null" |
13 | .if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null" | | 13 | .if ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null" |
14 | . error | | 14 | . error |
| @@ -41,14 +41,27 @@ DEV= null | | | @@ -41,14 +41,27 @@ DEV= null |
41 | # '.include' directives are typically kept as simple as possible. | | 41 | # '.include' directives are typically kept as simple as possible. |
42 | # | | 42 | # |
43 | # If the whole line were expanded before parsing, the filename to be included | | 43 | # If the whole line were expanded before parsing, the filename to be included |
44 | # would be empty, and the closing '"' would be in the trailing part of the | | 44 | # would be empty, and the closing '"' would be in the trailing part of the |
45 | # line, which is ignored as of 2021-12-03. | | 45 | # line, which is ignored as of 2021-12-03. |
46 | DQUOT= " | | 46 | DQUOT= " |
47 | .include "${DQUOT}" | | 47 | .include "${DQUOT}" |
48 | | | 48 | |
49 | # When the expression in a filename cannot be evaluated, the failing | | 49 | # When the expression in a filename cannot be evaluated, the failing |
50 | # expression is skipped and the file is included nevertheless. | | 50 | # expression is skipped and the file is included nevertheless. |
51 | # FIXME: Add proper error handling, no file must be included here. | | 51 | # FIXME: Add proper error handling, no file must be included here. |
52 | .include "nonexistent${:U123:Z}.mk" | | 52 | .include "nonexistent${:U123:Z}.mk" |
53 | | | 53 | |
| | | 54 | # The traditional include directive is seldom used. |
| | | 55 | include /dev/null # comment |
| | | 56 | # expect+1: Cannot open /nonexistent |
| | | 57 | include /nonexistent # comment |
| | | 58 | sinclude /nonexistent # comment |
| | | 59 | include ${:U/dev/null} # comment |
| | | 60 | include /dev/null /dev/null |
| | | 61 | # expect+1: Invalid line type |
| | | 62 | include |
| | | 63 | # XXX: trailing whitespace in diagnostic, missing quotes around filename |
| | | 64 | # expect+1: Could not find |
| | | 65 | include ${:U} |
| | | 66 | |
54 | all: | | 67 | all: |