]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | # Copyright 2001 David Abrahams |
b32b8144 | 2 | # Copyright 2002-2017 Rene Rivera |
7c673cae FG |
3 | # Copyright 2002-2003 Vladimir Prus |
4 | # Copyright 2005 Reece H. Dunn | |
5 | # Copyright 2006 Ilya Sokolov | |
6 | # Copyright 2007 Roland Schwarz | |
7 | # Copyright 2007 Boris Gubenko | |
8 | # | |
9 | # Distributed under the Boost Software License, Version 1.0. | |
10 | # (See accompanying file LICENSE_1_0.txt or copy at | |
11 | # http://www.boost.org/LICENSE_1_0.txt) | |
12 | ||
13 | import "class" : new ; | |
14 | import common ; | |
15 | import cygwin ; | |
16 | import feature ; | |
17 | import fortran ; | |
18 | import generators ; | |
19 | import os ; | |
20 | import pch ; | |
21 | import property ; | |
22 | import property-set ; | |
23 | import rc ; | |
24 | import regex ; | |
25 | import set ; | |
26 | import toolset ; | |
27 | import type ; | |
28 | import unix ; | |
b32b8144 FG |
29 | import virtual-target ; |
30 | import errors ; | |
7c673cae FG |
31 | |
32 | ||
33 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] | |
34 | { | |
35 | .debug-configuration = true ; | |
36 | } | |
37 | ||
38 | ||
39 | feature.extend toolset : gcc ; | |
40 | # feature.subfeature toolset gcc : flavor : : optional ; | |
41 | ||
42 | toolset.inherit-generators gcc : unix : unix.link unix.link.dll ; | |
43 | toolset.inherit-flags gcc : unix ; | |
44 | toolset.inherit-rules gcc : unix ; | |
45 | ||
46 | generators.override gcc.prebuilt : builtin.prebuilt ; | |
47 | generators.override gcc.searched-lib-generator : searched-lib-generator ; | |
48 | ||
49 | # Make gcc toolset object files use the "o" suffix on all platforms. | |
50 | type.set-generated-target-suffix OBJ : <toolset>gcc : o ; | |
51 | type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>windows : o ; | |
52 | type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>cygwin : o ; | |
53 | ||
54 | ||
55 | # Initializes the gcc toolset for the given version. If necessary, command may | |
56 | # be used to specify where the compiler is located. The parameter 'options' is a | |
57 | # space-delimited list of options, each one specified as | |
58 | # <option-name>option-value. Valid option names are: cxxflags, linkflags and | |
59 | # linker-type. Accepted linker-type values are aix, darwin, gnu, hpux, osf or | |
60 | # sun and the default value will be selected based on the current OS. | |
61 | # Example: | |
62 | # using gcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ; | |
63 | # | |
64 | # The compiler command to use is detected in three steps: | |
65 | # 1) If an explicit command is specified by the user, it will be used and must | |
66 | # be available. | |
67 | # 2) If only a certain version is specified, it is enforced: | |
68 | # - either the 'g++-VERSION' command must be available | |
69 | # - or the default command 'g++' must be available and match the exact | |
70 | # version. | |
71 | # 3) Without user-provided restrictions use default 'g++'. | |
72 | # | |
b32b8144 | 73 | rule init ( version ? : command * : options * : requirement * ) |
7c673cae FG |
74 | { |
75 | #1): use user-provided command | |
76 | local tool-command = ; | |
77 | if $(command) | |
78 | { | |
79 | tool-command = [ common.get-invocation-command-nodefault gcc : g++ : | |
80 | $(command) ] ; | |
81 | if ! $(tool-command) | |
82 | { | |
83 | import errors ; | |
84 | errors.error toolset gcc initialization: | |
85 | : provided command '$(command)' not found | |
86 | : initialized from [ errors.nearest-user-location ] ; | |
87 | } | |
88 | } | |
89 | #2): enforce user-provided version | |
90 | else if $(version) | |
91 | { | |
92 | tool-command = [ common.get-invocation-command-nodefault gcc : | |
93 | "g++-$(version[1])" ] ; | |
94 | ||
95 | #2.1) fallback: check whether "g++" reports the requested version | |
96 | if ! $(tool-command) | |
97 | { | |
98 | tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] | |
99 | ; | |
100 | if $(tool-command) | |
101 | { | |
102 | local tool-command-string = \"$(tool-command)\" ; | |
103 | tool-command-string = $(tool-command-string:J=" ") ; | |
104 | local tool-version = [ MATCH "^([0-9.]+)" : | |
105 | [ SHELL "$(tool-command-string) -dumpversion" ] ] ; | |
106 | if $(tool-version) != $(version) | |
107 | { | |
108 | # Permit a match betwen a two-digit version specified by the | |
109 | # user (e.g. 4.4) and a 3-digit version reported by gcc. | |
110 | # Since only two digits are present in the binary name | |
111 | # anyway, insisting that user specify the 3-digit version | |
112 | # when configuring Boost.Build, while it is not required on | |
113 | # the command line, would be strange. | |
114 | local stripped = [ MATCH "^([0-9]+\.[0-9]+).*" : | |
115 | $(tool-version) ] ; | |
116 | if $(stripped) != $(version) | |
117 | { | |
118 | import errors ; | |
119 | errors.error toolset gcc initialization: | |
120 | : version '$(version)' requested but | |
121 | 'g++-$(version)' not found and version | |
122 | '$(tool-version)' of default '$(tool-command)' | |
123 | does not match | |
124 | : initialized from [ errors.nearest-user-location ] | |
125 | ; | |
126 | tool-command = ; | |
127 | } | |
128 | # Use full 3-digit version to be compatible with the | |
129 | # 'using gcc ;' case | |
130 | version = $(tool-version) ; | |
131 | } | |
132 | } | |
133 | else | |
134 | { | |
135 | import errors ; | |
136 | errors.error toolset gcc initialization: | |
137 | : version '$(version)' requested but neither | |
138 | 'g++-$(version)' nor default 'g++' found | |
139 | : initialized from [ errors.nearest-user-location ] ; | |
140 | } | |
141 | } | |
142 | } | |
143 | #3) default: no command and no version specified, try using "g++" | |
144 | else | |
145 | { | |
146 | tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] ; | |
147 | if ! $(tool-command) | |
148 | { | |
149 | import errors ; | |
150 | errors.error toolset gcc initialization: | |
151 | : no command provided, default command 'g++' not found | |
152 | : initialized from [ errors.nearest-user-location ] ; | |
153 | } | |
154 | } | |
155 | ||
156 | ||
157 | # Information about the gcc command... | |
158 | # The command. | |
159 | local command = $(tool-command) ; | |
160 | # The 'command' variable can have multiple elements but when calling the | |
161 | # SHELL builtin we need a single string, and we need to quote elements | |
162 | # with spaces. | |
163 | local command-string = \"$(command)\" ; | |
164 | command-string = $(command-string:J=" ") ; | |
165 | # The root directory of the tool install. | |
166 | local root = [ feature.get-values <root> : $(options) ] ; | |
167 | # The bin directory where to find the command to execute. | |
168 | local bin ; | |
169 | # The compiler flavor. | |
170 | local flavor = [ feature.get-values <flavor> : $(options) ] ; | |
b32b8144 FG |
171 | # vxworks build on windows uses csh that is neither mingw or cygwin |
172 | if [ feature.get-values <target-os> : $(options) ] = vxworks | |
173 | { | |
174 | flavor ?= vxworks ; | |
175 | } | |
7c673cae FG |
176 | # Autodetect the root and bin dir if not given. |
177 | if $(command) | |
178 | { | |
179 | bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; | |
180 | root ?= $(bin:D) ; | |
181 | } | |
182 | # Autodetect the version and flavor if not given. | |
183 | if $(command) | |
184 | { | |
185 | local machine = [ MATCH "^([^ ]+)" : | |
186 | [ SHELL "$(command-string) -dumpmachine" ] ] ; | |
187 | version ?= [ MATCH "^([0-9.]+)" : | |
188 | [ SHELL "$(command-string) -dumpversion" ] ] ; | |
189 | switch $(machine:L) | |
190 | { | |
191 | case *mingw* : flavor ?= mingw ; | |
192 | } | |
193 | } | |
194 | ||
195 | local condition ; | |
196 | if $(flavor) | |
197 | { | |
198 | condition = flavor $(flavor) ; | |
199 | } | |
b32b8144 | 200 | condition = [ common.check-init-parameters gcc $(requirement) : version $(version) |
7c673cae FG |
201 | : $(condition) ] ; |
202 | ||
203 | common.handle-options gcc : $(condition) : $(command) : $(options) ; | |
204 | ||
b32b8144 | 205 | init-link-flags gcc "" $(condition) ; |
7c673cae FG |
206 | |
207 | # If gcc is installed in a non-standard location, we would need to add | |
208 | # LD_LIBRARY_PATH when running programs created with it (for unit-test/run | |
209 | # rules). | |
210 | if $(command) | |
211 | { | |
212 | # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries | |
213 | # and all must be added to LD_LIBRARY_PATH. The linker will pick the | |
214 | # right onces. Note that we do not provide a clean way to build a 32-bit | |
215 | # binary using a 64-bit compiler, but user can always pass -m32 | |
216 | # manually. | |
217 | local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ; | |
218 | if $(.debug-configuration) | |
219 | { | |
220 | ECHO notice: using gcc libraries :: $(condition) :: $(lib_path) ; | |
221 | } | |
222 | toolset.flags gcc.link RUN_PATH $(condition) : $(lib_path) ; | |
223 | } | |
224 | ||
225 | # If we are not using a system gcc installation we should adjust the various | |
226 | # programs as needed to prefer using their installation specific versions. | |
227 | # This is essential for correct use of MinGW and for cross-compiling. | |
228 | ||
229 | # - Archive builder. | |
230 | local archiver = [ common.get-invocation-command gcc | |
231 | : [ .get-prog-name $(command-string) : ar : $(flavor) ] | |
232 | : [ feature.get-values <archiver> : $(options) ] | |
233 | : $(bin) | |
234 | : search-path ] ; | |
235 | toolset.flags gcc.archive .AR $(condition) : $(archiver[1]) ; | |
236 | if $(.debug-configuration) | |
237 | { | |
238 | ECHO notice: using gcc archiver :: $(condition) :: $(archiver[1]) ; | |
239 | } | |
240 | ||
241 | # - Ranlib. | |
242 | local ranlib = [ common.get-invocation-command gcc | |
243 | : [ .get-prog-name $(command-string) : ranlib : $(flavor) ] | |
244 | : [ feature.get-values <ranlib> : $(options) ] | |
245 | : $(bin) | |
246 | : search-path ] ; | |
247 | toolset.flags gcc.archive .RANLIB $(condition) : $(ranlib[1]) ; | |
248 | if $(.debug-configuration) | |
249 | { | |
250 | ECHO notice: using gcc ranlib :: $(condition) :: $(ranlib[1]) ; | |
251 | } | |
252 | ||
253 | # - Resource compiler. | |
254 | local rc = [ common.get-invocation-command-nodefault gcc : windres : | |
255 | [ feature.get-values <rc> : $(options) ] : $(bin) : search-path ] ; | |
256 | local rc-type = [ feature.get-values <rc-type> : $(options) ] ; | |
257 | rc-type ?= windres ; | |
258 | if ! $(rc) | |
259 | { | |
260 | # If we can not find an RC compiler we fallback to a null one that | |
261 | # creates empty object files. This allows the same Jamfiles to work | |
262 | # across the board. The null RC uses assembler to create the empty | |
263 | # objects, so configure that. | |
264 | rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ] | |
265 | ; | |
266 | rc-type = null ; | |
267 | } | |
268 | rc.configure $(rc) : $(condition) : <rc-type>$(rc-type) ; | |
b32b8144 FG |
269 | |
270 | toolset.flags gcc VERSION $(condition) : [ regex.split $(version) "[.]" ] ; | |
7c673cae FG |
271 | } |
272 | ||
273 | if [ os.name ] = NT | |
274 | { | |
275 | # This causes single-line command invocation to not go through .bat files, | |
276 | # thus avoiding command-line length limitations. | |
277 | # TODO: Set JAMSHELL on specific targets instead of globally. | |
278 | JAMSHELL = % ; | |
279 | } | |
280 | ||
281 | # Uses -print-prog-name to get the name of the tool. | |
282 | # Converts the path to native form if using cygwin. | |
283 | rule .get-prog-name ( command-string : tool : flavor ? ) | |
284 | { | |
285 | local prog-name = [ NORMALIZE_PATH [ MATCH "(.*)[\n]+" : | |
286 | [ SHELL "$(command-string) -print-prog-name=$(tool)" ] ] ] ; | |
b32b8144 FG |
287 | |
288 | if $(flavor) != vxworks && $(flavor) != mingw && [ os.name ] = NT | |
7c673cae FG |
289 | { |
290 | prog-name = [ cygwin.cygwin-to-windows-path $(prog-name) ] ; | |
291 | } | |
292 | return $(prog-name) ; | |
293 | } | |
294 | ||
b32b8144 FG |
295 | ### |
296 | ### Functions that set options on the targets. | |
297 | ### | |
7c673cae | 298 | |
b32b8144 | 299 | rule set-fpic-options ( targets * : sources * : properties * ) |
7c673cae FG |
300 | { |
301 | local link = [ feature.get-values link : $(properties) ] ; | |
302 | if $(link) = shared | |
303 | { | |
b32b8144 | 304 | local target-os = [ feature.get-values target-os : $(properties) ] ; |
7c673cae FG |
305 | |
306 | # This logic will add -fPIC for all compilations: | |
307 | # | |
308 | # lib a : a.cpp b ; | |
309 | # obj b : b.cpp ; | |
310 | # exe c : c.cpp a d ; | |
311 | # obj d : d.cpp ; | |
312 | # | |
313 | # This all is fine, except that 'd' will be compiled with -fPIC even | |
314 | # though it is not needed, as 'd' is used only in exe. However, it is | |
315 | # hard to detect where a target is going to be used. Alternatively, we | |
316 | # can set -fPIC only when main target type is LIB but than 'b' would be | |
317 | # compiled without -fPIC which would lead to link errors on x86-64. So, | |
318 | # compile everything with -fPIC. | |
319 | # | |
320 | # Yet another alternative would be to create a propagated <sharedable> | |
321 | # feature and set it when building shared libraries, but that would be | |
322 | # hard to implement and would increase the target path length even more. | |
323 | ||
324 | # On Windows, fPIC is the default, and specifying -fPIC explicitly leads | |
325 | # to a warning. | |
b32b8144 | 326 | if ! $(target-os) in cygwin windows |
7c673cae FG |
327 | { |
328 | OPTIONS on $(targets) += -fPIC ; | |
329 | } | |
330 | } | |
331 | } | |
332 | ||
b32b8144 | 333 | rule set-address-model-options ( targets * : sources * : properties * ) |
7c673cae FG |
334 | { |
335 | local model = [ feature.get-values address-model : $(properties) ] ; | |
336 | if $(model) | |
337 | { | |
338 | local option ; | |
b32b8144 FG |
339 | local target-os = [ feature.get-values target-os : $(properties) ] ; |
340 | if $(target-os) = aix | |
7c673cae FG |
341 | { |
342 | if $(model) = 32 | |
343 | { | |
344 | option = -maix32 ; | |
345 | } | |
346 | else | |
347 | { | |
348 | option = -maix64 ; | |
349 | } | |
350 | } | |
b32b8144 | 351 | else if $(target-os) = hpux |
7c673cae FG |
352 | { |
353 | if $(model) = 32 | |
354 | { | |
355 | option = -milp32 ; | |
356 | } | |
357 | else | |
358 | { | |
359 | option = -mlp64 ; | |
360 | } | |
361 | } | |
362 | else | |
363 | { | |
364 | local arch = [ feature.get-values architecture : $(properties) ] ; | |
365 | if $(arch) = power || $(arch) = sparc || $(arch) = x86 | |
366 | { | |
367 | if $(model) = 32 | |
368 | { | |
369 | option = -m32 ; | |
370 | } | |
371 | else if $(model) = 64 | |
372 | { | |
373 | option = -m64 ; | |
374 | } | |
375 | } | |
376 | # For darwin, the model can be 32_64. darwin.jam will handle that | |
377 | # on its own. | |
378 | } | |
379 | OPTIONS on $(targets) += $(option) ; | |
380 | } | |
381 | } | |
382 | ||
b32b8144 FG |
383 | rule set-threading-options ( targets * : sources * : properties * ) |
384 | { | |
385 | local threading = [ feature.get-values threading : $(properties) ] ; | |
386 | if $(threading) = multi | |
387 | { | |
388 | local target-os = [ feature.get-values target-os : $(properties) ] ; | |
389 | local host-os = [ feature.get-values host-os : $(properties) ] ; | |
390 | local toolset = [ feature.get-values toolset : $(properties) ] ; | |
391 | local option ; | |
392 | local libs ; | |
393 | ||
394 | if $(toolset) = clang && $(target-os) = windows | |
395 | { | |
396 | option = -pthread ; | |
397 | } | |
398 | ||
399 | switch $(target-os) | |
400 | { | |
401 | case android : # No threading options, everything is in already. | |
402 | case windows : option ?= -mthreads ; | |
403 | case cygwin : option ?= -mthreads ; | |
404 | case solaris : option ?= -pthreads ; libs = rt ; | |
405 | case beos : # No threading options. | |
406 | case haiku : # No threading options. | |
407 | case *bsd : option ?= -pthread ; # There is no -lrt on BSD. | |
408 | case sgi : # gcc on IRIX does not support multi-threading. | |
409 | case darwin : # No threading options. | |
410 | case vxworks : # No threading options. | |
411 | case * : option ?= -pthread ; libs = rt ; | |
412 | } | |
413 | if $(option) | |
414 | { | |
415 | OPTIONS on $(targets) += $(option) ; | |
416 | } | |
417 | if $(libs) | |
418 | { | |
419 | FINDLIBS-SA on $(targets) += $(libs) ; | |
420 | } | |
421 | } | |
422 | } | |
7c673cae | 423 | |
b32b8144 | 424 | local rule zero-pad ( numbers * ) |
7c673cae | 425 | { |
b32b8144 FG |
426 | local result ; |
427 | for local n in $(numbers) | |
428 | { | |
429 | switch $(n) | |
430 | { | |
431 | case ???? : result += $(n) ; | |
432 | case ??? : result += 0$(n) ; | |
433 | case ?? : result += 00$(n) ; | |
434 | case ? : result += 000$(n) ; | |
435 | } | |
436 | } | |
437 | return $(result) ; | |
7c673cae FG |
438 | } |
439 | ||
b32b8144 | 440 | rule set-cxxstd-options ( targets * : sources * : properties * : action ) |
7c673cae | 441 | { |
b32b8144 FG |
442 | local *targets = [ $(action).targets ] ; |
443 | local *sources = [ $(action).sources ] ; | |
444 | local target-type = [ $(*targets[1]).type ] ; | |
445 | local source-type = [ $(*sources[1]).type ] ; | |
446 | local toolset = [ feature.get-values toolset : $(properties) ] ; | |
447 | local version = [ zero-pad [ on $(targets[1]) return $(VERSION) ] ] ; | |
448 | version = $(version[1]).$(version[2]) ; | |
449 | local cxxstd = [ feature.get-values cxxstd : $(properties) ] ; | |
450 | local cxxstd-dialect = [ feature.get-values cxxstd-dialect : $(properties) ] ; | |
451 | cxxstd-dialect ?= iso ; | |
452 | switch $(cxxstd-dialect) | |
453 | { | |
454 | case gnu : cxxstd-dialect = gnu++ ; | |
455 | case iso : cxxstd-dialect = c++ ; | |
456 | case * : | |
457 | errors.warning Unknown cxxstd-dialect $(cxxstd-dialect:E=?) .. using | |
458 | ISO dialect instead. ; | |
459 | cxxstd-dialect = c++ ; | |
460 | } | |
461 | local option ; | |
462 | if $(cxxstd) = latest | |
463 | { | |
464 | if $(toolset) = gcc | |
465 | { | |
466 | if $(version) >= 0008.0000 { option = 2a ; } | |
467 | else if $(version) >= 0005.0001 { option = 1z ; } | |
468 | else if $(version) >= 0004.0008 { option = 1y ; } | |
469 | else if $(version) >= 0004.0007 { option = 11 ; } | |
470 | else if $(version) >= 0003.0003 { option = 98 ; } | |
471 | } | |
472 | if $(toolset) = clang | |
473 | { | |
474 | if $(version) >= 0003.0005 { option = 1z ; } | |
475 | if $(version) >= 0003.0004 { option = 14 ; } | |
476 | if $(version) >= 0003.0003 { option = 11 ; } | |
477 | option ?= 03 ; | |
478 | } | |
479 | } | |
480 | else | |
481 | { | |
482 | option = $(cxxstd) ; | |
483 | } | |
484 | if $(source-type) in CPP || $(target-type) in CPP_PCH EXE SHARED_LIB | |
485 | { | |
486 | OPTIONS on $(targets) += -std=$(cxxstd-dialect)$(option) ; | |
487 | } | |
7c673cae FG |
488 | } |
489 | ||
b32b8144 FG |
490 | ### |
491 | ### Compiling generators and actions. | |
492 | ### | |
7c673cae | 493 | |
b32b8144 | 494 | class gcc-c-compiling-generator : C-compiling-generator |
7c673cae | 495 | { |
b32b8144 FG |
496 | rule action-class ( ) |
497 | { | |
498 | return gcc-c-compile-action ; | |
499 | } | |
7c673cae FG |
500 | } |
501 | ||
b32b8144 | 502 | class gcc-c-compile-action : compile-action |
7c673cae | 503 | { |
b32b8144 FG |
504 | import gcc ; |
505 | ||
506 | rule execute ( action-name targets + : sources * : properties * ) | |
507 | { | |
508 | gcc.set-threading-options $(targets) : $(sources) : $(properties) ; | |
509 | gcc.set-fpic-options $(targets) : $(sources) : $(properties) ; | |
510 | gcc.set-address-model-options $(targets) : $(sources) : $(properties) ; | |
511 | gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ; | |
512 | compile-action.execute $(action-name) $(targets) : $(sources) : $(properties) ; | |
513 | } | |
7c673cae FG |
514 | } |
515 | ||
b32b8144 FG |
516 | local rule register-gcc-c-compiler ( id : source-types + : target-types + : requirements * |
517 | : optional-properties * ) | |
7c673cae | 518 | { |
b32b8144 FG |
519 | generators.register [ new gcc-c-compiling-generator $(id) : $(source-types) : |
520 | $(target-types) : $(requirements) : $(optional-properties) ] ; | |
7c673cae FG |
521 | } |
522 | ||
b32b8144 FG |
523 | register-gcc-c-compiler gcc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : <toolset>gcc ; |
524 | register-gcc-c-compiler gcc.compile.c.preprocess : C : PREPROCESSED_C : <toolset>gcc ; | |
525 | register-gcc-c-compiler gcc.compile.c++ : CPP : OBJ : <toolset>gcc ; | |
526 | register-gcc-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ; | |
527 | register-gcc-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ; | |
528 | ||
529 | class gcc-fortran-compiling-generator : fortran-compiling-generator | |
7c673cae | 530 | { |
b32b8144 FG |
531 | rule action-class ( ) |
532 | { | |
533 | return gcc-fortran-compile-action ; | |
534 | } | |
7c673cae FG |
535 | } |
536 | ||
b32b8144 | 537 | class gcc-fortran-compile-action : compile-action |
7c673cae | 538 | { |
b32b8144 FG |
539 | import gcc ; |
540 | ||
541 | rule execute ( action-name targets + : sources * : properties * ) | |
542 | { | |
543 | gcc.set-threading-options $(targets) : $(sources) : $(properties) ; | |
544 | gcc.set-fpic-options $(targets) : $(sources) : $(properties) ; | |
545 | gcc.set-address-model-options $(targets) : $(sources) : $(properties) ; | |
546 | gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ; | |
547 | compile-action.execute $(action-name) $(targets) : $(sources) : $(properties) ; | |
548 | } | |
549 | } | |
550 | ||
551 | generators.register [ new gcc-fortran-compiling-generator | |
552 | gcc.compile.fortran : FORTRAN FORTRAN90 : OBJ : <toolset>gcc ] ; | |
7c673cae | 553 | |
b32b8144 FG |
554 | rule compile.c++.preprocess ( targets * : sources * : properties * ) |
555 | { | |
7c673cae FG |
556 | # Some extensions are compiled as C++ by default. For others, we need to |
557 | # pass -x c++. We could always pass -x c++ but distcc does not work with it. | |
558 | if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C | |
559 | { | |
560 | LANG on $(<) = "-x c++" ; | |
561 | } | |
562 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
563 | } | |
564 | ||
565 | rule compile.c.preprocess ( targets * : sources * : properties * ) | |
566 | { | |
7c673cae FG |
567 | # If we use the name g++ then default file suffix -> language mapping does |
568 | # not work. So have to pass -x option. Maybe, we can work around this by | |
569 | # allowing the user to specify both C and C++ compiler names. | |
570 | #if $(>:S) != .c | |
571 | #{ | |
572 | LANG on $(<) = "-x c" ; | |
573 | #} | |
574 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
575 | } | |
576 | ||
577 | rule compile.c++ ( targets * : sources * : properties * ) | |
578 | { | |
7c673cae FG |
579 | # Some extensions are compiled as C++ by default. For others, we need to |
580 | # pass -x c++. We could always pass -x c++ but distcc does not work with it. | |
581 | if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C | |
582 | { | |
583 | LANG on $(<) = "-x c++" ; | |
584 | } | |
585 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
7c673cae FG |
586 | } |
587 | ||
588 | rule compile.c ( targets * : sources * : properties * ) | |
589 | { | |
7c673cae FG |
590 | # If we use the name g++ then default file suffix -> language mapping does |
591 | # not work. So have to pass -x option. Maybe, we can work around this by | |
592 | # allowing the user to specify both C and C++ compiler names. | |
593 | #if $(>:S) != .c | |
594 | #{ | |
595 | LANG on $(<) = "-x c" ; | |
596 | #} | |
597 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
598 | } | |
599 | ||
600 | rule compile.fortran ( targets * : sources * : properties * ) | |
601 | { | |
7c673cae FG |
602 | } |
603 | ||
604 | actions compile.c++ bind PCH_FILE | |
605 | { | |
606 | "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)" | |
607 | } | |
608 | ||
609 | actions compile.c bind PCH_FILE | |
610 | { | |
611 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
612 | } | |
613 | ||
614 | actions compile.c++.preprocess bind PCH_FILE | |
615 | { | |
616 | "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>:W)" -E >"$(<:W)" | |
617 | } | |
618 | ||
619 | actions compile.c.preprocess bind PCH_FILE | |
620 | { | |
621 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>)" -E >$(<) | |
622 | } | |
623 | ||
624 | actions compile.fortran | |
625 | { | |
626 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
627 | } | |
628 | ||
629 | rule compile.asm ( targets * : sources * : properties * ) | |
630 | { | |
7c673cae FG |
631 | LANG on $(<) = "-x assembler-with-cpp" ; |
632 | } | |
633 | ||
634 | actions compile.asm | |
635 | { | |
b32b8144 | 636 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" |
7c673cae FG |
637 | } |
638 | ||
b32b8144 FG |
639 | ### |
640 | ### Preconpiled header use and generation. | |
641 | ### | |
642 | ||
643 | # The compiler looks for a precompiled header in each directory just before it | |
644 | # looks for the include file in that directory. The name searched for is the | |
645 | # name specified in the #include directive with ".gch" suffix appended. The | |
646 | # logic in gcc-pch-generator will make sure that the BASE_PCH suffix is appended | |
647 | # to the full header name. | |
648 | ||
649 | type.set-generated-target-suffix PCH : <toolset>gcc : gch ; | |
650 | ||
651 | # GCC-specific pch generator. | |
652 | class gcc-pch-generator : pch-generator | |
653 | { | |
654 | import project ; | |
655 | import property-set ; | |
656 | import type ; | |
657 | ||
658 | rule run-pch ( project name ? : property-set : sources + ) | |
659 | { | |
660 | # Find the header in sources. Ignore any CPP sources. | |
661 | local header ; | |
662 | for local s in $(sources) | |
663 | { | |
664 | if [ type.is-derived [ $(s).type ] H ] | |
665 | { | |
666 | header = $(s) ; | |
667 | } | |
668 | } | |
669 | ||
670 | # Error handling: base header file name should be the same as the base | |
671 | # precompiled header name. | |
672 | local header-name = [ $(header).name ] ; | |
673 | local header-basename = $(header-name:B) ; | |
674 | if $(header-basename) != $(name) | |
675 | { | |
676 | local location = [ $(project).project-module ] ; | |
677 | import errors : user-error : errors.user-error ; | |
678 | errors.user-error "in" $(location): pch target name '$(name)' should | |
679 | be the same as the base name of header file '$(header-name)' ; | |
680 | } | |
681 | ||
682 | local pch-file = [ generator.run $(project) $(name) : $(property-set) | |
683 | : $(header) ] ; | |
684 | ||
685 | # Return result of base class and pch-file property as | |
686 | # usage-requirements. | |
687 | return | |
688 | [ property-set.create <pch-file>$(pch-file) <cflags>-Winvalid-pch ] | |
689 | $(pch-file) | |
690 | ; | |
691 | } | |
692 | ||
693 | # Calls the base version specifying source's name as the name of the created | |
694 | # target. As a result, the PCH will be named whatever.hpp.gch, and not | |
695 | # whatever.gch. | |
696 | rule generated-targets ( sources + : property-set : project name ? ) | |
697 | { | |
698 | name = [ $(sources[1]).name ] ; | |
699 | return [ generator.generated-targets $(sources) | |
700 | : $(property-set) : $(project) $(name) ] ; | |
701 | } | |
702 | ||
703 | rule action-class ( ) | |
704 | { | |
705 | return gcc-pch-compile-action ; | |
706 | } | |
707 | } | |
708 | ||
709 | class gcc-pch-compile-action : compile-action | |
710 | { | |
711 | import gcc ; | |
712 | ||
713 | rule execute ( action-name targets + : sources * : properties * ) | |
714 | { | |
715 | gcc.set-threading-options $(targets) : $(sources) : $(properties) ; | |
716 | gcc.set-fpic-options $(targets) : $(sources) : $(properties) ; | |
717 | gcc.set-address-model-options $(targets) : $(sources) : $(properties) ; | |
718 | gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ; | |
719 | compile-action.execute $(action-name) $(targets) : $(sources) : $(properties) ; | |
720 | } | |
721 | } | |
722 | ||
723 | # Note: the 'H' source type will catch both '.h' header and '.hpp' header. The | |
724 | # latter have HPP type, but HPP type is derived from H. The type of compilation | |
725 | # is determined entirely by the destination type. | |
726 | generators.register [ new gcc-pch-generator gcc.compile.c.pch : H : C_PCH : <pch>on <toolset>gcc ] ; | |
727 | generators.register [ new gcc-pch-generator gcc.compile.c++.pch : H : CPP_PCH : <pch>on <toolset>gcc ] ; | |
728 | ||
729 | # Override default do-nothing generators. | |
730 | generators.override gcc.compile.c.pch : pch.default-c-pch-generator ; | |
731 | generators.override gcc.compile.c++.pch : pch.default-cpp-pch-generator ; | |
732 | ||
733 | toolset.flags gcc.compile PCH_FILE <pch>on : <pch-file> ; | |
734 | ||
735 | rule compile.c++.pch ( targets * : sources * : properties * ) | |
736 | { | |
737 | } | |
738 | ||
739 | actions compile.c++.pch | |
740 | { | |
741 | "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
742 | } | |
743 | ||
744 | rule compile.c.pch ( targets * : sources * : properties * ) | |
745 | { | |
746 | } | |
747 | ||
748 | actions compile.c.pch | |
749 | { | |
750 | "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
751 | } | |
752 | ||
753 | ### | |
754 | ### General options, like optimization. | |
755 | ### | |
756 | ||
757 | # Declare flags and action for compilation. | |
758 | toolset.flags gcc.compile OPTIONS <optimization>off : -O0 ; | |
759 | toolset.flags gcc.compile OPTIONS <optimization>speed : -O3 ; | |
760 | toolset.flags gcc.compile OPTIONS <optimization>space : -Os ; | |
761 | ||
762 | toolset.flags gcc.compile OPTIONS <inlining>off : -fno-inline ; | |
763 | toolset.flags gcc.compile OPTIONS <inlining>on : -Wno-inline ; | |
764 | toolset.flags gcc.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ; | |
765 | ||
766 | toolset.flags gcc.compile OPTIONS <warnings>off : -w ; | |
767 | toolset.flags gcc.compile OPTIONS <warnings>on : -Wall ; | |
768 | toolset.flags gcc.compile OPTIONS <warnings>all : -Wall -pedantic ; | |
769 | toolset.flags gcc.compile OPTIONS <warnings-as-errors>on : -Werror ; | |
770 | ||
771 | toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ; | |
772 | toolset.flags gcc.compile OPTIONS <profiling>on : -pg ; | |
773 | ||
774 | toolset.flags gcc.compile.c++ OPTIONS <rtti>off : -fno-rtti ; | |
775 | toolset.flags gcc.compile.c++ OPTIONS <exception-handling>off : -fno-exceptions ; | |
776 | ||
777 | ### | |
778 | ### User free feature options. | |
779 | ### | |
780 | ||
781 | toolset.flags gcc.compile USER_OPTIONS <cflags> ; | |
782 | toolset.flags gcc.compile.c++ USER_OPTIONS <cxxflags> ; | |
783 | toolset.flags gcc.compile.asm USER_OPTIONS <asmflags> ; | |
784 | toolset.flags gcc.compile DEFINES <define> ; | |
785 | toolset.flags gcc.compile INCLUDES <include> ; | |
786 | toolset.flags gcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ; | |
787 | toolset.flags gcc.compile.fortran USER_OPTIONS <fflags> ; | |
788 | ||
789 | ### | |
790 | ### Linking generators and actions. | |
791 | ### | |
792 | ||
7c673cae FG |
793 | # Class checking that we do not try to use the <runtime-link>static property |
794 | # while creating or using a shared library, since it is not supported by | |
795 | # gcc/libc. | |
796 | class gcc-linking-generator : unix-linking-generator | |
797 | { | |
798 | rule run ( project name ? : property-set : sources + ) | |
799 | { | |
b32b8144 FG |
800 | local target-os = [ $(property-set).get <target-os> ] ; |
801 | local no-static-link = true ; | |
802 | switch $(target-os) | |
7c673cae | 803 | { |
b32b8144 FG |
804 | case vms : no-static-link = ; |
805 | case windows : no-static-link = ; | |
7c673cae FG |
806 | } |
807 | ||
808 | local properties = [ $(property-set).raw ] ; | |
809 | local reason ; | |
810 | if $(no-static-link) && <runtime-link>static in $(properties) | |
811 | { | |
812 | if <link>shared in $(properties) | |
813 | { | |
814 | reason = On gcc, DLLs can not be built with | |
815 | '<runtime-link>static'. ; | |
816 | } | |
817 | else if [ type.is-derived $(self.target-types[1]) EXE ] | |
818 | { | |
819 | for local s in $(sources) | |
820 | { | |
821 | local type = [ $(s).type ] ; | |
822 | if $(type) && [ type.is-derived $(type) SHARED_LIB ] | |
823 | { | |
824 | reason = On gcc, using DLLs together with the | |
825 | '<runtime-link>static' option is not possible. ; | |
826 | } | |
827 | } | |
828 | } | |
829 | } | |
830 | if $(reason) | |
831 | { | |
832 | ECHO warning: $(reason) ; | |
833 | ECHO warning: It is suggested to use '<runtime-link>static' together | |
834 | with '<link>static'. ; | |
835 | } | |
836 | else | |
837 | { | |
838 | return [ unix-linking-generator.run $(project) $(name) : | |
839 | $(property-set) : $(sources) ] ; | |
840 | } | |
841 | } | |
b32b8144 FG |
842 | |
843 | rule action-class ( ) | |
844 | { | |
845 | return gcc-link-action ; | |
846 | } | |
847 | } | |
848 | ||
849 | class gcc-link-action : action | |
850 | { | |
851 | import gcc ; | |
852 | ||
853 | rule execute ( action-name targets + : sources * : properties * ) | |
854 | { | |
855 | gcc.set-threading-options $(targets) : $(sources) : $(properties) ; | |
856 | gcc.set-fpic-options $(targets) : $(sources) : $(properties) ; | |
857 | gcc.set-address-model-options $(targets) : $(sources) : $(properties) ; | |
858 | gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ; | |
859 | gcc.set-link-options $(action-name) $(targets) : $(sources) : $(properties) ; | |
860 | action.execute $(action-name) $(targets) : $(sources) : $(properties) ; | |
861 | } | |
7c673cae FG |
862 | } |
863 | ||
864 | # The set of permissible input types is different on mingw. So, define two sets | |
865 | # of generators, with mingw generators selected when target-os=windows. | |
866 | ||
867 | local g ; | |
868 | g = [ new gcc-linking-generator gcc.mingw.link | |
869 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
870 | : EXE | |
871 | : <toolset>gcc <target-os>windows ] ; | |
872 | $(g).set-rule-name gcc.link ; | |
873 | generators.register $(g) ; | |
874 | ||
875 | g = [ new gcc-linking-generator gcc.mingw.link.dll | |
876 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
877 | : IMPORT_LIB SHARED_LIB | |
878 | : <toolset>gcc <target-os>windows ] ; | |
879 | $(g).set-rule-name gcc.link.dll ; | |
880 | generators.register $(g) ; | |
881 | ||
882 | generators.register | |
883 | [ new gcc-linking-generator gcc.link | |
884 | : LIB OBJ | |
885 | : EXE | |
886 | : <toolset>gcc ] ; | |
887 | generators.register | |
888 | [ new gcc-linking-generator gcc.link.dll | |
889 | : LIB OBJ | |
890 | : SHARED_LIB | |
891 | : <toolset>gcc ] ; | |
892 | ||
893 | generators.override gcc.mingw.link : gcc.link ; | |
894 | generators.override gcc.mingw.link.dll : gcc.link.dll ; | |
895 | ||
896 | # Cygwin is similar to msvc and mingw in that it uses import libraries. While in | |
897 | # simple cases, it can directly link to a shared library, it is believed to be | |
898 | # slower, and not always possible. Define cygwin-specific generators here. | |
899 | ||
900 | g = [ new gcc-linking-generator gcc.cygwin.link | |
901 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
902 | : EXE | |
903 | : <toolset>gcc <target-os>cygwin ] ; | |
904 | $(g).set-rule-name gcc.link ; | |
905 | generators.register $(g) ; | |
906 | ||
907 | g = [ new gcc-linking-generator gcc.cygwin.link.dll | |
908 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
909 | : IMPORT_LIB SHARED_LIB | |
910 | : <toolset>gcc <target-os>cygwin ] ; | |
911 | $(g).set-rule-name gcc.link.dll ; | |
912 | generators.register $(g) ; | |
913 | ||
914 | generators.override gcc.cygwin.link : gcc.link ; | |
915 | generators.override gcc.cygwin.link.dll : gcc.link.dll ; | |
916 | ||
917 | # Declare flags for linking. | |
918 | # First, the common flags. | |
919 | toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ; | |
920 | toolset.flags gcc.link OPTIONS <profiling>on : -pg ; | |
921 | toolset.flags gcc.link USER_OPTIONS <linkflags> ; | |
922 | toolset.flags gcc.link LINKPATH <library-path> ; | |
923 | toolset.flags gcc.link FINDLIBS-ST <find-static-library> ; | |
924 | toolset.flags gcc.link FINDLIBS-SA <find-shared-library> ; | |
925 | toolset.flags gcc.link LIBRARIES <library-file> ; | |
926 | ||
927 | toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>windows : "-Wl,--out-implib," ; | |
928 | toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>cygwin : "-Wl,--out-implib," ; | |
929 | ||
b32b8144 FG |
930 | # Now, the vendor specific flags. |
931 | # The parameter linker can be either aix, darwin, gnu, hpux, osf or sun. | |
932 | rule init-link-flags ( toolset subtool condition ) | |
7c673cae | 933 | { |
b32b8144 FG |
934 | ## Need to define the linker-type feature once for each toolset module. |
935 | if ! [ feature.valid <toolset-$(toolset):linker-type> ] | |
936 | { | |
937 | feature.subfeature toolset $(toolset) : linker-type : | |
938 | gnu aix darwin hpux osf sun : propagated link-incompatible ; | |
939 | } | |
940 | ## The specification to add the linker-type is per toolset "instance". | |
941 | toolset.add-requirements | |
942 | $(condition),<target-os>aix:<toolset-$(toolset):linker-type>aix | |
943 | $(condition),<target-os>darwin:<toolset-$(toolset):linker-type>darwin | |
944 | $(condition),<target-os>hpux:<toolset-$(toolset):linker-type>hpux | |
945 | $(condition),<target-os>osf:<toolset-$(toolset):linker-type>osf | |
946 | $(condition),<target-os>solaris:<toolset-$(toolset):linker-type>sun | |
947 | ; | |
7c673cae FG |
948 | } |
949 | ||
b32b8144 | 950 | rule set-link-options ( action-name targets + : sources * : properties * ) |
7c673cae | 951 | { |
b32b8144 FG |
952 | local toolset = [ feature.get-values <toolset> : $(properties) ] ; |
953 | local linker-type = [ feature.get-values <toolset-$(toolset):linker-type> : $(properties) ] ; | |
954 | local target-os = [ feature.get-values <target-os> : $(properties) ] ; | |
955 | ||
956 | switch $(linker-type:G=) | |
7c673cae | 957 | { |
b32b8144 FG |
958 | case aix : |
959 | ||
7c673cae FG |
960 | # On AIX we *have* to use the native linker. |
961 | # | |
962 | # Using -brtl, the AIX linker will look for libraries with both the .a | |
963 | # and .so extensions, such as libfoo.a and libfoo.so. Without -brtl, the | |
964 | # AIX linker looks only for libfoo.a. Note that libfoo.a is an archived | |
965 | # file that may contain shared objects and is different from static libs | |
966 | # as on Linux. | |
967 | # | |
968 | # The -bnoipath strips the prepending (relative) path of libraries from | |
969 | # the loader section in the target library or executable. Hence, during | |
970 | # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded | |
971 | # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without | |
972 | # this option, the prepending (relative) path + library name is | |
973 | # hard-coded in the loader section, causing *only* this path to be | |
974 | # searched during load-time. Note that the AIX linker does not have an | |
975 | # -soname equivalent, this is as close as it gets. | |
976 | # | |
977 | # The -bbigtoc option instrcuts the linker to create a TOC bigger than 64k. | |
978 | # This is neccesary for some submodules such as math, but it does make running | |
979 | # the tests a tad slower. | |
980 | # | |
981 | # The above options are definately for AIX 5.x, and most likely also for | |
982 | # AIX 4.x and AIX 6.x. For details about the AIX linker see: | |
983 | # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf | |
984 | # | |
985 | ||
b32b8144 FG |
986 | OPTIONS on $(targets) += -Wl,-brtl -Wl,-bnoipath -Wl,-bbigtoc ; |
987 | ||
988 | # See note [1] | |
989 | if <runtime-link>static in $(properties) | |
990 | { | |
991 | OPTIONS on $(targets) += -static ; | |
992 | } | |
993 | ||
994 | case darwin : | |
7c673cae | 995 | |
7c673cae FG |
996 | # On Darwin, the -s option to ld does not work unless we pass -static, |
997 | # and passing -static unconditionally is a bad idea. So, do not pass -s | |
998 | # at all and darwin.jam will use a separate 'strip' invocation. | |
b32b8144 FG |
999 | RPATH on $(targets) += |
1000 | [ feature.get-values <dll-path> : $(properties) ] ; | |
1001 | # This does not support -R. | |
1002 | RPATH_OPTION on $(targets) += -rpath ; | |
1003 | # -rpath-link is not supported at all. | |
1004 | ||
1005 | # See note [1] | |
1006 | if <runtime-link>static in $(properties) | |
1007 | { | |
1008 | OPTIONS on $(targets) += -static ; | |
1009 | } | |
1010 | ||
1011 | case vxworks : | |
1012 | # On VxWorks we want to reflect what ever special flags have been set in the | |
1013 | # environment for the CPU we are targeting in the cross build | |
1014 | toolset.flags $(toolset).link OPTIONS $(condition)/<strip>on : -Wl,--strip-all : unchecked ; | |
1015 | toolset.flags $(toolset).link OPTIONS $(condition)/<link>static : [ os.environ LDFLAGS_STATIC ] : unchecked ; | |
1016 | toolset.flags $(toolset).link.dll OPTIONS $(condition) : [ os.environ LDFLAGS_SO ] : unchecked ; | |
1017 | toolset.flags $(toolset).link OPTIONS $(condition)/<link>shared : [ os.environ LDFLAGS_DYNAMIC ] : unchecked ; | |
1018 | ||
1019 | case gnu : | |
7c673cae | 1020 | |
7c673cae FG |
1021 | # Strip the binary when no debugging is needed. We use --strip-all flag |
1022 | # as opposed to -s since icc (intel's compiler) is generally | |
1023 | # option-compatible with and inherits from the gcc toolset, but does not | |
1024 | # support -s. | |
b32b8144 FG |
1025 | if <strip>on in $(properties) |
1026 | { | |
1027 | OPTIONS on $(targets) += -Wl,--strip-all ; | |
1028 | } | |
1029 | RPATH on $(targets) += | |
1030 | [ feature.get-values <dll-path> : $(properties) ] ; | |
1031 | RPATH_OPTION on $(targets) += -rpath ; | |
1032 | RPATH_LINK on $(targets) += | |
1033 | [ feature.get-values <xdll-path> : $(properties) ] ; | |
1034 | START-GROUP on $(targets) += -Wl,--start-group ; | |
1035 | END-GROUP on $(targets) += -Wl,--end-group ; | |
7c673cae FG |
1036 | |
1037 | # gnu ld has the ability to change the search behaviour for libraries | |
1038 | # referenced by the -l switch. These modifiers are -Bstatic and | |
1039 | # -Bdynamic and change search for -l switches that follow them. The | |
1040 | # following list shows the tried variants. Search stops at the first | |
1041 | # variant that has a match. | |
1042 | # | |
1043 | # *nix: -Bstatic -lxxx | |
1044 | # libxxx.a | |
1045 | # | |
1046 | # *nix: -Bdynamic -lxxx | |
1047 | # libxxx.so | |
1048 | # libxxx.a | |
1049 | # | |
1050 | # windows (mingw, cygwin) -Bstatic -lxxx | |
1051 | # libxxx.a | |
1052 | # xxx.lib | |
1053 | # | |
1054 | # windows (mingw, cygwin) -Bdynamic -lxxx | |
1055 | # libxxx.dll.a | |
1056 | # xxx.dll.a | |
1057 | # libxxx.a | |
1058 | # xxx.lib | |
1059 | # cygxxx.dll (*) | |
1060 | # libxxx.dll | |
1061 | # xxx.dll | |
1062 | # libxxx.a | |
1063 | # | |
1064 | # (*) This is for cygwin | |
1065 | # Please note that -Bstatic and -Bdynamic are not a guarantee that a | |
1066 | # static or dynamic lib indeed gets linked in. The switches only change | |
1067 | # search patterns! | |
1068 | ||
1069 | # On *nix mixing shared libs with static runtime is not a good idea. | |
b32b8144 FG |
1070 | if <runtime-link>shared in $(properties) |
1071 | { | |
1072 | FINDLIBS-ST-PFX on $(targets) += -Wl,-Bstatic ; | |
1073 | FINDLIBS-SA-PFX on $(targets) += -Wl,-Bdynamic ; | |
1074 | } | |
7c673cae FG |
1075 | |
1076 | # On windows allow mixing of static and dynamic libs with static | |
1077 | # runtime is not a good idea. | |
b32b8144 FG |
1078 | if <runtime-link>static in $(properties) && <target-os>windows in $(properties) |
1079 | { | |
1080 | FINDLIBS-ST-PFX on $(targets) += -Wl,-Bstatic ; | |
1081 | FINDLIBS-SA-PFX on $(targets) += -Wl,-Bdynamic ; | |
1082 | OPTIONS on $(targets) += -Wl,-Bstatic ; | |
1083 | } | |
7c673cae | 1084 | |
b32b8144 FG |
1085 | HAVE_SONAME on $(targets) += "" ; |
1086 | SONAME_OPTION on $(targets) += -h ; | |
1087 | ||
1088 | # See note [1] | |
1089 | if <runtime-link>static in $(properties) | |
1090 | { | |
1091 | OPTIONS on $(targets) += -static ; | |
1092 | } | |
1093 | ||
1094 | case hpux : | |
1095 | ||
1096 | if <strip>on in $(properties) | |
1097 | { | |
1098 | OPTIONS on $(targets) += -Wl,-s ; | |
1099 | } | |
1100 | if <link>shared in $(properties) | |
1101 | { | |
1102 | OPTIONS on $(targets) += -fPIC ; | |
1103 | } | |
1104 | ||
1105 | HAVE_SONAME on $(targets) += "" ; | |
1106 | SONAME_OPTION on $(targets) += +h ; | |
1107 | ||
1108 | case osf : | |
7c673cae | 1109 | |
7c673cae | 1110 | # No --strip-all, just -s. |
b32b8144 FG |
1111 | OPTIONS |
1112 | <toolset-$(toolset):linker-type>osf/$(condition)/<strip>on | |
1113 | : -Wl,-s | |
1114 | : unchecked ; | |
1115 | RPATH on $(targets) += [ feature.get-values <dll-path> ] ; | |
7c673cae | 1116 | # This does not support -R. |
b32b8144 | 1117 | RPATH_OPTION on $(targets) += -rpath ; |
7c673cae FG |
1118 | # -rpath-link is not supported at all. |
1119 | ||
b32b8144 FG |
1120 | # See note [1] |
1121 | if <runtime-link>static in $(properties) | |
1122 | { | |
1123 | OPTIONS on $(targets) += -static ; | |
1124 | } | |
1125 | ||
1126 | case sun : | |
1127 | ||
1128 | if <strip>on in $(properties) | |
1129 | { | |
1130 | OPTIONS on $(targets) += -Wl,-s ; | |
1131 | } | |
1132 | RPATH on $(targets) += [ feature.get-values <dll-path> ] ; | |
7c673cae FG |
1133 | # Solaris linker does not have a separate -rpath-link, but allows using |
1134 | # -L for the same purpose. | |
b32b8144 | 1135 | LINKPATH on $(targets) += [ feature.get-values <xdll-path> ] ; |
7c673cae FG |
1136 | |
1137 | # This permits shared libraries with non-PIC code on Solaris. | |
1138 | # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the | |
1139 | # following is not needed. Whether -fPIC should be hardcoded, is a | |
1140 | # separate question. | |
1141 | # AH, 2004/10/16: it is still necessary because some tests link against | |
1142 | # static libraries that were compiled without PIC. | |
b32b8144 FG |
1143 | if <link>shared in $(properties) |
1144 | { | |
1145 | OPTIONS on $(targets) += -mimpure-text ; | |
1146 | } | |
1147 | ||
1148 | # See note [1] | |
1149 | if <runtime-link>static in $(properties) | |
1150 | { | |
1151 | OPTIONS on $(targets) += -static ; | |
1152 | } | |
7c673cae | 1153 | } |
b32b8144 FG |
1154 | |
1155 | # [1] | |
1156 | # For <runtime-link>static we made sure there are no dynamic libraries in the | |
1157 | # link. On HP-UX not all system libraries exist as archived libraries (for | |
1158 | # example, there is no libunwind.a), so, on this platform, the -static option | |
1159 | # cannot be specified. | |
7c673cae FG |
1160 | } |
1161 | ||
1162 | ||
1163 | # Enclose the RPATH variable on 'targets' in double quotes, unless it is already | |
1164 | # enclosed in single quotes. This special casing is done because it is common to | |
1165 | # pass '$ORIGIN' to linker -- and it has to have single quotes to prevent shell | |
1166 | # expansion -- and if we add double quotes then the preventing properties of | |
1167 | # single quotes disappear. | |
1168 | # | |
1169 | rule quote-rpath ( targets * ) | |
1170 | { | |
1171 | local r = [ on $(targets[1]) return $(RPATH) ] ; | |
1172 | if ! [ MATCH ('.*') : $(r) ] | |
1173 | { | |
1174 | r = \"$(r)\" ; | |
1175 | } | |
1176 | RPATH on $(targets) = $(r) ; | |
1177 | } | |
1178 | ||
1179 | # Declare actions for linking. | |
1180 | rule link ( targets * : sources * : properties * ) | |
1181 | { | |
7c673cae FG |
1182 | SPACE on $(targets) = " " ; |
1183 | # Serialize execution of the 'link' action, since running N links in | |
1184 | # parallel is just slower. For now, serialize only gcc links, it might be a | |
1185 | # good idea to serialize all links. | |
1186 | JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ; | |
1187 | quote-rpath $(targets) ; | |
1188 | } | |
1189 | ||
1190 | actions link bind LIBRARIES | |
1191 | { | |
1192 | "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) | |
1193 | } | |
1194 | ||
b32b8144 FG |
1195 | rule link.dll ( targets * : sources * : properties * ) |
1196 | { | |
1197 | SPACE on $(targets) = " " ; | |
1198 | JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ; | |
1199 | quote-rpath $(targets) ; | |
1200 | } | |
1201 | ||
1202 | # Differs from 'link' above only by -shared. | |
1203 | actions link.dll bind LIBRARIES | |
1204 | { | |
1205 | "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) | |
1206 | } | |
1207 | ||
1208 | ### | |
1209 | ### Archive library generation. | |
1210 | ### | |
7c673cae FG |
1211 | |
1212 | # Default value. Mostly for the sake of intel-linux that inherits from gcc, but | |
1213 | # does not have the same logic to set the .AR variable. We can put the same | |
1214 | # logic in intel-linux, but that is hardly worth the trouble as on Linux, 'ar' | |
1215 | # is always available. | |
1216 | .AR = ar ; | |
1217 | .RANLIB = ranlib ; | |
1218 | ||
1219 | toolset.flags gcc.archive AROPTIONS <archiveflags> ; | |
1220 | ||
1221 | rule archive ( targets * : sources * : properties * ) | |
1222 | { | |
1223 | # Always remove archive and start again. Here is the rationale from | |
1224 | # | |
1225 | # Andre Hentz: | |
1226 | # | |
1227 | # I had a file, say a1.c, that was included into liba.a. I moved a1.c to | |
1228 | # a2.c, updated my Jamfiles and rebuilt. My program was crashing with absurd | |
1229 | # errors. After some debugging I traced it back to the fact that a1.o was | |
1230 | # *still* in liba.a | |
1231 | # | |
1232 | # Rene Rivera: | |
1233 | # | |
1234 | # Originally removing the archive was done by splicing an RM onto the | |
1235 | # archive action. That makes archives fail to build on NT when they have | |
1236 | # many files because it will no longer execute the action directly and blow | |
1237 | # the line length limit. Instead we remove the file in a different action, | |
1238 | # just before building the archive. | |
1239 | # | |
1240 | local clean.a = $(targets[1])(clean) ; | |
1241 | TEMPORARY $(clean.a) ; | |
1242 | NOCARE $(clean.a) ; | |
1243 | LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; | |
1244 | DEPENDS $(clean.a) : $(sources) ; | |
1245 | DEPENDS $(targets) : $(clean.a) ; | |
1246 | common.RmTemps $(clean.a) : $(targets) ; | |
1247 | } | |
1248 | ||
1249 | # Declare action for creating static libraries. | |
1250 | # The letter 'r' means to add files to the archive with replacement. Since we | |
1251 | # remove archive, we do not care about replacement, but there is no option "add | |
1252 | # without replacement". | |
1253 | # The letter 'c' suppresses the warning in case the archive does not exists yet. | |
1254 | # That warning is produced only on some platforms, for whatever reasons. | |
1255 | # | |
1256 | actions piecemeal archive | |
1257 | { | |
1258 | "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" | |
1259 | "$(.RANLIB)" "$(<)" | |
1260 | } | |
1261 | ||
b32b8144 FG |
1262 | ### |
1263 | ### CPU architecture and instruction set options. | |
1264 | ### | |
7c673cae FG |
1265 | |
1266 | local rule cpu-flags ( toolset variable : architecture : instruction-set + : | |
1267 | values + : default ? ) | |
1268 | { | |
1269 | if $(default) | |
1270 | { | |
1271 | toolset.flags $(toolset) $(variable) | |
1272 | <architecture>$(architecture)/<instruction-set> : $(values) ; | |
1273 | } | |
1274 | toolset.flags $(toolset) $(variable) | |
1275 | <architecture>/<instruction-set>$(instruction-set) | |
1276 | <architecture>$(architecture)/<instruction-set>$(instruction-set) | |
1277 | : $(values) ; | |
1278 | } | |
1279 | ||
1280 | ||
1281 | # Set architecture/instruction-set options. | |
1282 | # | |
1283 | # x86 and compatible | |
1284 | # The 'native' option appeared in gcc 4.2 so we cannot safely use it as default. | |
1285 | # Use i686 instead for 32-bit. | |
1286 | toolset.flags gcc OPTIONS <architecture>x86/<address-model>32/<instruction-set> : -march=i686 ; | |
1287 | cpu-flags gcc OPTIONS : x86 : native : -march=native ; | |
1288 | cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ; | |
1289 | cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ; | |
1290 | cpu-flags gcc OPTIONS : x86 : i686 : -march=i686 ; | |
1291 | cpu-flags gcc OPTIONS : x86 : pentium : -march=pentium ; | |
1292 | cpu-flags gcc OPTIONS : x86 : pentium-mmx : -march=pentium-mmx ; | |
1293 | cpu-flags gcc OPTIONS : x86 : pentiumpro : -march=pentiumpro ; | |
1294 | cpu-flags gcc OPTIONS : x86 : pentium2 : -march=pentium2 ; | |
1295 | cpu-flags gcc OPTIONS : x86 : pentium3 : -march=pentium3 ; | |
1296 | cpu-flags gcc OPTIONS : x86 : pentium3m : -march=pentium3m ; | |
1297 | cpu-flags gcc OPTIONS : x86 : pentium-m : -march=pentium-m ; | |
1298 | cpu-flags gcc OPTIONS : x86 : pentium4 : -march=pentium4 ; | |
1299 | cpu-flags gcc OPTIONS : x86 : pentium4m : -march=pentium4m ; | |
1300 | cpu-flags gcc OPTIONS : x86 : prescott : -march=prescott ; | |
1301 | cpu-flags gcc OPTIONS : x86 : nocona : -march=nocona ; | |
1302 | cpu-flags gcc OPTIONS : x86 : core2 : -march=core2 ; | |
1303 | cpu-flags gcc OPTIONS : x86 : conroe : -march=core2 ; | |
1304 | cpu-flags gcc OPTIONS : x86 : conroe-xe : -march=core2 ; | |
1305 | cpu-flags gcc OPTIONS : x86 : conroe-l : -march=core2 ; | |
1306 | cpu-flags gcc OPTIONS : x86 : allendale : -march=core2 ; | |
1307 | cpu-flags gcc OPTIONS : x86 : wolfdale : -march=core2 -msse4.1 ; | |
1308 | cpu-flags gcc OPTIONS : x86 : merom : -march=core2 ; | |
1309 | cpu-flags gcc OPTIONS : x86 : merom-xe : -march=core2 ; | |
1310 | cpu-flags gcc OPTIONS : x86 : kentsfield : -march=core2 ; | |
1311 | cpu-flags gcc OPTIONS : x86 : kentsfield-xe : -march=core2 ; | |
1312 | cpu-flags gcc OPTIONS : x86 : yorksfield : -march=core2 ; | |
1313 | cpu-flags gcc OPTIONS : x86 : penryn : -march=core2 ; | |
1314 | cpu-flags gcc OPTIONS : x86 : corei7 : -march=corei7 ; | |
1315 | cpu-flags gcc OPTIONS : x86 : nehalem : -march=corei7 ; | |
1316 | cpu-flags gcc OPTIONS : x86 : corei7-avx : -march=corei7-avx ; | |
1317 | cpu-flags gcc OPTIONS : x86 : sandy-bridge : -march=corei7-avx ; | |
1318 | cpu-flags gcc OPTIONS : x86 : core-avx-i : -march=core-avx-i ; | |
1319 | cpu-flags gcc OPTIONS : x86 : ivy-bridge : -march=core-avx-i ; | |
1320 | cpu-flags gcc OPTIONS : x86 : haswell : -march=core-avx-i -mavx2 -mfma -mbmi -mbmi2 -mlzcnt ; | |
b32b8144 FG |
1321 | cpu-flags gcc OPTIONS : x86 : broadwell : -march=broadwell ; |
1322 | cpu-flags gcc OPTIONS : x86 : skylake : -march=skylake ; | |
1323 | cpu-flags gcc OPTIONS : x86 : skylake-avx512 : -march=skylake-avx512 ; | |
1324 | cpu-flags gcc OPTIONS : x86 : cannonlake : -march=skylake-avx512 -mavx512vbmi -mavx512ifma -msha ; | |
7c673cae FG |
1325 | cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ; |
1326 | cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ; | |
1327 | cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ; | |
1328 | cpu-flags gcc OPTIONS : x86 : athlon : -march=athlon ; | |
1329 | cpu-flags gcc OPTIONS : x86 : athlon-tbird : -march=athlon-tbird ; | |
1330 | cpu-flags gcc OPTIONS : x86 : athlon-4 : -march=athlon-4 ; | |
1331 | cpu-flags gcc OPTIONS : x86 : athlon-xp : -march=athlon-xp ; | |
1332 | cpu-flags gcc OPTIONS : x86 : athlon-mp : -march=athlon-mp ; | |
1333 | ## | |
1334 | cpu-flags gcc OPTIONS : x86 : k8 : -march=k8 ; | |
1335 | cpu-flags gcc OPTIONS : x86 : opteron : -march=opteron ; | |
1336 | cpu-flags gcc OPTIONS : x86 : athlon64 : -march=athlon64 ; | |
1337 | cpu-flags gcc OPTIONS : x86 : athlon-fx : -march=athlon-fx ; | |
1338 | cpu-flags gcc OPTIONS : x86 : k8-sse3 : -march=k8-sse3 ; | |
1339 | cpu-flags gcc OPTIONS : x86 : opteron-sse3 : -march=opteron-sse3 ; | |
1340 | cpu-flags gcc OPTIONS : x86 : athlon64-sse3 : -march=athlon64-sse3 ; | |
1341 | cpu-flags gcc OPTIONS : x86 : amdfam10 : -march=amdfam10 ; | |
1342 | cpu-flags gcc OPTIONS : x86 : barcelona : -march=barcelona ; | |
1343 | cpu-flags gcc OPTIONS : x86 : bdver1 : -march=bdver1 ; | |
1344 | cpu-flags gcc OPTIONS : x86 : bdver2 : -march=bdver2 ; | |
1345 | cpu-flags gcc OPTIONS : x86 : bdver3 : -march=bdver3 ; | |
b32b8144 | 1346 | cpu-flags gcc OPTIONS : x86 : bdver4 : -march=bdver4 ; |
7c673cae FG |
1347 | cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ; |
1348 | cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ; | |
b32b8144 | 1349 | cpu-flags gcc OPTIONS : x86 : znver1 : -march=znver1 ; |
7c673cae FG |
1350 | cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ; |
1351 | cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ; | |
1352 | cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ; | |
1353 | cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ; | |
1354 | ## | |
1355 | cpu-flags gcc OPTIONS : x86 : atom : -march=atom ; | |
1356 | # Sparc | |
1357 | cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 : default ; | |
1358 | cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ; | |
1359 | cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ; | |
1360 | cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ; | |
1361 | cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ; | |
1362 | cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ; | |
1363 | cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ; | |
1364 | cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ; | |
1365 | cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ; | |
1366 | cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ; | |
1367 | cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ; | |
1368 | cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ; | |
1369 | cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ; | |
1370 | cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ; | |
1371 | # RS/6000 & PowerPC | |
1372 | cpu-flags gcc OPTIONS : power : 403 : -mcpu=403 ; | |
1373 | cpu-flags gcc OPTIONS : power : 505 : -mcpu=505 ; | |
1374 | cpu-flags gcc OPTIONS : power : 601 : -mcpu=601 ; | |
1375 | cpu-flags gcc OPTIONS : power : 602 : -mcpu=602 ; | |
1376 | cpu-flags gcc OPTIONS : power : 603 : -mcpu=603 ; | |
1377 | cpu-flags gcc OPTIONS : power : 603e : -mcpu=603e ; | |
1378 | cpu-flags gcc OPTIONS : power : 604 : -mcpu=604 ; | |
1379 | cpu-flags gcc OPTIONS : power : 604e : -mcpu=604e ; | |
1380 | cpu-flags gcc OPTIONS : power : 620 : -mcpu=620 ; | |
1381 | cpu-flags gcc OPTIONS : power : 630 : -mcpu=630 ; | |
1382 | cpu-flags gcc OPTIONS : power : 740 : -mcpu=740 ; | |
1383 | cpu-flags gcc OPTIONS : power : 7400 : -mcpu=7400 ; | |
1384 | cpu-flags gcc OPTIONS : power : 7450 : -mcpu=7450 ; | |
1385 | cpu-flags gcc OPTIONS : power : 750 : -mcpu=750 ; | |
1386 | cpu-flags gcc OPTIONS : power : 801 : -mcpu=801 ; | |
1387 | cpu-flags gcc OPTIONS : power : 821 : -mcpu=821 ; | |
1388 | cpu-flags gcc OPTIONS : power : 823 : -mcpu=823 ; | |
1389 | cpu-flags gcc OPTIONS : power : 860 : -mcpu=860 ; | |
1390 | cpu-flags gcc OPTIONS : power : 970 : -mcpu=970 ; | |
1391 | cpu-flags gcc OPTIONS : power : 8540 : -mcpu=8540 ; | |
1392 | cpu-flags gcc OPTIONS : power : power : -mcpu=power ; | |
1393 | cpu-flags gcc OPTIONS : power : power2 : -mcpu=power2 ; | |
1394 | cpu-flags gcc OPTIONS : power : power3 : -mcpu=power3 ; | |
1395 | cpu-flags gcc OPTIONS : power : power4 : -mcpu=power4 ; | |
1396 | cpu-flags gcc OPTIONS : power : power5 : -mcpu=power5 ; | |
1397 | cpu-flags gcc OPTIONS : power : powerpc : -mcpu=powerpc ; | |
1398 | cpu-flags gcc OPTIONS : power : powerpc64 : -mcpu=powerpc64 ; | |
1399 | cpu-flags gcc OPTIONS : power : rios : -mcpu=rios ; | |
1400 | cpu-flags gcc OPTIONS : power : rios1 : -mcpu=rios1 ; | |
1401 | cpu-flags gcc OPTIONS : power : rios2 : -mcpu=rios2 ; | |
1402 | cpu-flags gcc OPTIONS : power : rsc : -mcpu=rsc ; | |
1403 | cpu-flags gcc OPTIONS : power : rs64a : -mcpu=rs64 ; | |
1404 | # AIX variant of RS/6000 & PowerPC | |
1405 | toolset.flags gcc AROPTIONS <address-model>64/<target-os>aix : "-X64" ; |