xref: /src/contrib/bmake/unit-tests/recursive.mk (revision 8d5c8e21c690b35d0a9a604d6b886fba222cd2fe)
1dbb5be7fSSimon J. Gerraty# $NetBSD: recursive.mk,v 1.8 2024/06/02 15:31:26 rillig Exp $
26bbc783fSSimon J. Gerraty#
36bbc783fSSimon J. Gerraty# In -dL mode, a variable may get expanded before it makes sense.
46bbc783fSSimon J. Gerraty# This would stop make from doing anything since the "recursive" error
56bbc783fSSimon J. Gerraty# is fatal and exits immediately.
66bbc783fSSimon J. Gerraty#
76bbc783fSSimon J. Gerraty# The purpose of evaluating that variable early was just to detect
8ee914ef9SSimon J. Gerraty# whether there are unclosed variables.  The variable value is therefore
9dbb5be7fSSimon J. Gerraty# parsed with VARE_PARSE for that purpose.
106bbc783fSSimon J. Gerraty#
116bbc783fSSimon J. Gerraty
121b65f0bdSSimon J. Gerraty.MAKEFLAGS: -dL
131b65f0bdSSimon J. Gerraty
147a05a715SSimon J. Gerraty
15302da1a3SSimon J. GerratyAM_V_lt=	${am__v_lt_${V}}
16302da1a3SSimon J. Gerratyam__v_lt_=	${am__v_lt_${AM_DEFAULT_VERBOSITY}}
176bbc783fSSimon J. Gerratyam__v_lt_0=	--silent
186bbc783fSSimon J. Gerratyam__v_lt_1=
196bbc783fSSimon J. Gerraty
207a05a715SSimon J. Gerraty# Since parse.c 1.243 from 2020-07-31 and before parse.c 1.249 from
217a05a715SSimon J. Gerraty# 2020-08-06, when make ran in -dL mode, it reported: "Variable am__v_lt_ is
227a05a715SSimon J. Gerraty# recursive."
237a05a715SSimon J. Gerraty#
247a05a715SSimon J. Gerraty# Seen in pkgsrc/x11/libXfixes, and probably many more package that use
257a05a715SSimon J. Gerraty# GNU Automake.
26302da1a3SSimon J. GerratylibXfixes_la_LINK=	... ${AM_V_lt} ...
276bbc783fSSimon J. Gerraty
286bbc783fSSimon J. Gerraty
296bbc783fSSimon J. Gerraty# The purpose of the -dL flag is to detect unclosed variables.  This
306bbc783fSSimon J. Gerraty# can be achieved by just parsing the variable and not evaluating it.
316bbc783fSSimon J. Gerraty#
326bbc783fSSimon J. Gerraty# When the variable is only parsed but not evaluated, bugs in nested
336bbc783fSSimon J. Gerraty# variables are not discovered.  But these are hard to produce anyway,
346bbc783fSSimon J. Gerraty# therefore that's acceptable.  In most practical cases, the missing
356bbc783fSSimon J. Gerraty# brace would be detected directly in the line where it is produced.
366bbc783fSSimon J. GerratyMISSING_BRACE_INDIRECT:=	${:U\${MISSING_BRACE}
373e39ce56SSimon J. Gerraty# expect+1: Unclosed variable "MISSING_PAREN"
386bbc783fSSimon J. GerratyUNCLOSED=	$(MISSING_PAREN
393e39ce56SSimon J. Gerraty# expect+1: Unclosed variable "MISSING_BRACE"
406bbc783fSSimon J. GerratyUNCLOSED=	${MISSING_BRACE
416bbc783fSSimon J. GerratyUNCLOSED=	${MISSING_BRACE_INDIRECT}
42