2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

Make third 'init' parameter for all toolsets be 'options', so use can

write

   using gcc : ... : ... : <cxxflags>foo <linkflags>bar ;

* tools/common.jam (handle-options): The login for setting the common
options.


[SVN r25767]
This commit is contained in:
Vladimir Prus
2004-10-18 09:57:37 +00:00
parent 5feff8c90d
commit 18b96d9ce7
12 changed files with 105 additions and 65 deletions

View File

@@ -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 <main-target-type>LIB/<link>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)"
}

View File

@@ -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 <cflags> in options
# - OPTIONS for compile.c++ to the value of <cxxflags> in options
# - OPTIOns for compile to the value of <compileflags> in options
# - OPTIONs for link to the value of <linkflags> 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 <compileflags> : $(options) ] : unchecked ;
toolset.flags $(toolset).compile.c OPTIONS $(condition) :
[ feature.get-values <cflags> : $(options) ] : unchecked ;
toolset.flags $(toolset).compile.c++ OPTIONS $(condition) :
[ feature.get-values <cxxflags> : $(options) ] : unchecked ;
toolset.flags $(toolset).link OPTIONS $(condition) :
[ feature.get-values <linkflags> : $(options) ] : unchecked ;
}
# returns the location of the "program files" directory on a windows
# platform
rule get-program-files-dir ( )

View File

@@ -26,7 +26,7 @@ generators.register-c-compiler como-linux.compile.c++ : CPP : OBJ
generators.register-c-compiler como-linux.compile.c : C : OBJ
: <toolset>como <toolset-como:platform>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 <exception-handling>off : --no_exceptions ;

View File

@@ -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 <cflags> : $(options) ] ;
if $(compiler-options)
{
flags como-win.compile OPTIONS $(condition) : $(compiler-options) ;
}
local linker-options = [ feature.get-values <cflags> : $(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

View File

@@ -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 <setup> : $(options) ] ;
setup ?= cwenv.bat ;
compiler = [ get-values <compiler> : $(options) ] ;
compiler ?= mwcc ;
linker = [ get-values <linker> : $(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

View File

@@ -23,12 +23,12 @@ toolset.inherit-rules darwin : gcc ;
flags darwin.link ST_OPTIONS <debug-symbols>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

View File

@@ -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 <cxxflags> : $(options) ] ;
flags gcc.link OPTIONS $(condition)
: [ feature.get-values <linkflags> : $(options) ] ;
common.handle-options gcc : $(condition) : $(command) : $(options) ;
local linker = [ feature.get-values <linker-type> : $(options) ] ;
if ! $(linker) {
linker = gnu ;

View File

@@ -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 <inlining>off : "-Ob0" ;
@@ -44,21 +42,21 @@ flags intel-linux.compile OPTIONS <inlining>full : "-Ob2" ;
flags intel-linux.compile OPTIONS <optimization>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)
}

View File

@@ -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: <compatibility>
# either 'vc6', 'vc7', 'vc7.1'
# or 'native'(default).
)
{
local compatibility =
[ feature.get-values <compatibility> : $(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]) ] ;)

View File

@@ -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 <setup>, <compiler>, <linker> and <resource-compiler>
)
{
# setup will be used iff a path has been specified. If setup is
# not specified, vcvars32.bat will be used instead.
setup = [ get-values <setup> : $(options) ] ;
setup ?= vcvars32.bat ;
compiler = [ get-values <compiler> : $(options) ] ;
compiler ?= cl ;
linker = [ get-values <linker> : $(options) ] ;
linker ?= link ;
resource-compiler = [ get-values <resource-compiler> : $(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)
{

View File

@@ -21,7 +21,7 @@ feature.compose <stdlib>sun-stlport
: <cxxflags>-library=stlport4 <linkflags>-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) ;
}

View File

@@ -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 <toolset>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 <threading>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