1 1.3 rillig # $NetBSD: varmod-path.mk,v 1.3 2020/08/23 08:10:49 rillig Exp $ 2 1.1 rillig # 3 1.2 rillig # Tests for the :P variable modifier, which looks up the path for a given 4 1.2 rillig # target. 5 1.3 rillig # 6 1.3 rillig # The phony target does not have a corresponding path, therefore ... oops, 7 1.3 rillig # as of 2020-08-23 it is nevertheless resolved to a path. This is probably 8 1.3 rillig # unintended. 9 1.3 rillig # 10 1.3 rillig # The real target is located in a subdirectory, and its full path is returned. 11 1.3 rillig # If it had been in the current directory, the difference between its path and 12 1.3 rillig # its name would not be visible. 13 1.3 rillig # 14 1.3 rillig # The enoent target does not exist, therefore the target name is returned. 15 1.3 rillig 16 1.3 rillig .MAIN: all 17 1.3 rillig 18 1.3 rillig _!= rm -rf varmod-path.subdir 19 1.3 rillig _!= mkdir varmod-path.subdir 20 1.3 rillig _!= > varmod-path.subdir/varmod-path.phony 21 1.3 rillig _!= > varmod-path.subdir/varmod-path.real 22 1.3 rillig 23 1.3 rillig # To have an effect, this .PATH declaration must be after the directory is created. 24 1.3 rillig .PATH: varmod-path.subdir 25 1.3 rillig 26 1.3 rillig varmod-path.phony: .PHONY 27 1.3 rillig varmod-path.real: 28 1.1 rillig 29 1.3 rillig all: varmod-path.phony varmod-path.real 30 1.3 rillig @echo ${varmod-path.phony:P} 31 1.3 rillig @echo ${varmod-path.real:P} 32 1.3 rillig @echo ${varmod-path.enoent:P} 33 1.1 rillig 34 1.3 rillig .END: 35 1.3 rillig @rm -rf varmod-path.subdir 36