diff --git a/v2/tools/borland.jam b/v2/tools/borland.jam index 32bbd4852..bfe162911 100644 --- a/v2/tools/borland.jam +++ b/v2/tools/borland.jam @@ -12,13 +12,13 @@ import property ; import generators ; import os ; import toolset : flags ; -import feature ; +import feature : get-values ; import type ; import common ; toolset.register borland ; -rule init ( version ? : command * ) +rule init ( version ? : command * : options * ) { local condition = [ common.check-init-parameters borland : version $(version) ] ; @@ -26,15 +26,17 @@ rule init ( version ? : command * ) local command = [ common.get-invocation-command borland : bcc32.exe : $(command) ] ; + common.handle-options borland : $(condition) : $(command) : $(options) ; + if $(command) { command = [ common.get-absolute-tool-path $(command[-1]) ] ; } root = $(command:D) ; - toolset.flags borland.compile STDHDRS $(condition) : $(root)/include/ ; - toolset.flags borland.link STDLIBPATH $(condition) : $(root)/lib ; - toolset.flags borland .root $(condition) : $(root)/bin/ ; + flags borland.compile STDHDRS $(condition) : $(root)/include/ ; + flags borland.link STDLIBPATH $(condition) : $(root)/lib ; + flags borland .root $(condition) : $(root)/bin/ ; } @@ -110,13 +112,13 @@ flags borland NEED_IMPLIB LIB/shared : "" ; actions compile.c++ { - "$(.root)bcc32" -j5 -g255 -q -c -P -w -Ve -Vx -a8 -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" + $(CONFIG_COMMAND) -j5 -g255 -q -c -P -w -Ve -Vx -a8 -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" } # For C, we don't pass -P flag actions compile.c { - "$(.root)bcc32" -j5 -g255 -q -c -w -Ve -Vx -a8 -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" + $(CONFIG_COMMAND) -j5 -g255 -q -c -w -Ve -Vx -a8 -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" } @@ -191,7 +193,7 @@ rule link ( targets + : sources * : properties * ) actions link bind LIBRARIES { - $(.set-path)$(.root:W)$(.old-path) "$(.root)bcc32" -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"$(<[2]:W)" + $(.set-path)$(.root:W)$(.old-path) $(CONFIG_COMMAND) -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"$(<[2]:W)" } rule link.dll ( targets + : sources * : properties * ) @@ -201,6 +203,6 @@ rule link.dll ( targets + : sources * : properties * ) actions link.dll bind LIBRARIES { - $(.set-path)$(.root:W)$(.old-path) "$(.root)bcc32" -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"$(<[3]:W)" + $(.set-path)$(.root:W)$(.old-path) $(CONFIG_COMMAND) -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"$(<[3]:W)" "$(.root)implib" "$(<[2]:W)" "$(<[1]:W)" } diff --git a/v2/tools/common.jam b/v2/tools/common.jam index f42ed6f1e..1b6fe53a4 100644 --- a/v2/tools/common.jam +++ b/v2/tools/common.jam @@ -15,6 +15,8 @@ import feature ; import errors ; import path ; import sequence ; +import toolset ; + # The rule checks toolset parameters. Each trailing parameter # should be a pair of parameter name and parameter value. @@ -234,6 +236,29 @@ rule check-tool ( xcommand + ) } } +# Handle common options for toolset, specifically sets the following +# flag variables: +# - CONFIG_COMMAND to 'command' +# - OPTIONS for compile.c to the value of in options +# - OPTIONS for compile.c++ to the value of in options +# - OPTIOns for compile to the value of in options +# - OPTIONs for link to the value of in options +rule handle-options ( toolset : condition * : command ? : options * ) +{ + # The last parameter ('true') says it's OK to set flags for another + # module, + toolset.flags $(toolset) CONFIG_COMMAND $(condition) : $(command) : unchecked ; + toolset.flags $(toolset).compile OPTIONS $(condition) : + [ feature.get-values : $(options) ] : unchecked ; + toolset.flags $(toolset).compile.c OPTIONS $(condition) : + [ feature.get-values : $(options) ] : unchecked ; + toolset.flags $(toolset).compile.c++ OPTIONS $(condition) : + [ feature.get-values : $(options) ] : unchecked ; + toolset.flags $(toolset).link OPTIONS $(condition) : + [ feature.get-values : $(options) ] : unchecked ; +} + + # returns the location of the "program files" directory on a windows # platform rule get-program-files-dir ( ) diff --git a/v2/tools/como-linux.jam b/v2/tools/como-linux.jam index 614dd77b2..e6a278a2d 100644 --- a/v2/tools/como-linux.jam +++ b/v2/tools/como-linux.jam @@ -26,7 +26,7 @@ generators.register-c-compiler como-linux.compile.c++ : CPP : OBJ generators.register-c-compiler como-linux.compile.c : C : OBJ : como linux ; -rule init ( version ? : command * ) +rule init ( version ? : command * : options * ) { local condition = [ common.check-init-parameters como-linux : version $(version) ] ; @@ -34,7 +34,7 @@ rule init ( version ? : command * ) command = [ common.get-invocation-command como-linux : como : $(command) ] ; - flags como-linux CONFIG_COMMAND $(condition) : $(command) ; + common.handle-options como-linux : $(condition) : $(command) : $(options) ; } flags como-linux C++FLAGS off : --no_exceptions ; diff --git a/v2/tools/como-win.jam b/v2/tools/como-win.jam index cc7c55d16..e6ddbeb2a 100644 --- a/v2/tools/como-win.jam +++ b/v2/tools/como-win.jam @@ -31,18 +31,8 @@ rule init ( version ? : command * : options * ) command = [ common.get-invocation-command como-win : como.exe : $(command) ] ; - - flags como-win CONFIG_COMMAND $(condition) : $(command) ; - local compiler-options = [ feature.get-values : $(options) ] ; - if $(compiler-options) - { - flags como-win.compile OPTIONS $(condition) : $(compiler-options) ; - } - local linker-options = [ feature.get-values : $(options) ] ; - if $(linker-options) - { - flags como-win.link OPTIONS $(condition) : $(linker-options) ; - } + + common.handle-options como-win : $(condition) : $(command) : $(options) ; } generators.register-c-compiler como-win.compile.c++ : CPP : OBJ diff --git a/v2/tools/cw.jam b/v2/tools/cw.jam index 50c0132ad..35b946b56 100644 --- a/v2/tools/cw.jam +++ b/v2/tools/cw.jam @@ -11,7 +11,7 @@ import os ; import type ; import toolset : flags ; import errors : error ; -import feature : feature ; +import feature : feature get-values ; import path ; import sequence : unique ; import common ; @@ -23,27 +23,32 @@ if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] feature.extend toolset : cw ; -rule init ( version ? : command * : setup ? compiler ? linker ? ) +rule init ( version ? : command * : options * ) { # TODO: fix the $(command[1]) = $(compiler) issue + + setup = [ get-values : $(options) ] ; + setup ?= cwenv.bat ; + compiler = [ get-values : $(options) ] ; + compiler ?= mwcc ; + linker = [ get-values : $(options) ] ; + linker ?= mwld ; - setup ?= cwenv.bat ; - compiler ?= mwcc ; - linker ?= mwld ; + local condition = [ common.check-init-parameters cw : + version $(version) ] ; - local condition = [ common.check-init-parameters cw : - version $(version) ] ; - - command = [ common.get-invocation-command cw : mwcc.exe : $(command) : + command = [ common.get-invocation-command cw : mwcc.exe : $(command) : [ default-paths $(version) ] ] ; + + common.handle-options cw : $(condition) : $(command) : $(options) ; - if $(command) - { - command = [ common.get-absolute-tool-path $(command[-1]) ] ; - } - local root = $(command) ; + if $(command) + { + command = [ common.get-absolute-tool-path $(command[-1]) ] ; + } + local root = $(command) ; - setup = $(root)\\$(setup) ; + setup = $(root)\\$(setup) ; # map the batch file in setup so it can be executed diff --git a/v2/tools/darwin.jam b/v2/tools/darwin.jam index a530d90d5..048ae9946 100644 --- a/v2/tools/darwin.jam +++ b/v2/tools/darwin.jam @@ -23,12 +23,12 @@ toolset.inherit-rules darwin : gcc ; flags darwin.link ST_OPTIONS off : -s ; # No additional initialization should be necessary -rule init ( version ? : command * ) +rule init ( version ? : command * : options * ) { local condition = [ common.check-init-parameters darwin : version $(version) ] ; local command = [ common.get-invocation-command darwin : g++ : $(command) ] ; - flags darwin CONFIG_COMMAND $(condition) : $(command) ; + common.handle-options darwin : $(condition) : $(command) : $(options) ; } # Darwin has a different shared library suffix diff --git a/v2/tools/gcc.jam b/v2/tools/gcc.jam index e0a344aa4..21d7e6cd7 100644 --- a/v2/tools/gcc.jam +++ b/v2/tools/gcc.jam @@ -46,13 +46,9 @@ rule init ( version ? : command * : options * ) local condition = [ common.check-init-parameters gcc : version $(version) ] ; local command = [ common.get-invocation-command gcc : g++ : $(command) ] ; - - flags gcc CONFIG_COMMAND $(condition) : $(command) ; - flags gcc.compile OPTIONS $(condition) - : [ feature.get-values : $(options) ] ; - flags gcc.link OPTIONS $(condition) - : [ feature.get-values : $(options) ] ; + common.handle-options gcc : $(condition) : $(command) : $(options) ; + local linker = [ feature.get-values : $(options) ] ; if ! $(linker) { linker = gnu ; diff --git a/v2/tools/intel-linux.jam b/v2/tools/intel-linux.jam index de52c5813..7ca97e160 100644 --- a/v2/tools/intel-linux.jam +++ b/v2/tools/intel-linux.jam @@ -25,7 +25,7 @@ toolset.inherit-rules intel-linux : gcc ; # version in mandatory # name (default icc) is used to invoke the specified intellinux complier # compile and link options allow you to specify addition command line options for each version -rule init ( version ? : command * : compile_options * : link_options * ) +rule init ( version ? : command * : options * ) { local condition = [ common.check-init-parameters intel-linux : version $(version) ] ; @@ -33,9 +33,7 @@ rule init ( version ? : command * : compile_options * : link_options * ) command = [ common.get-invocation-command intel-linux : icc : $(command) : /opt/intel_cc_80/bin ] ; - flags intel-linux CONFIG_COMMAND $(condition) : $(command) ; - flags intel-linux CONFIG_COMPILE $(condition) : $(compile_options) ; - flags intel-linux CONFIG_LINK $(condition) : $(link_options) ; + common.handle-options intel-linux : $(condition) : $(command) : $(options) ; } flags intel-linux.compile OPTIONS off : "-Ob0" ; @@ -44,21 +42,21 @@ flags intel-linux.compile OPTIONS full : "-Ob2" ; flags intel-linux.compile OPTIONS space : "-O1" ; # no specific space optimization flag in icc actions compile.c++ { - "$(CONFIG_COMMAND)" -c -xc++ $(CONFIG_COMPILE) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" -c -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } actions compile.c { - "$(CONFIG_COMMAND)" -c -xc $(CONFIG_COMPILE) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" + "$(CONFIG_COMMAND)" -c -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" } actions link bind LIBRARIES { - "$(CONFIG_COMMAND)" $(CONFIG_LINK) -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) } # Differ from 'link' above only by -shared. actions link.dll bind LIBRARIES { - "$(CONFIG_COMMAND)" $(CONFIG_LINK) -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" -Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) $(OPTIONS) } diff --git a/v2/tools/intel-win.jam b/v2/tools/intel-win.jam index 16fe445e5..5de99b0fd 100644 --- a/v2/tools/intel-win.jam +++ b/v2/tools/intel-win.jam @@ -24,15 +24,20 @@ toolset.inherit-rules intel-win : msvc ; # Initializes the intel toolset for windows rule init ( version ? : # the compiler version command * : # the command to invoke the compiler itself - compatibility ? # Compatibility mode: either 'vc6', 'vc7', 'vc7.1' + options * # Additional option: + # either 'vc6', 'vc7', 'vc7.1' # or 'native'(default). ) { + local compatibility = + [ feature.get-values : $(options) ] ; local condition = [ common.check-init-parameters intel-win : version $(version) : compatibility $(compatibility) ] ; command = [ common.get-invocation-command intel-win : icc.exe : $(command) ] ; + + common.handle-options intel-win : $(condition) : $(command) : $(options) ; local root = [ common.get-absolute-tool-path $(command[-1]) ] ;) diff --git a/v2/tools/msvc.jam b/v2/tools/msvc.jam index 008670e36..8672ffe28 100644 --- a/v2/tools/msvc.jam +++ b/v2/tools/msvc.jam @@ -9,7 +9,7 @@ import os ; import type ; import toolset : flags ; import errors : error ; -import feature : feature ; +import feature : feature get-values ; import path ; import sequence : unique ; import common ; @@ -64,13 +64,19 @@ rule init ( # be searched # # - if compiler is not found in default locations, PATH will be searched. - : setup ? compiler ? linker ? resource-compiler ? ) + : options * + # options can include , , and +) { # setup will be used iff a path has been specified. If setup is # not specified, vcvars32.bat will be used instead. + setup = [ get-values : $(options) ] ; setup ?= vcvars32.bat ; + compiler = [ get-values : $(options) ] ; compiler ?= cl ; + linker = [ get-values : $(options) ] ; linker ?= link ; + resource-compiler = [ get-values : $(options) ] ; resource-compiler ?= rc ; local condition = [ common.check-init-parameters msvc : @@ -80,6 +86,8 @@ rule init ( # and only then in PATH. command = [ common.get-invocation-command msvc : cl.exe : $(command) : [ default-paths $(version) ] : $(version) ] ; + + common.handle-options msvc : $(condition) : $(command) : $(options) ; if $(command) { diff --git a/v2/tools/sun.jam b/v2/tools/sun.jam index 73d074097..4d012748a 100644 --- a/v2/tools/sun.jam +++ b/v2/tools/sun.jam @@ -21,7 +21,7 @@ feature.compose sun-stlport : -library=stlport4 -library=stlport4 ; -rule init ( version ? : command * ) +rule init ( version ? : command * : options * ) { local condition = [ common.check-init-parameters sun : version $(version) ] ; @@ -29,9 +29,10 @@ rule init ( version ? : command * ) command = [ common.get-invocation-command sun : CC : $(command) : "/opt/SUNWspro/bin" ] ; + common.handle-options sun : $(condition) : $(command) : $(options) ; + command_c = $(command[1--2]) $(command[-1]:B=cc) ; - toolset.flags sun CONFIG_COMMAND $(condition) : $(command) ; toolset.flags sun CONFIG_C_COMMAND $(condition) : $(command_c) ; } diff --git a/v2/tools/vacpp.jam b/v2/tools/vacpp.jam index 6040e95f8..f9bd19e5f 100644 --- a/v2/tools/vacpp.jam +++ b/v2/tools/vacpp.jam @@ -16,10 +16,20 @@ toolset.inherit vacpp : unix ; feature.subfeature toolset vacpp : version ; # Configures the vacpp toolset. -rule init ( version ? : path * ) +rule init ( version ? : command * : options * ) { -# feature.extend-subfeature toolset vacpp : version : $(version) ; -# flags vacpp VACPP_PATH vacpp-$(version) : $(path) ; + local condition = [ common.check-init-parameters vacpp : version $(version) ] ; + local command = [ common.get-invocation-command vacpp : xlc : $(command) ] ; + + common.handle-options acc : $(condition) : $(command) : $(options) ; + + if $(command) + { + command = [ common.get-absolute-tool-path $(command[-1]) ] ; + } + local root = $(command:D) ; + + flags vacpp ROOT $(condition) : $(root) ; } @@ -79,17 +89,17 @@ flags vacpp VA_CXX_COMPILER multi : xlC_r ; actions vacpp.link bind NEEDLIBS { - $(VA_CXX_COMPILER) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) + $(ROOT)/$(VA_CXX_COMPILER) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) } actions vacpp.compile.c { - $(VA_C_COMPILER) -c -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" + $(ROOT)/$(VA_C_COMPILER) -c -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" } actions vacpp.compile.c++ { - $(VA_CXX_COMPILER) -c -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" + $(ROOT)/$(VA_CXX_COMPILER) -c -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" } actions updated together piecemeal vacpp.archive