| @@ -1,44 +1,44 @@ | | | @@ -1,44 +1,44 @@ |
1 | # $NetBSD: varname-makefile.mk,v 1.1 2020/09/04 17:05:39 rillig Exp $ | | 1 | # $NetBSD: varname-makefile.mk,v 1.2 2020/09/05 06:25:38 rillig Exp $ |
2 | # | | 2 | # |
3 | # Tests for the special MAKEFILE variable, which contains the current | | 3 | # Tests for the special MAKEFILE variable, which contains the current |
4 | # makefile from the -f command line option. | | 4 | # makefile from the -f command line option. |
5 | # | | 5 | # |
6 | # When there are multiple -f options, the variable MAKEFILE is set | | 6 | # When there are multiple -f options, the variable MAKEFILE is set |
7 | # again for each of these makefiles, before the file is parsed. | | 7 | # again for each of these makefiles, before the file is parsed. |
8 | # Including a file via .include does not influence the MAKEFILE | | 8 | # Including a file via .include does not influence the MAKEFILE |
9 | # variable though. | | 9 | # variable though. |
10 | | | 10 | |
11 | .if ${MAKEFILE} != "varname-makefile.mk" | | 11 | .if ${MAKEFILE:T} != "varname-makefile.mk" |
12 | . error | | 12 | . error |
13 | .endif | | 13 | .endif |
14 | | | 14 | |
15 | # This variable lives in the "Internal" namespace. | | 15 | # This variable lives in the "Internal" namespace. |
16 | # TODO: Why does it do that, and what consequences does this have? | | 16 | # TODO: Why does it do that, and what consequences does this have? |
17 | | | 17 | |
18 | # Deleting the variable does not work since this variable does not live in | | 18 | # Deleting the variable does not work since this variable does not live in |
19 | # the "Global" namespace but in "Internal", which is kind of a child | | 19 | # the "Global" namespace but in "Internal", which is kind of a child |
20 | # namespace. | | 20 | # namespace. |
21 | # | | 21 | # |
22 | .undef MAKEFILE | | 22 | .undef MAKEFILE |
23 | .if ${MAKEFILE} != "varname-makefile.mk" | | 23 | .if ${MAKEFILE:T} != "varname-makefile.mk" |
24 | . error | | 24 | . error |
25 | .endif | | 25 | .endif |
26 | | | 26 | |
27 | # Overwriting this variable is possible since the "Internal" namespace | | 27 | # Overwriting this variable is possible since the "Internal" namespace |
28 | # serves as a fallback for the "Global" namespace (see VarFind). | | 28 | # serves as a fallback for the "Global" namespace (see VarFind). |
29 | # | | 29 | # |
30 | MAKEFILE= overwritten | | 30 | MAKEFILE= overwritten |
31 | .if ${MAKEFILE} != "overwritten" | | 31 | .if ${MAKEFILE:T} != "overwritten" |
32 | . error | | 32 | . error |
33 | .endif | | 33 | .endif |
34 | | | 34 | |
35 | # When the overwritten value is deleted, the fallback value becomes | | 35 | # When the overwritten value is deleted, the fallback value becomes |
36 | # visible again. | | 36 | # visible again. |
37 | # | | 37 | # |
38 | .undef MAKEFILE | | 38 | .undef MAKEFILE |
39 | .if ${MAKEFILE} != "varname-makefile.mk" | | 39 | .if ${MAKEFILE:T} != "varname-makefile.mk" |
40 | . error | | 40 | . error |
41 | .endif | | 41 | .endif |
42 | | | 42 | |
43 | all: | | 43 | all: |
44 | @:; | | 44 | @:; |