diff options
Diffstat (limited to 'doc/user/less-simple.xml')
| -rw-r--r-- | doc/user/less-simple.xml | 69 | 
1 files changed, 64 insertions, 5 deletions
diff --git a/doc/user/less-simple.xml b/doc/user/less-simple.xml index c17bdae..e8ff44a 100644 --- a/doc/user/less-simple.xml +++ b/doc/user/less-simple.xml @@ -2,7 +2,7 @@  <!DOCTYPE sconsdoc [      <!ENTITY % scons SYSTEM "../scons.mod">      %scons; -     +      <!ENTITY % builders-mod SYSTEM "../generated/builders.mod">      %builders-mod;      <!ENTITY % functions-mod SYSTEM "../generated/functions.mod"> @@ -21,7 +21,7 @@  <!-- -  Copyright (c) 2001 - 2017 The SCons Foundation +  Copyright (c) 2001 - 2019 The SCons Foundation    Permission is hereby granted, free of charge, to any person obtaining    a copy of this software and associated documentation files (the @@ -257,7 +257,7 @@ Program('program', Glob('*.c'))      (see <xref linkend="chap-variants"></xref>, below)      and repositories      (see <xref linkend="chap-repositories"></xref>, below), -    excluding some files  +    excluding some files      and returning strings rather than Nodes.      </para> @@ -311,7 +311,7 @@ Program('hello', ['hello.c'])      </para>      <important> -     +      <para>      Although &SCons; functions @@ -359,7 +359,7 @@ Program('program2', common_sources + ['program2.c'])      <para>      One drawback to the use of a Python list -    for source files is that  +    for source files is that      each file name must be enclosed in quotes      (either single quotes or double quotes).      This can get cumbersome and difficult to read @@ -644,4 +644,63 @@ Program('bar', bar_files)    </section> +  <section> +  <title>Overriding construction variables when calling a Builder</title> + +    <para> + +    It is possible to override or add construction variables +    when calling a builder method by passing additional keyword arguments. +    These overridden or added variables will only be in effect when +    building the target, so they will not affect other parts of the build. +    For example, if you want to add additional libraries for just one program: + +    </para> + +    <programlisting> +env.Program('hello', 'hello.c', LIBS=['gl', 'glut']) +    </programlisting> + +    <para> + +    or generate a shared library with a non-standard suffix: + +    </para> + +    <programlisting> +env.SharedLibrary('word', 'word.cpp', +                  SHLIBSUFFIX='.ocx', +                  LIBSUFFIXES=['.ocx']) +    </programlisting> + +    <para> + +    It is also possible to use the <literal>parse_flags</literal> +    keyword argument in an override to merge command-line +    style arguments into the appropriate construction +    variables (see &f-link-env-MergeFlags;). + +    </para> + +    <para> + +    This example adds 'include' to &cv-link-CPPPATH;, +    'EBUG' to &cv-link-CPPDEFINES;, and 'm' to &cv-link-LIBS;. + +    </para> + +    <programlisting> +env = Program('hello', 'hello.c', parse_flags='-Iinclude -DEBUG -lm') +    </programlisting> + +    <para> + +    Within the call to the builder action the environment is not cloned, +    instead an OverrideEnvironment() is created which is more +    light weight than a whole Environment() + +    </para> + +  </section> +  </chapter>  | 
