1# $NetBSD: var-scope-local-legacy.mk,v 1.3 2023/12/17 14:07:22 rillig Exp $ 2# 3# Tests for legacy target-local variables, such as ${<F} or ${@D}. 4 5 6# In the global or command line scopes, the legacy forms are not recognized, 7# as the target-specific variables are not available either. The expressions 8# are retained so that they can be resolved later, in the target scope. 9.if "${@D}" != "\${@D}" 10. error 11.endif 12 13# It's possible to define variables of the legacy name in the global or 14# command line scope, and they override the target-local variables, leading to 15# unnecessary confusion. 16@D= global-value 17.if "${@D}" != "global-value" 18. error 19.endif 20 21 22all: .PHONY 23 # Only variables of length 2 can be legacy, this one cannot. 24 : LEN4=${LEN4:Uundef}_ 25 # The second character of the name must be 'D' or 'F'. 26 : XY=${XY:Uundef}_ 27 # The first character must name one of the 7 predefined local 28 # variables, 'A' is not such a character. 29 : AF=${AF:Uundef}_ 30 # The variable '.MEMBER' is undefined, therefore '%D' and '%F' are 31 # undefined as well. 32 : %D=${%D:Uundef}_ %F=${%F:Uundef}_ 33 # The directory name of the target is shadowed by the global variable, 34 # it would be '.' otherwise. The basename is 'all'. 35 : @D=${@D:Uundef}_ @F=${@F:Uundef}_ 36