xref: /freebsd/contrib/bmake/unit-tests/opt-x-reduce-exported.mk (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1# $NetBSD: opt-x-reduce-exported.mk,v 1.3 2022/05/08 07:27:50 rillig Exp $
2#
3# Tests for the -X command line option, which prevents variables passed on the
4# command line from being exported to the environment of child commands.
5
6# The variable 'BEFORE' is exported, the variable 'AFTER' isn't.
7.MAKEFLAGS: BEFORE=before -X AFTER=after
8
9all: .PHONY ordinary submake
10
11ordinary: .PHONY
12	@echo 'ordinary:'
13	@env | sort | grep -e '^BEFORE' -e '^AFTER'
14
15submake: .PHONY
16	@echo 'submake:'
17	@${MAKE} -r -f ${MAKEFILE} show-env
18
19show-env: .PHONY
20	@env | sort | grep -e '^BEFORE' -e '^AFTER'
21