€•;xŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ1/translations/zh_CN/kbuild/kconfig-macro-language”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/zh_TW/kbuild/kconfig-macro-language”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/it_IT/kbuild/kconfig-macro-language”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ja_JP/kbuild/kconfig-macro-language”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/ko_KR/kbuild/kconfig-macro-language”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/pt_BR/kbuild/kconfig-macro-language”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ1/translations/sp_SP/kbuild/kconfig-macro-language”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒKconfig macro language”h]”hŒKconfig macro language”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒK/var/lib/git/docbuild/linux/Documentation/kbuild/kconfig-macro-language.rst”h´Kubh¶)”}”(hhh]”(h»)”}”(hŒConcept”h]”hŒConcept”…””}”(hhÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhhËh²hh³hÊh´KubhŒ paragraph”“”)”}”(hŒ÷The basic idea was inspired by Make. When we look at Make, we notice sort of two languages in one. One language describes dependency graphs consisting of targets and prerequisites. The other is a macro language for performing textual substitution.”h]”hŒ÷The basic idea was inspired by Make. When we look at Make, we notice sort of two languages in one. One language describes dependency graphs consisting of targets and prerequisites. The other is a macro language for performing textual substitution.”…””}”(hhÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubhÝ)”}”(hŒpThere is clear distinction between the two language stages. For example, you can write a makefile like follows::”h]”hŒoThere is clear distinction between the two language stages. For example, you can write a makefile like follows:”…””}”(hhìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K hhËh²hubhŒ literal_block”“”)”}”(hŒPAPP := foo SRC := foo.c CC := gcc $(APP): $(SRC) $(CC) -o $(APP) $(SRC)”h]”hŒPAPP := foo SRC := foo.c CC := gcc $(APP): $(SRC) $(CC) -o $(APP) $(SRC)”…””}”hhüsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1húh³hÊh´KhhËh²hubhÝ)”}”(hŒ‰The macro language replaces the variable references with their expanded form, and handles as if the source file were input like follows::”h]”hŒˆThe macro language replaces the variable references with their expanded form, and handles as if the source file were input like follows:”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubhû)”}”(hŒ#foo: foo.c gcc -o foo foo.c”h]”hŒ#foo: foo.c gcc -o foo foo.c”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”j j uh1húh³hÊh´KhhËh²hubhÝ)”}”(hŒRThen, Make analyzes the dependency graph and determines the targets to be updated.”h]”hŒRThen, Make analyzes the dependency graph and determines the targets to be updated.”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KhhËh²hubhÝ)”}”(hŒ\The idea is quite similar in Kconfig - it is possible to describe a Kconfig file like this::”h]”hŒ[The idea is quite similar in Kconfig - it is possible to describe a Kconfig file like this:”…””}”(hj6h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K hhËh²hubhû)”}”(hŒaCC := gcc config CC_HAS_FOO def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC))”h]”hŒaCC := gcc config CC_HAS_FOO def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC))”…””}”hjDsbah}”(h]”h ]”h"]”h$]”h&]”j j uh1húh³hÊh´K#hhËh²hubhÝ)”}”(hŒYThe macro language in Kconfig processes the source file into the following intermediate::”h]”hŒXThe macro language in Kconfig processes the source file into the following intermediate:”…””}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K(hhËh²hubhû)”}”(hŒ$config CC_HAS_FOO def_bool y”h]”hŒ$config CC_HAS_FOO def_bool y”…””}”hj`sbah}”(h]”h ]”h"]”h$]”h&]”j j uh1húh³hÊh´K+hhËh²hubhÝ)”}”(hŒvThen, Kconfig moves onto the evaluation stage to resolve inter-symbol dependency as explained in kconfig-language.rst.”h]”hŒvThen, Kconfig moves onto the evaluation stage to resolve inter-symbol dependency as explained in kconfig-language.rst.”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K.hhËh²hubeh}”(h]”Œconcept”ah ]”h"]”Œconcept”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒ Variables”h]”hŒ Variables”…””}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj„h²hh³hÊh´K3ubhÝ)”}”(hXxLike in Make, a variable in Kconfig works as a macro variable. A macro variable is expanded "in place" to yield a text string that may then be expanded further. To get the value of a variable, enclose the variable name in $( ). The parentheses are required even for single-letter variable names; $X is a syntax error. The curly brace form as in ${CC} is not supported either.”h]”hX|Like in Make, a variable in Kconfig works as a macro variable. A macro variable is expanded “in place†to yield a text string that may then be expanded further. To get the value of a variable, enclose the variable name in $( ). The parentheses are required even for single-letter variable names; $X is a syntax error. The curly brace form as in ${CC} is not supported either.”…””}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K5hj„h²hubhÝ)”}”(hŒ_There are two types of variables: simply expanded variables and recursively expanded variables.”h]”hŒ_There are two types of variables: simply expanded variables and recursively expanded variables.”…””}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K;hj„h²hubhÝ)”}”(hŒŸA simply expanded variable is defined using the := assignment operator. Its righthand side is expanded immediately upon reading the line from the Kconfig file.”h]”hŒŸA simply expanded variable is defined using the := assignment operator. Its righthand side is expanded immediately upon reading the line from the Kconfig file.”…””}”(hj±h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K>hj„h²hubhÝ)”}”(hŒìA recursively expanded variable is defined using the = assignment operator. Its righthand side is simply stored as the value of the variable without expanding it in any way. Instead, the expansion is performed when the variable is used.”h]”hŒìA recursively expanded variable is defined using the = assignment operator. Its righthand side is simply stored as the value of the variable without expanding it in any way. Instead, the expansion is performed when the variable is used.”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KBhj„h²hubhÝ)”}”(hŒðThere is another type of assignment operator; += is used to append text to a variable. The righthand side of += is expanded immediately if the lefthand side was originally defined as a simple variable. Otherwise, its evaluation is deferred.”h]”hŒðThere is another type of assignment operator; += is used to append text to a variable. The righthand side of += is expanded immediately if the lefthand side was originally defined as a simple variable. Otherwise, its evaluation is deferred.”…””}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KGhj„h²hubhÝ)”}”(hŒCThe variable reference can take parameters, in the following form::”h]”hŒBThe variable reference can take parameters, in the following form:”…””}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KLhj„h²hubhû)”}”(hŒ$(name,arg1,arg2,arg3)”h]”hŒ$(name,arg1,arg2,arg3)”…””}”hjésbah}”(h]”h ]”h"]”h$]”h&]”j j uh1húh³hÊh´KNhj„h²hubhÝ)”}”(hŒ–You can consider the parameterized reference as a function. (more precisely, "user-defined function" in contrast to "built-in function" listed below).”h]”hŒžYou can consider the parameterized reference as a function. (more precisely, “user-defined function†in contrast to “built-in function†listed below).”…””}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KPhj„h²hubhÝ)”}”(hX"Useful functions must be expanded when they are used since the same function is expanded differently if different parameters are passed. Hence, a user-defined function is defined using the = assignment operator. The parameters are referenced within the body definition with $(1), $(2), etc.”h]”hX"Useful functions must be expanded when they are used since the same function is expanded differently if different parameters are passed. Hence, a user-defined function is defined using the = assignment operator. The parameters are referenced within the body definition with $(1), $(2), etc.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KShj„h²hubhÝ)”}”(hŒèIn fact, recursively expanded variables and user-defined functions are the same internally. (In other words, "variable" is "function with zero argument".) When we say "variable" in a broad sense, it includes "user-defined function".”h]”hŒøIn fact, recursively expanded variables and user-defined functions are the same internally. (In other words, “variable†is “function with zero argumentâ€.) When we say “variable†in a broad sense, it includes “user-defined functionâ€.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KXhj„h²hubeh}”(h]”Œ variables”ah ]”h"]”Œ variables”ah$]”h&]”uh1hµhh·h²hh³hÊh´K3ubh¶)”}”(hhh]”(h»)”}”(hŒBuilt-in functions”h]”hŒBuilt-in functions”…””}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj)h²hh³hÊh´K^ubhÝ)”}”(hŒnLike Make, Kconfig provides several built-in functions. Every function takes a particular number of arguments.”h]”hŒnLike Make, Kconfig provides several built-in functions. Every function takes a particular number of arguments.”…””}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K`hj)h²hubhÝ)”}”(hXIIn Make, every built-in function takes at least one argument. Kconfig allows zero argument for built-in functions, such as $(filename), $(lineno). You could consider those as "built-in variable", but it is just a matter of how we call it after all. Let's say "built-in function" here to refer to natively supported functionality.”h]”hXSIn Make, every built-in function takes at least one argument. Kconfig allows zero argument for built-in functions, such as $(filename), $(lineno). You could consider those as “built-in variableâ€, but it is just a matter of how we call it after all. Let’s say “built-in function†here to refer to natively supported functionality.”…””}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kchj)h²hubhÝ)”}”(hŒ