xref: /freebsd/contrib/bmake/unit-tests/make-exported.mk (revision 18054d0220cfc8df9c9568c437bd6fbb59d53c3c)
1# $NetBSD: make-exported.mk,v 1.6 2020/10/05 19:27:48 rillig Exp $
2#
3# As of 2020-08-09, the code in Var_Export is shared between the .export
4# directive and the .MAKE.EXPORTED variable.  This leads to non-obvious
5# behavior for certain variable assignments.
6
7-env=		make-exported-value-env
8-literal=	make-exported-value-literal
9UT_VAR=		${UNEXPANDED}
10
11# Before 2020-10-03, the following line took the code path of .export-env,
12# which was surprising behavior.  Since 2020-10-03 this line tries to
13# export the variable named "-env", but that is rejected because the
14# variable name starts with a hyphen.
15.MAKE.EXPORTED=		-env
16
17# Before 2020-10-03, if the value of .MAKE.EXPORTED started with "-literal",
18# make behaved like a mixture of .export-literal and a regular .export.
19#
20# Since 2020-10-03, the "variable" named "-literal" is not exported anymore,
21# it is just ignored since its name starts with '-'.
22.MAKE.EXPORTED=		-literal UT_VAR
23
24all:
25	@env | sort | egrep '^UT_|make-exported-value' || true
26