diff --git a/modules.jam b/modules.jam index a79ad6add..ab92c935a 100644 --- a/modules.jam +++ b/modules.jam @@ -57,31 +57,26 @@ rule call-in ( module-name ? : rule-name args * : * ) } # load the indicated module if it is not already loaded. -rule load ( module-name : filename ? : search * : module-tag ? ) +rule load ( module-name : filename ? : search * ) { filename ?= $(module-name).jam ; - module-tag ?= $(module-name) ; - if ! ( $(module-tag) in $(loaded-modules) ) + if ! ( $(module-name) in $(loaded-modules) ) { - loaded-modules += $(module-tag) ; - loading-modules += $(module-tag) ; + loaded-modules += $(module-name) ; + loading-modules += $(module-name) ; local suppress-test = $(untested[1]) ; # suppress tests until all recursive loads are complete. - untested += $(module-tag) ; # add the module to the stack of untested modules + untested += $(module-name) ; # add the module to the stack of untested modules - poke $(module-tag) : __name__ : $(module-tag) ; - poke $(module-tag) : __file__ : $(filename) ; - poke $(module-name) : __tag__ : $(module-tag) ; + poke $(module-name) : __name__ : $(module-name) ; + poke $(module-name) : __file__ : $(filename) ; - module $(module-tag) + module $(module-name) { # Prepare a default behavior, in case no __test__ is defined. IMPORT modules : no_test_defined : $(__name__) : __test__ ; - } - module $(module-name) - { + # Add some grist so that the module will have a unique target name - local module-target = [ modules.peek $(__tag__) : __file__ ] ; - module-target = $(module-target:G=module@) ; + local module-target = $(__file__:G=module@) ; search = $(3) ; search ?= [ modules.peek : BOOST_BUILD_PATH ] ; @@ -109,11 +104,11 @@ rule load ( module-name : filename ? : search * : module-tag ? ) untested = ; } } - else if $(module-tag) in $(loading-modules) + else if $(module-name) in $(loading-modules) { - ECHO loading \"$(module-tag)\" ; + ECHO loading \"$(module-name)\" ; ECHO circular module loading dependency: ; - EXIT $(loading-modules) $(module-tag) ; + EXIT $(loading-modules) $(module-name) ; } } @@ -121,7 +116,7 @@ rule load ( module-name : filename ? : search * : module-tag ? ) # each loaded module. rule record-binding ( module-target : binding ) { - $(module-target:G=:S=).__binding__ = $(binding) ; + $(loading-modules[-1]).__binding__ = $(binding) ; } # load the indicated module and import rule names into the current