1 # Copyright (C) Christopher Currie 2003. Permission to copy, use,
2 # modify, sell and distribute this software is granted provided this
3 # copyright notice appears in all copies. This software is provided
4 # "as is" without express or implied warranty, and with no claim as
5 # to its suitability for any purpose.
10 import toolset : flags ;
15 feature.extend toolset : sun ;
16 toolset.inherit sun : unix ;
17 generators.override sun.prebuilt : builtin.lib-generator ;
18 generators.override sun.prebuilt : builtin.prebuilt ;
19 generators.override sun.searched-lib-generator : searched-lib-generator ;
22 # There are no less than 5 standard library options:
23 # 1) The default, which uses an old version of the Rogue Wave std lib,
24 # also available via -std=sun03.
25 # 2) C++03 mode + STLport, selected via the -library option.
26 # 3) C++03 mode plus the Apache std lib, selected via the -library option.
27 # 4) C++03 or C++11 in g++ compatibility mode, and GNU libstdc++3, selected via -std=c++03/11.
29 # Note that the -std, -library and -compat compiler switches appear to be largely mutually
30 # incompatible, and that going forward the -std switch seems to be the prefered one.
32 # See http://docs.oracle.com/cd/E37069_01/html/E37075/bkamw.html#OSSCPgnaof
34 feature.extend stdlib : sun-stlport ;
35 feature.compose <stdlib>sun-stlport
36 : <cxxflags>-library=stlport4 <cxxflags>-compat=5 <cxxflags>-features=zla
37 <linkflags>-library=stlport4 <linkflags>-compat=5
39 feature.extend stdlib : apache ;
40 feature.compose <stdlib>apache
41 : <cxxflags>-library=stdcxx4 <cxxflags>-compat=5 <cxxflags>-features=zla
42 <linkflags>-library=stdcxx4 <cxxflags>-compat=5
44 feature.extend stdlib : gnu ;
45 feature.compose <stdlib>gnu
46 : <cxxflags>-std=c++03 <linkflags>-std=c++03
49 rule init ( version ? : command * : options * )
52 common.check-init-parameters sun : version $(version) ] ;
54 command = [ common.get-invocation-command sun : CC
55 : $(command) : "/opt/SUNWspro/bin" ] ;
57 # Even if the real compiler is not found, put CC to
58 # command line so that user see command line that would have being executed.
61 common.handle-options sun : $(condition) : $(command) : $(options) ;
63 command_c = $(command[1--2]) $(command[-1]:B=cc) ;
65 toolset.flags sun CONFIG_C_COMMAND $(condition) : $(command_c) ;
69 generators.register-c-compiler sun.compile.c : C : OBJ : <toolset>sun ;
70 generators.register-c-compiler sun.compile.c++ : CPP : OBJ : <toolset>sun ;
72 # Declare flags and actions for compilation
73 flags sun.compile OPTIONS <debug-symbols>on : -g ;
74 flags sun.compile OPTIONS <profiling>on : -xprofile=tcov ;
75 flags sun.compile OPTIONS <optimization>speed : -xO4 ;
76 flags sun.compile OPTIONS <optimization>space : -xO2 -xspace ;
77 flags sun.compile OPTIONS <threading>multi : -mt ;
78 flags sun.compile OPTIONS <warnings>off : -erroff ;
79 flags sun.compile OPTIONS <warnings>on : -erroff=%none ;
80 flags sun.compile OPTIONS <warnings>all : -erroff=%none ;
81 flags sun.compile OPTIONS <warnings-as-errors>on : -errwarn ;
83 flags sun.compile.c++ OPTIONS <inlining>off : +d ;
85 # The -m32 and -m64 options are supported starting
86 # with Sun Studio 12. On earlier compilers, the
87 # 'address-model' feature is not supported and should not
88 # be used. Instead, use -xarch=generic64 command line
90 # See http://svn.boost.org/trac/boost/ticket/1186
92 flags sun OPTIONS <address-model>32 : -m32 ;
93 flags sun OPTIONS <address-model>64 : -m64 ;
94 # On sparc, there's a difference between -Kpic
95 # and -KPIC. The first is slightly more efficient,
96 # but has the limits on the size of GOT table.
97 # For minimal fuss on user side, we use -KPIC here.
98 # See http://svn.boost.org/trac/boost/ticket/1186#comment:6
99 # for detailed explanation.
100 flags sun OPTIONS <link>shared : -KPIC ;
102 flags sun.compile OPTIONS <cflags> ;
103 flags sun.compile.c++ OPTIONS <cxxflags> ;
104 flags sun.compile DEFINES <define> ;
105 flags sun.compile INCLUDES <include> ;
109 "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
114 "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
117 # Declare flags and actions for linking
118 flags sun.link OPTIONS <debug-symbols>on : -g ;
119 # Strip the binary when no debugging is needed
120 flags sun.link OPTIONS <debug-symbols>off : -s ;
121 flags sun.link OPTIONS <profiling>on : -xprofile=tcov ;
122 flags sun.link OPTIONS <threading>multi : -mt ;
123 flags sun.link OPTIONS <linkflags> ;
124 flags sun.link LINKPATH <library-path> ;
125 flags sun.link FINDLIBS-ST <find-static-library> ;
126 flags sun.link FINDLIBS-SA <find-shared-library> ;
127 flags sun.link LIBRARIES <library-file> ;
128 flags sun.link LINK-RUNTIME <runtime-link>static : static ;
129 flags sun.link LINK-RUNTIME <runtime-link>shared : dynamic ;
130 flags sun.link RPATH <dll-path> ;
131 # On gcc, there are separate options for dll path at runtime and
132 # link time. On Solaris, there's only one: -R, so we have to use
133 # it, even though it's bad idea.
134 flags sun.link RPATH <xdll-path> ;
136 # The POSIX real-time library is always needed (nanosleep, clock_gettime etc.)
137 flags sun.link FINDLIBS-SA : rt ;
139 rule link ( targets * : sources * : properties * )
141 SPACE on $(targets) = " " ;
144 actions link bind LIBRARIES
146 "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
149 # Slight mods for dlls
150 rule link.dll ( targets * : sources * : properties * )
152 SPACE on $(targets) = " " ;
155 actions link.dll bind LIBRARIES
157 "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" -h$(<[1]:D=) -G "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
160 # Declare action for creating static libraries
161 actions piecemeal archive
163 "$(CONFIG_COMMAND)" -xar -o "$(<)" "$(>)"