xref: /freebsd/contrib/bmake/unit-tests/recursive.mk (revision 02e9120893770924227138ba49df1edb3896112a)
1# $NetBSD: recursive.mk,v 1.6 2023/06/01 20:56:35 rillig Exp $
2#
3# In -dL mode, a variable may get expanded before it makes sense.
4# This would stop make from doing anything since the "recursive" error
5# is fatal and exits immediately.
6#
7# The purpose of evaluating that variable early was just to detect
8# whether there are unclosed variables.  The variable value is therefore
9# parsed with VARE_PARSE_ONLY for that purpose.
10#
11# Seen in pkgsrc/x11/libXfixes, and probably many more package that use
12# GNU Automake.
13
14.MAKEFLAGS: -dL
15
16AM_V_lt=	${am__v_lt_${V}}
17am__v_lt_=	${am__v_lt_${AM_DEFAULT_VERBOSITY}}
18am__v_lt_0=	--silent
19am__v_lt_1=
20
21# On 2020-08-06, make reported: "Variable am__v_lt_ is recursive."
22libXfixes_la_LINK=	... ${AM_V_lt} ...
23
24# somewhere later ...
25AM_DEFAULT_VERBOSITY=	1
26
27
28# The purpose of the -dL flag is to detect unclosed variables.  This
29# can be achieved by just parsing the variable and not evaluating it.
30#
31# When the variable is only parsed but not evaluated, bugs in nested
32# variables are not discovered.  But these are hard to produce anyway,
33# therefore that's acceptable.  In most practical cases, the missing
34# brace would be detected directly in the line where it is produced.
35MISSING_BRACE_INDIRECT:=	${:U\${MISSING_BRACE}
36# expect+1: Unclosed variable "MISSING_PAREN"
37UNCLOSED=	$(MISSING_PAREN
38# expect+1: Unclosed variable "MISSING_BRACE"
39UNCLOSED=	${MISSING_BRACE
40UNCLOSED=	${MISSING_BRACE_INDIRECT}
41