[Scons-users] Default() and Ignore() - seem a little awkward

Gary Oberbrunner garyo at oberbrunner.com
Sat Jan 5 11:13:12 EST 2019


Some people look at the COMMAND_LINE_TARGETS variable (or some other
command line way) to decide whether to call env.Program() at all --
especially in larger builds, that can reduce noop build time because those
targets and their dependencies never even get scanned. But in your case,
Mats, I think Default(Alias('DefaultBuild')) and then adding to that alias
is the way to go. If you really want to get what SCons does by default
(build all targets under '.') just call "scons .".

As for your note that a Default list of None is "not legal" well, not
exactly -- but it does mean nothing will be built by default (without some
target specified on the cmd line), which is odd at best. Default() is
global - it just replaces '.' as what gets built if the user doesn't
specify any command line targets.

Once you set up a default alias (as above) though, in each SConscript if
you do nothing (don't add any targets to that default alias) then nothing
will be built by default by that SConscript, yet all its targets are
available to be built. I'd create another alias "DangerousExamples" and add
each sample to that, so anyone can build them with "scons
DangerousExamples". (I like camel case for aliases, but you can call them
whatever you like.)

On Sat, Jan 5, 2019 at 9:31 AM Mats Wichmann <mats at wichmann.us> wrote:

> On 1/4/19 9:52 PM, Bill Deegan wrote:
>
> >> So if in an SConscript, you undefine targets for a certain
> >> env - by way of using Default(None) - the build will not complete
> >> because there are no targets. Even if there are other targets in the
> >> overall build that are available to build. That was the idea behind
> >> claiming not benign.
> >>
> >
> > You cannot undefine targets from an env. You can only not add them.
> > If you're building a scheme which depends on undefining targets from the
> > DAG.. you're doing it wrong...
>
> okay, imprecise wording. the targets are still there (which I want), but
> are not built by default. By "undefine target" I was trying to say
> "remove from default build". However a default list of None is not
> legal, apparently - which in an sconscript which currently defines
> targets only for these "examples" and no other targets is a bit of a
> bummer.
>
> > What mechanism do you use to enable them? Use that method to also add it
> to
> > the tree, otherwise don't.
>
> Not understanding this question. There are calls to env.Program builder,
> so this is how things are "added".  Now I want those not to be built by
> default, but be able to be built if explicitly requested. If we don't
> have a Program call, then the latter is not possible - scons will know
> no rule for building it, right?
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>


-- 
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190105/1cd8a411/attachment.html>


More information about the Scons-users mailing list