1*148ee845SSimon J. Gerraty# $NetBSD: varname-dot-makeflags.mk,v 1.8 2023/06/01 20:56:35 rillig Exp $ 206b9b3e0SSimon J. Gerraty# 306b9b3e0SSimon J. Gerraty# Tests for the special .MAKEFLAGS variable, which collects almost all 406b9b3e0SSimon J. Gerraty# command line arguments and passes them on to any child processes via 506b9b3e0SSimon J. Gerraty# the environment variable MAKEFLAGS (without leading '.'). 68c973ee2SSimon J. Gerraty# 78c973ee2SSimon J. Gerraty# See also: 88c973ee2SSimon J. Gerraty# varname-dot-makeoverrides.mk 906b9b3e0SSimon J. Gerraty 10*148ee845SSimon J. Gerraty# expect+1: MAKEFLAGS=<undefined> 118c973ee2SSimon J. Gerraty.info MAKEFLAGS=<${MAKEFLAGS:Uundefined}> 12*148ee845SSimon J. Gerraty# expect+1: .MAKEFLAGS=< -r -k> 138c973ee2SSimon J. Gerraty.info .MAKEFLAGS=<${.MAKEFLAGS}> 14*148ee845SSimon J. Gerraty# expect+1: .MAKEOVERRIDES=<> 158c973ee2SSimon J. Gerraty.info .MAKEOVERRIDES=<${.MAKEOVERRIDES:Uundefined}> 1606b9b3e0SSimon J. Gerraty 178c973ee2SSimon J. Gerraty# Append an option with argument, a plain option and a variable assignment. 188c973ee2SSimon J. Gerraty.MAKEFLAGS: -DVARNAME -r VAR=value 198c973ee2SSimon J. Gerraty 208c973ee2SSimon J. Gerraty# expect+1: MAKEFLAGS=<undefined> 218c973ee2SSimon J. Gerraty.info MAKEFLAGS=<${MAKEFLAGS:Uundefined}> 228c973ee2SSimon J. Gerraty# expect+1: .MAKEFLAGS=< -r -k -D VARNAME -r> 238c973ee2SSimon J. Gerraty.info .MAKEFLAGS=<${.MAKEFLAGS}> 248c973ee2SSimon J. Gerraty# expect+1: .MAKEOVERRIDES=< VAR> 258c973ee2SSimon J. Gerraty.info .MAKEOVERRIDES=<${.MAKEOVERRIDES}> 268c973ee2SSimon J. Gerraty 278c973ee2SSimon J. Gerraty# The environment variable 'MAKEFLAGS' is not available to child processes 288c973ee2SSimon J. Gerraty# when parsing the makefiles. This is different from exported variables, 298c973ee2SSimon J. Gerraty# which are already available during parse time. 308c973ee2SSimon J. Gerraty.if ${:!echo "\${MAKEFLAGS-undef}"!} != "undef" 318c973ee2SSimon J. Gerraty. error 328c973ee2SSimon J. Gerraty.endif 338c973ee2SSimon J. Gerraty 348c973ee2SSimon J. Gerraty# After parsing, the environment variable 'MAKEFLAGS' is set based on the 358c973ee2SSimon J. Gerraty# special variables '.MAKEFLAGS' and '.MAKEOVERRIDES'. 368c973ee2SSimon J. Gerratyruntime: 378c973ee2SSimon J. Gerraty @echo '$@: MAKEFLAGS=<'${MAKEFLAGS:Q}'>' 388c973ee2SSimon J. Gerraty @echo '$@: .MAKEFLAGS=<'${.MAKEFLAGS:Q}'>' 398c973ee2SSimon J. Gerraty @echo '$@: .MAKEOVERRIDES=<'${.MAKEOVERRIDES:Q}'>' 40