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