make: update var-scope-local test

Show what VAR value is in environment of target script.
This commit is contained in:
sjg 2024-03-01 20:15:59 +00:00
parent 38c0bdf232
commit bbd77d9b59
2 changed files with 11 additions and 1 deletions

View File

@ -61,11 +61,18 @@ dir/subdir/inference-rule-chain.ir-to: * = <dir/subdir/inference-rule-chain>
: Making var-scope-local.o from var-scope-local.c.
: Making basename "var-scope-local.o" in "." from "var-scope-local.c" in ".".
: Making var-scope-local-assign.o with VAR="local".
var-scope-local-assign.o env has VAR='local'
: Making var-scope-local-append.o with VAR="local to var-scope-local-append.o".
var-scope-local-append.o env has VAR='local to var-scope-local-append.o'
: Making var-scope-local-append-global.o with VAR="global+local".
var-scope-local-append-global.o env has VAR='global+local'
: Making var-scope-local-default.o with VAR="global".
var-scope-local-default.o env has VAR='global'
: Making var-scope-local-subst.o with VAR="global+local".
var-scope-local-subst.o env has VAR='global+local'
: Making var-scope-local-shell.o with VAR="output".
var-scope-local-shell.o env has VAR='output'
: var-scope-local-use.o uses .USE VAR="global"
var-scope-local-use.o env has VAR='global'
: all overwritten
exit status 0

View File

@ -1,4 +1,4 @@
# $NetBSD: var-scope-local.mk,v 1.9 2023/12/20 09:03:09 rillig Exp $
# $NetBSD: var-scope-local.mk,v 1.10 2024/03/01 20:15:59 sjg Exp $
#
# Tests for target-local variables, such as ${.TARGET} or $@. These variables
# are relatively short-lived as they are created just before making the
@ -200,12 +200,14 @@ var-scope-local-default.o \
var-scope-local-subst.o \
var-scope-local-shell.o:
: Making ${.TARGET} with VAR="${VAR}".
@echo "${.TARGET} env has VAR='$$VAR'"
# Target-local variables are enabled by default. Force them to be enabled
# just in case a test above has disabled them.
.MAKE.TARGET_LOCAL_VARIABLES= yes
VAR= global
.export VAR
# If the sources of a dependency line look like a variable assignment, make
# treats them as such. There is only a single variable assignment per
@ -264,6 +266,7 @@ var-scope-local-shell.o: VAR != echo output
# expect: : var-scope-local-use.o uses .USE VAR="global"
a_use: .USE VAR=use
: ${.TARGET} uses .USE VAR="${VAR}"
@echo "${.TARGET} env has VAR='$$VAR'"
all: var-scope-local-use.o
var-scope-local-use.o: a_use