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