99 See the License for the specific language governing permissions and
1010 limitations under the License.
1111
12- .. _ projectconf_dynamic_vars :
12+ .. _ projectconf_interpolation :
1313
14- Dynamic variables
15- -----------------
14+ Interpolation of Values
15+ -----------------------
1616
17- Dynamic variables (interpolations) are useful when you have a custom
18- configuration data between build environments. For examples, extra
19- :ref: `projectconf_build_flags ` or project dependencies :ref: `projectconf_lib_deps `.
17+ On top of the core functionality, PlatformIO supports interpolation. It enables values
18+ to contain format strings which refer to other values from foreign sections.
2019
21- Each variable should have a next format: ``${<section>.<option>} ``, where
20+ Interpolation has the next syntax – ``${<section>.<option>} ``, where
2221``<section> `` is a value from ``[<section>] `` group, and ``<option> `` is a
2322first item from pair ``<option> = value ``.
2423
25- You can inject system environment variable using `` sysenv `` as a `` section ``.
26- For example, `` ${sysenv.HOME} ``.
24+ .. list-table ::
25+ :header-rows: 1
2726
28- * Variable can be applied only for the option's value
29- * Multiple variables are allowed
27+ * - Syntax
28+ - Meaning
29+
30+ * - ``${sysenv.<name>} ``
31+ - Embed system environment variable by a name. For example,
32+ ``${sysenv.HOME} `` refers to user home directory on Unix machine
33+
34+ * - ``${platformio.<option>} ``
35+ - Embed value from :ref: `projectconf_section_platformio `. For example,
36+ ``${platformio.packages_dir} `` refers to a path of :ref: `projectconf_pio_packages_dir `
37+
38+ * - ``${env.<option>} ``
39+ - Embed default value from :ref: `projectconf_section_env `. For example,
40+ ``${env.debug_build_flags} `` refers to the default debugging flags.
41+
42+ * - ``${<section>.<option>} ``
43+ - Embed value from another section. For example, ``${extra.lib_deps} `` embeds
44+ library dependencies declared in the section named ``extra ``.
45+
46+ * Interpolation can span multiple levels
47+ * Interpolation can be applied only for the option's value
48+ * Multiple interpolations are allowed
3049* The :ref: `projectconf_section_platformio ` and :ref: `projectconf_section_env `
3150 sections are reserved and could not be used as a custom section. Some good
3251 section names might be ``extra `` or ``custom ``.
@@ -37,7 +56,7 @@ For example, ``${sysenv.HOME}``.
3756 :ref: `projectconf_section_env ` or :ref: `projectconf_env_extends ` option which
3857 allows extending of other sections.
3958
40- Example:
59+ ** Example: **
4160
4261.. code-block :: ini
4362
0 commit comments