varname-dot-makeflags.mk revision 1.9 1 # $NetBSD: varname-dot-makeflags.mk,v 1.9 2025/05/18 21:46:23 sjg Exp $
2 #
3 # Tests for the special .MAKEFLAGS variable, which collects almost all
4 # command line arguments and passes them on to any child processes via
5 # the environment variable MAKEFLAGS (without leading '.').
6 #
7 # See also:
8 # varname-dot-makeoverrides.mk
9
10 # expect+1: MAKEFLAGS=<undefined>
11 .info MAKEFLAGS=<${MAKEFLAGS:Uundefined}>
12 # expect+1: .MAKEFLAGS=< -r -k>
13 .info .MAKEFLAGS=<${.MAKEFLAGS}>
14 # expect+1: .MAKEOVERRIDES=<>
15 .info .MAKEOVERRIDES=<${.MAKEOVERRIDES:Uundefined}>
16
17 # Append an option with argument, a plain option and a variable assignment.
18 .MAKEFLAGS: -DVARNAME -r VAR=value
19
20 # expect+1: MAKEFLAGS=<undefined>
21 .info MAKEFLAGS=<${MAKEFLAGS:Uundefined}>
22 # expect+1: .MAKEFLAGS=< -r -k -D VARNAME -r>
23 .info .MAKEFLAGS=<${.MAKEFLAGS}>
24 # expect+1: .MAKEOVERRIDES=< VAR>
25 .info .MAKEOVERRIDES=<${.MAKEOVERRIDES}>
26
27 # After parsing, the environment variable 'MAKEFLAGS' is set based on the
28 # special variables '.MAKEFLAGS' and '.MAKEOVERRIDES'.
29 runtime:
30 @echo '$@: MAKEFLAGS=<'${MAKEFLAGS:Q}'>'
31 @echo '$@: .MAKEFLAGS=<'${.MAKEFLAGS:Q}'>'
32 @echo '$@: .MAKEOVERRIDES=<'${.MAKEOVERRIDES:Q}'>'
33