]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/tools/qcc.jam
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / src / tools / qcc.jam
CommitLineData
7c673cae
FG
1# Copyright (c) 2001 David Abrahams.
2# Copyright (c) 2002-2003 Rene Rivera.
3# Copyright (c) 2002-2003 Vladimir Prus.
4#
5# Use, modification and distribution is subject to the Boost Software
6# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
7# http://www.boost.org/LICENSE_1_0.txt)
8
9import "class" : new ;
10import common ;
11import errors ;
12import feature ;
13import generators ;
14import os ;
15import property ;
16import set ;
17import toolset ;
18import type ;
19import unix ;
20
21feature.extend toolset : qcc ;
22
23toolset.inherit-generators qcc : unix : unix.link unix.link.dll ;
7c673cae
FG
24toolset.inherit-flags qcc : unix ;
25toolset.inherit-rules qcc : unix ;
26
27# Initializes the qcc toolset for the given version. If necessary, command may
28# be used to specify where the compiler is located. The parameter 'options' is a
29# space-delimited list of options, each one being specified as
30# <option-name>option-value. Valid option names are: cxxflags, linkflags and
31# linker-type. Accepted values for linker-type are gnu and sun, gnu being the
32# default.
33#
34# Example:
35# using qcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ;
36#
37rule init ( version ? : command * : options * )
38{
39 local condition = [ common.check-init-parameters qcc : version $(version) ] ;
40 local command = [ common.get-invocation-command qcc : QCC : $(command) ] ;
41 common.handle-options qcc : $(condition) : $(command) : $(options) ;
42}
43
44
45generators.register-c-compiler qcc.compile.c++ : CPP : OBJ : <toolset>qcc ;
46generators.register-c-compiler qcc.compile.c : C : OBJ : <toolset>qcc ;
47generators.register-c-compiler qcc.compile.asm : ASM : OBJ : <toolset>qcc ;
48
49
50# Declare flags for compilation.
51toolset.flags qcc.compile OPTIONS <debug-symbols>on : -gstabs+ ;
52
53# Declare flags and action for compilation.
54toolset.flags qcc.compile OPTIONS <optimization>off : -O0 ;
55toolset.flags qcc.compile OPTIONS <optimization>speed : -O3 ;
56toolset.flags qcc.compile OPTIONS <optimization>space : -Os ;
57
58toolset.flags qcc.compile OPTIONS <inlining>off : -Wc,-fno-inline ;
59toolset.flags qcc.compile OPTIONS <inlining>on : -Wc,-Wno-inline ;
60toolset.flags qcc.compile OPTIONS <inlining>full : -Wc,-finline-functions -Wc,-Wno-inline ;
61
62toolset.flags qcc.compile OPTIONS <warnings>off : -w ;
63toolset.flags qcc.compile OPTIONS <warnings>all : -Wc,-Wall ;
64toolset.flags qcc.compile OPTIONS <warnings-as-errors>on : -Wc,-Werror ;
65
66toolset.flags qcc.compile OPTIONS <profiling>on : -p ;
67
68toolset.flags qcc.compile OPTIONS <cflags> ;
69toolset.flags qcc.compile.c++ OPTIONS <cxxflags> ;
70toolset.flags qcc.compile DEFINES <define> ;
71toolset.flags qcc.compile INCLUDES <include> ;
72
73toolset.flags qcc.compile OPTIONS <link>shared : -shared ;
74
75toolset.flags qcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
76
77
78rule compile.c++
79{
80 # Here we want to raise the template-depth parameter value to something
81 # higher than the default value of 17. Note that we could do this using the
82 # feature.set-default rule but we do not want to set the default value for
83 # all toolsets as well.
84 #
85 # TODO: This 'modified default' has been inherited from some 'older Boost
86 # Build implementation' and has most likely been added to make some Boost
87 # library parts compile correctly. We should see what exactly prompted this
88 # and whether we can get around the problem more locally.
89 local template-depth = [ on $(1) return $(TEMPLATE_DEPTH) ] ;
90 if ! $(template-depth)
91 {
92 TEMPLATE_DEPTH on $(1) = 128 ;
93 }
94}
95
96actions compile.c++
97{
98 "$(CONFIG_COMMAND)" -Wc,-ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
99}
100
101actions compile.c
102{
11fdf7f2 103 "$(CONFIG_COMMAND)" -lang-c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
7c673cae
FG
104}
105
106actions compile.asm
107{
108 "$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
109}
110
111
112# The class checking that we do not try to use the <runtime-link>static property
113# while creating or using a shared library, since it is not supported by qcc/
114# /libc.
115#
116class qcc-linking-generator : unix-linking-generator
117{
118 rule generated-targets ( sources + : property-set : project name ? )
119 {
120 if <runtime-link>static in [ $(property-set).raw ]
121 {
122 local m ;
123 if [ id ] = "qcc.link.dll"
124 {
125 m = "on qcc, DLL can't be build with <runtime-link>static" ;
126 }
127 if ! $(m)
128 {
129 for local s in $(sources)
130 {
131 local type = [ $(s).type ] ;
132 if $(type) && [ type.is-derived $(type) SHARED_LIB ]
133 {
134 m = "on qcc, using DLLS together with the <runtime-link>static options is not possible " ;
135 }
136 }
137 }
138 if $(m)
139 {
140 errors.user-error $(m) : "It is suggested to use"
141 "<runtime-link>static together with <link>static." ;
142 }
143 }
144
145 return [ unix-linking-generator.generated-targets
146 $(sources) : $(property-set) : $(project) $(name) ] ;
147 }
148}
149
150generators.register [ new qcc-linking-generator qcc.link : LIB OBJ : EXE
151 : <toolset>qcc ] ;
152
153generators.register [ new qcc-linking-generator qcc.link.dll : LIB OBJ
154 : SHARED_LIB : <toolset>qcc ] ;
155
156generators.override qcc.prebuilt : builtin.prebuilt ;
157generators.override qcc.searched-lib-generator : searched-lib-generator ;
158
159
160# Declare flags for linking.
161# First, the common flags.
162toolset.flags qcc.link OPTIONS <debug-symbols>on : -gstabs+ ;
163toolset.flags qcc.link OPTIONS <profiling>on : -p ;
164toolset.flags qcc.link OPTIONS <linkflags> ;
165toolset.flags qcc.link LINKPATH <library-path> ;
166toolset.flags qcc.link FINDLIBS-ST <find-static-library> ;
167toolset.flags qcc.link FINDLIBS-SA <find-shared-library> ;
168toolset.flags qcc.link LIBRARIES <library-file> ;
169
170toolset.flags qcc.link FINDLIBS-SA : m ;
171
172# For <runtime-link>static we made sure there are no dynamic libraries in the
173# link.
174toolset.flags qcc.link OPTIONS <runtime-link>static : -static ;
175
176# Assuming this is just like with gcc.
177toolset.flags qcc.link RPATH : <dll-path> : unchecked ;
178toolset.flags qcc.link RPATH_LINK : <xdll-path> : unchecked ;
179
180
181# Declare actions for linking.
182#
183rule link ( targets * : sources * : properties * )
184{
185 SPACE on $(targets) = " " ;
186 # Serialize execution of the 'link' action, since running N links in
187 # parallel is just slower. For now, serialize only qcc links while it might
188 # be a good idea to serialize all links.
189 JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
190}
191
192actions link bind LIBRARIES
193{
194 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)
195}
196
197
198# Always remove archive and start again. Here is the rationale from Andre Hentz:
199# I had a file, say a1.c, that was included into liba.a. I moved a1.c to a2.c,
200# updated my Jamfiles and rebuilt. My program was crashing with absurd errors.
201# After some debugging I traced it back to the fact that a1.o was *still* in
202# liba.a
203RM = [ common.rm-command ] ;
204if [ os.name ] = NT
205{
206 RM = "if exist \"$(<[1])\" DEL \"$(<[1])\"" ;
207}
208
209
210# Declare action for creating static libraries. The 'r' letter means to add
211# files to the archive with replacement. Since we remove the archive, we do not
212# care about replacement, but there is no option to "add without replacement".
213# The 'c' letter suppresses warnings in case the archive does not exists yet.
214# That warning is produced only on some platforms, for whatever reasons.
215#
216# Use qcc driver to create archive, see
217# http://www.qnx.com/developers/docs/6.3.2/neutrino/utilities/q/qcc.html
218actions piecemeal archive
219{
220 $(RM) "$(<)"
221 "$(CONFIG_COMMAND)" -A "$(<)" "$(>)"
222}
223
224
225rule link.dll ( targets * : sources * : properties * )
226{
227 SPACE on $(targets) = " " ;
228 JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
229}
230
231
232# Differ from 'link' above only by -shared.
233#
234actions link.dll bind LIBRARIES
235{
b32b8144 236 "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)
7c673cae 237}