Home | History | Annotate | Line # | Download | only in unit-tests
      1  1.3  rillig # $NetBSD: varname-dot-path.mk,v 1.3 2020/10/02 18:46:54 rillig Exp $
      2  1.1  rillig #
      3  1.3  rillig # Tests for the special .PATH variable, which TODO: describe the purpose.
      4  1.1  rillig 
      5  1.3  rillig _!=	mkdir -p varname-dot-path.d
      6  1.3  rillig 
      7  1.3  rillig # By default, .PATH consists of "." and .CURDIR.
      8  1.3  rillig # XXX: Why both? Shouldn't they have the same effect?
      9  1.3  rillig .if ${.PATH} != ". ${.CURDIR}"
     10  1.3  rillig .  error ${.PATH}
     11  1.3  rillig .endif
     12  1.3  rillig 
     13  1.3  rillig # The special target .PATH adds a directory to the path.
     14  1.3  rillig .PATH: /
     15  1.3  rillig .if ${.PATH} != ". ${.CURDIR} /"
     16  1.3  rillig .  error ${.PATH}
     17  1.3  rillig .endif
     18  1.3  rillig 
     19  1.3  rillig # Only existing directories are added to the path, the others are ignored.
     20  1.3  rillig .PATH: /nonexistent
     21  1.3  rillig .if ${.PATH} != ". ${.CURDIR} /"
     22  1.3  rillig .  error ${.PATH}
     23  1.3  rillig .endif
     24  1.3  rillig 
     25  1.3  rillig # Only directories are added to the path, not regular files.
     26  1.3  rillig .PATH: ${.PARSEDIR}/${.PARSEFILE}
     27  1.3  rillig .if ${.PATH} != ". ${.CURDIR} /"
     28  1.3  rillig .  error ${.PATH}
     29  1.3  rillig .endif
     30  1.3  rillig 
     31  1.3  rillig # Relative directories can be added as well.
     32  1.3  rillig # Each directory is only added once to the path.
     33  1.3  rillig .PATH: varname-dot-path.d /
     34  1.3  rillig .if ${.PATH} != ". ${.CURDIR} / varname-dot-path.d"
     35  1.3  rillig .  error ${.PATH}
     36  1.3  rillig .endif
     37  1.3  rillig 
     38  1.3  rillig # The pathnames are not normalized before being added to the path.
     39  1.3  rillig .PATH: ./.
     40  1.3  rillig .if ${.PATH} != ". ${.CURDIR} / varname-dot-path.d ./."
     41  1.3  rillig .  error ${.PATH}
     42  1.3  rillig .endif
     43  1.3  rillig 
     44  1.3  rillig # The two default entries can be placed at the back of the path,
     45  1.3  rillig # by adding the special entry ".DOTLAST" somewhere in the path.
     46  1.3  rillig # The entry .DOTLAST, if any, is listed in the path, always at the
     47  1.3  rillig # very beginning, to make this magic less surprising.
     48  1.3  rillig .PATH: .DOTLAST
     49  1.3  rillig .if ${.PATH} != ".DOTLAST / varname-dot-path.d ./. . ${.CURDIR}"
     50  1.3  rillig .  error ${.PATH}
     51  1.3  rillig .endif
     52  1.3  rillig 
     53  1.3  rillig _!=	rmdir varname-dot-path.d
     54  1.1  rillig 
     55  1.1  rillig all:
     56  1.1  rillig 	@:;
     57