From 95c3a34839ba07cffdb57e0fce1e7ca5694c496d Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Wed, 15 Jan 2003 10:56:47 +0000 Subject: [PATCH] Improve toolset versions support. * new/toolset.jam (normalize-condition): New rule (flags): Call 'normalize-condition' * new/gcc.jam (init): Set compiler name for all actions in gcc module, now that toolset.jam supports it. [SVN r16906] --- gcc.jam | 6 +----- src/build/toolset.jam | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/gcc.jam b/gcc.jam index 62aebebb9..e968341a8 100644 --- a/gcc.jam +++ b/gcc.jam @@ -29,11 +29,7 @@ rule init ( a1 * : a2 * : a3 * ) feature.extend-subfeature toolset gcc : version : $(version) ; - # NOTE: this should be collapsed in one line once - # 'toolset.flags' supports specifying module name. - toolset.flags gcc.compile NAME gcc-$(version) : $(name) ; - toolset.flags gcc.link NAME gcc-$(version) : $(name) ; - toolset.flags gcc.link-dll NAME gcc-$(version) : $(name) ; + toolset.flags gcc NAME gcc-$(version) : $(name) ; # TODO: set path accordingly. } diff --git a/src/build/toolset.jam b/src/build/toolset.jam index 77d803c12..d04609389 100644 --- a/src/build/toolset.jam +++ b/src/build/toolset.jam @@ -21,6 +21,23 @@ rule using ( toolset-module : * ) $(toolset-module).init $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ; } +# Expands subfeatures in each property sets. +# e.g +# gcc-3.2 +# will be converted to +# gcc/3.2 +local rule normalize-condition ( property-sets * ) +{ + local result ; + for local p in $(property-sets) + { + local split = [ feature.split $(p) ] ; + local expanded = [ feature.expand-subfeatures [ feature.split $(p) ] ] ; + result += $(expanded:J=/) ; + } + return $(result) ; +} + # Specifies the flags (variables) that must be set on targets under certain # conditions, described by arguments. @@ -30,7 +47,7 @@ rule flags ( rule-or-module # If contains dot, should be a rule name. # # 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. + # module. variable-name # Variable that should be set on target condition * : # Can specify either @@ -44,6 +61,9 @@ rule flags ( rule-or-module # If contains dot, should be a rule name. # - a set of property sets. If one of those property # sets is contained in build properties, 'values' # will be added to the variable. + # Implied values are not allowed: "gcc" should + # be used, not just "gcc". Subfeatures, like in + # "gcc-3.2" are allowed. # # - empty. 'values' will be added to the variable # unconditionally @@ -52,7 +72,6 @@ rule flags ( rule-or-module # If contains dot, should be a rule name. .$(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) ; if $(condition[1]:G=) @@ -64,6 +83,7 @@ rule flags ( rule-or-module # If contains dot, should be a rule name. error empty value set used with property-set match criterion: : $(condition) ; } + condition = [ normalize-condition $(condition) ] ; } else if $(condition) { @@ -79,6 +99,8 @@ rule flags ( rule-or-module # If contains dot, should be a rule name. error empty value set used with unconditional match criterion ; } + .$(rule-or-module).condition.$(.flag-no) += $(condition) ; + .flag-no = [ numbers.increment $(.flag-no) ] ; }