From 1c8731a10018e8ba1e6b30411a290ca50fa45d81 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 11 Jun 2020 16:04:50 -0400 Subject: envconfig: Add [constants] section in machine files Machine files already supports `+` operator as an implementation detail, since it's using eval(). Now make it an officially supported feature and add a way to define constants that are used while evaluating an entry value. --- docs/markdown/snippets/machine_file_constants.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/markdown/snippets/machine_file_constants.md (limited to 'docs/markdown/snippets') diff --git a/docs/markdown/snippets/machine_file_constants.md b/docs/markdown/snippets/machine_file_constants.md new file mode 100644 index 0000000..84b0848 --- /dev/null +++ b/docs/markdown/snippets/machine_file_constants.md @@ -0,0 +1,20 @@ +## Machine file constants + +Native and cross files now support string and list concatenation using the `+` +operator, and joining paths using the `/` operator. +Entries defined in the `[constants]` section can be used in any other section. +An entry defined in any other section can be used only within that same section and only +after it has been defined. + +```ini +[constants] +toolchain = '/toolchain' +common_flags = ['--sysroot=' + toolchain + '/sysroot'] + +[properties] +c_args = common_flags + ['-DSOMETHING'] +cpp_args = c_args + ['-DSOMETHING_ELSE'] + +[binaries] +c = toolchain + '/gcc' +``` -- cgit v1.1