[Scons-users] [c++] Automatically choosing sources for linking

Dirk Bächle tshortik at gmx.de
Fri Feb 28 14:10:00 EST 2014

On 28.02.2014 17:48, Viktor Dick wrote:

> Hi,

> thanks for the quick answer. One problem with this solution is that

> there are compiler flags (mostly in src/define.h) that, among other

> things, control the inclusion of files, so the parsing would be more

> complicated that just grepping for #include (it's not even only #ifdef

> or #ifndef, sometimes it is "#if defined ... and #defined ..." or

> something alike). Delegating this task to gcc -MM (the dependency

> generator of gcc), which should be able to ignore the rest of the file

> and only look at the relevant parts, was quite slow, so I am not sure if

> this will work. I even managed to reduce the number of times that gcc is

> called to about 3 or 4 in order to reduce overhead from the call itself,

> but then the argument list became long and it still took a lot of time.

> Is it maybe possible to call the scons dependency scanner so it can find

> the correct includes, respecting compiler switches?

I have added a first draft of a recipe for this to our Wiki at


. Please check it out, and see if you can take it from there.

Best regards,


More information about the Scons-users mailing list