Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-01-06 00:16:19


On Saturday 05 January 2002 07:57 pm, you wrote:
> Based on the above, I don't think your fix is quite right. I'm not sure
> that everything in the Jam code will account properly for an
> explicitly-specified Jamfile out-of-the-box, but you should probably try
> again without setting TOP in the command-line.

Here's attempt #2, trying to avoid setting TOP on the command-line. You
mentioned project-root, but frankly the project-root doesn't do all that much:

rule project-root
{
    SubDir TOP ;
}

It seems that BOOST_ROOT should show up somehow if we're declaring that the
current Jamfile is at $(BOOST_ROOT)/Jamfile. If we look at the part of
SubDir that is supposed to set TOP, we have:

    if ! $($(<[1]))
    {
        if ! $(<[1])
        {
            EXIT SubDir syntax error ;
        }

        $(<[1]) = [ FSubDir $(<[2-]) ];
        $(<[1])_TOKENS = [ split-path $($(<[1])) ] ;
        gTOP = $(<[1]) ; # not sure why someone would want to use anything
                         # other than TOP, but just in case...
    }

Where $(<) is going to be TOP. $(<[2-]) will, of course, be empty, so $(TOP)
will _always_ get set to just "."
Furthermore, even if $(<[2-]) had some form of path in there, we would only
be getting the subdirectory from that path back to the root ("/").

As an experiment, I performed the following changes. First we make
project-root look like this:

  rule project-root
  {
     SubDir TOP $(BOOST_ROOT) ;
  }

and then we make the above block of SubDir look like this:

    if ! $($(<[1]))
    {
        if ! $(<[1])
        {
            EXIT SubDir syntax error ;
        }

        $(<[1]) = $(<[2-]) ;
        $(<[1])_TOKENS = [ split-path $($(<[1])) ] ;
        gTOP = $(<[1]) ; # not sure why someone would want to use anything
                         # other than TOP, but just in case...
    }

Now, when we see project-root, TOP = $(BOOST_ROOT) and
TOP_TOKENS = [ split-path $(BOOST_ROOT) ]

This actually does work, though there is one thing I'd surely like to change:
instead of passing $(BOOST_ROOT) to the subdir command, we should be passing
the directory in which the Jamfile containing the project-root command
resides. Perhaps this is $(JAMFILE:D)?

Anyway, with the above two changes (context diff below), I can build
out-of-source, out-of-target with:

jam -sALL_LOCATE_TARGET=/path/to/put/binaries
-sJAMFILE=/path/to/boost/root/Jamfile

Getting closer, I hope?

        Doug

Index: allyourbase.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/allyourbase.jam,v
retrieving revision 1.18
diff -c -3 -p -r1.18 allyourbase.jam
*** allyourbase.jam 2001/12/13 18:45:42 1.18
--- allyourbase.jam 2002/01/06 05:04:40
*************** rule subproject
*** 1122,1128 ****
  # Declares this directory to be the project root.
  rule project-root
  {
! SubDir TOP ;
  }

  # dwa 6/7/01 - added for boost
--- 1122,1128 ----
  # Declares this directory to be the project root.
  rule project-root
  {
! SubDir TOP $(BOOST_ROOT) ;
  }

  # dwa 6/7/01 - added for boost
*************** rule SubDir
*** 1182,1188 ****
              EXIT SubDir syntax error ;
          }

! $(<[1]) = [ FSubDir $(<[2-]) ] ;
          $(<[1])_TOKENS = [ split-path $($(<[1])) ] ;
          gTOP = $(<[1]) ; # not sure why someone would want to use anything
                           # other than TOP, but just in case...
--- 1182,1188 ----
              EXIT SubDir syntax error ;
          }

! $(<[1]) = $(<[2-]) ;
          $(<[1])_TOKENS = [ split-path $($(<[1])) ] ;
          gTOP = $(<[1]) ; # not sure why someone would want to use anything
                           # other than TOP, but just in case...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk