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