xref: /linux/scripts/kconfig/tests/preprocess/escape/Kconfig (revision 95298d63c67673c654c08952672d016212b26054)
1# SPDX-License-Identifier: GPL-2.0
2
3# Shorthand
4warning = $(warning-if,y,$(1))
5
6# You can not pass commas directly to a function since they are treated as
7# delimiters. You can use the following trick to do so.
8comma   := ,
9$(warning,hello$(comma) world)
10
11# Like Make, single quotes, double quotes, spaces are treated verbatim.
12# The following prints the text as-is.
13$(warning,  ' " '"   ' ''' "'")
14
15# Unlike Make, '$' has special meaning only when it is followed by '('.
16# No need to escape '$' itself.
17$(warning,$)
18$(warning,$$)
19$ := 1
20$(warning,$($))
21
22# You need a trick to escape '$' followed by '('
23# The following should print "$(X)". It should not be expanded further.
24dollar := $
25$(warning,$(dollar)(X))
26
27# You need a trick to treat unbalanced parentheses.
28# The following should print "(".
29left_paren := (
30$(warning,$(left_paren))
31
32# A simple expanded should not be expanded multiple times.
33# The following should print "$(X)". It should not be expanded further.
34Y := $(dollar)(X)
35$(warning,$(Y))
36
37# The following should print "$(X)" as well.
38Y = $(dollar)(X)
39$(warning,$(Y))
40
41# The following should print "$(".
42# It should not be emit "unterminated reference" error.
43unterminated := $(dollar)(
44$(warning,$(unterminated))
45