diff --git a/v2/build/configure.jam b/v2/build/configure.jam index 66b81b3..543bade 100644 --- a/v2/build/configure.jam +++ b/v2/build/configure.jam @@ -123,76 +123,87 @@ rule print-configure-checks-summary ( ) } } - -# Attempt to build a metatarget named by 'metatarget-reference' in context of -# 'project' with properties 'ps'. Returns non-empty value if build is OK. -# -rule builds-raw ( metatarget-reference : project : ps : what : retry ? ) +# Attempts to build a set of virtual targets +rule try-build ( targets * : ps : what : retry ? ) { + local cache-name = $(what) [ $(ps).raw ] ; + cache-name = $(cache-name:J=-) ; + local value = [ config-cache.get $(cache-name) ] ; + local result ; + local jam-targets ; - if ! $(retry) && ! $(.$(what)-tested.$(ps)) + for local t in $(targets) { - .$(what)-tested.$(ps) = true ; - - local cache-name = $(what) [ $(ps).raw ] ; - cache-name = $(cache-name:J=-) ; - local value = [ config-cache.get $(cache-name) ] ; - - local targets = [ targets.generate-from-reference - $(metatarget-reference) : $(project) : $(ps) ] ; - - local jam-targets ; - for local t in $(targets[2-]) + jam-targets += [ $(t).actualize ] ; + } + + if $(value) + { + local x = [ PAD " - $(what)" : $(.width) ] ; + if $(value) = true { - jam-targets += [ $(t).actualize ] ; + .$(what)-supported.$(ps) = yes ; + result = true ; + log-check-result "$(x) : yes (cached)" ; } - - if $(value) + else { - local x = [ PAD " - $(what)" : $(.width) ] ; - if $(value) = true - { - .$(what)-supported.$(ps) = yes ; - result = true ; - log-check-result "$(x) : yes (cached)" ; - } - else - { - log-check-result "$(x) : no (cached)" ; - } - } - else if ! UPDATE_NOW in [ RULENAMES ] + log-check-result "$(x) : no (cached)" ; + } + } + else if ! UPDATE_NOW in [ RULENAMES ] + { + # Cannot determine. Assume existance. + } + else + { + local x = [ PAD " - $(what)" : $(.width) ] ; + if [ UPDATE_NOW $(jam-targets) : + $(.log-fd) : ignore-minus-n : ignore-minus-q ] { - # Cannot determine. Assume existance. + .$(what)-supported.$(ps) = yes ; + result = true ; + log-check-result "$(x) : yes" ; } else { - local x = [ PAD " - $(what)" : $(.width) ] ; - if [ UPDATE_NOW $(jam-targets) : - $(.log-fd) : ignore-minus-n : ignore-minus-q ] - { - .$(what)-supported.$(ps) = yes ; - result = true ; - log-check-result "$(x) : yes" ; - } - else - { - log-check-result "$(x) : no" ; - } + log-check-result "$(x) : no" ; + } + } + if ! $(value) + { + if $(result) + { + config-cache.set $(cache-name) : true ; } - if ! $(value) + else { - if $(result) - { - config-cache.set $(cache-name) : true ; - } - else - { - config-cache.set $(cache-name) : false ; - } - } + config-cache.set $(cache-name) : false ; + } + } + return $(result) ; +} + +# Attempt to build a metatarget named by 'metatarget-reference' +# in context of 'project' with properties 'ps'. +# Returns non-empty value if build is OK. +rule builds-raw ( metatarget-reference : project : ps : what : retry ? ) +{ + local result ; + + if ! $(retry) && ! $(.$(what)-tested.$(ps)) + { + .$(what)-tested.$(ps) = true ; + + local targets = [ targets.generate-from-reference + $(metatarget-reference) : $(project) : $(ps) ] ; + + result = [ try-build $(targets[2-]) : $(ps) : $(what) : $(retry) ] ; + .$(what)-supported.$(ps) = $(result) ; + return $(result) ; + } else { diff --git a/v2/tools/link.jam b/v2/tools/link.jam index e604b12..ed0c424 100644 --- a/v2/tools/link.jam +++ b/v2/tools/link.jam @@ -10,6 +10,7 @@ import virtual-target ; import configure ; import path ; import property ; +import property-set ; import common ; rule get-root-project ( project ) @@ -33,7 +34,7 @@ actions touch { $(TOUCH) "$(<)" } -rule can-symlink ( project ) +rule can-symlink ( project : ps ) { if ! $(.can-symlink) { @@ -44,7 +45,7 @@ rule can-symlink ( project ) local target = [ new file-target test-symlink : : $(project) : [ new action $(source-target) : link.mklink ] ] ; - if [ configure.try-build $(target) : "symlinks supported" ] + if [ configure.try-build $(target) : $(ps) : "symlinks supported" ] { .can-symlink = true ; } @@ -60,7 +61,7 @@ rule can-symlink ( project ) } -rule can-hardlink ( project ) +rule can-hardlink ( project : ps ) { if ! $(.can-hardlink) { @@ -72,7 +73,7 @@ rule can-hardlink ( project ) local target = [ new file-target test-hardlink : : $(project) : [ new action $(source-target) : link.hardlink ] ] ; - if [ configure.try-build $(target) : "hardlinks supported" ] + if [ configure.try-build $(target) : $(ps) : "hardlinks supported" ] { .can-hardlink = true ; } @@ -143,9 +144,9 @@ class symlink-target-class : basic-target local files = [ path.glob-tree $(location) : * ] ; local targets ; - if ! [ link.can-symlink $(self.project) ] + if ! [ link.can-symlink $(self.project) : $(property-set) ] { - link.can-hardlink $(self.project) ; + link.can-hardlink $(self.project) : $(property-set) ; } if [ $(property-set).get ]