xref: /freebsd/contrib/bmake/unit-tests/recursive.mk (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
1# $NetBSD: recursive.mk,v 1.8 2024/06/02 15:31:26 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 for that purpose.
10#
11
12.MAKEFLAGS: -dL
13
14
15AM_V_lt=	${am__v_lt_${V}}
16am__v_lt_=	${am__v_lt_${AM_DEFAULT_VERBOSITY}}
17am__v_lt_0=	--silent
18am__v_lt_1=
19
20# Since parse.c 1.243 from 2020-07-31 and before parse.c 1.249 from
21# 2020-08-06, when make ran in -dL mode, it reported: "Variable am__v_lt_ is
22# recursive."
23#
24# Seen in pkgsrc/x11/libXfixes, and probably many more package that use
25# GNU Automake.
26libXfixes_la_LINK=	... ${AM_V_lt} ...
27
28
29# The purpose of the -dL flag is to detect unclosed variables.  This
30# can be achieved by just parsing the variable and not evaluating it.
31#
32# When the variable is only parsed but not evaluated, bugs in nested
33# variables are not discovered.  But these are hard to produce anyway,
34# therefore that's acceptable.  In most practical cases, the missing
35# brace would be detected directly in the line where it is produced.
36MISSING_BRACE_INDIRECT:=	${:U\${MISSING_BRACE}
37# expect+1: Unclosed variable "MISSING_PAREN"
38UNCLOSED=	$(MISSING_PAREN
39# expect+1: Unclosed variable "MISSING_BRACE"
40UNCLOSED=	${MISSING_BRACE
41UNCLOSED=	${MISSING_BRACE_INDIRECT}
42