You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.5 KiB

6 years ago
  1. """SCons.Tool.sgiar
  2. Tool-specific initialization for SGI ar (library archive). If CC
  3. exists, static libraries should be built with it, so the prelinker has
  4. a chance to resolve C++ template instantiations.
  5. There normally shouldn't be any need to import this module directly.
  6. It will usually be imported through the generic SCons.Tool.Tool()
  7. selection method.
  8. """
  9. #
  10. # Copyright (c) 2001 - 2017 The SCons Foundation
  11. #
  12. # Permission is hereby granted, free of charge, to any person obtaining
  13. # a copy of this software and associated documentation files (the
  14. # "Software"), to deal in the Software without restriction, including
  15. # without limitation the rights to use, copy, modify, merge, publish,
  16. # distribute, sublicense, and/or sell copies of the Software, and to
  17. # permit persons to whom the Software is furnished to do so, subject to
  18. # the following conditions:
  19. #
  20. # The above copyright notice and this permission notice shall be included
  21. # in all copies or substantial portions of the Software.
  22. #
  23. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  24. # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  25. # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  27. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  28. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  29. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. #
  31. __revision__ = "src/engine/SCons/Tool/sgiar.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
  32. import SCons.Defaults
  33. import SCons.Tool
  34. import SCons.Util
  35. def generate(env):
  36. """Add Builders and construction variables for ar to an Environment."""
  37. SCons.Tool.createStaticLibBuilder(env)
  38. if env.Detect('CC'):
  39. env['AR'] = 'CC'
  40. env['ARFLAGS'] = SCons.Util.CLVar('-ar')
  41. env['ARCOM'] = '$AR $ARFLAGS -o $TARGET $SOURCES'
  42. else:
  43. env['AR'] = 'ar'
  44. env['ARFLAGS'] = SCons.Util.CLVar('r')
  45. env['ARCOM'] = '$AR $ARFLAGS $TARGET $SOURCES'
  46. env['SHLINK'] = '$LINK'
  47. env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
  48. env['SHLINKCOM'] = '$SHLINK $SHLINKFLAGS -o $TARGET $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
  49. env['LIBPREFIX'] = 'lib'
  50. env['LIBSUFFIX'] = '.a'
  51. def exists(env):
  52. return env.Detect('CC') or env.Detect('ar')
  53. # Local Variables:
  54. # tab-width:4
  55. # indent-tabs-mode:nil
  56. # End:
  57. # vim: set expandtab tabstop=4 shiftwidth=4: