···11+# SPDX-License-Identifier: GPL-2.022+33+# 'info' prints the argument to stdout.44+$(info,hello world 0)55+66+# 'warning-if', if the first argument is y, sends the second argument to stderr,77+# and the message is prefixed with the current file name and line number.88+$(warning-if,y,hello world 1)99+1010+# 'error-if' is similar, but it terminates the parsing immediately.1111+# The following is just no-op since the first argument is not y.1212+$(error-if,n,this should not be printed)1313+1414+# Shorthand1515+warning = $(warning-if,y,$(1))1616+1717+# 'shell' executes a command, and returns its stdout.1818+$(warning,$(shell,echo hello world 3))1919+2020+# Every newline in the output is replaced with a space,2121+# but any trailing newlines are deleted.2222+$(warning,$(shell,printf 'hello\nworld\n\n4\n\n\n'))2323+2424+# 'filename' is expanded to the currently parsed file name,2525+# 'lineno' to the line number.2626+$(warning,filename=$(filename))2727+$(warning,lineno=$(lineno))
···11+# SPDX-License-Identifier: GPL-2.022+33+# Shorthand44+warning = $(warning-if,y,$(1))55+66+# You can not pass commas directly to a function since they are treated as77+# delimiters. You can use the following trick to do so.88+comma := ,99+$(warning,hello$(comma) world)1010+1111+# Like Make, single quotes, double quotes, spaces are treated verbatim.1212+# The following prints the text as-is.1313+$(warning, ' " '" ' ''' "'")1414+1515+# Unlike Make, '$' has special meaning only when it is followed by '('.1616+# No need to escape '$' itself.1717+$(warning,$)1818+$(warning,$$)1919+$ := 12020+$(warning,$($))2121+2222+# You need a trick to escape '$' followed by '('2323+# The following should print "$(X)". It should not be expanded further.2424+dollar := $2525+$(warning,$(dollar)(X))2626+2727+# You need a trick to treat unbalanced parentheses.2828+# The following should print "(".2929+left_paren := (3030+$(warning,$(left_paren))3131+3232+# A simple expanded should not be expanded multiple times.3333+# The following should print "$(X)". It should not be expanded further.3434+Y := $(dollar)(X)3535+$(warning,$(Y))3636+3737+# The following should print "$(X)" as well.3838+Y = $(dollar)(X)3939+$(warning,$(Y))4040+4141+# The following should print "$(".4242+# It should not be emit "unterminated reference" error.4343+unterminated := $(dollar)(4444+$(warning,$(unterminated))
···11+# SPDX-License-Identifier: GPL-2.022+33+# Shorthand44+warning = $(warning-if,y,$(1))55+66+# Simply expanded variable.77+X := 188+SIMPLE := $(X)99+X := 21010+$(warning,SIMPLE = $(SIMPLE))1111+1212+# Recursively expanded variable.1313+X := 11414+RECURSIVE = $(X)1515+X := 21616+$(warning,RECURSIVE = $(RECURSIVE))1717+1818+# Append something to a simply expanded variable.1919+Y := 32020+SIMPLE += $(Y)2121+Y := 42222+$(warning,SIMPLE = $(SIMPLE))2323+2424+# Append something to a recursively expanded variable.2525+Y := 32626+RECURSIVE += $(Y)2727+Y := 42828+$(warning,RECURSIVE = $(RECURSIVE))2929+3030+# Use += operator to an undefined variable.3131+# This works as a recursively expanded variable.3232+Y := 33333+UNDEFINED_VARIABLE += $(Y)3434+Y := 43535+$(warning,UNDEFINED_VARIABLE = $(UNDEFINED_VARIABLE))3636+3737+# You can use variable references for the lefthand side of assignment statement.3838+X := A3939+Y := B4040+$(X)$(Y) := 54141+$(warning,AB = $(AB))4242+4343+# User-defined function.4444+greeting = $(1), my name is $(2).4545+$(warning,$(greeting,Hello,John))4646+4747+# The number of arguments is not checked for user-defined functions.4848+# If some arguments are optional, it is useful to pass fewer parameters.4949+# $(2) will be blank in this case.5050+$(warning,$(greeting,Hello))5151+5252+# Unreferenced parameters are just ignored.5353+$(warning,$(greeting,Hello,John,ignored,ignored))
···11+Kconfig:10: SIMPLE = 122+Kconfig:16: RECURSIVE = 233+Kconfig:22: SIMPLE = 1 344+Kconfig:28: RECURSIVE = 2 455+Kconfig:35: UNDEFINED_VARIABLE = 466+Kconfig:41: AB = 577+Kconfig:45: Hello, my name is John.88+Kconfig:50: Hello, my name is .99+Kconfig:53: Hello, my name is John.