]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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. | |
6 | ||
7 | import property ; | |
8 | import generators ; | |
9 | import os ; | |
10 | import toolset : flags ; | |
11 | import feature ; | |
12 | import type ; | |
13 | import common ; | |
14 | ||
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 ; | |
20 | ||
21 | # | |
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. | |
28 | # | |
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. | |
31 | # | |
32 | # See http://docs.oracle.com/cd/E37069_01/html/E37075/bkamw.html#OSSCPgnaof | |
33 | # | |
34 | feature.extend stdlib : sun-stlport ; | |
35 | feature.compose <stdlib>sun-stlport | |
b32b8144 FG |
36 | : <cxxflags>-library=stlport4 <cxxflags>-compat=5 <cxxflags>-features=zla |
37 | <linkflags>-library=stlport4 <linkflags>-compat=5 | |
7c673cae FG |
38 | ; |
39 | feature.extend stdlib : apache ; | |
40 | feature.compose <stdlib>apache | |
b32b8144 FG |
41 | : <cxxflags>-library=stdcxx4 <cxxflags>-compat=5 <cxxflags>-features=zla |
42 | <linkflags>-library=stdcxx4 <cxxflags>-compat=5 | |
7c673cae FG |
43 | ; |
44 | feature.extend stdlib : gnu ; | |
45 | feature.compose <stdlib>gnu | |
46 | : <cxxflags>-std=c++03 <linkflags>-std=c++03 | |
47 | ; | |
48 | ||
49 | rule init ( version ? : command * : options * ) | |
50 | { | |
51 | local condition = [ | |
52 | common.check-init-parameters sun : version $(version) ] ; | |
53 | ||
54 | command = [ common.get-invocation-command sun : CC | |
55 | : $(command) : "/opt/SUNWspro/bin" ] ; | |
56 | ||
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. | |
59 | command ?= CC ; | |
60 | ||
61 | common.handle-options sun : $(condition) : $(command) : $(options) ; | |
62 | ||
63 | command_c = $(command[1--2]) $(command[-1]:B=cc) ; | |
64 | ||
65 | toolset.flags sun CONFIG_C_COMMAND $(condition) : $(command_c) ; | |
66 | } | |
67 | ||
68 | # Declare generators | |
69 | generators.register-c-compiler sun.compile.c : C : OBJ : <toolset>sun ; | |
70 | generators.register-c-compiler sun.compile.c++ : CPP : OBJ : <toolset>sun ; | |
71 | ||
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 ; | |
82 | ||
83 | flags sun.compile.c++ OPTIONS <inlining>off : +d ; | |
84 | ||
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 | |
89 | # option. | |
90 | # See http://svn.boost.org/trac/boost/ticket/1186 | |
91 | # for details. | |
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 ; | |
101 | ||
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> ; | |
106 | ||
107 | actions compile.c | |
108 | { | |
109 | "$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
110 | } | |
111 | ||
112 | actions compile.c++ | |
113 | { | |
114 | "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
115 | } | |
116 | ||
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> ; | |
135 | ||
136 | # The POSIX real-time library is always needed (nanosleep, clock_gettime etc.) | |
137 | flags sun.link FINDLIBS-SA : rt ; | |
138 | ||
139 | rule link ( targets * : sources * : properties * ) | |
140 | { | |
141 | SPACE on $(targets) = " " ; | |
142 | } | |
143 | ||
144 | actions link bind LIBRARIES | |
145 | { | |
146 | "$(CONFIG_COMMAND)" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME) | |
147 | } | |
148 | ||
149 | # Slight mods for dlls | |
150 | rule link.dll ( targets * : sources * : properties * ) | |
151 | { | |
152 | SPACE on $(targets) = " " ; | |
153 | } | |
154 | ||
155 | actions link.dll bind LIBRARIES | |
156 | { | |
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) | |
158 | } | |
159 | ||
160 | # Declare action for creating static libraries | |
161 | actions piecemeal archive | |
162 | { | |
163 | "$(CONFIG_COMMAND)" -xar -o "$(<)" "$(>)" | |
164 | } | |
165 |