make: demonstrate inconsistency in .undef of an exported variable

This commit is contained in:
rillig 2021-02-16 18:02:19 +00:00
parent a75802fa16
commit a017c69c81
2 changed files with 20 additions and 2 deletions

View File

@ -1,5 +1,6 @@
make: "directive-undef.mk" line 29: The .undef directive requires an argument
make: "directive-undef.mk" line 86: Unknown modifier 'Z'
make: "directive-undef.mk" line 103: warning: UT_EXPORTED is still listed in .MAKE.EXPORTED even though spaceit is not exported anymore.
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1

View File

@ -1,4 +1,4 @@
# $NetBSD: directive-undef.mk,v 1.9 2020/12/22 20:10:21 rillig Exp $
# $NetBSD: directive-undef.mk,v 1.10 2021/02/16 18:02:19 rillig Exp $
#
# Tests for the .undef directive.
#
@ -86,5 +86,22 @@ ${DOLLAR}= dollar
.undef ${VARNAMES:L:Z}
UT_EXPORTED= exported-value
.export UT_EXPORTED
.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "exported-value"
. error
.endif
.if !${.MAKE.EXPORTED:MUT_EXPORTED}
. error
.endif
.undef UT_EXPORTED # XXX: does not update .MAKE.EXPORTED
.if ${:!echo "\${UT_EXPORTED:-not-exported}"!} != "not-exported"
. error
.endif
.if ${.MAKE.EXPORTED:MUT_EXPORTED}
. warning UT_EXPORTED is still listed in .MAKE.EXPORTED even though $\
it is not exported anymore.
.endif
all:
@:;