]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/tools/gcc.jam
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / src / tools / gcc.jam
1 # Copyright 2001 David Abrahams
2 # Copyright 2002-2017 Rene Rivera
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 sequence ;
26 import set ;
27 import toolset ;
28 import type ;
29 import unix ;
30 import virtual-target ;
31 import errors ;
32
33
34 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
35 {
36 .debug-configuration = true ;
37 }
38
39
40 feature.extend toolset : gcc ;
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 #
73 rule init ( version ? : command * : options * : requirement * )
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 = [ dump-full-version
105 $(tool-command-string) ] ;
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) ] ;
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 }
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 local target-os ;
183 # Autodetect the version and flavor if not given.
184 if $(command)
185 {
186 local machine = [ MATCH "^([^ ]+)" :
187 [ SHELL "$(command-string) -dumpmachine" ] ] ;
188 version ?= [ dump-full-version $(command-string) ] ;
189 switch $(machine:L)
190 {
191 case *mingw* : flavor ?= mingw ;
192 case *cygwin* : flavor ?= cygwin ;
193 }
194 switch $(machine:L)
195 {
196 case *mingw* : target-os ?= windows ;
197 case *cygwin* : target-os ?= cygwin ;
198 case *linux* : target-os ?= linux ;
199 # TODO: finish this list.
200 }
201 }
202
203 local condition ;
204 condition = [ common.check-init-parameters gcc $(requirement) : version $(version)
205 : $(condition) ] ;
206
207 common.handle-options gcc : $(condition) : $(command) : $(options) ;
208
209 # Set the default target-os for this toolset.
210 if $(target-os) && ! [ feature.get-values <target-os> : $(requirement) ]
211 {
212 local conditionx = [ regex.replace $(condition) "/" "," ] ;
213 toolset.add-defaults $(conditionx)\:<target-os>$(target-os) ;
214 }
215
216 # If gcc is installed in a non-standard location, we would need to add
217 # LD_LIBRARY_PATH when running programs created with it (for unit-test/run
218 # rules).
219 if $(command)
220 {
221 # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries
222 # and all must be added to LD_LIBRARY_PATH. The linker will pick the
223 # right onces. Note that we do not provide a clean way to build a 32-bit
224 # binary using a 64-bit compiler, but user can always pass -m32
225 # manually.
226 local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ;
227 if $(.debug-configuration)
228 {
229 ECHO "notice:" using gcc libraries "::" $(condition) "::" $(lib_path) ;
230 }
231 toolset.flags gcc.link RUN_PATH $(condition) : $(lib_path) ;
232 }
233
234 # If we are not using a system gcc installation we should adjust the various
235 # programs as needed to prefer using their installation specific versions.
236 # This is essential for correct use of MinGW and for cross-compiling.
237
238 # - Archive builder.
239 local archiver = [ common.get-invocation-command gcc
240 : [ .get-prog-name $(command-string) : ar : $(flavor) ]
241 : [ feature.get-values <archiver> : $(options) ]
242 : $(bin)
243 : search-path ] ;
244 toolset.flags gcc.archive .AR $(condition) : $(archiver[1]) ;
245 if $(.debug-configuration)
246 {
247 ECHO "notice:" using gcc archiver "::" $(condition) "::" $(archiver[1]) ;
248 }
249
250 # - Ranlib.
251 local ranlib = [ common.get-invocation-command gcc
252 : [ .get-prog-name $(command-string) : ranlib : $(flavor) ]
253 : [ feature.get-values <ranlib> : $(options) ]
254 : $(bin)
255 : search-path ] ;
256 toolset.flags gcc.archive .RANLIB $(condition) : $(ranlib[1]) ;
257 if $(.debug-configuration)
258 {
259 ECHO "notice:" using gcc ranlib "::" $(condition) "::" $(ranlib[1]) ;
260 }
261
262 # - Resource compiler.
263 local rc = [ common.get-invocation-command-nodefault gcc : windres :
264 [ feature.get-values <rc> : $(options) ] : $(bin) : search-path ] ;
265 local rc-type = [ feature.get-values <rc-type> : $(options) ] ;
266 rc-type ?= windres ;
267 if ! $(rc)
268 {
269 # If we can not find an RC compiler we fallback to a null one that
270 # creates empty object files. This allows the same Jamfiles to work
271 # across the board. The null RC uses assembler to create the empty
272 # objects, so configure that.
273 rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ]
274 ;
275 rc-type = null ;
276 }
277 rc.configure $(rc) : $(condition) : <rc-type>$(rc-type) ;
278
279 toolset.flags gcc VERSION $(condition) : [ regex.split $(version) "[.]" ] ;
280
281 init-cxxstd-flags $(condition) : $(version) ;
282 }
283
284 if [ os.name ] = NT
285 {
286 # This causes single-line command invocation to not go through .bat files,
287 # thus avoiding command-line length limitations.
288 # TODO: Set JAMSHELL on specific targets instead of globally.
289 JAMSHELL = % ;
290 }
291
292 local rule dump-full-version ( command-string )
293 {
294 # -dumpfullversion is only supported for gcc 7+.
295 # Passing both options works, as the first one that's
296 # recognized will be used.
297 return [ MATCH "^([0-9.]+)" :
298 [ SHELL "$(command-string) -dumpfullversion -dumpversion" ] ] ;
299 }
300
301 # Uses -print-prog-name to get the name of the tool.
302 # Converts the path to native form if using cygwin.
303 rule .get-prog-name ( command-string : tool : flavor ? )
304 {
305 local prog-name = [ NORMALIZE_PATH [ MATCH "(.*)[\n]+" :
306 [ SHELL "$(command-string) -print-prog-name=$(tool)" ] ] ] ;
307
308 if $(flavor) = cygwin && [ os.name ] = NT
309 {
310 prog-name = [ cygwin.cygwin-to-windows-path $(prog-name) ] ;
311 }
312 return $(prog-name) ;
313 }
314
315 ###
316 ### Functions that set options on the targets.
317 ###
318
319 local all-os = [ feature.values <target-os> ] ;
320
321 local rule compile-link-flags ( * )
322 {
323 toolset.flags gcc.compile OPTIONS $(1) : $(2) ;
324 toolset.flags gcc.link OPTIONS $(1) : $(2) ;
325 }
326
327 {
328 # This logic will add -fPIC for all compilations:
329 #
330 # lib a : a.cpp b ;
331 # obj b : b.cpp ;
332 # exe c : c.cpp a d ;
333 # obj d : d.cpp ;
334 #
335 # This all is fine, except that 'd' will be compiled with -fPIC even
336 # though it is not needed, as 'd' is used only in exe. However, it is
337 # hard to detect where a target is going to be used. Alternatively, we
338 # can set -fPIC only when main target type is LIB but than 'b' would be
339 # compiled without -fPIC which would lead to link errors on x86-64. So,
340 # compile everything with -fPIC.
341 #
342 # Yet another alternative would be to create a propagated <sharedable>
343 # feature and set it when building shared libraries, but that would be
344 # hard to implement and would increase the target path length even more.
345
346 # On Windows, fPIC is the default, and specifying -fPIC explicitly leads
347 # to a warning.
348 local non-windows = [ set.difference $(all-os) : cygwin windows ] ;
349 compile-link-flags <link>shared/<target-os>$(non-windows) : -fPIC ;
350 }
351
352 {
353 # Handle address-model
354 compile-link-flags <target-os>aix/<address-model>32 : -maix32 ;
355 compile-link-flags <target-os>aix/<address-model>64 : -maix64 ;
356
357 compile-link-flags <target-os>hpux/<address-model>32 : -milp32 ;
358 compile-link-flags <target-os>hpux/<address-model>64 : -mlp64 ;
359
360 local generic-os = [ set.difference $(all-os) : aix hpux ] ;
361 local arch = power sparc x86 ;
362 compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>32 : -m32 ;
363 compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>64 : -m64 ;
364 }
365
366 {
367 # Handle threading
368 local rule threading-flags ( * )
369 {
370 compile-link-flags <threading>multi/$(1) : $(2) ;
371 if $(3)
372 {
373 toolset.flags gcc.link FINDLIBS-SA <threading>multi/$(1) : $(3) ;
374 }
375 }
376
377 threading-flags <target-os>windows : -mthreads ;
378 threading-flags <target-os>cygwin : -mthreads ;
379 threading-flags <target-os>solaris : -pthreads : rt ;
380
381 local bsd = [ MATCH ^(.*bsd)$ : $(all-os) ] ;
382 threading-flags <target-os>$(bsd) : -pthread ;
383
384 local no-threading = android beos haiku sgi darwin vxworks ;
385 local threading-generic-os = [ set.difference $(all-os) : $(no-threading) $(bsd) windows cygwin solaris ] ;
386 threading-flags <target-os>$(threading-generic-os) : -pthread : rt ;
387 }
388
389 {
390 local rule cxxstd-flags ( * )
391 {
392 toolset.flags gcc.compile.c++ OPTIONS $(1) : $(2) ;
393 toolset.flags gcc.link OPTIONS $(1) : $(2) ;
394 }
395
396 local cxxstd = [ feature.values <cxxstd> ] ;
397 local dialects = [ feature.values <cxxstd-dialect> ] ;
398 .cxxstd-dialects = [ set.difference $(dialects) : gnu iso ] ;
399 # C++ latest needs to be set up on a per-toolset basis
400 for local std in [ set.difference $(cxxstd) : latest ]
401 {
402 cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>iso : -std=c++$(std) ;
403 cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>gnu : -std=gnu++$(std) ;
404 # If we see this it's probably a mistake, but
405 # toolset.flags has no way to set up diagnostics.
406 cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>$(.cxxstd-dialects) : -std=c++$(std) ;
407 }
408
409 local rule version-ge ( lhs : rhs )
410 {
411 lhs = [ regex.split $(lhs) "[.]" ] ;
412 rhs = [ regex.split $(rhs) "[.]" ] ;
413 return [ sequence.compare $(rhs) : $(lhs) : numbers.less ] ;
414 }
415 # Version specific flags
416 local rule init-cxxstd-flags ( condition * : version )
417 {
418 local std ;
419 if [ version-ge $(version) : 8.0 ] { std = 2a ; }
420 else if [ version-ge $(version) : 5.1 ] { std = 1z ; }
421 else if [ version-ge $(version) : 4.8 ] { std = 1y ; }
422 else if [ version-ge $(version) : 4.7 ] { std = 11 ; }
423 else if [ version-ge $(version) : 3.3 ] { std = 98 ; }
424 if $(std)
425 {
426 cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>iso : -std=c++$(std) ;
427 cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>gnu : -std=gnu++$(std) ;
428 cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>$(.cxxstd-dialects) : -std=c++$(std) ;
429 }
430 }
431 }
432
433 generators.register-c-compiler gcc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : <toolset>gcc ;
434 generators.register-c-compiler gcc.compile.c.preprocess : C : PREPROCESSED_C : <toolset>gcc ;
435 generators.register-c-compiler gcc.compile.c++ : CPP : OBJ : <toolset>gcc ;
436 generators.register-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ;
437 generators.register-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ;
438
439 generators.register [ new fortran-compiling-generator
440 gcc.compile.fortran : FORTRAN FORTRAN90 : OBJ : <toolset>gcc ] ;
441
442 rule compile.c++.preprocess ( targets * : sources * : properties * )
443 {
444 # Some extensions are compiled as C++ by default. For others, we need to
445 # pass -x c++. We could always pass -x c++ but distcc does not work with it.
446 if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C
447 {
448 LANG on $(<) = "-x c++" ;
449 }
450 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
451 }
452
453 rule compile.c.preprocess ( targets * : sources * : properties * )
454 {
455 # If we use the name g++ then default file suffix -> language mapping does
456 # not work. So have to pass -x option. Maybe, we can work around this by
457 # allowing the user to specify both C and C++ compiler names.
458 #if $(>:S) != .c
459 #{
460 LANG on $(<) = "-x c" ;
461 #}
462 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
463 }
464
465 rule compile.c++ ( targets * : sources * : properties * )
466 {
467 # Some extensions are compiled as C++ by default. For others, we need to
468 # pass -x c++. We could always pass -x c++ but distcc does not work with it.
469 if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C
470 {
471 LANG on $(<) = "-x c++" ;
472 }
473 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
474 }
475
476 rule compile.c ( targets * : sources * : properties * )
477 {
478 # If we use the name g++ then default file suffix -> language mapping does
479 # not work. So have to pass -x option. Maybe, we can work around this by
480 # allowing the user to specify both C and C++ compiler names.
481 #if $(>:S) != .c
482 #{
483 LANG on $(<) = "-x c" ;
484 #}
485 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
486 }
487
488 rule compile.fortran ( targets * : sources * : properties * )
489 {
490 }
491
492 actions compile.c++ bind PCH_FILE
493 {
494 "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)"
495 }
496
497 actions compile.c bind PCH_FILE
498 {
499 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
500 }
501
502 actions compile.c++.preprocess bind PCH_FILE
503 {
504 "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>:W)" -E >"$(<:W)"
505 }
506
507 actions compile.c.preprocess bind PCH_FILE
508 {
509 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>)" -E >$(<)
510 }
511
512 actions compile.fortran
513 {
514 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
515 }
516
517 rule compile.asm ( targets * : sources * : properties * )
518 {
519 LANG on $(<) = "-x assembler-with-cpp" ;
520 }
521
522 actions compile.asm
523 {
524 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
525 }
526
527 ###
528 ### Preconpiled header use and generation.
529 ###
530
531 # The compiler looks for a precompiled header in each directory just before it
532 # looks for the include file in that directory. The name searched for is the
533 # name specified in the #include directive with ".gch" suffix appended. The
534 # logic in gcc-pch-generator will make sure that the BASE_PCH suffix is appended
535 # to the full header name.
536
537 type.set-generated-target-suffix PCH : <toolset>gcc : gch ;
538
539 # GCC-specific pch generator.
540 class gcc-pch-generator : pch-generator
541 {
542 import project ;
543 import property-set ;
544 import type ;
545
546 rule run-pch ( project name ? : property-set : sources + )
547 {
548 # Find the header in sources. Ignore any CPP sources.
549 local header ;
550 for local s in $(sources)
551 {
552 if [ type.is-derived [ $(s).type ] H ]
553 {
554 header = $(s) ;
555 }
556 }
557
558 # Error handling: base header file name should be the same as the base
559 # precompiled header name.
560 local header-name = [ $(header).name ] ;
561 local header-basename = $(header-name:B) ;
562 if $(header-basename) != $(name)
563 {
564 local location = [ $(project).project-module ] ;
565 import errors : user-error : errors.user-error ;
566 errors.user-error "in" "$(location):" pch target name '$(name)' should
567 be the same as the base name of header file '$(header-name)' ;
568 }
569
570 local pch-file = [ generator.run $(project) $(name) : $(property-set)
571 : $(header) ] ;
572
573 # Return result of base class and pch-file property as
574 # usage-requirements.
575 return
576 [ $(pch-file[1]).add-raw <pch-file>$(pch-file[2-]) <cflags>-Winvalid-pch ]
577 $(pch-file[2-])
578 ;
579 }
580
581 # Calls the base version specifying source's name as the name of the created
582 # target. As a result, the PCH will be named whatever.hpp.gch, and not
583 # whatever.gch.
584 rule generated-targets ( sources + : property-set : project name ? )
585 {
586 name = [ $(sources[1]).name ] ;
587 return [ generator.generated-targets $(sources)
588 : $(property-set) : $(project) $(name) ] ;
589 }
590 }
591
592 # Note: the 'H' source type will catch both '.h' header and '.hpp' header. The
593 # latter have HPP type, but HPP type is derived from H. The type of compilation
594 # is determined entirely by the destination type.
595 generators.register [ new gcc-pch-generator gcc.compile.c.pch : H : C_PCH : <pch>on <toolset>gcc ] ;
596 generators.register [ new gcc-pch-generator gcc.compile.c++.pch : H : CPP_PCH : <pch>on <toolset>gcc ] ;
597
598 # Override default do-nothing generators.
599 generators.override gcc.compile.c.pch : pch.default-c-pch-generator ;
600 generators.override gcc.compile.c++.pch : pch.default-cpp-pch-generator ;
601
602 toolset.flags gcc.compile PCH_FILE <pch>on : <pch-file> ;
603
604 rule compile.c++.pch ( targets * : sources * : properties * )
605 {
606 }
607
608 actions compile.c++.pch
609 {
610 "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
611 }
612
613 rule compile.c.pch ( targets * : sources * : properties * )
614 {
615 }
616
617 actions compile.c.pch
618 {
619 "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
620 }
621
622 ###
623 ### General options, like optimization.
624 ###
625
626 # Declare flags and action for compilation.
627 toolset.flags gcc.compile OPTIONS <optimization>off : -O0 ;
628 toolset.flags gcc.compile OPTIONS <optimization>speed : -O3 ;
629 toolset.flags gcc.compile OPTIONS <optimization>space : -Os ;
630
631 toolset.flags gcc.compile OPTIONS <inlining>off : -fno-inline ;
632 toolset.flags gcc.compile OPTIONS <inlining>on : -Wno-inline ;
633 toolset.flags gcc.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ;
634
635 toolset.flags gcc.compile OPTIONS <warnings>off : -w ;
636 toolset.flags gcc.compile OPTIONS <warnings>on : -Wall ;
637 toolset.flags gcc.compile OPTIONS <warnings>all : -Wall -pedantic ;
638 toolset.flags gcc.compile OPTIONS <warnings-as-errors>on : -Werror ;
639
640 toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ;
641 toolset.flags gcc.compile OPTIONS <profiling>on : -pg ;
642
643 toolset.flags gcc.compile.c++ OPTIONS <rtti>off : -fno-rtti ;
644 toolset.flags gcc.compile.c++ OPTIONS <exception-handling>off : -fno-exceptions ;
645
646 # configure Dinkum STL to match compiler options
647 toolset.flags gcc.compile.c++ DEFINES <rtti>off/<target-os>vxworks : _NO_RTTI ;
648 toolset.flags gcc.compile.c++ DEFINES <exception-handling>off/<target-os>vxworks : _NO_EX=1 ;
649
650 ###
651 ### User free feature options.
652 ###
653
654 toolset.flags gcc.compile USER_OPTIONS <cflags> ;
655 toolset.flags gcc.compile.c++ USER_OPTIONS <cxxflags> ;
656 toolset.flags gcc.compile.asm USER_OPTIONS <asmflags> ;
657 toolset.flags gcc.compile DEFINES <define> ;
658 toolset.flags gcc.compile INCLUDES <include> ;
659 toolset.flags gcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
660 toolset.flags gcc.compile.fortran USER_OPTIONS <fflags> ;
661
662 ###
663 ### Linking generators and actions.
664 ###
665
666 # Class checking that we do not try to use the <runtime-link>static property
667 # while creating or using a shared library, since it is not supported by
668 # gcc/libc.
669 class gcc-linking-generator : unix-linking-generator
670 {
671 rule run ( project name ? : property-set : sources + )
672 {
673 local target-os = [ $(property-set).get <target-os> ] ;
674 local no-static-link = true ;
675 switch $(target-os)
676 {
677 case vms : no-static-link = ;
678 case windows : no-static-link = ;
679 }
680
681 local properties = [ $(property-set).raw ] ;
682 local reason ;
683 if $(no-static-link) && <runtime-link>static in $(properties)
684 {
685 if <link>shared in $(properties)
686 {
687 reason = On gcc, DLLs can not be built with
688 '<runtime-link>static'. ;
689 }
690 else if [ type.is-derived $(self.target-types[1]) EXE ]
691 {
692 for local s in $(sources)
693 {
694 local type = [ $(s).type ] ;
695 if $(type) && [ type.is-derived $(type) SHARED_LIB ]
696 {
697 reason = On gcc, using DLLs together with the
698 '<runtime-link>static' option is not possible. ;
699 }
700 }
701 }
702 }
703 if $(reason)
704 {
705 ECHO "warning:" $(reason) ;
706 ECHO "warning:" It is suggested to use '<runtime-link>static' together
707 with '<link>static'. ;
708 }
709 else
710 {
711 return [ unix-linking-generator.run $(project) $(name) :
712 $(property-set) : $(sources) ] ;
713 }
714 }
715 }
716
717 # The set of permissible input types is different on mingw. So, define two sets
718 # of generators, with mingw generators selected when target-os=windows.
719
720 local g ;
721 g = [ new gcc-linking-generator gcc.mingw.link
722 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
723 : EXE
724 : <toolset>gcc <target-os>windows ] ;
725 $(g).set-rule-name gcc.link ;
726 generators.register $(g) ;
727
728 g = [ new gcc-linking-generator gcc.mingw.link.dll
729 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
730 : IMPORT_LIB SHARED_LIB
731 : <toolset>gcc <target-os>windows ] ;
732 $(g).set-rule-name gcc.link.dll ;
733 generators.register $(g) ;
734
735 generators.register
736 [ new gcc-linking-generator gcc.link
737 : LIB OBJ
738 : EXE
739 : <toolset>gcc ] ;
740 generators.register
741 [ new gcc-linking-generator gcc.link.dll
742 : LIB OBJ
743 : SHARED_LIB
744 : <toolset>gcc ] ;
745
746 generators.override gcc.mingw.link : gcc.link ;
747 generators.override gcc.mingw.link.dll : gcc.link.dll ;
748
749 # Cygwin is similar to msvc and mingw in that it uses import libraries. While in
750 # simple cases, it can directly link to a shared library, it is believed to be
751 # slower, and not always possible. Define cygwin-specific generators here.
752
753 g = [ new gcc-linking-generator gcc.cygwin.link
754 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
755 : EXE
756 : <toolset>gcc <target-os>cygwin ] ;
757 $(g).set-rule-name gcc.link ;
758 generators.register $(g) ;
759
760 g = [ new gcc-linking-generator gcc.cygwin.link.dll
761 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
762 : IMPORT_LIB SHARED_LIB
763 : <toolset>gcc <target-os>cygwin ] ;
764 $(g).set-rule-name gcc.link.dll ;
765 generators.register $(g) ;
766
767 generators.override gcc.cygwin.link : gcc.link ;
768 generators.override gcc.cygwin.link.dll : gcc.link.dll ;
769
770 # Declare flags for linking.
771 # First, the common flags.
772 toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ;
773 toolset.flags gcc.link OPTIONS <profiling>on : -pg ;
774 toolset.flags gcc.link USER_OPTIONS <linkflags> ;
775 toolset.flags gcc.link LINKPATH <library-path> ;
776 toolset.flags gcc.link FINDLIBS-ST <find-static-library> ;
777 toolset.flags gcc.link FINDLIBS-SA <find-shared-library> ;
778 toolset.flags gcc.link LIBRARIES <library-file> ;
779
780 toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>windows : "-Wl,--out-implib," ;
781 toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>cygwin : "-Wl,--out-implib," ;
782
783 # target specific link flags
784 {
785 # aix
786
787 # On AIX we *have* to use the native linker.
788 #
789 # Using -brtl, the AIX linker will look for libraries with both the .a
790 # and .so extensions, such as libfoo.a and libfoo.so. Without -brtl, the
791 # AIX linker looks only for libfoo.a. Note that libfoo.a is an archived
792 # file that may contain shared objects and is different from static libs
793 # as on Linux.
794 #
795 # The -bnoipath strips the prepending (relative) path of libraries from
796 # the loader section in the target library or executable. Hence, during
797 # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded
798 # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without
799 # this option, the prepending (relative) path + library name is
800 # hard-coded in the loader section, causing *only* this path to be
801 # searched during load-time. Note that the AIX linker does not have an
802 # -soname equivalent, this is as close as it gets.
803 #
804 # The -bbigtoc option instrcuts the linker to create a TOC bigger than 64k.
805 # This is neccesary for some submodules such as math, but it does make running
806 # the tests a tad slower.
807 #
808 # The above options are definately for AIX 5.x, and most likely also for
809 # AIX 4.x and AIX 6.x. For details about the AIX linker see:
810 # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf
811 #
812 toolset.flags gcc.link OPTIONS <target-os>aix : -Wl,-brtl -Wl,-bnoipath -Wl,-bbigtoc ;
813
814 # See note [1]
815 toolset.flags gcc.link OPTIONS <target-os>aix/<runtime-link>static : -static ;
816
817 # darwin
818
819 # On Darwin, the -s option to ld does not work unless we pass -static,
820 # and passing -static unconditionally is a bad idea. So, do not pass -s
821 # at all and darwin.jam will use a separate 'strip' invocation.
822 toolset.flags gcc.link RPATH <target-os>darwin : <dll-path> ;
823 # This does not support -R.
824 toolset.flags gcc.link RPATH_OPTION <target-os>darwin : -rpath ;
825 # -rpath-link is not supported at all.
826
827 # See note [1]
828 toolset.flags gcc.link OPTIONS <target-os>darwin/<runtime-link>static : -static ;
829
830 # vxworks
831 # On VxWorks we want to reflect what ever special flags have been set in the
832 # environment for the CPU we are targeting in the cross build
833 toolset.flags gcc.link OPTIONS <target-os>vxworks/<strip>on : -Wl,--strip-all ;
834 toolset.flags gcc.link OPTIONS <target-os>vxworks/<link>static : [ os.environ LDFLAGS_STATIC ] ;
835 toolset.flags gcc.link.dll OPTIONS <target-os>vxworks : [ os.environ LDFLAGS_SO ] ;
836 toolset.flags gcc.link OPTIONS <target-os>vxworks/<link>shared : [ os.environ LDFLAGS_DYNAMIC ] ;
837
838 # default
839
840 local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;
841 # Strip the binary when no debugging is needed. We use --strip-all flag
842 # as opposed to -s since icc (intel's compiler) is generally
843 # option-compatible with and inherits from the gcc toolset, but does not
844 # support -s.
845 toolset.flags gcc.link OPTIONS <target-os>$(generic-os)/<strip>on :
846 -Wl,--strip-all ;
847 toolset.flags gcc.link RPATH <target-os>$(generic-os) : <dll-path> ;
848 toolset.flags gcc.link RPATH_OPTION <target-os>$(generic-os) : -rpath ;
849 toolset.flags gcc.link RPATH_LINK <target-os>$(generic-os) : <xdll-path> ;
850 toolset.flags gcc.link START-GROUP <target-os>$(generic-os) :
851 -Wl,--start-group ;
852 toolset.flags gcc.link END-GROUP <target-os>$(generic-os) : -Wl,--end-group ;
853
854 # gnu ld has the ability to change the search behaviour for libraries
855 # referenced by the -l switch. These modifiers are -Bstatic and
856 # -Bdynamic and change search for -l switches that follow them. The
857 # following list shows the tried variants. Search stops at the first
858 # variant that has a match.
859 #
860 # *nix: -Bstatic -lxxx
861 # libxxx.a
862 #
863 # *nix: -Bdynamic -lxxx
864 # libxxx.so
865 # libxxx.a
866 #
867 # windows (mingw, cygwin) -Bstatic -lxxx
868 # libxxx.a
869 # xxx.lib
870 #
871 # windows (mingw, cygwin) -Bdynamic -lxxx
872 # libxxx.dll.a
873 # xxx.dll.a
874 # libxxx.a
875 # xxx.lib
876 # cygxxx.dll (*)
877 # libxxx.dll
878 # xxx.dll
879 # libxxx.a
880 #
881 # (*) This is for cygwin
882 # Please note that -Bstatic and -Bdynamic are not a guarantee that a
883 # static or dynamic lib indeed gets linked in. The switches only change
884 # search patterns!
885
886 # On *nix mixing shared libs with static runtime is not a good idea.
887 toolset.flags gcc.link FINDLIBS-ST-PFX <target-os>$(generic-os)/<runtime-link>shared : -Wl,-Bstatic ;
888 toolset.flags gcc.link FINDLIBS-SA-PFX <target-os>$(generic-os)/<runtime-link>shared : -Wl,-Bdynamic ;
889
890 # On windows allow mixing of static and dynamic libs with static
891 # runtime is not a good idea.
892 toolset.flags gcc.link FINDLIBS-ST-PFX <target-os>windows/<runtime-link>static : -Wl,-Bstatic ;
893 toolset.flags gcc.link FINDLIBS-SA-PFX <target-os>windows/<runtime-link>static : -Wl,-Bdynamic ;
894 toolset.flags gcc.link OPTIONS <target-os>windows/<runtime-link>static : -Wl,-Bstatic ;
895
896 toolset.flags gcc.link HAVE_SONAME <target-os>$(generic-os) : "" ;
897 toolset.flags gcc.link SONAME_OPTION <target-os>$(generic-os) : -h ;
898
899 # See note [1]
900 toolset.flags gcc.link OPTIONS <target-os>$(generic-os)/<runtime-link>static : -static ;
901
902 # hpux
903
904 toolset.flags gcc.link OPTIONS <target-os>hpux/<strip>on : -Wl,-s ;
905
906 toolset.flags gcc.link HAVE_SONAME <target-os>hpux : "" ;
907 toolset.flags gcc.link SONAME_OPTION <target-os>hpux : +h ;
908
909 # osf
910
911 # No --strip-all, just -s.
912 toolset.flags gcc.link OPTIONS <target-os>osf/<strip>on : -Wl,-s ;
913 toolset.flags gcc.link RPATH <target-os>osf : <dll-path> ;
914 # This does not support -R.
915 toolset.flags gcc.link RPATH_OPTION <target-os>osf : -rpath ;
916 # -rpath-link is not supported at all.
917
918 # See note [1]
919 toolset.flags gcc.link OPTIONS <target-os>osf/<runtime-link>static : -static ;
920
921 # sun
922
923 toolset.flags gcc.link OPTIONS <target-os>solaris/<strip>on : -Wl,-s ;
924
925 toolset.flags gcc.link RPATH <target-os>solaris : <dll-path> ;
926 # Solaris linker does not have a separate -rpath-link, but allows using
927 # -L for the same purpose.
928 toolset.flags gcc.link LINKPATH <target-os>solaris : <xdll-path> ;
929
930 # This permits shared libraries with non-PIC code on Solaris.
931 # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the
932 # following is not needed. Whether -fPIC should be hardcoded, is a
933 # separate question.
934 # AH, 2004/10/16: it is still necessary because some tests link against
935 # static libraries that were compiled without PIC.
936 toolset.flags gcc.link OPTIONS <target-os>solaris : -mimpure-text ;
937
938 # See note [1]
939 toolset.flags gcc.link OPTIONS <target-os>solaris/<runtime-link>static : -static ;
940
941 # [1]
942 # For <runtime-link>static we made sure there are no dynamic libraries in the
943 # link. On HP-UX not all system libraries exist as archived libraries (for
944 # example, there is no libunwind.a), so, on this platform, the -static option
945 # cannot be specified.
946 }
947
948
949 # Enclose the RPATH variable on 'targets' in double quotes, unless it is already
950 # enclosed in single quotes. This special casing is done because it is common to
951 # pass '$ORIGIN' to linker -- and it has to have single quotes to prevent shell
952 # expansion -- and if we add double quotes then the preventing properties of
953 # single quotes disappear.
954 #
955 rule quote-rpath ( targets * )
956 {
957 local r = [ on $(targets[1]) return $(RPATH) ] ;
958 if ! [ MATCH ('.*') : $(r) ]
959 {
960 r = \"$(r)\" ;
961 }
962 RPATH on $(targets) = $(r) ;
963 }
964
965 # Declare actions for linking.
966 rule link ( targets * : sources * : properties * )
967 {
968 SPACE on $(targets) = " " ;
969 # Serialize execution of the 'link' action, since running N links in
970 # parallel is just slower. For now, serialize only gcc links, it might be a
971 # good idea to serialize all links.
972 JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
973 quote-rpath $(targets) ;
974 }
975
976 actions link bind LIBRARIES
977 {
978 "$(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)
979 }
980
981 rule link.dll ( targets * : sources * : properties * )
982 {
983 SPACE on $(targets) = " " ;
984 JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
985 quote-rpath $(targets) ;
986 }
987
988 # Differs from 'link' above only by -shared.
989 actions link.dll bind LIBRARIES
990 {
991 "$(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)
992 }
993
994 ###
995 ### Archive library generation.
996 ###
997
998 # Default value. Mostly for the sake of intel-linux that inherits from gcc, but
999 # does not have the same logic to set the .AR variable. We can put the same
1000 # logic in intel-linux, but that is hardly worth the trouble as on Linux, 'ar'
1001 # is always available.
1002 .AR = ar ;
1003 .RANLIB = ranlib ;
1004
1005 toolset.flags gcc.archive AROPTIONS <archiveflags> ;
1006
1007 rule archive ( targets * : sources * : properties * )
1008 {
1009 # Always remove archive and start again. Here is the rationale from
1010 #
1011 # Andre Hentz:
1012 #
1013 # I had a file, say a1.c, that was included into liba.a. I moved a1.c to
1014 # a2.c, updated my Jamfiles and rebuilt. My program was crashing with absurd
1015 # errors. After some debugging I traced it back to the fact that a1.o was
1016 # *still* in liba.a
1017 #
1018 # Rene Rivera:
1019 #
1020 # Originally removing the archive was done by splicing an RM onto the
1021 # archive action. That makes archives fail to build on NT when they have
1022 # many files because it will no longer execute the action directly and blow
1023 # the line length limit. Instead we remove the file in a different action,
1024 # just before building the archive.
1025 #
1026 local clean.a = $(targets[1])(clean) ;
1027 TEMPORARY $(clean.a) ;
1028 NOCARE $(clean.a) ;
1029 LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ;
1030 DEPENDS $(clean.a) : $(sources) ;
1031 DEPENDS $(targets) : $(clean.a) ;
1032 common.RmTemps $(clean.a) : $(targets) ;
1033 }
1034
1035 # Declare action for creating static libraries.
1036 # The letter 'r' means to add files to the archive with replacement. Since we
1037 # remove archive, we do not care about replacement, but there is no option "add
1038 # without replacement".
1039 # The letter 'c' suppresses the warning in case the archive does not exists yet.
1040 # That warning is produced only on some platforms, for whatever reasons.
1041 #
1042 actions piecemeal archive
1043 {
1044 "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
1045 "$(.RANLIB)" "$(<)"
1046 }
1047
1048 ###
1049 ### CPU architecture and instruction set options.
1050 ###
1051
1052 local rule cpu-flags ( toolset variable : architecture : instruction-set + :
1053 values + : default ? )
1054 {
1055 if $(default)
1056 {
1057 toolset.flags $(toolset) $(variable)
1058 <architecture>$(architecture)/<instruction-set> : $(values) ;
1059 }
1060 toolset.flags $(toolset) $(variable)
1061 <architecture>/<instruction-set>$(instruction-set)
1062 <architecture>$(architecture)/<instruction-set>$(instruction-set)
1063 : $(values) ;
1064 }
1065
1066
1067 # Set architecture/instruction-set options.
1068 #
1069 # x86 and compatible
1070 # The 'native' option appeared in gcc 4.2 so we cannot safely use it as default.
1071 # Use i686 instead for 32-bit.
1072 toolset.flags gcc OPTIONS <architecture>x86/<address-model>32/<instruction-set> : -march=i686 ;
1073 cpu-flags gcc OPTIONS : x86 : native : -march=native ;
1074 cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ;
1075 cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ;
1076 cpu-flags gcc OPTIONS : x86 : i686 : -march=i686 ;
1077 cpu-flags gcc OPTIONS : x86 : pentium : -march=pentium ;
1078 cpu-flags gcc OPTIONS : x86 : pentium-mmx : -march=pentium-mmx ;
1079 cpu-flags gcc OPTIONS : x86 : pentiumpro : -march=pentiumpro ;
1080 cpu-flags gcc OPTIONS : x86 : pentium2 : -march=pentium2 ;
1081 cpu-flags gcc OPTIONS : x86 : pentium3 : -march=pentium3 ;
1082 cpu-flags gcc OPTIONS : x86 : pentium3m : -march=pentium3m ;
1083 cpu-flags gcc OPTIONS : x86 : pentium-m : -march=pentium-m ;
1084 cpu-flags gcc OPTIONS : x86 : pentium4 : -march=pentium4 ;
1085 cpu-flags gcc OPTIONS : x86 : pentium4m : -march=pentium4m ;
1086 cpu-flags gcc OPTIONS : x86 : prescott : -march=prescott ;
1087 cpu-flags gcc OPTIONS : x86 : nocona : -march=nocona ;
1088 cpu-flags gcc OPTIONS : x86 : core2 : -march=core2 ;
1089 cpu-flags gcc OPTIONS : x86 : conroe : -march=core2 ;
1090 cpu-flags gcc OPTIONS : x86 : conroe-xe : -march=core2 ;
1091 cpu-flags gcc OPTIONS : x86 : conroe-l : -march=core2 ;
1092 cpu-flags gcc OPTIONS : x86 : allendale : -march=core2 ;
1093 cpu-flags gcc OPTIONS : x86 : wolfdale : -march=core2 -msse4.1 ;
1094 cpu-flags gcc OPTIONS : x86 : merom : -march=core2 ;
1095 cpu-flags gcc OPTIONS : x86 : merom-xe : -march=core2 ;
1096 cpu-flags gcc OPTIONS : x86 : kentsfield : -march=core2 ;
1097 cpu-flags gcc OPTIONS : x86 : kentsfield-xe : -march=core2 ;
1098 cpu-flags gcc OPTIONS : x86 : yorksfield : -march=core2 ;
1099 cpu-flags gcc OPTIONS : x86 : penryn : -march=core2 ;
1100 cpu-flags gcc OPTIONS : x86 : corei7 : -march=corei7 ;
1101 cpu-flags gcc OPTIONS : x86 : nehalem : -march=corei7 ;
1102 cpu-flags gcc OPTIONS : x86 : corei7-avx : -march=corei7-avx ;
1103 cpu-flags gcc OPTIONS : x86 : sandy-bridge : -march=corei7-avx ;
1104 cpu-flags gcc OPTIONS : x86 : core-avx-i : -march=core-avx-i ;
1105 cpu-flags gcc OPTIONS : x86 : ivy-bridge : -march=core-avx-i ;
1106 cpu-flags gcc OPTIONS : x86 : haswell : -march=core-avx-i -mavx2 -mfma -mbmi -mbmi2 -mlzcnt ;
1107 cpu-flags gcc OPTIONS : x86 : broadwell : -march=broadwell ;
1108 cpu-flags gcc OPTIONS : x86 : skylake : -march=skylake ;
1109 cpu-flags gcc OPTIONS : x86 : skylake-avx512 : -march=skylake-avx512 ;
1110 cpu-flags gcc OPTIONS : x86 : cannonlake : -march=skylake-avx512 -mavx512vbmi -mavx512ifma -msha ;
1111 cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ;
1112 cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ;
1113 cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ;
1114 cpu-flags gcc OPTIONS : x86 : athlon : -march=athlon ;
1115 cpu-flags gcc OPTIONS : x86 : athlon-tbird : -march=athlon-tbird ;
1116 cpu-flags gcc OPTIONS : x86 : athlon-4 : -march=athlon-4 ;
1117 cpu-flags gcc OPTIONS : x86 : athlon-xp : -march=athlon-xp ;
1118 cpu-flags gcc OPTIONS : x86 : athlon-mp : -march=athlon-mp ;
1119 ##
1120 cpu-flags gcc OPTIONS : x86 : k8 : -march=k8 ;
1121 cpu-flags gcc OPTIONS : x86 : opteron : -march=opteron ;
1122 cpu-flags gcc OPTIONS : x86 : athlon64 : -march=athlon64 ;
1123 cpu-flags gcc OPTIONS : x86 : athlon-fx : -march=athlon-fx ;
1124 cpu-flags gcc OPTIONS : x86 : k8-sse3 : -march=k8-sse3 ;
1125 cpu-flags gcc OPTIONS : x86 : opteron-sse3 : -march=opteron-sse3 ;
1126 cpu-flags gcc OPTIONS : x86 : athlon64-sse3 : -march=athlon64-sse3 ;
1127 cpu-flags gcc OPTIONS : x86 : amdfam10 : -march=amdfam10 ;
1128 cpu-flags gcc OPTIONS : x86 : barcelona : -march=barcelona ;
1129 cpu-flags gcc OPTIONS : x86 : bdver1 : -march=bdver1 ;
1130 cpu-flags gcc OPTIONS : x86 : bdver2 : -march=bdver2 ;
1131 cpu-flags gcc OPTIONS : x86 : bdver3 : -march=bdver3 ;
1132 cpu-flags gcc OPTIONS : x86 : bdver4 : -march=bdver4 ;
1133 cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ;
1134 cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ;
1135 cpu-flags gcc OPTIONS : x86 : znver1 : -march=znver1 ;
1136 cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ;
1137 cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ;
1138 cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ;
1139 cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ;
1140 ##
1141 cpu-flags gcc OPTIONS : x86 : atom : -march=atom ;
1142 # Sparc
1143 cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 : default ;
1144 cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ;
1145 cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ;
1146 cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ;
1147 cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ;
1148 cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ;
1149 cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ;
1150 cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ;
1151 cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ;
1152 cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ;
1153 cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ;
1154 cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ;
1155 cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ;
1156 cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ;
1157 # RS/6000 & PowerPC
1158 cpu-flags gcc OPTIONS : power : 403 : -mcpu=403 ;
1159 cpu-flags gcc OPTIONS : power : 505 : -mcpu=505 ;
1160 cpu-flags gcc OPTIONS : power : 601 : -mcpu=601 ;
1161 cpu-flags gcc OPTIONS : power : 602 : -mcpu=602 ;
1162 cpu-flags gcc OPTIONS : power : 603 : -mcpu=603 ;
1163 cpu-flags gcc OPTIONS : power : 603e : -mcpu=603e ;
1164 cpu-flags gcc OPTIONS : power : 604 : -mcpu=604 ;
1165 cpu-flags gcc OPTIONS : power : 604e : -mcpu=604e ;
1166 cpu-flags gcc OPTIONS : power : 620 : -mcpu=620 ;
1167 cpu-flags gcc OPTIONS : power : 630 : -mcpu=630 ;
1168 cpu-flags gcc OPTIONS : power : 740 : -mcpu=740 ;
1169 cpu-flags gcc OPTIONS : power : 7400 : -mcpu=7400 ;
1170 cpu-flags gcc OPTIONS : power : 7450 : -mcpu=7450 ;
1171 cpu-flags gcc OPTIONS : power : 750 : -mcpu=750 ;
1172 cpu-flags gcc OPTIONS : power : 801 : -mcpu=801 ;
1173 cpu-flags gcc OPTIONS : power : 821 : -mcpu=821 ;
1174 cpu-flags gcc OPTIONS : power : 823 : -mcpu=823 ;
1175 cpu-flags gcc OPTIONS : power : 860 : -mcpu=860 ;
1176 cpu-flags gcc OPTIONS : power : 970 : -mcpu=970 ;
1177 cpu-flags gcc OPTIONS : power : 8540 : -mcpu=8540 ;
1178 cpu-flags gcc OPTIONS : power : power : -mcpu=power ;
1179 cpu-flags gcc OPTIONS : power : power2 : -mcpu=power2 ;
1180 cpu-flags gcc OPTIONS : power : power3 : -mcpu=power3 ;
1181 cpu-flags gcc OPTIONS : power : power4 : -mcpu=power4 ;
1182 cpu-flags gcc OPTIONS : power : power5 : -mcpu=power5 ;
1183 cpu-flags gcc OPTIONS : power : powerpc : -mcpu=powerpc ;
1184 cpu-flags gcc OPTIONS : power : powerpc64 : -mcpu=powerpc64 ;
1185 cpu-flags gcc OPTIONS : power : rios : -mcpu=rios ;
1186 cpu-flags gcc OPTIONS : power : rios1 : -mcpu=rios1 ;
1187 cpu-flags gcc OPTIONS : power : rios2 : -mcpu=rios2 ;
1188 cpu-flags gcc OPTIONS : power : rsc : -mcpu=rsc ;
1189 cpu-flags gcc OPTIONS : power : rs64a : -mcpu=rs64 ;
1190 # AIX variant of RS/6000 & PowerPC
1191 toolset.flags gcc AROPTIONS <address-model>64/<target-os>aix : "-X64" ;