varname-dot-parsedir.mk revision 1.3 1 # $NetBSD: varname-dot-parsedir.mk,v 1.3 2020/09/12 11:45:47 rillig Exp $
2 #
3 # Tests for the special .PARSEDIR variable, which contains the directory part
4 # of the file that is currently parsed.
5
6 # The .PARSEDIR may be absolute or relative, therefore there is not much that
7 # can be tested here.
8 .if !${.PARSEDIR:tA:M*/unit-tests}
9 . error
10 .endif
11
12 # During parsing, it is possible to undefine .PARSEDIR.
13 # Not that anyone would ever want to do this, but there's code in parse.c,
14 # function PrintLocation, that explicitly handles this situation.
15 .undef .PARSEDIR
16
17 # The .rawout file contains the full path to the current directory.
18 # In the .out file, it is filtered out.
19 .info At this point, .PARSEDIR is undefined.
20
21 # There is absolutely no point in faking the location of the file that is
22 # being parsed. Technically, it's possible though.
23 .PARSEDIR = /fake-absolute-path
24 .info The location can be faked.
25
26 # After including another file, .PARSEDIR is reset.
27 .include "/dev/null"
28 .info The location is no longer fake.
29
30 all:
31 @:;
32