suncc.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_scc(conf):
  10. """
  11. Detects the Sun C compiler
  12. """
  13. v = conf.env
  14. cc = conf.find_program('cc', var='CC')
  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.CC_NAME = 'sun'
  20. conf.get_suncc_version(cc)
  21. @conf
  22. def scc_common_flags(conf):
  23. """
  24. Flags required for executing the sun C compiler
  25. """
  26. v = conf.env
  27. v.CC_SRC_F = []
  28. v.CC_TGT_F = ['-c', '-o', '']
  29. if not v.LINK_CC:
  30. v.LINK_CC = v.CC
  31. v.CCLNK_SRC_F = ''
  32. v.CCLNK_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.cprogram_PATTERN = '%s'
  43. v.CFLAGS_cshlib = ['-xcode=pic32', '-DPIC']
  44. v.LINKFLAGS_cshlib = ['-G']
  45. v.cshlib_PATTERN = 'lib%s.so'
  46. v.LINKFLAGS_cstlib = ['-Bstatic']
  47. v.cstlib_PATTERN = 'lib%s.a'
  48. def configure(conf):
  49. conf.find_scc()
  50. conf.find_ar()
  51. conf.scc_common_flags()
  52. conf.cc_load_tools()
  53. conf.cc_add_flags()
  54. conf.link_add_flags()