xref: /freebsd/contrib/bmake/unit-tests/export.mk (revision 3e8eb5c7f4909209c042403ddee340b2ee7003a5)
1# $NetBSD: export.mk,v 1.11 2021/12/05 14:57:36 rillig Exp $
2
3UT_TEST=	export
4UT_FOO=		foo${BAR}
5UT_FU=		fubar
6UT_ZOO=		hoopie
7UT_NO=		all
8# believe it or not, we expect this one to come out with $UT_FU unexpanded.
9UT_DOLLAR=	This is $$UT_FU
10
11.export UT_FU UT_FOO
12.export UT_DOLLAR
13
14.if !defined(.MAKE.PID)
15.  error .MAKE.PID must be defined
16.endif
17@=	at
18%=	percent
19*=	asterisk
20${:U!}=	exclamation		# A direct != would try to run "exclamation"
21				# as a shell command and assign its output
22				# to the empty variable.
23&=	ampersand
24
25# This is ignored because it is internal.
26.export .MAKE.PID
27# These are ignored because they are local to the target.
28.export @
29.export %
30.export *
31.export !
32# This is exported (see the .rawout file) but not displayed since the dash
33# shell filters it out.  To reach consistent output for each shell, the
34# ampersand is filtered out already by FILTER_CMD.
35.export &
36# This is ignored because it is undefined.
37.export UNDEFINED
38
39BAR=	bar is ${UT_FU}
40
41.MAKE.EXPORTED+=	UT_ZOO UT_TEST
42
43FILTER_CMD?=	egrep -v '^(MAKEFLAGS|MALLOC_.*|PATH|PWD|SHLVL|_|&)='
44
45all:
46	@env | ${FILTER_CMD} | sort
47