diff --git a/v2/tools/builtin.jam b/v2/tools/builtin.jam index d1351a423..77ffed2dd 100644 --- a/v2/tools/builtin.jam +++ b/v2/tools/builtin.jam @@ -78,7 +78,7 @@ local rule default-host-os ( ) case MACOSX : host-os = darwin ; case KFREEBSD : host-os = freebsd ; case LINUX : host-os = linux ; - case SUNOS : + case SUNOS : ECHO "SunOS is not a supported operating system." ; ECHO "We believe last version of SunOS was released in 1992, " ; ECHO "so if you get this message, something is very wrong with configuration logic. " ; @@ -271,11 +271,12 @@ feature.feature architecture : # The specific instruction set in an architecture to compile. feature.feature instruction-set : # x86 and x86-64 - native i386 i486 i586 i686 pentium pentium-mmx pentiumpro pentium2 pentium3 - pentium3m pentium-m pentium4 pentium4m prescott nocona core2 conroe conroe-xe - conroe-l allendale mermon mermon-xe kentsfield kentsfield-xe penryn wolfdale - yorksfield nehalem k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp - athlon-mp k8 opteron athlon64 athlon-fx winchip-c6 winchip2 c3 c3-2 + native i486 i586 i686 pentium pentium-mmx pentiumpro pentium2 pentium3 + pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i + conroe conroe-xe conroe-l allendale merom merom-xe kentsfield kentsfield-xe penryn wolfdale + yorksfield nehalem sandy-bridge ivy-bridge haswell k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp + athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona + bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 atom # ia64 itanium itanium1 merced itanium2 mckinley @@ -542,7 +543,7 @@ class searched-lib-generator : generator rule __init__ ( ) { - # The requirements cause the generators to be tried *only* when we're + # The requirements cause the generators to be tried *only* when we are # building a lib target with a 'search' feature. This seems ugly --- all # we want is to make sure searched-lib-generator is not invoked deep # inside transformation search to produce intermediate targets. @@ -639,7 +640,7 @@ rule preprocessed ( name : sources * : requirements * : default-build * : return [ targets.main-target-alternative [ new preprocessed-target-class $(name) : $(project) : [ targets.main-target-sources $(sources) : $(name) ] - : [ targets.main-target-requirements $(r) : $(project) ] + : [ targets.main-target-requirements $(requirements) : $(project) ] : [ targets.main-target-default-build $(default-build) : $(project) ] : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ] ] ] ; @@ -662,8 +663,15 @@ class compile-action : action rule adjust-properties ( property-set ) { local s = [ $(self.targets[1]).creating-subvariant ] ; - return [ $(property-set).add-raw - [ $(s).implicit-includes "include" : H ] ] ; + if $(s) + { + return [ $(property-set).add-raw + [ $(s).implicit-includes "include" : H ] ] ; + } + else + { + return $(property-set) ; + } } } diff --git a/v2/tools/builtin.py b/v2/tools/builtin.py index 5b28a0aa7..35c1a40d8 100644 --- a/v2/tools/builtin.py +++ b/v2/tools/builtin.py @@ -267,11 +267,12 @@ def register_globals (): # The specific instruction set in an architecture to compile. feature.feature('instruction-set', [ # x86 and x86-64 - 'i386', 'i486', 'i586', 'i686', 'pentium', 'pentium-mmx', 'pentiumpro', 'pentium2', 'pentium3', - 'pentium3m', 'pentium-m', 'pentium4', 'pentium4m', 'prescott', 'nocona', 'conroe', 'conroe-xe', - 'conroe-l', 'allendale', 'mermon', 'mermon-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', - 'yorksfield', 'nehalem', 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp', - 'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', 'winchip-c6', 'winchip2', 'c3', 'c3-2', + 'native', 'i486', 'i586', 'i686', 'pentium', 'pentium-mmx', 'pentiumpro', 'pentium2', 'pentium3', + 'pentium3m', 'pentium-m', 'pentium4', 'pentium4m', 'prescott', 'nocona', 'core2', 'corei7', 'corei7-avx', 'core-avx-i', + 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'merom', 'merom-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', + 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell', 'k6', 'k6-2', 'k6-3', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp', + 'athlon-mp', 'k8', 'opteron', 'athlon64', 'athlon-fx', 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', + 'bdver1', 'bdver2', 'bdver3', 'btver1', 'btver2', 'winchip-c6', 'winchip2', 'c3', 'c3-2', 'atom', # ia64 'itanium', 'itanium1', 'merced', 'itanium2', 'mckinley', diff --git a/v2/tools/gcc.jam b/v2/tools/gcc.jam index ee3aae128..ef90f05c7 100644 --- a/v2/tools/gcc.jam +++ b/v2/tools/gcc.jam @@ -1,10 +1,10 @@ -# Copyright 2001 David Abrahams. -# Copyright 2002-2006 Rene Rivera. -# Copyright 2002-2003 Vladimir Prus. -# Copyright (c) 2005 Reece H. Dunn. -# Copyright 2006 Ilya Sokolov. +# Copyright 2001 David Abrahams +# Copyright 2002-2006 Rene Rivera +# Copyright 2002-2003 Vladimir Prus +# Copyright 2005 Reece H. Dunn +# Copyright 2006 Ilya Sokolov # Copyright 2007 Roland Schwarz -# Copyright 2007 Boris Gubenko. +# Copyright 2007 Boris Gubenko # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at @@ -12,20 +12,19 @@ import "class" : new ; import common ; -import errors ; import feature ; +import fortran ; import generators ; import os ; import pch ; import property ; import property-set ; -import toolset ; -import type ; import rc ; import regex ; import set ; +import toolset ; +import type ; import unix ; -import fortran ; if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] @@ -49,6 +48,7 @@ type.set-generated-target-suffix OBJ : gcc : o ; type.set-generated-target-suffix OBJ : gcc windows : o ; type.set-generated-target-suffix OBJ : gcc cygwin : o ; + # Initializes the gcc toolset for the given version. If necessary, command may # be used to specify where the compiler is located. The parameter 'options' is a # space-delimited list of options, each one specified as @@ -58,88 +58,109 @@ type.set-generated-target-suffix OBJ : gcc cygwin : o ; # Example: # using gcc : 3.4 : : foo bar sun ; # -# The compiler command to use is detected in a three step manner: -# 1) If an explicit command is specified by the user, it will be used and must available. +# The compiler command to use is detected in three steps: +# 1) If an explicit command is specified by the user, it will be used and must +# be available. # 2) If only a certain version is specified, it is enforced: -# - either a command 'g++-VERSION' must be available -# - or the default command 'g++' must be available and match the exact version. -# 3) Without user-provided restrictions use default 'g++' +# - either the 'g++-VERSION' command must be available +# - or the default command 'g++' must be available and match the exact +# version. +# 3) Without user-provided restrictions use default 'g++'. +# rule init ( version ? : command * : options * ) { #1): use user-provided command local tool-command = ; if $(command) { - tool-command = [ common.get-invocation-command-nodefault gcc : g++ : $(command) ] ; - if ! $(tool-command) - { - errors.error "toolset gcc initialization:" : - "provided command '$(command)' not found" : - "initialized from" [ errors.nearest-user-location ] ; - } + tool-command = [ common.get-invocation-command-nodefault gcc : g++ : + $(command) ] ; + if ! $(tool-command) + { + import errors ; + errors.error toolset gcc initialization: + : provided command '$(command)' not found + : initialized from [ errors.nearest-user-location ] ; + } } #2): enforce user-provided version else if $(version) { - tool-command = [ common.get-invocation-command-nodefault gcc : "g++-$(version[1])" ] ; - + tool-command = [ common.get-invocation-command-nodefault gcc : + "g++-$(version[1])" ] ; + #2.1) fallback: check whether "g++" reports the requested version if ! $(tool-command) { - tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] ; + tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] + ; if $(tool-command) { local tool-command-string = $(tool-command:J=" ") ; - local tool-version = [ MATCH "^([0-9.]+)" : [ SHELL "$(tool-command-string) -dumpversion" ] ] ; + local tool-version = [ MATCH "^([0-9.]+)" : + [ SHELL "$(tool-command-string) -dumpversion" ] ] ; if $(tool-version) != $(version) { - # Permit a match betwen two-digit version specified by the user - # (e.g. 4.4) and 3-digit version reported by gcc. - # Since only two digits are present in binary name anyway, - # insisting that user specify 3-digit version when - # configuring Boost.Build while it's not required on - # command like would be strange. - local stripped = [ MATCH "^([0-9]+\.[0-9]+).*" : $(tool-version) ] ; + # Permit a match betwen a two-digit version specified by the + # user (e.g. 4.4) and a 3-digit version reported by gcc. + # Since only two digits are present in the binary name + # anyway, insisting that user specify the 3-digit version + # when configuring Boost.Build, while it is not required on + # the command line, would be strange. + local stripped = [ MATCH "^([0-9]+\.[0-9]+).*" : + $(tool-version) ] ; if $(stripped) != $(version) - { - errors.error "toolset gcc initialization:" : - "version '$(version)' requested but 'g++-$(version)' not found and version '$(tool-version)' of default '$(tool-command)' does not match" : - "initialized from" [ errors.nearest-user-location ] ; + { + import errors ; + errors.error toolset gcc initialization: + : version '$(version)' requested but + 'g++-$(version)' not found and version + '$(tool-version)' of default '$(tool-command)' + does not match + : initialized from [ errors.nearest-user-location ] + ; tool-command = ; } - # Use full 3-digit version to be compatible with the 'using gcc ;' case + # Use full 3-digit version to be compatible with the + # 'using gcc ;' case version = $(tool-version) ; } } else { - errors.error "toolset gcc initialization:" : - "version '$(version)' requested but neither 'g++-$(version)' nor default 'g++' found" : - "initialized from" [ errors.nearest-user-location ] ; + import errors ; + errors.error toolset gcc initialization: + : version '$(version)' requested but neither + 'g++-$(version)' nor default 'g++' found + : initialized from [ errors.nearest-user-location ] ; } } } - #3) default: no command and no version specified, try using default command "g++" + #3) default: no command and no version specified, try using "g++" else { tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] ; if ! $(tool-command) { - errors.error "toolset gcc initialization:" : - "no command provided, default command 'g++' not found" : - "initialized from" [ errors.nearest-user-location ] ; + import errors ; + errors.error toolset gcc initialization: + : no command provided, default command 'g++' not found + : initialized from [ errors.nearest-user-location ] ; } } - - + + # Information about the gcc command... # The command. local command = $(tool-command) ; + # The 'command' variable can have multiple elements but when calling the + # SHELL builtin we need a single string. + local command-string = $(command:J=" ") ; # The root directory of the tool install. local root = [ feature.get-values : $(options) ] ; # The bin directory where to find the command to execute. local bin ; - # The flavor of compiler. + # The compiler flavor. local flavor = [ feature.get-values : $(options) ] ; # Autodetect the root and bin dir if not given. if $(command) @@ -147,16 +168,13 @@ rule init ( version ? : command * : options * ) bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; root ?= $(bin:D) ; } - # The 'command' variable can have multiple elements. When calling - # the SHELL builtin we need a single string. - local command-string = $(command:J=" ") ; # Autodetect the version and flavor if not given. if $(command) - { - local machine = [ MATCH "^([^ ]+)" - : [ SHELL "$(command-string) -dumpmachine" ] ] ; - version ?= [ MATCH "^([0-9.]+)" - : [ SHELL "$(command-string) -dumpversion" ] ] ; + { + local machine = [ MATCH "^([^ ]+)" : + [ SHELL "$(command-string) -dumpmachine" ] ] ; + version ?= [ MATCH "^([0-9.]+)" : + [ SHELL "$(command-string) -dumpversion" ] ] ; switch $(machine:L) { case *mingw* : flavor ?= mingw ; @@ -166,58 +184,38 @@ rule init ( version ? : command * : options * ) local condition ; if $(flavor) { - condition = [ common.check-init-parameters gcc - : version $(version) - : flavor $(flavor) - ] ; - } - else - { - condition = [ common.check-init-parameters gcc - : version $(version) - ] ; - condition = $(condition) ; #/ ; + condition = flavor $(flavor) ; } + condition = [ common.check-init-parameters gcc : version $(version) + : $(condition) ] ; common.handle-options gcc : $(condition) : $(command) : $(options) ; local linker = [ feature.get-values : $(options) ] ; - # The logic below should actually be keyed on + # TODO: The logic below should actually be keyed on . if ! $(linker) { - if [ os.name ] = OSF + switch [ os.name ] { - linker = osf ; - } - else if [ os.name ] = HPUX - { - linker = hpux ; - } - else if [ os.name ] = AIX - { - linker = aix ; - } - else if [ os.name ] = SOLARIS - { - linker = sun ; - } - else - { - linker = gnu ; + case OSF : linker = osf ; + case HPUX : linker = hpux ; + case AIX : linker = aix ; + case SOLARIS : linker = sun ; + case * : linker = gnu ; } } init-link-flags gcc $(linker) $(condition) ; - - # If gcc is installed in non-standard location, we'd need to add + # If gcc is installed in a non-standard location, we would need to add # LD_LIBRARY_PATH when running programs created with it (for unit-test/run # rules). if $(command) { # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries # and all must be added to LD_LIBRARY_PATH. The linker will pick the - # right onces. Note that we don't provide a clean way to build 32-bit - # binary with 64-bit compiler, but user can always pass -m32 manually. + # right onces. Note that we do not provide a clean way to build a 32-bit + # binary using a 64-bit compiler, but user can always pass -m32 + # manually. local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ; if $(.debug-configuration) { @@ -226,52 +224,52 @@ rule init ( version ? : command * : options * ) toolset.flags gcc.link RUN_PATH $(condition) : $(lib_path) ; } - # If it's not a system gcc install we should adjust the various programs as - # needed to prefer using the install specific versions. This is essential - # for correct use of MinGW and for cross-compiling. - + # If we are not using a system gcc installation we should adjust the various + # programs as needed to prefer using their installation specific versions. + # This is essential for correct use of MinGW and for cross-compiling. + local nl = " " ; - # - The archive builder. + # - Archive builder. local archiver = [ common.get-invocation-command gcc - : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : [ SHELL "$(command-string) -print-prog-name=ar" ] ] ] - : [ feature.get-values : $(options) ] - : $(bin) - : search-path ] ; + : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : + [ SHELL "$(command-string) -print-prog-name=ar" ] ] ] + : [ feature.get-values : $(options) ] + : $(bin) + : search-path ] ; toolset.flags gcc.archive .AR $(condition) : $(archiver[1]) ; if $(.debug-configuration) { ECHO notice: using gcc archiver :: $(condition) :: $(archiver[1]) ; } - # - Ranlib + # - Ranlib. local ranlib = [ common.get-invocation-command gcc - : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : [ SHELL "$(command-string) -print-prog-name=ranlib" ] ] ] - : [ feature.get-values : $(options) ] - : $(bin) - : search-path ] ; + : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : + [ SHELL "$(command-string) -print-prog-name=ranlib" ] ] ] + : [ feature.get-values : $(options) ] + : $(bin) + : search-path ] ; toolset.flags gcc.archive .RANLIB $(condition) : $(ranlib[1]) ; if $(.debug-configuration) { ECHO notice: using gcc ranlib :: $(condition) :: $(ranlib[1]) ; } - - # - The resource compiler. - local rc = - [ common.get-invocation-command-nodefault gcc - : windres : [ feature.get-values : $(options) ] : $(bin) : search-path ] ; - local rc-type = - [ feature.get-values : $(options) ] ; + # - Resource compiler. + local rc = [ common.get-invocation-command-nodefault gcc : windres : + [ feature.get-values : $(options) ] : $(bin) : search-path ] ; + local rc-type = [ feature.get-values : $(options) ] ; rc-type ?= windres ; if ! $(rc) { - # If we can't find an RC compiler we fallback to a null RC compiler that + # If we can not find an RC compiler we fallback to a null one that # creates empty object files. This allows the same Jamfiles to work - # across the board. The null RC uses the assembler to create the empty + # across the board. The null RC uses assembler to create the empty # objects, so configure that. - rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ] ; + rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ] + ; rc-type = null ; } rc.configure $(rc) : $(condition) : $(rc-type) ; @@ -281,6 +279,7 @@ if [ os.name ] = NT { # This causes single-line command invocation to not go through .bat files, # thus avoiding command-line length limitations. + # TODO: Set JAMSHELL on specific targets instead of globally. JAMSHELL = % ; } @@ -296,8 +295,8 @@ generators.register-fortran-compiler gcc.compile.fortran : FORTRAN FORTRAN90 : O # The compiler looks for a precompiled header in each directory just before it # looks for the include file in that directory. The name searched for is the # name specified in the #include directive with ".gch" suffix appended. The -# logic in gcc-pch-generator will make sure that BASE_PCH suffix is appended to -# full name of the header. +# logic in gcc-pch-generator will make sure that the BASE_PCH suffix is appended +# to the full header name. type.set-generated-target-suffix PCH : gcc : gch ; @@ -320,20 +319,23 @@ class gcc-pch-generator : pch-generator } } - # Error handling: Base header file name should be the same as the base + # Error handling: base header file name should be the same as the base # precompiled header name. local header-name = [ $(header).name ] ; local header-basename = $(header-name:B) ; if $(header-basename) != $(name) { local location = [ $(project).project-module ] ; - errors.user-error "in" $(location)": pch target name `"$(name)"' should be the same as the base name of header file `"$(header-name)"'" ; + import errors : user-error : errors.user-error ; + errors.user-error "in" $(location): pch target name '$(name)' should + be the same as the base name of header file '$(header-name)' ; } local pch-file = [ generator.run $(project) $(name) : $(property-set) : $(header) ] ; - # return result of base class and pch-file property as usage-requirements + # Return result of base class and pch-file property as + # usage-requirements. return [ property-set.create $(pch-file) -Winvalid-pch ] $(pch-file) @@ -341,7 +343,7 @@ class gcc-pch-generator : pch-generator } # Calls the base version specifying source's name as the name of the created - # target. As result, the PCH will be named whatever.hpp.gch, and not + # target. As a result, the PCH will be named whatever.hpp.gch, and not # whatever.gch. rule generated-targets ( sources + : property-set : project name ? ) { @@ -379,15 +381,17 @@ toolset.flags gcc.compile OPTIONS on : -Werror ; toolset.flags gcc.compile OPTIONS on : -g ; toolset.flags gcc.compile OPTIONS on : -pg ; -toolset.flags gcc.compile OPTIONS off : -fno-rtti ; + +toolset.flags gcc.compile.c++ OPTIONS off : -fno-rtti ; +toolset.flags gcc.compile.c++ OPTIONS off : -fno-exceptions ; rule setup-fpic ( targets * : sources * : properties * ) { local link = [ feature.get-values link : $(properties) ] ; if $(link) = shared - { + { local target = [ feature.get-values target-os : $(properties) ] ; - + # This logic will add -fPIC for all compilations: # # lib a : a.cpp b ; @@ -395,23 +399,23 @@ rule setup-fpic ( targets * : sources * : properties * ) # exe c : c.cpp a d ; # obj d : d.cpp ; # - # This all is fine, except that 'd' will be compiled with -fPIC even though - # it is not needed, as 'd' is used only in exe. However, it is hard to - # detect where a target is going to be used. Alternatively, we can set -fPIC - # only when main target type is LIB but than 'b' would be compiled without - # -fPIC which would lead to link errors on x86-64. So, compile everything - # with -fPIC. + # This all is fine, except that 'd' will be compiled with -fPIC even + # though it is not needed, as 'd' is used only in exe. However, it is + # hard to detect where a target is going to be used. Alternatively, we + # can set -fPIC only when main target type is LIB but than 'b' would be + # compiled without -fPIC which would lead to link errors on x86-64. So, + # compile everything with -fPIC. # # Yet another alternative would be to create a propagated - # feature and set it when building shared libraries, but that would be hard - # to implement and would increase the target path length even more. - - # On Windows, fPIC is default, specifying -fPIC explicitly leads to - # a warning. - if $(target) != cygwin && $(target) != windows + # feature and set it when building shared libraries, but that would be + # hard to implement and would increase the target path length even more. + + # On Windows, fPIC is the default, and specifying -fPIC explicitly leads + # to a warning. + if ! $(target) in cygwin windows { OPTIONS on $(targets) += -fPIC ; - } + } } } @@ -462,12 +466,12 @@ rule setup-address-model ( targets * : sources * : properties * ) # on its own. } OPTIONS on $(targets) += $(option) ; - } + } } # FIXME: this should not use os.name. -if [ os.name ] != NT && [ os.name ] != OSF && [ os.name ] != HPUX && [ os.name ] != AIX +if ! [ os.name ] in NT OSF HPUX AIX { # OSF does have an option called -soname but it does not seem to work as # expected, therefore it has been disabled. @@ -475,7 +479,7 @@ if [ os.name ] != NT && [ os.name ] != OSF && [ os.name ] != HPUX && [ os.name ] SONAME_OPTION = -h ; } -# HPUX, for some reason, seem to use '+h', not '-h'. +# HPUX, for some reason, seems to use '+h' instead of '-h'. if [ os.name ] = HPUX { HAVE_SONAME = "" ; @@ -505,7 +509,7 @@ rule compile.c.pch ( targets * : sources * : properties * ) { setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; - setup-address-model $(targets) : $(sources) : $(properties) ; + setup-address-model $(targets) : $(sources) : $(properties) ; } actions compile.c.pch @@ -518,7 +522,7 @@ rule compile.c++.preprocess ( targets * : sources * : properties * ) setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; setup-address-model $(targets) : $(sources) : $(properties) ; - + # Some extensions are compiled as C++ by default. For others, we need to # pass -x c++. We could always pass -x c++ but distcc does not work with it. if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C @@ -533,7 +537,7 @@ rule compile.c.preprocess ( targets * : sources * : properties * ) setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; setup-address-model $(targets) : $(sources) : $(properties) ; - + # If we use the name g++ then default file suffix -> language mapping does # not work. So have to pass -x option. Maybe, we can work around this by # allowing the user to specify both C and C++ compiler names. @@ -549,7 +553,7 @@ rule compile.c++ ( targets * : sources * : properties * ) setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; setup-address-model $(targets) : $(sources) : $(properties) ; - + # Some extensions are compiled as C++ by default. For others, we need to # pass -x c++. We could always pass -x c++ but distcc does not work with it. if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C @@ -557,7 +561,7 @@ rule compile.c++ ( targets * : sources * : properties * ) LANG on $(<) = "-x c++" ; } DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; - + # Here we want to raise the template-depth parameter value to something # higher than the default value of 17. Note that we could do this using the # feature.set-default rule but we do not want to set the default value for @@ -579,7 +583,7 @@ rule compile.c ( targets * : sources * : properties * ) setup-threading $(targets) : $(sources) : $(properties) ; setup-fpic $(targets) : $(sources) : $(properties) ; setup-address-model $(targets) : $(sources) : $(properties) ; - + # If we use the name g++ then default file suffix -> language mapping does # not work. So have to pass -x option. Maybe, we can work around this by # allowing the user to specify both C and C++ compiler names. @@ -619,12 +623,12 @@ actions compile.c.preprocess bind PCH_FILE actions compile.fortran { - "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } rule compile.asm ( targets * : sources * : properties * ) { - setup-fpic $(targets) : $(sources) : $(properties) ; + setup-fpic $(targets) : $(sources) : $(properties) ; setup-address-model $(targets) : $(sources) : $(properties) ; LANG on $(<) = "-x assembler-with-cpp" ; } @@ -634,8 +638,8 @@ actions compile.asm "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } -# The class which check that we don't try to use the static -# property while creating or using shared library, since it's not supported by +# Class checking that we do not try to use the static property +# while creating or using a shared library, since it is not supported by # gcc/libc. class gcc-linking-generator : unix-linking-generator { @@ -657,44 +661,38 @@ class gcc-linking-generator : unix-linking-generator { if shared in $(properties) { - reason = - "On gcc, DLL can't be build with 'static'." ; + reason = On gcc, DLLs can not be built with + 'static'. ; } else if [ type.is-derived $(self.target-types[1]) EXE ] { for local s in $(sources) { local type = [ $(s).type ] ; - if $(type) && [ type.is-derived $(type) SHARED_LIB ] + if $(type) && [ type.is-derived $(type) SHARED_LIB ] { - reason = - "On gcc, using DLLS together with the" - "static options is not possible " ; + reason = On gcc, using DLLs together with the + 'static' option is not possible. ; } } } } if $(reason) { - ECHO warning: - $(reason) ; - ECHO warning: - "It is suggested to use 'static' together" - "with 'static'." ; - return ; + ECHO warning: $(reason) ; + ECHO warning: It is suggested to use 'static' together + with 'static'. ; } else { - local generated-targets = [ unix-linking-generator.run $(project) - $(name) : $(property-set) : $(sources) ] ; - return $(generated-targets) ; + return [ unix-linking-generator.run $(project) $(name) : + $(property-set) : $(sources) ] ; } } } -# The set of permissible input types is different on mingw. -# So, define two sets of generators, with mingw generators -# selected when target-os=windows. +# The set of permissible input types is different on mingw. So, define two sets +# of generators, with mingw generators selected when target-os=windows. local g ; g = [ new gcc-linking-generator gcc.mingw.link @@ -725,10 +723,9 @@ generators.register generators.override gcc.mingw.link : gcc.link ; generators.override gcc.mingw.link.dll : gcc.link.dll ; -# Cygwin is similar to msvc and mingw in that it uses import libraries. -# While in simple cases, it can directly link to a shared library, -# it is believed to be slower, and not always possible. Define cygwin-specific -# generators here. +# Cygwin is similar to msvc and mingw in that it uses import libraries. While in +# simple cases, it can directly link to a shared library, it is believed to be +# slower, and not always possible. Define cygwin-specific generators here. g = [ new gcc-linking-generator gcc.cygwin.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB @@ -776,8 +773,6 @@ rule init-link-flags ( toolset linker condition ) switch $(linker) { case aix : - { - # # On AIX we *have* to use the native linker. # # Using -brtl, the AIX linker will look for libraries with both the .a @@ -802,34 +797,33 @@ rule init-link-flags ( toolset linker condition ) toolset.flags $(toolset).link OPTIONS : -Wl,-brtl -Wl,-bnoipath : unchecked ; - } case darwin : - { # On Darwin, the -s option to ld does not work unless we pass -static, - # and passing -static unconditionally is a bad idea. So, don't pass -s. - # at all, darwin.jam will use separate 'strip' invocation. - toolset.flags $(toolset).link RPATH $(condition) : : unchecked ; - toolset.flags $(toolset).link RPATH_LINK $(condition) : : unchecked ; - } + # and passing -static unconditionally is a bad idea. So, do not pass -s + # at all and darwin.jam will use a separate 'strip' invocation. + toolset.flags $(toolset).link RPATH $(condition) : : + unchecked ; + toolset.flags $(toolset).link RPATH_LINK $(condition) : : + unchecked ; case gnu : - { # Strip the binary when no debugging is needed. We use --strip-all flag # as opposed to -s since icc (intel's compiler) is generally # option-compatible with and inherits from the gcc toolset, but does not # support -s. - toolset.flags $(toolset).link OPTIONS $(condition)/on : -Wl,--strip-all : unchecked ; - toolset.flags $(toolset).link RPATH $(condition) : : unchecked ; - toolset.flags $(toolset).link RPATH_LINK $(condition) : : unchecked ; - toolset.flags $(toolset).link START-GROUP $(condition) : -Wl,--start-group : unchecked ; - toolset.flags $(toolset).link END-GROUP $(condition) : -Wl,--end-group : unchecked ; + toolset.flags $(toolset).link OPTIONS $(condition)/on : -Wl,--strip-all : unchecked ; + toolset.flags $(toolset).link RPATH $(condition) : : unchecked ; + toolset.flags $(toolset).link RPATH_LINK $(condition) : : unchecked ; + toolset.flags $(toolset).link START-GROUP $(condition) : -Wl,--start-group : unchecked ; + toolset.flags $(toolset).link END-GROUP $(condition) : -Wl,--end-group : unchecked ; # gnu ld has the ability to change the search behaviour for libraries - # referenced by -l switch. These modifiers are -Bstatic and -Bdynamic - # and change search for -l switches that follow them. The following list - # shows the tried variants. - # The search stops at the first variant that has a match. + # referenced by the -l switch. These modifiers are -Bstatic and + # -Bdynamic and change search for -l switches that follow them. The + # following list shows the tried variants. Search stops at the first + # variant that has a match. + # # *nix: -Bstatic -lxxx # libxxx.a # @@ -837,11 +831,11 @@ rule init-link-flags ( toolset linker condition ) # libxxx.so # libxxx.a # - # windows (mingw,cygwin) -Bstatic -lxxx + # windows (mingw, cygwin) -Bstatic -lxxx # libxxx.a # xxx.lib # - # windows (mingw,cygwin) -Bdynamic -lxxx + # windows (mingw, cygwin) -Bdynamic -lxxx # libxxx.dll.a # xxx.dll.a # libxxx.a @@ -857,52 +851,49 @@ rule init-link-flags ( toolset linker condition ) # search patterns! # On *nix mixing shared libs with static runtime is not a good idea. - toolset.flags $(toolset).link FINDLIBS-ST-PFX $(condition)/shared - : -Wl,-Bstatic : unchecked ; - toolset.flags $(toolset).link FINDLIBS-SA-PFX $(condition)/shared - : -Wl,-Bdynamic : unchecked ; + toolset.flags $(toolset).link FINDLIBS-ST-PFX + $(condition)/shared : -Wl,-Bstatic : unchecked ; + toolset.flags $(toolset).link FINDLIBS-SA-PFX + $(condition)/shared : -Wl,-Bdynamic : unchecked ; # On windows allow mixing of static and dynamic libs with static - # runtime. - toolset.flags $(toolset).link FINDLIBS-ST-PFX $(condition)/static/windows - : -Wl,-Bstatic : unchecked ; - toolset.flags $(toolset).link FINDLIBS-SA-PFX $(condition)/static/windows - : -Wl,-Bdynamic : unchecked ; - toolset.flags $(toolset).link OPTIONS $(condition)/static/windows - : -Wl,-Bstatic : unchecked ; - } + # runtime is not a good idea. + toolset.flags $(toolset).link FINDLIBS-ST-PFX + $(condition)/static/windows : -Wl,-Bstatic + : unchecked ; + toolset.flags $(toolset).link FINDLIBS-SA-PFX + $(condition)/static/windows : -Wl,-Bdynamic + : unchecked ; + toolset.flags $(toolset).link OPTIONS + $(condition)/static/windows : -Wl,-Bstatic + : unchecked ; case hpux : - { - toolset.flags $(toolset).link OPTIONS $(condition)/on - : -Wl,-s : unchecked ; - toolset.flags $(toolset).link OPTIONS $(condition)/shared - : -fPIC : unchecked ; - } + toolset.flags $(toolset).link OPTIONS $(condition)/on : -Wl,-s : + unchecked ; + toolset.flags $(toolset).link OPTIONS $(condition)/shared : -fPIC + : unchecked ; case osf : - { # No --strip-all, just -s. - toolset.flags $(toolset).link OPTIONS $(condition)/on - : -Wl,-s : unchecked ; - toolset.flags $(toolset).link RPATH $(condition) : - : unchecked ; - # This does not supports -R. - toolset.flags $(toolset).link RPATH_OPTION $(condition) : -rpath - : unchecked ; + toolset.flags $(toolset).link OPTIONS $(condition)/on : -Wl,-s : + unchecked ; + toolset.flags $(toolset).link RPATH $(condition) : : + unchecked ; + # This does not support -R. + toolset.flags $(toolset).link RPATH_OPTION $(condition) : -rpath : + unchecked ; # -rpath-link is not supported at all. - } case sun : - { - toolset.flags $(toolset).link OPTIONS $(condition)/on - : -Wl,-s : unchecked ; - toolset.flags $(toolset).link RPATH $(condition) : - : unchecked ; - # Solaris linker does not have a separate -rpath-link, but allows to use + toolset.flags $(toolset).link OPTIONS $(condition)/on : -Wl,-s : + unchecked ; + toolset.flags $(toolset).link RPATH $(condition) : : + unchecked ; + # Solaris linker does not have a separate -rpath-link, but allows using # -L for the same purpose. - toolset.flags $(toolset).link LINKPATH $(condition) : - : unchecked ; + toolset.flags $(toolset).link LINKPATH $(condition) : : + unchecked ; # This permits shared libraries with non-PIC code on Solaris. # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the @@ -910,32 +901,31 @@ rule init-link-flags ( toolset linker condition ) # separate question. # AH, 2004/10/16: it is still necessary because some tests link against # static libraries that were compiled without PIC. - toolset.flags $(toolset).link OPTIONS $(condition)/shared - : -mimpure-text : unchecked ; - } + toolset.flags $(toolset).link OPTIONS $(condition)/shared : + -mimpure-text : unchecked ; case * : - { - errors.user-error - "$(toolset) initialization: invalid linker '$(linker)'" : - "The value '$(linker)' specified for is not recognized." : - "Possible values are 'aix', 'darwin', 'gnu', 'hpux', 'osf' or 'sun'" ; - } + import errors ; + errors.user-error $(toolset) initialization: invalid linker '$(linker)' + : The value '$(linker)' specified for is not recognized. + : Possible values are 'aix', 'darwin', 'gnu', 'hpux', 'osf' or 'sun' + ; } } -# Enclose the RPATH variable on 'targets' in (double) quotes, -# unless it's already enclosed in single quotes. -# This special casing is done because it's common to pass -# '$ORIGIN' to linker -- and it has to have single quotes -# to prevent expansion by shell -- and if we add double -# quotes then preventing properties of single quotes disappear. + +# Enclose the RPATH variable on 'targets' in double quotes, unless it is already +# enclosed in single quotes. This special casing is done because it is common to +# pass '$ORIGIN' to linker -- and it has to have single quotes to prevent shell +# expansion -- and if we add double quotes then the preventing properties of +# single quotes disappear. +# rule quote-rpath ( targets * ) { local r = [ on $(targets[1]) return $(RPATH) ] ; - if ! [ MATCH "('.*')" : $(r) ] + if ! [ MATCH ('.*') : $(r) ] { - r = "\"$(r)\"" ; + r = \"$(r)\" ; } RPATH on $(targets) = $(r) ; } @@ -956,13 +946,13 @@ rule link ( targets * : sources * : properties * ) actions link bind LIBRARIES { "$(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) - } + # Default value. Mostly for the sake of intel-linux that inherits from gcc, but # does not have the same logic to set the .AR variable. We can put the same -# logic in intel-linux, but that's hardly worth the trouble as on Linux, 'ar' is -# always available. +# logic in intel-linux, but that is hardly worth the trouble as on Linux, 'ar' +# is always available. .AR = ar ; .RANLIB = ranlib ; @@ -998,10 +988,11 @@ rule archive ( targets * : sources * : properties * ) # Declare action for creating static libraries. # The letter 'r' means to add files to the archive with replacement. Since we -# remove archive, we don't care about replacement, but there's no option "add +# remove archive, we do not care about replacement, but there is no option "add # without replacement". # The letter 'c' suppresses the warning in case the archive does not exists yet. # That warning is produced only on some platforms, for whatever reasons. +# actions piecemeal archive { "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" @@ -1027,51 +1018,23 @@ rule setup-threading ( targets * : sources * : properties * ) { local threading = [ feature.get-values threading : $(properties) ] ; if $(threading) = multi - { + { local target = [ feature.get-values target-os : $(properties) ] ; local option ; local libs ; - + switch $(target) { - case windows : - { - option = -mthreads ; - } - case cygwin : - { - option = -mthreads ; - } - case solaris : - { - option = -pthreads ; - libs = rt ; - } - case beos : - { - # BeOS has no threading options, so do not set anything here. - } - case *bsd : - { - option = -pthread ; - # There is no -lrt on BSD. - } - case sgi : - { - # gcc on IRIX does not support multi-threading so do not set anything - # here. - } - case darwin : - { - # Darwin has no threading options so do not set anything here. - } - case * : - { - option = -pthread ; - libs = rt ; - } + case windows : option = -mthreads ; + case cygwin : option = -mthreads ; + case solaris : option = -pthreads ; libs = rt ; + case beos : # No threading options. + case *bsd : option = -pthread ; # There is no -lrt on BSD. + case sgi : # gcc on IRIX does not support multi-threading. + case darwin : # No threading options. + case * : option = -pthread ; libs = rt ; } - + if $(option) { OPTIONS on $(targets) += $(option) ; @@ -1080,16 +1043,17 @@ rule setup-threading ( targets * : sources * : properties * ) { FINDLIBS-SA on $(targets) += $(libs) ; } - } + } } -local rule cpu-flags ( toolset variable : architecture : instruction-set + : values + : default ? ) + +local rule cpu-flags ( toolset variable : architecture : instruction-set + : + values + : default ? ) { if $(default) { toolset.flags $(toolset) $(variable) - $(architecture)/ - : $(values) ; + $(architecture)/ : $(values) ; } toolset.flags $(toolset) $(variable) /$(instruction-set) @@ -1097,14 +1061,14 @@ local rule cpu-flags ( toolset variable : architecture : instruction-set + : val : $(values) ; } + # Set architecture/instruction-set options. # # x86 and compatible -# The 'native' option appeared in gcc 4.2 so we cannot safely use it -# as default. Use conservative i386 instead for 32-bit. -toolset.flags gcc OPTIONS x86/32/ : -march=i386 ; +# The 'native' option appeared in gcc 4.2 so we cannot safely use it as default. +# Use i686 instead for 32-bit. +toolset.flags gcc OPTIONS x86/32/ : -march=i686 ; cpu-flags gcc OPTIONS : x86 : native : -march=native ; -cpu-flags gcc OPTIONS : x86 : i386 : -march=i386 ; cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ; cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ; cpu-flags gcc OPTIONS : x86 : i686 : -march=i686 ; @@ -1120,6 +1084,24 @@ cpu-flags gcc OPTIONS : x86 : pentium4m : -march=pentium4m ; cpu-flags gcc OPTIONS : x86 : prescott : -march=prescott ; cpu-flags gcc OPTIONS : x86 : nocona : -march=nocona ; cpu-flags gcc OPTIONS : x86 : core2 : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : conroe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : conroe-xe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : conroe-l : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : allendale : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : wolfdale : -march=core2 -msse4.1 ; +cpu-flags gcc OPTIONS : x86 : merom : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : merom-xe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : kentsfield : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : kentsfield-xe : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : yorksfield : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : penryn : -march=core2 ; +cpu-flags gcc OPTIONS : x86 : corei7 : -march=corei7 ; +cpu-flags gcc OPTIONS : x86 : nehalem : -march=corei7 ; +cpu-flags gcc OPTIONS : x86 : corei7-avx : -march=corei7-avx ; +cpu-flags gcc OPTIONS : x86 : sandy-bridge : -march=corei7-avx ; +cpu-flags gcc OPTIONS : x86 : core-avx-i : -march=core-avx-i ; +cpu-flags gcc OPTIONS : x86 : ivy-bridge : -march=core-avx-i ; +cpu-flags gcc OPTIONS : x86 : haswell : -march=core-avx-i -mavx2 -mfma -mbmi -mbmi2 -mlzcnt ; cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ; cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ; cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ; @@ -1133,10 +1115,22 @@ cpu-flags gcc OPTIONS : x86 : k8 : -march=k8 ; cpu-flags gcc OPTIONS : x86 : opteron : -march=opteron ; cpu-flags gcc OPTIONS : x86 : athlon64 : -march=athlon64 ; cpu-flags gcc OPTIONS : x86 : athlon-fx : -march=athlon-fx ; +cpu-flags gcc OPTIONS : x86 : k8-sse3 : -march=k8-sse3 ; +cpu-flags gcc OPTIONS : x86 : opteron-sse3 : -march=opteron-sse3 ; +cpu-flags gcc OPTIONS : x86 : athlon64-sse3 : -march=athlon64-sse3 ; +cpu-flags gcc OPTIONS : x86 : amdfam10 : -march=amdfam10 ; +cpu-flags gcc OPTIONS : x86 : barcelona : -march=barcelona ; +cpu-flags gcc OPTIONS : x86 : bdver1 : -march=bdver1 ; +cpu-flags gcc OPTIONS : x86 : bdver2 : -march=bdver2 ; +cpu-flags gcc OPTIONS : x86 : bdver3 : -march=bdver3 ; +cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ; +cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ; cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ; cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ; cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ; cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ; +## +cpu-flags gcc OPTIONS : x86 : atom : -march=atom ; # Sparc cpu-flags gcc OPTIONS : sparc : c3 : -mcpu=c3 : default ; cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 ; diff --git a/v2/tools/gcc.py b/v2/tools/gcc.py index b0aba1d29..25e7eeb4f 100644 --- a/v2/tools/gcc.py +++ b/v2/tools/gcc.py @@ -709,10 +709,10 @@ def cpu_flags(toolset, variable, architecture, instruction_set, values, default= # x86 and compatible flags('gcc', 'OPTIONS', ['x86/32'], ['-m32']) flags('gcc', 'OPTIONS', ['x86/64'], ['-m64']) -cpu_flags('gcc', 'OPTIONS', 'x86', 'i386', ['-march=i386'], default=True) +cpu_flags('gcc', 'OPTIONS', 'x86', 'native', ['-march=native']) cpu_flags('gcc', 'OPTIONS', 'x86', 'i486', ['-march=i486']) cpu_flags('gcc', 'OPTIONS', 'x86', 'i586', ['-march=i586']) -cpu_flags('gcc', 'OPTIONS', 'x86', 'i686', ['-march=i686']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'i686', ['-march=i686'], default=True) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium', ['-march=pentium']) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium-mmx', ['-march=pentium-mmx']) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentiumpro', ['-march=pentiumpro']) @@ -724,6 +724,25 @@ cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium4', ['-march=pentium4']) cpu_flags('gcc', 'OPTIONS', 'x86', 'pentium4m', ['-march=pentium4m']) cpu_flags('gcc', 'OPTIONS', 'x86', 'prescott', ['-march=prescott']) cpu_flags('gcc', 'OPTIONS', 'x86', 'nocona', ['-march=nocona']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'core2', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'conroe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'conroe-xe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'conroe-l', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'allendale', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'wolfdale', ['-march=core2', '-msse4.1']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'merom', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'merom-xe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'kentsfield', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'kentsfield-xe', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'yorksfield', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'penryn', ['-march=core2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'corei7', ['-march=corei7']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'nehalem', ['-march=corei7']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'corei7-avx', ['-march=corei7-avx']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'sandy-bridge', ['-march=corei7-avx']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'core-avx-i', ['-march=core-avx-i']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'ivy-bridge', ['-march=core-avx-i']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'haswell', ['-march=core-avx-i', '-mavx2', '-mfma', '-mbmi', '-mbmi2', '-mlzcnt']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6', ['-march=k6']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6-2', ['-march=k6-2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'k6-3', ['-march=k6-3']) @@ -737,10 +756,22 @@ cpu_flags('gcc', 'OPTIONS', 'x86', 'k8', ['-march=k8']) cpu_flags('gcc', 'OPTIONS', 'x86', 'opteron', ['-march=opteron']) cpu_flags('gcc', 'OPTIONS', 'x86', 'athlon64', ['-march=athlon64']) cpu_flags('gcc', 'OPTIONS', 'x86', 'athlon-fx', ['-march=athlon-fx']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'k8-sse3', ['-march=k8-sse3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'opteron-sse3', ['-march=opteron-sse3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'athlon64-sse3', ['-march=athlon64-sse3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'amdfam10', ['-march=amdfam10']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'barcelona', ['-march=barcelona']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver1', ['-march=bdver1']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver2', ['-march=bdver2']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'bdver3', ['-march=bdver3']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'btver1', ['-march=btver1']) +cpu_flags('gcc', 'OPTIONS', 'x86', 'btver2', ['-march=btver2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'winchip-c6', ['-march=winchip-c6']) cpu_flags('gcc', 'OPTIONS', 'x86', 'winchip2', ['-march=winchip2']) cpu_flags('gcc', 'OPTIONS', 'x86', 'c3', ['-march=c3']) cpu_flags('gcc', 'OPTIONS', 'x86', 'c3-2', ['-march=c3-2']) +## +cpu_flags('gcc', 'OPTIONS', 'x86', 'atom', ['-march=atom']) # Sparc flags('gcc', 'OPTIONS', ['sparc/32'], ['-m32']) flags('gcc', 'OPTIONS', ['sparc/64'], ['-m64']) diff --git a/v2/tools/intel-darwin.jam b/v2/tools/intel-darwin.jam index aa0fd8fb6..c682a7f70 100644 --- a/v2/tools/intel-darwin.jam +++ b/v2/tools/intel-darwin.jam @@ -132,9 +132,16 @@ flags intel-darwin.compile OPTIONS ; flags intel-darwin.compile OPTIONS space : -O1 ; # no specific space optimization flag in icc # -cpu-type-em64t = prescott nocona ; -flags intel-darwin.compile OPTIONS $(cpu-type-em64t)/32 : -m32 ; # -mcmodel=small ; -flags intel-darwin.compile OPTIONS $(cpu-type-em64t)/64 : -m64 ; # -mcmodel=large ; +.cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i + conroe conroe-xe conroe-l allendale merom + merom-xe kentsfield kentsfield-xe penryn wolfdale + yorksfield nehalem sandy-bridge ivy-bridge haswell ; +.cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 + athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 ; +.cpu-type-x86-64 = $(.cpu-type-em64t) $(.cpu-type-amd64) ; + +flags intel-darwin.compile OPTIONS $(.cpu-type-x86-64)/32 : -m32 ; # -mcmodel=small ; +flags intel-darwin.compile OPTIONS $(.cpu-type-x86-64)/64 : -m64 ; # -mcmodel=large ; flags intel-darwin.compile.c OPTIONS off : -w0 ; flags intel-darwin.compile.c OPTIONS on : -w1 ; diff --git a/v2/tools/msvc.jam b/v2/tools/msvc.jam index 22548323a..e31927b24 100644 --- a/v2/tools/msvc.jam +++ b/v2/tools/msvc.jam @@ -232,7 +232,6 @@ rule configure-version-specific ( toolset : version : conditions ) toolset.flags $(toolset).compile CFLAGS $(conditions)/space : /Os ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/ : /GB ; - toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/i386 : /G3 ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/i486 : /G4 ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g5) : /G5 ; toolset.flags $(toolset).compile CFLAGS $(conditions)/$(.cpu-arch-i386)/$(.cpu-type-g6) : /G6 ; @@ -466,18 +465,18 @@ actions compile.rc rule link ( targets + : sources * : properties * ) { if on in $(properties) - { + { msvc.manifest $(targets) : $(sources) : $(properties) ; - } + } } rule link.dll ( targets + : sources * : properties * ) { DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ; if on in $(properties) - { + { msvc.manifest.dll $(targets) : $(sources) : $(properties) ; - } + } } # Incremental linking a DLL causes no end of problems: if the actual exports do @@ -497,14 +496,14 @@ if [ os.name ] in NT $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL% } - + actions manifest - { + { if exist "$(<[1]).manifest" ( $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);1" ) } - + actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" @@ -512,37 +511,37 @@ if [ os.name ] in NT } actions manifest.dll - { + { if exist "$(<[1]).manifest" ( $(.MT) -manifest "$(<[1]).manifest" "-outputresource:$(<[1]);2" ) - } + } } else -{ +{ actions link bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.LD) $(LINKFLAGS) /out:"$(<[1]:W)" /LIBPATH:"$(LINKPATH:W)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" } actions manifest - { + { if test -e "$(<[1]).manifest"; then $(.MT) -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);1" fi } - + actions link.dll bind DEF_FILE LIBRARIES_MENTIONED_BY_FILE { $(.LD) /DLL $(LINKFLAGS) /out:"$(<[1]:W)" /IMPLIB:"$(<[2]:W)" /LIBPATH:"$(LINKPATH:W)" /def:"$(DEF_FILE)" $(OPTIONS) @"@($(<[1]:W).rsp:E=$(.nl)"$(>)" $(.nl)$(LIBRARIES_MENTIONED_BY_FILE) $(.nl)$(LIBRARIES) $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST).lib" $(.nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA).lib")" } - + actions manifest.dll { if test -e "$(<[1]).manifest"; then $(.MT) -manifest "$(<[1]:W).manifest" "-outputresource:$(<[1]:W);2" fi - } + } } # this rule sets up the pdb file that will be used when generating static @@ -797,9 +796,9 @@ local rule configure-really ( version ? : options * ) # toolset version. command = [ common.get-absolute-tool-path $(command[-1]) ] ; } - + if $(command) - { + { local parent = [ path.make $(command) ] ; parent = [ path.parent $(parent) ] ; parent = [ path.native $(parent) ] ; @@ -1344,10 +1343,12 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] .cpu-type-g5 = i586 pentium pentium-mmx ; .cpu-type-g6 = i686 pentiumpro pentium2 pentium3 pentium3m pentium-m k6 k6-2 k6-3 winchip-c6 winchip2 c3 c3-2 ; -.cpu-type-em64t = prescott nocona conroe conroe-xe conroe-l allendale mermon - mermon-xe kentsfield kentsfield-xe penryn wolfdale - yorksfield nehalem ; -.cpu-type-amd64 = k8 opteron athlon64 athlon-fx ; +.cpu-type-em64t = prescott nocona core2 corei7 corei7-avx core-avx-i + conroe conroe-xe conroe-l allendale merom + merom-xe kentsfield kentsfield-xe penryn wolfdale + yorksfield nehalem sandy-bridge ivy-bridge haswell ; +.cpu-type-amd64 = k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 + athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 ; .cpu-type-g7 = pentium4 pentium4m athlon athlon-tbird athlon-4 athlon-xp athlon-mp $(.cpu-type-em64t) $(.cpu-type-amd64) ; .cpu-type-itanium = itanium itanium1 merced ; diff --git a/v2/tools/msvc.py b/v2/tools/msvc.py index f4448daab..1e737c8a0 100644 --- a/v2/tools/msvc.py +++ b/v2/tools/msvc.py @@ -176,7 +176,6 @@ def configure_version_specific(toolset_arg, version, conditions): cpu_arch_i386_cond = extend_conditions(conditions, __cpu_arch_i386) toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['']),['/GB']) - toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['i386']),['/G3']) toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['i486']),['/G4']) toolset.flags('{}.compile'.format(toolset_arg), 'CFLAGS', extend_conditions(cpu_arch_i386_cond,['' + t for t in __cpu_type_g5]), ['/G5']) @@ -1145,10 +1144,11 @@ __cpu_arch_ia64 = [ __cpu_type_g5 = ['i586', 'pentium', 'pentium-mmx' ] __cpu_type_g6 = ['i686', 'pentiumpro', 'pentium2', 'pentium3', 'pentium3m', 'pentium-m', 'k6', 'k6-2', 'k6-3', 'winchip-c6', 'winchip2', 'c3', 'c3-2' ] -__cpu_type_em64t = ['prescott', 'nocona', 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'mermon', - 'mermon-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', - 'yorksfield', 'nehalem' ] -__cpu_type_amd64 = ['k8', 'opteron', 'athlon64', 'athlon-fx'] +__cpu_type_em64t = ['prescott', 'nocona', 'core2', 'corei7', 'corei7-avx', 'core-avx-i', 'conroe', 'conroe-xe', 'conroe-l', 'allendale', 'merom', + 'merom-xe', 'kentsfield', 'kentsfield-xe', 'penryn', 'wolfdale', + 'yorksfield', 'nehalem', 'sandy-bridge', 'ivy-bridge', 'haswell' ] +__cpu_type_amd64 = ['k8', 'opteron', 'athlon64', 'athlon-fx', 'k8-sse3', 'opteron-sse3', 'athlon64-sse3', 'amdfam10', 'barcelona', + 'bdver1', 'bdver2', 'bdver3', 'btver1', 'btver2' ] __cpu_type_g7 = ['pentium4', 'pentium4m', 'athlon', 'athlon-tbird', 'athlon-4', 'athlon-xp' 'athlon-mp'] + __cpu_type_em64t + __cpu_type_amd64 __cpu_type_itanium = ['itanium', 'itanium1', 'merced']