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.

81 lines
2.9 KiB

6 years ago
  1. """SCons.Tool.bcc32
  2. XXX
  3. """
  4. #
  5. # Copyright (c) 2001 - 2017 The SCons Foundation
  6. #
  7. # Permission is hereby granted, free of charge, to any person obtaining
  8. # a copy of this software and associated documentation files (the
  9. # "Software"), to deal in the Software without restriction, including
  10. # without limitation the rights to use, copy, modify, merge, publish,
  11. # distribute, sublicense, and/or sell copies of the Software, and to
  12. # permit persons to whom the Software is furnished to do so, subject to
  13. # the following conditions:
  14. #
  15. # The above copyright notice and this permission notice shall be included
  16. # in all copies or substantial portions of the Software.
  17. #
  18. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
  19. # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  20. # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  21. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  22. # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  23. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  24. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  25. #
  26. __revision__ = "src/engine/SCons/Tool/bcc32.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
  27. import os
  28. import os.path
  29. import SCons.Defaults
  30. import SCons.Tool
  31. import SCons.Util
  32. def findIt(program, env):
  33. # First search in the SCons path and then the OS path:
  34. borwin = env.WhereIs(program) or SCons.Util.WhereIs(program)
  35. if borwin:
  36. dir = os.path.dirname(borwin)
  37. env.PrependENVPath('PATH', dir)
  38. return borwin
  39. def generate(env):
  40. findIt('bcc32', env)
  41. """Add Builders and construction variables for bcc to an
  42. Environment."""
  43. static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
  44. for suffix in ['.c', '.cpp']:
  45. static_obj.add_action(suffix, SCons.Defaults.CAction)
  46. shared_obj.add_action(suffix, SCons.Defaults.ShCAction)
  47. static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)
  48. shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter)
  49. env['CC'] = 'bcc32'
  50. env['CCFLAGS'] = SCons.Util.CLVar('')
  51. env['CFLAGS'] = SCons.Util.CLVar('')
  52. env['CCCOM'] = '$CC -q $CFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES'
  53. env['SHCC'] = '$CC'
  54. env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
  55. env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS')
  56. env['SHCCCOM'] = '$SHCC -WD $SHCFLAGS $SHCCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o$TARGET $SOURCES'
  57. env['CPPDEFPREFIX'] = '-D'
  58. env['CPPDEFSUFFIX'] = ''
  59. env['INCPREFIX'] = '-I'
  60. env['INCSUFFIX'] = ''
  61. env['SHOBJSUFFIX'] = '.dll'
  62. env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0
  63. env['CFILESUFFIX'] = '.cpp'
  64. def exists(env):
  65. return findIt('bcc32', env)
  66. # Local Variables:
  67. # tab-width:4
  68. # indent-tabs-mode:nil
  69. # End:
  70. # vim: set expandtab tabstop=4 shiftwidth=4: