From 2433deba7889931c4bae679f116887fe49a2ce04 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 3 Jul 2018 18:30:06 +0200 Subject: Add Kconfig preprocessor Implement the Kconfig preprocessor described in https://github.com/torvalds/linux/blob/master/Documentation/kbuild/kconfig-macro-language.txt (which is now in linux-next and will appear in Linux 4.18). A new Kconfig.variables property holds all the preprocessor variables so that they can be inspected programmatically. Preprocessor variables are represented by a new Variable class. With the preprocessor, environment variables are referenced with $(FOO) instead of $FOO. For backwards compatibility, $FOO is accepted as well for now (and leaves "$FOO" as-is if FOO doesn't exist). The $FOO syntax might be dropped at some point in the future (together with a major version increase). It should be supported for a few months at least. Some internals were cleaned up too, mostly related to parsing. Some outdated documentation was fixed as well. --- README.rst | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'README.rst') diff --git a/README.rst b/README.rst index 3884e7a..e118834 100644 --- a/README.rst +++ b/README.rst @@ -18,6 +18,14 @@ should be relatively easy, if needed. The `Zephyr `_ project uses Kconfiglib exclusively, with lots of small helper scripts in other projects. +Kconfiglib implements the recently added `Kconfig preprocessor +`_. +For backwards compatibility, environment variables can be referenced both as +``$(FOO)`` (the new syntax) and as ``$FOO`` (the old syntax). Support for the +old syntax might be removed in the future (the major version would be increased +at the same time). Using the old syntax with an undefined environment variable +keeps the string as is. + Installation ------------ @@ -193,10 +201,14 @@ The following Kconfig extensions are available: - Environment variables are expanded directly in e.g. ``source`` and ``mainmenu`` statements, meaning ``option env`` symbols are redundant. + + This is the standard behavior with the new `Kconfig preprocessor + `_, + which Kconfiglib implements. - ``option env`` symbols are still supported for compatibility, - with the caveat that they must have the same name as the environment - variables they reference. A warning is printed if the names differ. + ``option env`` symbols are supported for backwards compatibility, with the + caveat that they must have the same name as the environment variables they + reference. A warning is printed if the names differ. Other features -------------- -- cgit v1.2.3