| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import "class" : new ; |
| import common ; |
| import errors ; |
| import feature ; |
| import generators ; |
| import os ; |
| import pch ; |
| import property ; |
| import property-set ; |
| import toolset ; |
| import type ; |
| import rc ; |
| import regex ; |
| import set ; |
| import unix ; |
| import fortran ; |
|
|
|
|
| if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] |
| { |
| .debug-configuration = true ; |
| } |
|
|
|
|
| feature.extend toolset : gcc ; |
| |
|
|
| toolset.inherit-generators gcc : unix : unix.link unix.link.dll ; |
| toolset.inherit-flags gcc : unix ; |
| toolset.inherit-rules gcc : unix ; |
|
|
| generators.override gcc.prebuilt : builtin.prebuilt ; |
| generators.override gcc.searched-lib-generator : searched-lib-generator ; |
|
|
| |
| type.set-generated-target-suffix OBJ : <toolset>gcc : o ; |
| type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>windows : o ; |
| type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>cygwin : o ; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| rule init ( version ? : command * : options * ) |
| { |
| |
| 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 ] ; |
| } |
| } |
| |
| else if $(version) |
| { |
| tool-command = [ common.get-invocation-command-nodefault gcc : "g++-$(version[1])" ] ; |
| |
| |
| if ! $(tool-command) |
| { |
| 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" ] ] ; |
| if $(tool-version) != $(version) |
| { |
| |
| |
| |
| |
| |
| |
| 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 ] ; |
| tool-command = ; |
| } |
| |
| 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 ] ; |
| } |
| } |
| } |
| |
| 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 ] ; |
| } |
| } |
| |
| |
| |
| |
| local command = $(tool-command) ; |
| |
| local root = [ feature.get-values <root> : $(options) ] ; |
| |
| local bin ; |
| |
| local flavor = [ feature.get-values <flavor> : $(options) ] ; |
| |
| if $(command) |
| { |
| bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; |
| root ?= $(bin:D) ; |
| } |
| |
| |
| local command-string = $(command:J=" ") ; |
| |
| if $(command) |
| { |
| local machine = [ MATCH "^([^ ]+)" |
| : [ SHELL "$(command-string) -dumpmachine" ] ] ; |
| version ?= [ MATCH "^([0-9.]+)" |
| : [ SHELL "$(command-string) -dumpversion" ] ] ; |
| switch $(machine:L) |
| { |
| case *mingw* : flavor ?= mingw ; |
| } |
| } |
|
|
| 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) ; |
| } |
|
|
| common.handle-options gcc : $(condition) : $(command) : $(options) ; |
|
|
| local linker = [ feature.get-values <linker-type> : $(options) ] ; |
| |
| if ! $(linker) |
| { |
| if [ os.name ] = OSF |
| { |
| 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 ; |
| } |
| } |
| init-link-flags gcc $(linker) $(condition) ; |
|
|
|
|
| |
| |
| |
| if $(command) |
| { |
| |
| |
| |
| |
| local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ; |
| if $(.debug-configuration) |
| { |
| ECHO notice: using gcc libraries :: $(condition) :: $(lib_path) ; |
| } |
| toolset.flags gcc.link RUN_PATH $(condition) : $(lib_path) ; |
| } |
|
|
| |
| |
| |
| |
| local nl = " |
| " ; |
|
|
| |
| local archiver = [ common.get-invocation-command gcc |
| : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : [ SHELL "$(command-string) -print-prog-name=ar" ] ] ] |
| : [ feature.get-values <archiver> : $(options) ] |
| : $(bin) |
| : search-path ] ; |
| toolset.flags gcc.archive .AR $(condition) : $(archiver[1]) ; |
| if $(.debug-configuration) |
| { |
| ECHO notice: using gcc archiver :: $(condition) :: $(archiver[1]) ; |
| } |
|
|
| |
| local ranlib = [ common.get-invocation-command gcc |
| : [ NORMALIZE_PATH [ MATCH "(.*)[$(nl)]+" : [ SHELL "$(command-string) -print-prog-name=ranlib" ] ] ] |
| : [ feature.get-values <ranlib> : $(options) ] |
| : $(bin) |
| : search-path ] ; |
| toolset.flags gcc.archive .RANLIB $(condition) : $(ranlib[1]) ; |
| if $(.debug-configuration) |
| { |
| ECHO notice: using gcc ranlib :: $(condition) :: $(ranlib[1]) ; |
| } |
|
|
|
|
| |
| local rc = |
| [ common.get-invocation-command-nodefault gcc |
| : windres : [ feature.get-values <rc> : $(options) ] : $(bin) : search-path ] ; |
| local rc-type = |
| [ feature.get-values <rc-type> : $(options) ] ; |
| rc-type ?= windres ; |
| if ! $(rc) |
| { |
| |
| |
| |
| |
| rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ] ; |
| rc-type = null ; |
| } |
| rc.configure $(rc) : $(condition) : <rc-type>$(rc-type) ; |
| } |
|
|
| if [ os.name ] = NT |
| { |
| |
| |
| JAMSHELL = % ; |
| } |
|
|
| generators.register-c-compiler gcc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : <toolset>gcc ; |
| generators.register-c-compiler gcc.compile.c.preprocess : C : PREPROCESSED_C : <toolset>gcc ; |
| generators.register-c-compiler gcc.compile.c++ : CPP : OBJ : <toolset>gcc ; |
| generators.register-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ; |
| generators.register-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ; |
| generators.register-fortran-compiler gcc.compile.fortran : FORTRAN FORTRAN90 : OBJ : <toolset>gcc ; |
|
|
| |
|
|
| |
| |
| |
| |
| |
|
|
| type.set-generated-target-suffix PCH : <toolset>gcc : gch ; |
|
|
| |
| class gcc-pch-generator : pch-generator |
| { |
| import project ; |
| import property-set ; |
| import type ; |
|
|
| rule run-pch ( project name ? : property-set : sources + ) |
| { |
| |
| local header ; |
| for local s in $(sources) |
| { |
| if [ type.is-derived [ $(s).type ] H ] |
| { |
| header = $(s) ; |
| } |
| } |
|
|
| |
| |
| 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)"'" ; |
| } |
|
|
| local pch-file = [ generator.run $(project) $(name) : $(property-set) |
| : $(header) ] ; |
|
|
| |
| return |
| [ property-set.create <pch-file>$(pch-file) <cflags>-Winvalid-pch ] |
| $(pch-file) |
| ; |
| } |
|
|
| |
| |
| |
| rule generated-targets ( sources + : property-set : project name ? ) |
| { |
| name = [ $(sources[1]).name ] ; |
| return [ generator.generated-targets $(sources) |
| : $(property-set) : $(project) $(name) ] ; |
| } |
| } |
|
|
| |
| |
| |
| generators.register [ new gcc-pch-generator gcc.compile.c.pch : H : C_PCH : <pch>on <toolset>gcc ] ; |
| generators.register [ new gcc-pch-generator gcc.compile.c++.pch : H : CPP_PCH : <pch>on <toolset>gcc ] ; |
|
|
| |
| generators.override gcc.compile.c.pch : pch.default-c-pch-generator ; |
| generators.override gcc.compile.c++.pch : pch.default-cpp-pch-generator ; |
|
|
| toolset.flags gcc.compile PCH_FILE <pch>on : <pch-file> ; |
|
|
| |
| toolset.flags gcc.compile OPTIONS <optimization>off : -O0 ; |
| toolset.flags gcc.compile OPTIONS <optimization>speed : -O3 ; |
| toolset.flags gcc.compile OPTIONS <optimization>space : -Os ; |
|
|
| toolset.flags gcc.compile OPTIONS <inlining>off : -fno-inline ; |
| toolset.flags gcc.compile OPTIONS <inlining>on : -Wno-inline ; |
| toolset.flags gcc.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ; |
|
|
| toolset.flags gcc.compile OPTIONS <warnings>off : -w ; |
| toolset.flags gcc.compile OPTIONS <warnings>on : -Wall ; |
| toolset.flags gcc.compile OPTIONS <warnings>all : -Wall -pedantic ; |
| toolset.flags gcc.compile OPTIONS <warnings-as-errors>on : -Werror ; |
|
|
| toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ; |
| toolset.flags gcc.compile OPTIONS <profiling>on : -pg ; |
| toolset.flags gcc.compile OPTIONS <rtti>off : -fno-rtti ; |
|
|
| rule setup-fpic ( targets * : sources * : properties * ) |
| { |
| local link = [ feature.get-values link : $(properties) ] ; |
| if $(link) = shared |
| { |
| local target = [ feature.get-values target-os : $(properties) ] ; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| if $(target) != cygwin && $(target) != windows |
| { |
| OPTIONS on $(targets) += -fPIC ; |
| } |
| } |
| } |
|
|
| rule setup-address-model ( targets * : sources * : properties * ) |
| { |
| local model = [ feature.get-values address-model : $(properties) ] ; |
| if $(model) |
| { |
| local option ; |
| local os = [ feature.get-values target-os : $(properties) ] ; |
| if $(os) = aix |
| { |
| if $(model) = 32 |
| { |
| option = -maix32 ; |
| } |
| else |
| { |
| option = -maix64 ; |
| } |
| } |
| else if $(os) = hpux |
| { |
| if $(model) = 32 |
| { |
| option = -milp32 ; |
| } |
| else |
| { |
| option = -mlp64 ; |
| } |
| } |
| else |
| { |
| local arch = [ feature.get-values architecture : $(properties) ] ; |
| if $(arch) != arm |
| { |
| if $(model) = 32 |
| { |
| option = -m32 ; |
| } |
| else if $(model) = 64 |
| { |
| option = -m64 ; |
| } |
| } |
| |
| |
| } |
| OPTIONS on $(targets) += $(option) ; |
| } |
| } |
|
|
|
|
| |
| if [ os.name ] != NT && [ os.name ] != OSF && [ os.name ] != HPUX && [ os.name ] != AIX |
| { |
| |
| |
| HAVE_SONAME = "" ; |
| SONAME_OPTION = -h ; |
| } |
|
|
| |
| if [ os.name ] = HPUX |
| { |
| HAVE_SONAME = "" ; |
| SONAME_OPTION = +h ; |
| } |
|
|
| toolset.flags gcc.compile USER_OPTIONS <cflags> ; |
| toolset.flags gcc.compile.c++ USER_OPTIONS <cxxflags> ; |
| toolset.flags gcc.compile DEFINES <define> ; |
| toolset.flags gcc.compile INCLUDES <include> ; |
| toolset.flags gcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ; |
| toolset.flags gcc.compile.fortran USER_OPTIONS <fflags> ; |
|
|
| rule compile.c++.pch ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-fpic $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| } |
|
|
| actions compile.c++.pch |
| { |
| "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" |
| } |
|
|
| rule compile.c.pch ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-fpic $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| } |
|
|
| actions compile.c.pch |
| { |
| "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" |
| } |
|
|
| rule compile.c++.preprocess ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-fpic $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| |
| |
| |
| if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C |
| { |
| LANG on $(<) = "-x c++" ; |
| } |
| DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; |
| } |
|
|
| rule compile.c.preprocess ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-fpic $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| |
| |
| |
| |
| |
| |
| LANG on $(<) = "-x c" ; |
| |
| DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; |
| } |
|
|
| rule compile.c++ ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-fpic $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| |
| |
| |
| if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C |
| { |
| LANG on $(<) = "-x c++" ; |
| } |
| DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| local template-depth = [ on $(<) return $(TEMPLATE_DEPTH) ] ; |
| if ! $(template-depth) |
| { |
| TEMPLATE_DEPTH on $(<) = 128 ; |
| } |
| } |
|
|
| rule compile.c ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-fpic $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| |
| |
| |
| |
| |
| |
| LANG on $(<) = "-x c" ; |
| |
| DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; |
| } |
|
|
| rule compile.fortran ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-fpic $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| } |
|
|
| actions compile.c++ bind PCH_FILE |
| { |
| "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)" |
| } |
|
|
| actions compile.c bind PCH_FILE |
| { |
| "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" |
| } |
|
|
| actions compile.c++.preprocess bind PCH_FILE |
| { |
| "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>:W)" -E >"$(<:W)" |
| } |
|
|
| actions compile.c.preprocess bind PCH_FILE |
| { |
| "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>)" -E >$(<) |
| } |
|
|
| actions compile.fortran |
| { |
| "$(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-address-model $(targets) : $(sources) : $(properties) ; |
| LANG on $(<) = "-x assembler-with-cpp" ; |
| } |
|
|
| actions compile.asm |
| { |
| "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" |
| } |
|
|
| |
| |
| |
| class gcc-linking-generator : unix-linking-generator |
| { |
| rule run ( project name ? : property-set : sources + ) |
| { |
| |
| local no-static-link = ; |
| if [ modules.peek : UNIX ] |
| { |
| switch [ modules.peek : JAMUNAME ] |
| { |
| case * : no-static-link = true ; |
| } |
| } |
|
|
| local properties = [ $(property-set).raw ] ; |
| local reason ; |
| if $(no-static-link) && <runtime-link>static in $(properties) |
| { |
| if <link>shared in $(properties) |
| { |
| reason = |
| "On gcc, DLL can't be build with '<runtime-link>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 ] |
| { |
| reason = |
| "On gcc, using DLLS together with the" |
| "<runtime-link>static options is not possible " ; |
| } |
| } |
| } |
| } |
| if $(reason) |
| { |
| ECHO warning: |
| $(reason) ; |
| ECHO warning: |
| "It is suggested to use '<runtime-link>static' together" |
| "with '<link>static'." ; |
| return ; |
| } |
| else |
| { |
| local generated-targets = [ unix-linking-generator.run $(project) |
| $(name) : $(property-set) : $(sources) ] ; |
| return $(generated-targets) ; |
| } |
| } |
| } |
|
|
| |
| |
| |
|
|
| local g ; |
| g = [ new gcc-linking-generator gcc.mingw.link |
| : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB |
| : EXE |
| : <toolset>gcc <target-os>windows ] ; |
| $(g).set-rule-name gcc.link ; |
| generators.register $(g) ; |
|
|
| g = [ new gcc-linking-generator gcc.mingw.link.dll |
| : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB |
| : IMPORT_LIB SHARED_LIB |
| : <toolset>gcc <target-os>windows ] ; |
| $(g).set-rule-name gcc.link.dll ; |
| generators.register $(g) ; |
|
|
| generators.register |
| [ new gcc-linking-generator gcc.link |
| : LIB OBJ |
| : EXE |
| : <toolset>gcc ] ; |
| generators.register |
| [ new gcc-linking-generator gcc.link.dll |
| : LIB OBJ |
| : SHARED_LIB |
| : <toolset>gcc ] ; |
|
|
| generators.override gcc.mingw.link : gcc.link ; |
| generators.override gcc.mingw.link.dll : gcc.link.dll ; |
|
|
| |
| |
| |
| |
|
|
| g = [ new gcc-linking-generator gcc.cygwin.link |
| : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB |
| : EXE |
| : <toolset>gcc <target-os>cygwin ] ; |
| $(g).set-rule-name gcc.link ; |
| generators.register $(g) ; |
|
|
| g = [ new gcc-linking-generator gcc.cygwin.link.dll |
| : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB |
| : IMPORT_LIB SHARED_LIB |
| : <toolset>gcc <target-os>cygwin ] ; |
| $(g).set-rule-name gcc.link.dll ; |
| generators.register $(g) ; |
|
|
| generators.override gcc.cygwin.link : gcc.link ; |
| generators.override gcc.cygwin.link.dll : gcc.link.dll ; |
|
|
| |
| |
| toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ; |
| toolset.flags gcc.link OPTIONS <profiling>on : -pg ; |
| toolset.flags gcc.link USER_OPTIONS <linkflags> ; |
| toolset.flags gcc.link LINKPATH <library-path> ; |
| toolset.flags gcc.link FINDLIBS-ST <find-static-library> ; |
| toolset.flags gcc.link FINDLIBS-SA <find-shared-library> ; |
| toolset.flags gcc.link LIBRARIES <library-file> ; |
|
|
| toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>windows : "-Wl,--out-implib," ; |
| toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>cygwin : "-Wl,--out-implib," ; |
|
|
| |
| |
| |
| |
| if [ os.name ] != HPUX |
| { |
| toolset.flags gcc.link OPTIONS <runtime-link>static : -static ; |
| } |
|
|
| |
| |
| rule init-link-flags ( toolset linker condition ) |
| { |
| switch $(linker) |
| { |
| case aix : |
| { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| toolset.flags $(toolset).link OPTIONS : -Wl,-brtl -Wl,-bnoipath |
| : unchecked ; |
| } |
|
|
| case darwin : |
| { |
| |
| |
| |
| toolset.flags $(toolset).link RPATH $(condition) : <dll-path> : unchecked ; |
| toolset.flags $(toolset).link RPATH_LINK $(condition) : <xdll-path> : unchecked ; |
| } |
|
|
| case gnu : |
| { |
| |
| |
| |
| |
| toolset.flags $(toolset).link OPTIONS $(condition)/<strip>on : -Wl,--strip-all : unchecked ; |
| toolset.flags $(toolset).link RPATH $(condition) : <dll-path> : unchecked ; |
| toolset.flags $(toolset).link RPATH_LINK $(condition) : <xdll-path> : 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 FINDLIBS-ST-PFX $(condition)/<runtime-link>shared |
| : -Wl,-Bstatic : unchecked ; |
| toolset.flags $(toolset).link FINDLIBS-SA-PFX $(condition)/<runtime-link>shared |
| : -Wl,-Bdynamic : unchecked ; |
|
|
| |
| |
| toolset.flags $(toolset).link FINDLIBS-ST-PFX $(condition)/<runtime-link>static/<target-os>windows |
| : -Wl,-Bstatic : unchecked ; |
| toolset.flags $(toolset).link FINDLIBS-SA-PFX $(condition)/<runtime-link>static/<target-os>windows |
| : -Wl,-Bdynamic : unchecked ; |
| toolset.flags $(toolset).link OPTIONS $(condition)/<runtime-link>static/<target-os>windows |
| : -Wl,-Bstatic : unchecked ; |
| } |
|
|
| case hpux : |
| { |
| toolset.flags $(toolset).link OPTIONS $(condition)/<strip>on |
| : -Wl,-s : unchecked ; |
| toolset.flags $(toolset).link OPTIONS $(condition)/<link>shared |
| : -fPIC : unchecked ; |
| } |
|
|
| case osf : |
| { |
| |
| toolset.flags $(toolset).link OPTIONS $(condition)/<strip>on |
| : -Wl,-s : unchecked ; |
| toolset.flags $(toolset).link RPATH $(condition) : <dll-path> |
| : unchecked ; |
| |
| toolset.flags $(toolset).link RPATH_OPTION $(condition) : -rpath |
| : unchecked ; |
| |
| } |
|
|
| case sun : |
| { |
| toolset.flags $(toolset).link OPTIONS $(condition)/<strip>on |
| : -Wl,-s : unchecked ; |
| toolset.flags $(toolset).link RPATH $(condition) : <dll-path> |
| : unchecked ; |
| |
| |
| toolset.flags $(toolset).link LINKPATH $(condition) : <xdll-path> |
| : unchecked ; |
|
|
| |
| |
| |
| |
| |
| |
| toolset.flags $(toolset).link OPTIONS $(condition)/<link>shared |
| : -mimpure-text : unchecked ; |
| } |
|
|
| case * : |
| { |
| errors.user-error |
| "$(toolset) initialization: invalid linker '$(linker)'" : |
| "The value '$(linker)' specified for <linker> is not recognized." : |
| "Possible values are 'aix', 'darwin', 'gnu', 'hpux', 'osf' or 'sun'" ; |
| } |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| rule quote-rpath ( targets * ) |
| { |
| local r = [ on $(targets[1]) return $(RPATH) ] ; |
| if ! [ MATCH "('.*')" : $(r) ] |
| { |
| r = "\"$(r)\"" ; |
| } |
| RPATH on $(targets) = $(r) ; |
| } |
|
|
| |
| rule link ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| SPACE on $(targets) = " " ; |
| |
| |
| |
| JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ; |
| quote-rpath $(targets) ; |
| } |
|
|
| 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) |
|
|
| } |
|
|
| |
| |
| |
| |
| .AR = ar ; |
| .RANLIB = ranlib ; |
|
|
| toolset.flags gcc.archive AROPTIONS <archiveflags> ; |
|
|
| rule archive ( targets * : sources * : properties * ) |
| { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| local clean.a = $(targets[1])(clean) ; |
| TEMPORARY $(clean.a) ; |
| NOCARE $(clean.a) ; |
| LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; |
| DEPENDS $(clean.a) : $(sources) ; |
| DEPENDS $(targets) : $(clean.a) ; |
| common.RmTemps $(clean.a) : $(targets) ; |
| } |
|
|
| |
| |
| |
| |
| |
| |
| actions piecemeal archive |
| { |
| "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)" |
| "$(.RANLIB)" "$(<)" |
| } |
|
|
| rule link.dll ( targets * : sources * : properties * ) |
| { |
| setup-threading $(targets) : $(sources) : $(properties) ; |
| setup-address-model $(targets) : $(sources) : $(properties) ; |
| SPACE on $(targets) = " " ; |
| JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ; |
| quote-rpath $(targets) ; |
| } |
|
|
| |
| actions link.dll bind LIBRARIES |
| { |
| "$(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) |
| } |
|
|
| 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 : |
| { |
| |
| } |
| case *bsd : |
| { |
| option = -pthread ; |
| |
| } |
| case sgi : |
| { |
| |
| |
| } |
| case darwin : |
| { |
| |
| } |
| case * : |
| { |
| option = -pthread ; |
| libs = rt ; |
| } |
| } |
| |
| if $(option) |
| { |
| OPTIONS on $(targets) += $(option) ; |
| } |
| if $(libs) |
| { |
| FINDLIBS-SA on $(targets) += $(libs) ; |
| } |
| } |
| } |
|
|
| local rule cpu-flags ( toolset variable : architecture : instruction-set + : values + : default ? ) |
| { |
| if $(default) |
| { |
| toolset.flags $(toolset) $(variable) |
| <architecture>$(architecture)/<instruction-set> |
| : $(values) ; |
| } |
| toolset.flags $(toolset) $(variable) |
| <architecture>/<instruction-set>$(instruction-set) |
| <architecture>$(architecture)/<instruction-set>$(instruction-set) |
| : $(values) ; |
| } |
|
|
| |
| |
| |
| |
| |
| toolset.flags gcc OPTIONS <architecture>x86/<address-model>32/<instruction-set> : -march=i386 ; |
| 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 ; |
| 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 ; |
| cpu-flags gcc OPTIONS : x86 : pentium2 : -march=pentium2 ; |
| cpu-flags gcc OPTIONS : x86 : pentium3 : -march=pentium3 ; |
| cpu-flags gcc OPTIONS : x86 : pentium3m : -march=pentium3m ; |
| cpu-flags gcc OPTIONS : x86 : pentium-m : -march=pentium-m ; |
| 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 : k6 : -march=k6 ; |
| cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ; |
| cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ; |
| cpu-flags gcc OPTIONS : x86 : athlon : -march=athlon ; |
| cpu-flags gcc OPTIONS : x86 : athlon-tbird : -march=athlon-tbird ; |
| cpu-flags gcc OPTIONS : x86 : athlon-4 : -march=athlon-4 ; |
| cpu-flags gcc OPTIONS : x86 : athlon-xp : -march=athlon-xp ; |
| cpu-flags gcc OPTIONS : x86 : athlon-mp : -march=athlon-mp ; |
| |
| 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 : 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 : sparc : c3 : -mcpu=c3 : default ; |
| cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 ; |
| cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ; |
| cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ; |
| cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ; |
| cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ; |
| cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ; |
| cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ; |
| cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ; |
| cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ; |
| cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ; |
| cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ; |
| cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ; |
| cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ; |
| cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ; |
| |
| cpu-flags gcc OPTIONS : power : 403 : -mcpu=403 ; |
| cpu-flags gcc OPTIONS : power : 505 : -mcpu=505 ; |
| cpu-flags gcc OPTIONS : power : 601 : -mcpu=601 ; |
| cpu-flags gcc OPTIONS : power : 602 : -mcpu=602 ; |
| cpu-flags gcc OPTIONS : power : 603 : -mcpu=603 ; |
| cpu-flags gcc OPTIONS : power : 603e : -mcpu=603e ; |
| cpu-flags gcc OPTIONS : power : 604 : -mcpu=604 ; |
| cpu-flags gcc OPTIONS : power : 604e : -mcpu=604e ; |
| cpu-flags gcc OPTIONS : power : 620 : -mcpu=620 ; |
| cpu-flags gcc OPTIONS : power : 630 : -mcpu=630 ; |
| cpu-flags gcc OPTIONS : power : 740 : -mcpu=740 ; |
| cpu-flags gcc OPTIONS : power : 7400 : -mcpu=7400 ; |
| cpu-flags gcc OPTIONS : power : 7450 : -mcpu=7450 ; |
| cpu-flags gcc OPTIONS : power : 750 : -mcpu=750 ; |
| cpu-flags gcc OPTIONS : power : 801 : -mcpu=801 ; |
| cpu-flags gcc OPTIONS : power : 821 : -mcpu=821 ; |
| cpu-flags gcc OPTIONS : power : 823 : -mcpu=823 ; |
| cpu-flags gcc OPTIONS : power : 860 : -mcpu=860 ; |
| cpu-flags gcc OPTIONS : power : 970 : -mcpu=970 ; |
| cpu-flags gcc OPTIONS : power : 8540 : -mcpu=8540 ; |
| cpu-flags gcc OPTIONS : power : power : -mcpu=power ; |
| cpu-flags gcc OPTIONS : power : power2 : -mcpu=power2 ; |
| cpu-flags gcc OPTIONS : power : power3 : -mcpu=power3 ; |
| cpu-flags gcc OPTIONS : power : power4 : -mcpu=power4 ; |
| cpu-flags gcc OPTIONS : power : power5 : -mcpu=power5 ; |
| cpu-flags gcc OPTIONS : power : powerpc : -mcpu=powerpc ; |
| cpu-flags gcc OPTIONS : power : powerpc64 : -mcpu=powerpc64 ; |
| cpu-flags gcc OPTIONS : power : rios : -mcpu=rios ; |
| cpu-flags gcc OPTIONS : power : rios1 : -mcpu=rios1 ; |
| cpu-flags gcc OPTIONS : power : rios2 : -mcpu=rios2 ; |
| cpu-flags gcc OPTIONS : power : rsc : -mcpu=rsc ; |
| cpu-flags gcc OPTIONS : power : rs64a : -mcpu=rs64 ; |
| |
| toolset.flags gcc AROPTIONS <address-model>64/<target-os>aix : "-X 64" ; |
|
|