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