]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/envfirst.mk
Update to bmake-20200902
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / envfirst.mk
1 # $NetBSD: envfirst.mk,v 1.2 2020/07/27 18:57:42 rillig Exp $
2 #
3 # The -e option makes environment variables stronger than global variables.
4
5 .if ${FROM_ENV} != value-from-env
6 .error ${FROM_ENV}
7 .endif
8
9 # Try to override the variable; this does not have any effect.
10 FROM_ENV=       value-from-mk
11 .if ${FROM_ENV} != value-from-env
12 .error ${FROM_ENV}
13 .endif
14
15 # Try to append to the variable; this also doesn't have any effect.
16 FROM_ENV+=      appended
17 .if ${FROM_ENV} != value-from-env
18 .error ${FROM_ENV}
19 .endif
20
21 # The default assignment also cannot change the variable.
22 FROM_ENV?=      default
23 .if ${FROM_ENV} != value-from-env
24 .error ${FROM_ENV}
25 .endif
26
27 # Neither can the assignment modifiers.
28 .if ${FROM_ENV::=from-condition}
29 .endif
30 .if ${FROM_ENV} != value-from-env
31 .error ${FROM_ENV}
32 .endif
33
34 # Even .undef doesn't work since it only affects the global context,
35 # which is independent from the environment variables.
36 .undef FROM_ENV
37 .if ${FROM_ENV} != value-from-env
38 .error ${FROM_ENV}
39 .endif
40
41 all:
42         @: nothing