xref: /freebsd/contrib/bmake/unit-tests/make-exported.mk (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1# $NetBSD: make-exported.mk,v 1.7 2022/09/09 18:36:15 sjg 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