waf/waflib/Tools/suncxx.py

67 lines
1.4 KiB
Python
Raw Normal View History

2011-09-10 11:13:51 +02:00
#!/usr/bin/env python
# encoding: utf-8
2016-06-25 20:10:04 +02:00
# Thomas Nagy, 2006-2016 (ita)
2011-09-10 11:13:51 +02:00
# Ralf Habacker, 2006 (rh)
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_sxx(conf):
"""
2016-06-25 23:54:12 +02:00
Detects the sun C++ compiler
2011-09-10 11:13:51 +02:00
"""
v = conf.env
2014-11-20 20:43:56 +01:00
cc = conf.find_program(['CC', 'c++'], var='CXX')
2011-09-10 11:13:51 +02:00
try:
conf.cmd_and_log(cc + ['-flags'])
2012-02-11 14:49:27 +01:00
except Exception:
2011-09-10 11:13:51 +02:00
conf.fatal('%r is not a Sun compiler' % cc)
2014-11-20 20:43:56 +01:00
v.CXX_NAME = 'sun'
conf.get_suncc_version(cc)
2011-09-10 11:13:51 +02:00
@conf
def sxx_common_flags(conf):
"""
Flags required for executing the sun C++ compiler
"""
v = conf.env
2016-06-25 23:54:12 +02:00
v.CXX_SRC_F = []
v.CXX_TGT_F = ['-c', '-o', '']
2011-09-10 11:13:51 +02:00
2016-06-25 23:54:12 +02:00
if not v.LINK_CXX:
v.LINK_CXX = v.CXX
2011-09-10 11:13:51 +02:00
2016-06-25 23:54:12 +02:00
v.CXXLNK_SRC_F = []
v.CXXLNK_TGT_F = ['-o', '']
v.CPPPATH_ST = '-I%s'
v.DEFINES_ST = '-D%s'
2011-09-10 11:13:51 +02:00
2016-06-25 23:54:12 +02:00
v.LIB_ST = '-l%s' # template for adding libs
v.LIBPATH_ST = '-L%s' # template for adding libpaths
v.STLIB_ST = '-l%s'
v.STLIBPATH_ST = '-L%s'
2011-09-10 11:13:51 +02:00
2016-06-25 23:54:12 +02:00
v.SONAME_ST = '-Wl,-h,%s'
v.SHLIB_MARKER = '-Bdynamic'
v.STLIB_MARKER = '-Bstatic'
2011-09-10 11:13:51 +02:00
2016-06-25 23:54:12 +02:00
v.cxxprogram_PATTERN = '%s'
2011-09-10 11:13:51 +02:00
2016-06-25 23:54:12 +02:00
v.CXXFLAGS_cxxshlib = ['-xcode=pic32', '-DPIC']
v.LINKFLAGS_cxxshlib = ['-G']
v.cxxshlib_PATTERN = 'lib%s.so'
v.LINKFLAGS_cxxstlib = ['-Bstatic']
v.cxxstlib_PATTERN = 'lib%s.a'
2011-09-10 11:13:51 +02:00
def configure(conf):
conf.find_sxx()
conf.find_ar()
conf.sxx_common_flags()
conf.cxx_load_tools()
conf.cxx_add_flags()
conf.link_add_flags()