make(1): add test for deferred variable expansion in dependencies
This commit is contained in:
parent
2b49b3fd7c
commit
78b4692a94
@ -1,4 +1,4 @@
|
||||
# $NetBSD: mi,v 1.898 2020/08/22 11:27:02 rillig Exp $
|
||||
# $NetBSD: mi,v 1.899 2020/08/22 16:51:25 rillig Exp $
|
||||
#
|
||||
# Note: don't delete entries from here - mark them as "obsolete" instead.
|
||||
#
|
||||
@ -4593,6 +4593,10 @@
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-double-colon.mk tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-exclam.exp tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-exclam.mk tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-none.exp tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-none.mk tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-var.exp tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-var.mk tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-wildcards.exp tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep-wildcards.mk tests-usr.bin-tests compattestfile,atf
|
||||
./usr/tests/usr.bin/make/unit-tests/dep.exp tests-usr.bin-tests compattestfile,atf
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.108 2020/08/22 15:25:50 sjg Exp $
|
||||
# $NetBSD: Makefile,v 1.109 2020/08/22 16:51:26 rillig Exp $
|
||||
#
|
||||
# Unit tests for make(1)
|
||||
#
|
||||
@ -66,6 +66,7 @@ TESTS+= dep-colon
|
||||
TESTS+= dep-double-colon
|
||||
TESTS+= dep-exclam
|
||||
TESTS+= dep-none
|
||||
TESTS+= dep-var
|
||||
TESTS+= dep-wildcards
|
||||
TESTS+= depsrc
|
||||
TESTS+= depsrc-exec
|
||||
|
2
usr.bin/make/unit-tests/dep-var.exp
Normal file
2
usr.bin/make/unit-tests/dep-var.exp
Normal file
@ -0,0 +1,2 @@
|
||||
def2
|
||||
exit status 0
|
33
usr.bin/make/unit-tests/dep-var.mk
Normal file
33
usr.bin/make/unit-tests/dep-var.mk
Normal file
@ -0,0 +1,33 @@
|
||||
# $NetBSD: dep-var.mk,v 1.1 2020/08/22 16:51:26 rillig Exp $
|
||||
#
|
||||
# Tests for variable references in dependency declarations.
|
||||
#
|
||||
# Uh oh, this feels so strange that probably nobody uses it. But it seems to
|
||||
# be the only way to reach the lower half of SuffExpandChildren.
|
||||
|
||||
# XXX: The -dv log says:
|
||||
# Var_Parse: ${UNDEF1} with VARE_UNDEFERR|VARE_WANTRES
|
||||
# but no error message is generated for this line.
|
||||
# The variable expression ${UNDEF1} simply expands to an empty string.
|
||||
all: ${UNDEF1}
|
||||
|
||||
# Using a double dollar in order to circumvent immediate variable expansion
|
||||
# feels like unintended behavior. At least the manual page says nothing at
|
||||
# all about defined or undefined variables in dependency lines.
|
||||
#
|
||||
# At the point where the expression ${DEF2} is expanded, the variable DEF2
|
||||
# is defined, so everything's fine.
|
||||
all: $${DEF2}
|
||||
|
||||
# This variable is not defined at all.
|
||||
# XXX: The -dv log says:
|
||||
# Var_Parse: ${UNDEF3} with VARE_UNDEFERR|VARE_WANTRES
|
||||
# but no error message is generated for this line, just like for UNDEF1.
|
||||
# The variable expression ${UNDEF3} simply expands to an empty string.
|
||||
all: $${UNDEF3}
|
||||
|
||||
UNDEF1= undef1
|
||||
DEF2= def2
|
||||
|
||||
undef1 def2:
|
||||
@echo ${.TARGET}
|
Loading…
Reference in New Issue
Block a user