suncxx.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2006-2018 (ita)
  4. # Ralf Habacker, 2006 (rh)
  5. from waflib import Errors
  6. from waflib.Tools import ccroot, ar
  7. from waflib.Configure import conf
  8. @conf
  9. def find_sxx(conf):
  10. """
  11. Detects the sun C++ compiler
  12. """
  13. v = conf.env
  14. cc = conf.find_program(['CC', 'c++'], var='CXX')
  15. try:
  16. conf.cmd_and_log(cc + ['-flags'])
  17. except Errors.WafError:
  18. conf.fatal('%r is not a Sun compiler' % cc)
  19. v.CXX_NAME = 'sun'
  20. conf.get_suncc_version(cc)
  21. @conf
  22. def sxx_common_flags(conf):
  23. """
  24. Flags required for executing the sun C++ compiler
  25. """
  26. v = conf.env
  27. v.CXX_SRC_F = []
  28. v.CXX_TGT_F = ['-c', '-o', '']
  29. if not v.LINK_CXX:
  30. v.LINK_CXX = v.CXX
  31. v.CXXLNK_SRC_F = []
  32. v.CXXLNK_TGT_F = ['-o', '']
  33. v.CPPPATH_ST = '-I%s'
  34. v.DEFINES_ST = '-D%s'
  35. v.LIB_ST = '-l%s' # template for adding libs
  36. v.LIBPATH_ST = '-L%s' # template for adding libpaths
  37. v.STLIB_ST = '-l%s'
  38. v.STLIBPATH_ST = '-L%s'
  39. v.SONAME_ST = '-Wl,-h,%s'
  40. v.SHLIB_MARKER = '-Bdynamic'
  41. v.STLIB_MARKER = '-Bstatic'
  42. v.cxxprogram_PATTERN = '%s'
  43. v.CXXFLAGS_cxxshlib = ['-xcode=pic32', '-DPIC']
  44. v.LINKFLAGS_cxxshlib = ['-G']
  45. v.cxxshlib_PATTERN = 'lib%s.so'
  46. v.LINKFLAGS_cxxstlib = ['-Bstatic']
  47. v.cxxstlib_PATTERN = 'lib%s.a'
  48. def configure(conf):
  49. conf.find_sxx()
  50. conf.find_ar()
  51. conf.sxx_common_flags()
  52. conf.cxx_load_tools()
  53. conf.cxx_add_flags()
  54. conf.link_add_flags()