1# $NetBSD: varname-dot-parsefile.mk,v 1.5 2020/10/24 08:50:17 rillig Exp $ 2# 3# Tests for the special .PARSEFILE variable, which contains the basename part 4# of the file that is currently parsed. 5 6.if ${.PARSEFILE} != "varname-dot-parsefile.mk" 7. error 8.endif 9 10# During parsing, it is possible to undefine .PARSEFILE. 11# Not that anyone would ever want to do this, but there's code in parse.c, 12# function PrintLocation, that explicitly handles this situation. 13.if !defined(.PARSEFILE) 14. error 15.endif 16.undef .PARSEFILE 17.if defined(.PARSEFILE) 18. error 19.endif 20 21# The variable .PARSEFILE is indirectly used by the .info directive, 22# via PrintLocation. 23.info At this point, .PARSEFILE is undefined. 24 25# There is absolutely no point in faking the location of the file that is 26# being parsed. Technically, it's possible though, but only if the file 27# being parsed is a relative pathname. See PrintLocation for details. 28.PARSEFILE= fake-parsefile 29.info The location can be faked in some cases. 30 31# After including another file, .PARSEFILE is reset. 32.include "/dev/null" 33.info The location is no longer fake. 34 35all: 36 @echo At run time, .PARSEFILE is ${.PARSEFILE:Uundefined}. 37