[Scons-users] Print all known commands (without executing them)?
Johan Holmberg
johan556 at gmail.com
Mon Sep 17 17:39:27 EDT 2012
On Mon, Sep 17, 2012 at 10:25 PM, Dirk Bächle <tshortik at gmx.de> wrote:
> Hi Johan,
>
>
> On 17.09.2012 21:32, Johan Holmberg wrote:
>>
>> Hi!
>>
>> I wonder if it is possible to print all "commands" known by SCons,
>> without executing them? Say I have a SConstruct file like:
>>
>> e = Environment(CFLAGS='-Wall')
>> e.Program('foobar', ['foo.c', 'bar.c'])
>>
>> Then I would like to get a list like:
>>
>> gcc -o bar.o -c -Wall bar.c
>> gcc -o foo.o -c -Wall foo.c
>> gcc -o foobar foo.o bar.o
>>
>> I don't care about the order of the commands. Just a list of all
>> commands that SCons at some point might want to run (based on the
>> SConstruct read).
>>
>> And I don't want to actually execute the commands. For a larger
>> project this might take a long time, and I would like to get the list
>> immediately.
>>
>> Is this possible?
>
>
> yes it is. Opening SCons' Man page and searching for a keyword like
> "execute" would lead you to the '-n' command line option, which is pretty
> much doing what you want.
>
Thanks for your answer, but I was looking for a way that would not
exercise the "build logic" in SCons (not even in "dry-run" mode). Some
reasons:
- On one of my projects, "scons -n" takes over 2 1/2 min to complete
(> 6000 commands).
- "scons -n" seem to need that all sources exist, otherwise I get an
error like below:
gcc -o bar.o -c -Wall bar.c
scons: *** [foo.o] Source `foo.c' not found, needed by target `foo.o'.
scons: building terminated because of errors.
- Since "scons -n" is a "dry-run", I would have to do a "scons
--clean" before, otherwise the already executed commands would not be
shown.
What I was looking for, was something like the effect of the following
pseudo-code:
for target in all_scons_targets:
print target.commandline
ie. I wanted SCons to tell me every command it learned about by
reading the SConstruct. Reading my SConscript file takes just a couple
of seconds. After that I would like to get the list more or less
"immediately", not after 2 1/2 min. And the full list always.
I hope this makes it clearer what I meant to ask for. I realize that
this use-case might be a bit odd.
/Johan
More information about the Scons-users
mailing list