summaryrefslogtreecommitdiff
path: root/doc/user/mergeflags.in
diff options
context:
space:
mode:
authorLuca Falavigna <dktrkranz@debian.org>2014-04-26 15:11:58 +0200
committerLuca Falavigna <dktrkranz@debian.org>2014-04-26 15:11:58 +0200
commita3a0ab66f0da855e75e3a0e2acfb8aa106b46510 (patch)
tree5352edff1387c3d7e5a8b49ec56524f085c22782 /doc/user/mergeflags.in
parent51fa4e4acb6fc8fc7a2af0fbdc21fd1e8feddb3a (diff)
parent140d836e9cd54fb67b969fd82ef7ed19ba574d40 (diff)
Merge tag 'upstream/2.3.1'
Upstream version 2.3.1
Diffstat (limited to 'doc/user/mergeflags.in')
-rw-r--r--doc/user/mergeflags.in137
1 files changed, 0 insertions, 137 deletions
diff --git a/doc/user/mergeflags.in b/doc/user/mergeflags.in
deleted file mode 100644
index f1997a0..0000000
--- a/doc/user/mergeflags.in
+++ /dev/null
@@ -1,137 +0,0 @@
-<!--
-
- Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be included
- in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
- KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
--->
-
- <para>
-
- &SCons; construction environments have a &MergeFlags; method
- that merges a dictionary of values into the construction environment.
- &MergeFlags; treats each value in the dictionary
- as a list of options such as one might pass to a command
- (such as a compiler or linker).
- &MergeFlags; will not duplicate an option
- if it already exists in the construction environment variable.
-
- </para>
-
- <para>
-
- &MergeFlags; tries to be intelligent about merging options.
- When merging options to any variable
- whose name ends in <varname>PATH</varname>,
- &MergeFlags; keeps the leftmost occurrence of the option,
- because in typical lists of directory paths,
- the first occurrence "wins."
- When merging options to any other variable name,
- &MergeFlags; keeps the rightmost occurrence of the option,
- because in a list of typical command-line options,
- the last occurrence "wins."
-
- </para>
-
- <scons_example name="MergeFlags1">
- <file name="SConstruct" printme="1">
- env = Environment()
- env.Append(CCFLAGS = '-option -O3 -O1')
- flags = { 'CCFLAGS' : '-whatever -O3' }
- env.MergeFlags(flags)
- print env['CCFLAGS']
- </file>
- </scons_example>
-
- <scons_output example="MergeFlags1">
- <scons_output_command>scons -Q</scons_output_command>
- </scons_output>
-
- <para>
-
- Note that the default value for &cv-link-CCFLAGS;
- <!--
- [TODO: for when we make CLVar public]
- is a <varname>CLVar</varname>,
- -->
- is an internal &SCons; object
- which automatically converts
- the options we specified as a string into a list.
-
- </para>
-
- <scons_example name="MergeFlags2">
- <file name="SConstruct" printme="1">
- env = Environment()
- env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include'])
- flags = { 'CPPPATH' : ['/usr/opt/include', '/usr/local/include'] }
- env.MergeFlags(flags)
- print env['CPPPATH']
- </file>
- </scons_example>
-
- <scons_output example="MergeFlags2">
- <scons_output_command>scons -Q</scons_output_command>
- </scons_output>
-
- <para>
-
- Note that the default value for &cv-link-CPPPATH;
- <!--
- [TODO: for when we make CLVar public]
- is a Python list, not a <varname>CLVar</varname>,
- -->
- is a normal Python list,
- so we must specify its values as a list
- in the dictionary we pass to the &MergeFlags; function.
-
- </para>
-
- <para>
-
- If &MergeFlags; is passed anything other than a dictionary,
- it calls the &ParseFlags; method to convert it into a dictionary.
-
- </para>
-
- <scons_example name="MergeFlags3">
- <file name="SConstruct" printme="1">
- env = Environment()
- env.Append(CCFLAGS = '-option -O3 -O1')
- env.Append(CPPPATH = ['/include', '/usr/local/include', '/usr/include'])
- env.MergeFlags('-whatever -I/usr/opt/include -O3 -I/usr/local/include')
- print env['CCFLAGS']
- print env['CPPPATH']
- </file>
- </scons_example>
-
- <scons_output example="MergeFlags3">
- <scons_output_command>scons -Q</scons_output_command>
- </scons_output>
-
- <para>
-
- In the combined example above,
- &ParseFlags; has sorted the options into their corresponding variables
- and returned a dictionary for &MergeFlags; to apply
- to the construction variables
- in the specified construction environment.
-
- </para>