freebsd-src/unit-tests/varmod-path.mk
Simon J. Gerraty 945078deae Import bmake-20230510
Relevant/interesting changes:

	o parse.c: don't print null filename in stack traces
	o for.c: skip syntactically wrong .for loops
	o var.c: allow for :gmtime=${mtime}
	add :mtime[=timestamp] where timestamp is used if stat(2)
	fails, if :mtime=error stat(2) failure causes error.
	o make.1: fix documentation of .PREFIX to match reality and POSIX
	o unit-tests: improved var-scope-local
2023-05-13 10:03:50 -07:00

38 lines
1.1 KiB
Makefile

# $NetBSD: varmod-path.mk,v 1.4 2023/05/10 15:53:32 rillig Exp $
#
# Tests for the :P variable modifier, which looks up the path for a given
# target.
#
# The phony target does not have a corresponding path, therefore ... oops,
# as of 2020-08-23 it is nevertheless resolved to a path. This is probably
# unintended.
#
# In this test, the real target is located in a subdirectory, and its full
# path is returned. If it had been in the current directory, the difference
# between its path and its name would not be visible.
#
# The enoent target does not exist, therefore the plain name of the target
# is returned.
.MAIN: all
_!= rm -rf varmod-path.subdir
_!= mkdir varmod-path.subdir
_!= > varmod-path.subdir/varmod-path.phony
_!= > varmod-path.subdir/varmod-path.real
# To have an effect, this .PATH declaration must be processed after the
# directory has been created.
.PATH: varmod-path.subdir
varmod-path.phony: .PHONY
varmod-path.real:
all: varmod-path.phony varmod-path.real
@echo ${varmod-path.phony:P}
@echo ${varmod-path.real:P}
@echo ${varmod-path.enoent:P}
.END:
@rm -rf varmod-path.subdir