[Scons-users] Build Order

William Roberts bill.c.roberts at gmail.com
Sat Jul 12 18:10:19 EDT 2014


When I did a custom builder my emitter would return the results, such as
generated .c and .h files. I would then take the return of that and pass
them in the SRC files of the dependent target so scons would pick up the
dependency. You could likely do something similar with depends.
On Jul 12, 2014 8:30 AM, "Russell, J.J." <russell at slac.stanford.edu> wrote:

> Before compiling some C code, an include directory which that code uses
> needs to be populated.  I’ve written a builder to do this populating, but,
> because SCons controls the build order, there is no guarantee that the
> include directory will be populated when needed by the Object builder.
>
>
> The Requires method seems just the ticket and appears to work, however I
> am a little worried.  The Requires method does two things
>    1) Ensures that prerequisite target is built first
>         - Here, populating the include directory, just want I want
>
>    2) That targets of the prerequisites do not get built if only the
> prerequisites have changed
>          - Not what I want, if an include file needed by the C code
> changes, those targets do need to get rebuilt
>
> (I note that even when using Requires method, the dependency tree is
> correct; given my understanding, I don’t know why.)
>
>
> The Depends method is functionally what I want, but it is impractical,
> since it demands that all the include files for each C file be known and
> listed in the method.  This list is what the Scanner normally automatically
> collects.
>
>
> I’ve thought of other tactics to get this directory populated before the
> builders that need it access it, but they involve either
>     1) An awkward two pass build system (one pass to populate, one to
> build)
>     2) Making the populater just a Python function that runs before the
> build stage, rather than an SCons Builder
>          - This would work, but I lose the nice features that come with a
> builder, like the clean function.
>
> If it makes a difference, the Builder to populate the include directory
> functions in two modes, either
>     1) Making symbolic links to the include files and the relevant
> sub-directories, or
>     2) By explicitly copying the include file directory tree (after doing
> some rearrangement).
>
> I’ve only tested the former at this point.
>
> What I am concerned about is in the case of the symbolic links, the
> prerequisite targets are the symbolic links, not the actual files, possibly
> explaining why the dependencies are correct.  This will not be the case for
> explicit copies.  I will certainly test this, but a clean explanation would
> help; nuances sometimes are not captured when just trying things by
> experiment or as I call it, the ‘poke with a stick’ method.
>
>
> Jim Russell
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140712/09d34c52/attachment.html>


More information about the Scons-users mailing list