|
Boost-Build : |
From: Steven Knight (knight_at_[hidden])
Date: 2004-12-29 12:01:15
> > > > >> There's no precedent for that in any build system
> > > > >> I've seen,
> > > > >
> > > > > SCons?
> > > >
> > > > SCons requires a file at the root of a project that isn't called
> > > > Sconsfile? That's news to me.
> > >
> > > The top-level file is called SConstruct, and it invokes subsidiary files
> > > called SConstript. Probably, it's just a convention and subsidiary files
> > > can have any name...
> >
> > That's correct, subsidiary SCons config files are named "SConscript"
> > purely by convention.
>
> But, you can't name subsidiary config file SConstruct, right? In other words,
> can you write:
>
> SConscirpt("d/SConstruct")
>
> and have everything work?
Sure, you could, but there are some caveats.
When invoked from the d/ subdirectory, SCons would, of course, think
that was the top of the tree. This would mean you couldn't rely on an
environment (or other variable) passed from a higher-layer SConstruct
file, so you'd have to write each SConstruct file to be self-contained
(or use some common Python modules or something to share logic).
You'd have to use TargetSignatures('content') everywhere. That will give
you consistent signatures regardless of whether the file (like a library)
is a source in one build (because you're only linking against it) and
a target in another build (because you're building it *and* linking
against it). By default, SCons uses a "build signature" for targets
that consists of the signatures of all its consistuent source files,
and the command/action used to build it, which is more efficient than
re-scanning the target's contents.
Last, you'd definitely want to use the current default behavior of a
separate .sconsign file in each directory, no global database file for
all of the build's signatures. I mention this because we may be changing
the default behavior to use the global file, which is friendlier for
most builds. An explicit SConsignFile(None) will specify the existing
.sconsign-per-directory behavior regardless of whether we change the
default.
Note that I haven't tried such a configuration (SConstruct in each
directory) myself, though, so there may be other snags, but I'd be glad
to help figure them out if you wanted to try to make a configuration
like this work.
--SK
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk