freebsd-dev/contrib/bmake/unit-tests/varname-dot-curdir.mk
Simon J. Gerraty 956e45f6fb Update to bmake-20201101
Lots of new unit-tests increase code coverage.

Lots of refactoring, cleanup and simlpification to reduce
code size.

Fixes for Bug 223564 and 245807

Updates to dirdeps.mk and meta2deps.py
2020-11-07 21:46:27 +00:00

46 lines
1.3 KiB
Makefile

# $NetBSD: varname-dot-curdir.mk,v 1.7 2020/10/08 19:09:08 rillig Exp $
#
# Tests for the special .CURDIR variable, which is initially set to the
# canonical path of the current working directory, when make started.
# In all normal situations, the current directory exists, and its name can
# be resolved. If not, make fails at startup.
#
# It would be possible on some systems to remove the current directory, even
# while a process runs in it, but this is so unrealistic that it's no worth
# testing.
.if !exists(${.CURDIR})
. error
.endif
.if !exists(${.CURDIR}/)
. error
.endif
.if !exists(${.CURDIR}/.)
. error
.endif
.if !exists(${.CURDIR}/..)
. error
.endif
# Until 2020-10-04, assigning the result of a shell assignment to .CURDIR
# tried to add the shell command ("echo /") to the .PATH instead of the
# output of the shell command ("/"). Since "echo /" does not exist, the
# .PATH was left unmodified. See VarAssign_Eval.
#
# Since 2020-10-04, the output of the shell command is added to .PATH.
.CURDIR!= echo /
.if ${.PATH:M/} != "/"
. error
.endif
# A normal assignment works fine, as does a substitution assignment.
# Appending to .CURDIR does not make sense, therefore it doesn't matter that
# this code path is buggy as well.
.CURDIR= /
.if ${.PATH:M/} != "/"
. error
.endif
all:
@:;