xref: /freebsd/contrib/bmake/unit-tests/export-variants.mk (revision 956e45f6fb3e18b8e89b1341708db60c30bb9f27)
1*956e45f6SSimon J. Gerraty# $NetBSD: export-variants.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
22c3632d1SSimon J. Gerraty#
32c3632d1SSimon J. Gerraty# Test whether exported variables apply to each variant of running
42c3632d1SSimon J. Gerraty# external commands:
52c3632d1SSimon J. Gerraty#
62c3632d1SSimon J. Gerraty# The != assignments.
72c3632d1SSimon J. Gerraty# The :!cmd! modifier.
82c3632d1SSimon J. Gerraty# The :sh modifier.
92c3632d1SSimon J. Gerraty
102c3632d1SSimon J. GerratySHVAR!=	env | grep ^UT_ || true
112c3632d1SSimon J. Gerraty.if ${SHVAR} != ""
122c3632d1SSimon J. Gerraty.  warning At this point, no variable should be exported.
132c3632d1SSimon J. Gerraty.endif
142c3632d1SSimon J. Gerraty
152c3632d1SSimon J. Gerraty.if ${:!env | grep ^UT_ || true!} != ""
162c3632d1SSimon J. Gerraty.  warning At this point, no variable should be exported.
172c3632d1SSimon J. Gerraty.endif
182c3632d1SSimon J. Gerraty
192c3632d1SSimon J. Gerraty.if ${env | grep ^UT_ || true:L:sh} != ""
202c3632d1SSimon J. Gerraty.  warning At this point, no variable should be exported.
212c3632d1SSimon J. Gerraty.endif
222c3632d1SSimon J. Gerraty
232c3632d1SSimon J. GerratyUT_VAR=		value
242c3632d1SSimon J. Gerraty.export UT_VAR
252c3632d1SSimon J. Gerraty
262c3632d1SSimon J. GerratySHVAR!=	env | grep ^UT_ || true
272c3632d1SSimon J. Gerraty.if ${SHVAR} != "UT_VAR=value"
28*956e45f6SSimon J. Gerraty.  warning At this point, a single variable should be exported.
292c3632d1SSimon J. Gerraty.endif
302c3632d1SSimon J. Gerraty
312c3632d1SSimon J. Gerraty.if ${:!env | grep ^UT_ || true!} != "UT_VAR=value"
32*956e45f6SSimon J. Gerraty.  warning At this point, a single variable should be exported.
332c3632d1SSimon J. Gerraty.endif
342c3632d1SSimon J. Gerraty
352c3632d1SSimon J. Gerraty.if ${env | grep ^UT_ || true:L:sh} != "UT_VAR=value"
36*956e45f6SSimon J. Gerraty.  warning At this point, a single variable should be exported.
372c3632d1SSimon J. Gerraty.endif
382c3632d1SSimon J. Gerraty
392c3632d1SSimon J. Gerratyall:
402c3632d1SSimon J. Gerraty	@:;
41