From b543458dd67d24a228fa2db0ecb4ddd20016a560 Mon Sep 17 00:00:00 2001 From: Scott Rifenbark Date: Thu, 1 Sep 2016 14:01:21 -0700 Subject: bitbake-user-manual: Added "Exporting Variables to the Environment" Fixes [YOCTO #10196] Added a new section named "Exporting Variables to the Environment". This section provides a dedicated description for how to export variables to the shell. Signed-off-by: Scott Rifenbark --- .../bitbake-user-manual-metadata.xml | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'doc/bitbake-user-manual/bitbake-user-manual-metadata.xml') diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml b/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml index 64f08157f..d4f73ae14 100644 --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.xml @@ -476,6 +476,53 @@ +
+ Exporting Variables to the Environment + + + You can export variables to the environment of running + tasks by using the export keyword. + For example, in the following example, the + do_foo task prints "value from + the environment" when run: + + export ENV_VARIABLE + ENV_VARIABLE = "value from the environment" + + do_foo() { + bbplain "$ENV_VARIABLE" + } + + + BitBake does not expand $ENV_VARIABLE + in this case because it lacks the obligatory + {}. + Rather, $ENV_VARIABLE is expanded + by the shell. + + It does not matter whether + export ENV_VARIABLE appears before or + after assignments to ENV_VARIABLE. + + + + It is also possible to combine export + with setting a value for the variable. + Here is an example: + + export ENV_VARIABLE = "variable-value" + + In the output of bitbake -e, variables + that are exported to the environment are preceded by "export". + + + + Among the variables commonly exported to the environment + are CC and CFLAGS, + which are picked up by many build systems. + +
+
Conditional Syntax (Overrides) -- cgit 1.2.3-korg