Files
cubelinux-kernel/scripts/kconfig/tests/preprocess/variable/Kconfig
T
Greg Kroah-Hartman 598cf27219 Linux 6.19.3
Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org
Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com>
Tested-by: Peter Schneider <pschneider1968@googlemail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Salvatore Bonaccorso <carnil@debian.org>
Tested-by: Brett A C Sheffield <bacs@librecast.net>
Tested-by: Mark Brown <broonie@kernel.org>
Tested-by: Luna Jernberg <droidbittin@gmail.com>
Tested-by: Ronald Warsow <rwarsow@gmx.de>
Tested-by: Justin M. Forbes <jforbes@fedoraproject.org>
Tested-by: Ron Economos <re@w6rz.net>
Tested-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-02-19 16:33:27 +01:00

54 lines
1.2 KiB
Plaintext

# SPDX-License-Identifier: GPL-2.0
# Shorthand
warning = $(warning-if,y,$(1))
# Simply expanded variable.
X := 1
SIMPLE := $(X)
X := 2
$(warning,SIMPLE = $(SIMPLE))
# Recursively expanded variable.
X := 1
RECURSIVE = $(X)
X := 2
$(warning,RECURSIVE = $(RECURSIVE))
# Append something to a simply expanded variable.
Y := 3
SIMPLE += $(Y)
Y := 4
$(warning,SIMPLE = $(SIMPLE))
# Append something to a recursively expanded variable.
Y := 3
RECURSIVE += $(Y)
Y := 4
$(warning,RECURSIVE = $(RECURSIVE))
# Use += operator to an undefined variable.
# This works as a recursively expanded variable.
Y := 3
UNDEFINED_VARIABLE += $(Y)
Y := 4
$(warning,UNDEFINED_VARIABLE = $(UNDEFINED_VARIABLE))
# You can use variable references for the lefthand side of assignment statement.
X := A
Y := B
$(X)$(Y) := 5
$(warning,AB = $(AB))
# User-defined function.
greeting = $(1), my name is $(2).
$(warning,$(greeting,Hello,John))
# The number of arguments is not checked for user-defined functions.
# If some arguments are optional, it is useful to pass fewer parameters.
# $(2) will be blank in this case.
$(warning,$(greeting,Hello))
# Unreferenced parameters are just ignored.
$(warning,$(greeting,Hello,John,ignored,ignored))