11.8Srillig# $NetBSD: recursive.mk,v 1.8 2024/06/02 15:31:26 rillig Exp $
21.1Srillig#
31.1Srillig# In -dL mode, a variable may get expanded before it makes sense.
41.1Srillig# This would stop make from doing anything since the "recursive" error
51.1Srillig# is fatal and exits immediately.
61.1Srillig#
71.1Srillig# The purpose of evaluating that variable early was just to detect
81.5Srillig# whether there are unclosed variables.  The variable value is therefore
91.8Srillig# parsed with VARE_PARSE for that purpose.
101.1Srillig#
111.1Srillig
121.4Srillig.MAKEFLAGS: -dL
131.4Srillig
141.7Srillig
151.3SrilligAM_V_lt=	${am__v_lt_${V}}
161.3Srilligam__v_lt_=	${am__v_lt_${AM_DEFAULT_VERBOSITY}}
171.3Srilligam__v_lt_0=	--silent
181.3Srilligam__v_lt_1=
191.2Srillig
201.7Srillig# Since parse.c 1.243 from 2020-07-31 and before parse.c 1.249 from
211.7Srillig# 2020-08-06, when make ran in -dL mode, it reported: "Variable am__v_lt_ is
221.7Srillig# recursive."
231.7Srillig#
241.7Srillig# Seen in pkgsrc/x11/libXfixes, and probably many more package that use
251.7Srillig# GNU Automake.
261.3SrilliglibXfixes_la_LINK=	... ${AM_V_lt} ...
271.1Srillig
281.2Srillig
291.2Srillig# The purpose of the -dL flag is to detect unclosed variables.  This
301.2Srillig# can be achieved by just parsing the variable and not evaluating it.
311.2Srillig#
321.2Srillig# When the variable is only parsed but not evaluated, bugs in nested
331.2Srillig# variables are not discovered.  But these are hard to produce anyway,
341.2Srillig# therefore that's acceptable.  In most practical cases, the missing
351.2Srillig# brace would be detected directly in the line where it is produced.
361.2SrilligMISSING_BRACE_INDIRECT:=	${:U\${MISSING_BRACE}
371.6Srillig# expect+1: Unclosed variable "MISSING_PAREN"
381.3SrilligUNCLOSED=	$(MISSING_PAREN
391.6Srillig# expect+1: Unclosed variable "MISSING_BRACE"
401.3SrilligUNCLOSED=	${MISSING_BRACE
411.3SrilligUNCLOSED=	${MISSING_BRACE_INDIRECT}
42