xref: /freebsd/contrib/bmake/unit-tests/opt-debug-var.mk (revision 2008043f386721d58158e37e0d7e50df8095942d)
1# $NetBSD: opt-debug-var.mk,v 1.2 2022/01/23 16:09:38 rillig Exp $
2#
3# Tests for the -dv command line option, which adds debug logging about
4# variable assignment and evaluation.
5
6.MAKEFLAGS: -dv
7
8# expect: Global: ASSIGNED = value
9ASSIGNED=	value
10
11# TODO: Explain why the empty assignment "Global: SUBST = " is needed.
12# expect: Global: SUBST = value
13SUBST:=		value
14
15.if defined(ASSIGNED)
16.endif
17
18# The usual form of variable expressions is ${VAR}.  The form $(VAR) is used
19# less often as it can be visually confused with the shell construct for
20# capturing the output of a subshell, which looks the same.
21#
22# In conditions, a call to the function 'empty' is syntactically similar to
23# the form $(VAR), only that the initial '$' is the 'y' of 'empty'.
24#
25# expect: Var_Parse: y(ASSIGNED) (eval)
26.if !empty(ASSIGNED)
27.endif
28
29.MAKEFLAGS: -d0
30
31all: .PHONY
32