freebsd-src/unit-tests/varname-dot-makeflags.mk
Simon J. Gerraty 51d8a8b4ac Import bmake-20230414
Relevant/interesting changes:

	* make.1: document seemingly unexplained Error code 6.
	o compat.c: CompatDeleteTarget skip .PHONY targets to be
	consistent with JobDeleteTarget.
	o job.c: fix memory leak in handling sysv :from=to modifiers
	o unit tests for .MAKE.META.IGNORE_{FILTER,PATHS,PATTERNS}
	o var.c: fix parsing of unevaluated subexpressions with
	unbalanced '{}'
	o cond.c: reduce complexity of evaluating expressions
2023-04-24 16:44:30 -07:00

37 lines
1.3 KiB
Makefile

# $NetBSD: varname-dot-makeflags.mk,v 1.7 2023/02/25 19:24:07 rillig Exp $
#
# Tests for the special .MAKEFLAGS variable, which collects almost all
# command line arguments and passes them on to any child processes via
# the environment variable MAKEFLAGS (without leading '.').
#
# See also:
# varname-dot-makeoverrides.mk
.info MAKEFLAGS=<${MAKEFLAGS:Uundefined}>
.info .MAKEFLAGS=<${.MAKEFLAGS}>
.info .MAKEOVERRIDES=<${.MAKEOVERRIDES:Uundefined}>
# Append an option with argument, a plain option and a variable assignment.
.MAKEFLAGS: -DVARNAME -r VAR=value
# expect+1: MAKEFLAGS=<undefined>
.info MAKEFLAGS=<${MAKEFLAGS:Uundefined}>
# expect+1: .MAKEFLAGS=< -r -k -D VARNAME -r>
.info .MAKEFLAGS=<${.MAKEFLAGS}>
# expect+1: .MAKEOVERRIDES=< VAR>
.info .MAKEOVERRIDES=<${.MAKEOVERRIDES}>
# The environment variable 'MAKEFLAGS' is not available to child processes
# when parsing the makefiles. This is different from exported variables,
# which are already available during parse time.
.if ${:!echo "\${MAKEFLAGS-undef}"!} != "undef"
. error
.endif
# After parsing, the environment variable 'MAKEFLAGS' is set based on the
# special variables '.MAKEFLAGS' and '.MAKEOVERRIDES'.
runtime:
@echo '$@: MAKEFLAGS=<'${MAKEFLAGS:Q}'>'
@echo '$@: .MAKEFLAGS=<'${.MAKEFLAGS:Q}'>'
@echo '$@: .MAKEOVERRIDES=<'${.MAKEOVERRIDES:Q}'>'