4 # Copyright The SCons Foundation
6 # Permission is hereby granted, free of charge, to any person obtaining
7 # a copy of this software and associated documentation files (the
8 # "Software"), to deal in the Software without restriction, including
9 # without limitation the rights to use, copy, modify, merge, publish,
10 # distribute, sublicense, and/or sell copies of the Software, and to
11 # permit persons to whom the Software is furnished to do so, subject to
12 # the following conditions:
14 # The above copyright notice and this permission notice shall be included
15 # in all copies or substantial portions of the Software.
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
18 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
19 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 Tool-specific initialization for the generic POSIX linker.
28 There normally shouldn't be any need to import this module directly.
29 It will usually be imported through the generic SCons.Tool.Tool()
37 from SCons
.Tool
import createProgBuilder
38 from SCons
.Tool
.linkCommon
import smart_link
39 from SCons
.Tool
.linkCommon
.LoadableModule
import setup_loadable_module_logic
40 from SCons
.Tool
.linkCommon
.SharedLibrary
import setup_shared_lib_logic
43 def generate(env
) -> None:
44 """Add Builders and construction variables for gnulink to an Environment."""
45 createProgBuilder(env
)
47 setup_shared_lib_logic(env
)
48 setup_loadable_module_logic(env
)
50 env
['SMARTLINK'] = smart_link
51 env
['LINK'] = "$SMARTLINK"
52 env
['LINKFLAGS'] = SCons
.Util
.CLVar('')
54 # __RPATH is only set to something ($_RPATH typically) on platforms that support it.
55 env
['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
56 env
['LIBDIRPREFIX'] = '-L'
57 env
['LIBDIRSUFFIX'] = ''
58 env
['_LIBFLAGS'] = '${_stripixes(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__, LIBLITERALPREFIX)}'
59 env
['LIBLINKPREFIX'] = '-l'
60 env
['LIBLINKSUFFIX'] = ''
64 # This module isn't really a Tool on its own, it's common logic for
70 # indent-tabs-mode:nil
72 # vim: set expandtab tabstop=4 shiftwidth=4: