Newbie Jamfile author question

Hello: I am trying to write some Jamfiles and I am finding that bjam tends to run my rules twice. Here is a tiny demo (using Boost 1.31.1 on Windows XP, with zsh/cygwin, bjam version "3.1.13. OS=NT".). % export BOOST_ROOT=c:/boost_1_33_1; cd c:/; rm -rf deleteme; mkdir deleteme; cd deleteme; echo 'Echo Hello Twice ;' > Jamfile; bjam Hello Twice Hello Twice ...found 8 targets... (Note: If the first statement is "export BOOST_ROOT=;" instead, I get the error "Unable to load Boost.Build: could not find "boost-build.jam...Attempted search from c:\deleteme up to the root...etc.") Notice the double-execution. Here is some potentially useful extra information. I ran it with -d5, and noticed that 'Echo Hello Twice ;' was getting executed at lines 1785 and 1797 of allyourbase.jam. Here is a snippet of the -d5 output: ---------------------------------------------------------output with -d5---------------------------------------------------------- <snip> c:\boost_1_33_1\tools/build/v1\allyourbase.jam:1784:>>>>|> set gINCLUDED_AS_DEPENDANT(Jamfile) = TRUE c:\boost_1_33_1\tools/build/v1\allyourbase.jam:1785:>>>>|> include Jamfile Jamfile:1:>>>>|> Echo Hello Twice Hello Twice c:\boost_1_33_1\tools/build/v1\allyourbase.jam:1791:>>>>|> set gIN_LIB_INCLUDE = c:\boost_1_33_1\tools/build/v1\allyourbase.jam:1796:>>>>|> set gINCLUDED(Jamfile) = TRUE c:\boost_1_33_1\tools/build/v1\allyourbase.jam:1797:>>>>|> include Jamfile Jamfile:1:>>>>|> Echo Hello Twice Hello Twice make -- all make -- all <snip> --------------------------------------------------------end output with -d5------------------------------------------------------ The file allyourbase.jam is too big for this email, but I'm including the relevant snippet here, with key lines marked with "<<<<<" : ------------------------------------------------------allyourbase.jam--- --------------------------------------------- <snip> # Load a user's Jamfile(s). # rule load-jamfiles ( jamfiles * ) { # First we load the Jamfiles without generation of main targets so that # dependencies are preloaded. Then we reload the files with target # generation enabled. local jamfile ; local as-dependant = $(gIN_LIB_INCLUDE) ; local gIN_LIB_INCLUDE ; gIN_LIB_INCLUDE = TRUE ; for jamfile-path in $(jamfiles) { if ! $(gINCLUDED_AS_DEPENDANT($(jamfile-path))) { gINCLUDED_AS_DEPENDANT($(jamfile-path)) = TRUE ; include $(jamfile-path) ; <<<<< line 1785 } } if ! $(as-dependant) { gIN_LIB_INCLUDE = ; for jamfile-path in $(jamfiles) { if ! $(gINCLUDED($(jamfile-path))) { gINCLUDED($(jamfile-path)) = TRUE ; include $(jamfile-path) ; <<<<< line 1797 } } } } <snip> ------------------------------------------------------end allyourbase.jam------------------------------------------------ Can anyone reproduce and/or explain this? Thank you. Michael Drumheller Boeing Phantom Works Mathematics and Engineering Analysis 425.373.2703 michael.drumheller@boeing.com This email may contain proprietary information. If you are not the intended recipient please delete it and notify the sender that you received it in error.

Drumheller, Michael wrote:
Hello:
I am trying to write some Jamfiles and I am finding that bjam tends to run my rules twice. Here is a tiny demo (using Boost 1.31.1 on Windows XP, with zsh/cygwin, bjam version "3.1.13. OS=NT".).
% export BOOST_ROOT=c:/boost_1_33_1; cd c:/; rm -rf deleteme; mkdir deleteme; cd deleteme; echo 'Echo Hello Twice ;' > Jamfile; bjam Hello Twice Hello Twice ...found 8 targets...
(Note: If the first statement is "export BOOST_ROOT=;" instead, I get the error "Unable to load Boost.Build: could not find "boost-build.jam...Attempted search from c:\deleteme up to the root...etc.")
Notice the double-execution.
Can anyone reproduce and/or explain this?
Yes, that's per design of the build system (v1 only). It uses the first pass to declare all the targets, and the second pass to define them and hence to possible refer to other declared targets. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo
participants (3)
-
David Klein
-
Drumheller, Michael
-
Rene Rivera