2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00
Files
build/new/toolset.jam
Vladimir Prus a8d2feea84 Work on BB5. Mininal version of toolset initialization implemented.
* new/gcc.jam (init): New rule. Allows to specify alternative
    gcc versions.

* new/toolset.jam
    (using): New rule.
    (set-target-variables): Bufgix. I was making indirect call
        via variable with multiple values.

* new/build-request.jam
   (looks-like-implicit-value): New rule.
   (from-command-line): Use the above.
   (convert-command-line-element): Don't validate
      elements with dashes (this probably must be fixed).


[SVN r16468]
2002-12-02 07:20:37 +00:00

108 lines
4.0 KiB
Plaintext

# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
# Support for toolset definition.
import feature ;
import numbers ;
.flag-no = 1 ;
# Initializes an additional toolset-like module.
# First load 'toolset-module' and then calls it's 'init'
# rule with trailing arguments
rule using ( toolset-module : * )
{
import $(toolset-module) ;
$(toolset-module).init $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
}
# Specifies the flags (variables) that must be set on targets under certain
# conditions, described by arguments.
rule flags ( rule-or-module # If contains dot, should be a rule name.
# The flags will be applied when that rule is
# used to set up build actions.
#
# If does not contain dot, should be a module name.
# The flags will be applied for all rules in that
# module. THIS PART IS NOT IMPLEMENTED YET.
variable-name # Variable that should be set on target
condition * : # Can specify either
#
# - a set of feature names. Values of all mentioned
# feature that are present in build property set
# will be appended to the variable. The 'actualize'
# method will be called on values of all dependency
# features. The next argument will be unused.
#
# - a set of property sets. If one of those property
# sets is contained in build properties, 'values'
# will be added to the variable.
values * )
{
.$(rule-or-module).flags += $(.flag-no) ;
.$(rule-or-module).variable.$(.flag-no) += $(variable-name) ;
.$(rule-or-module).condition.$(.flag-no) += $(condition) ;
.$(rule-or-module).values.$(.flag-no) += $(values) ;
.flag-no = [ numbers.increment $(.flag-no) ] ;
}
rule set-target-variables ( rule-or-module target : properties * )
{
for local f in $(.$(rule-or-module).flags)
{
local variable = $(.$(rule-or-module).variable.$(f)) ;
local condition = $(.$(rule-or-module).condition.$(f)) ;
local values = $(.$(rule-or-module).values.$(f)) ;
local result ;
local found ;
for local c in $(condition)
{
local requirements = [ feature.split $(c) ] ;
if $(requirements:G=)
{
# This is a property set
if ! $(found) && $(requirements) in $(properties)
{
result += $(values) ;
found = 1 ;
}
}
else
{
for local r in $(requirements)
{
local item = [ feature.get-values $(r) : $(properties) ] ;
for local i in $(item)
{
if dependency in [ feature.attributes $(r:G) ]
{
result += [ $(i).actualize ] ;
}
else
{
result += $(i) ;
}
}
}
}
}
if ! $(condition)
{
result = $(values) ;
}
$(variable) on $(target) += $(result) ;
}
}