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