xref: /freebsd/contrib/bmake/unit-tests/varmod-path.mk (revision c1d01b5fd6811491ee6c05cf6982fd65343122c8)
1*c1d01b5fSSimon J. Gerraty# $NetBSD: varmod-path.mk,v 1.4 2023/05/10 15:53:32 rillig Exp $
22c3632d1SSimon J. Gerraty#
32c3632d1SSimon J. Gerraty# Tests for the :P variable modifier, which looks up the path for a given
42c3632d1SSimon J. Gerraty# target.
52c3632d1SSimon J. Gerraty#
62c3632d1SSimon J. Gerraty# The phony target does not have a corresponding path, therefore ... oops,
72c3632d1SSimon J. Gerraty# as of 2020-08-23 it is nevertheless resolved to a path.  This is probably
82c3632d1SSimon J. Gerraty# unintended.
92c3632d1SSimon J. Gerraty#
10*c1d01b5fSSimon J. Gerraty# In this test, the real target is located in a subdirectory, and its full
11*c1d01b5fSSimon J. Gerraty# path is returned.  If it had been in the current directory, the difference
12*c1d01b5fSSimon J. Gerraty# between its path and its name would not be visible.
132c3632d1SSimon J. Gerraty#
14*c1d01b5fSSimon J. Gerraty# The enoent target does not exist, therefore the plain name of the target
15*c1d01b5fSSimon J. Gerraty# is returned.
162c3632d1SSimon J. Gerraty
172c3632d1SSimon J. Gerraty.MAIN: all
182c3632d1SSimon J. Gerraty
192c3632d1SSimon J. Gerraty_!=	rm -rf varmod-path.subdir
202c3632d1SSimon J. Gerraty_!=	mkdir varmod-path.subdir
212c3632d1SSimon J. Gerraty_!=	> varmod-path.subdir/varmod-path.phony
222c3632d1SSimon J. Gerraty_!=	> varmod-path.subdir/varmod-path.real
232c3632d1SSimon J. Gerraty
24*c1d01b5fSSimon J. Gerraty# To have an effect, this .PATH declaration must be processed after the
25*c1d01b5fSSimon J. Gerraty# directory has been created.
262c3632d1SSimon J. Gerraty.PATH: varmod-path.subdir
272c3632d1SSimon J. Gerraty
282c3632d1SSimon J. Gerratyvarmod-path.phony: .PHONY
292c3632d1SSimon J. Gerratyvarmod-path.real:
302c3632d1SSimon J. Gerraty
312c3632d1SSimon J. Gerratyall: varmod-path.phony varmod-path.real
322c3632d1SSimon J. Gerraty	@echo ${varmod-path.phony:P}
332c3632d1SSimon J. Gerraty	@echo ${varmod-path.real:P}
342c3632d1SSimon J. Gerraty	@echo ${varmod-path.enoent:P}
352c3632d1SSimon J. Gerraty
362c3632d1SSimon J. Gerraty.END:
372c3632d1SSimon J. Gerraty	@rm -rf varmod-path.subdir
38