0

Any c/cpp files can call functions defined in other module, only linking phase resolve them. These c/cpp files don't depend on each other for compiling sequence.

So my question is, is there any case that one c/cpp file should depend on another one, so that we need to specify in SConstruct like:

hello=Program("hello.c")
Depends(hello,'other_file')

Thanks!

Troskyvs
  • 7,537
  • 7
  • 47
  • 115
  • For `.c` files? Probably never... can you be more specific as to the problem you've encountered? – Lightness Races in Orbit Oct 04 '16 at 15:33
  • `Depends` is useful (sometimes) when you write custom builders and stuff like that. If you're using SCons for mainstream languages and activities, it might not be directly useful. – Ami Tavory Oct 04 '16 at 15:56

1 Answers1

1

It can be useful to force dependencies which SCons may not be aware of. For example you may use

env.Command('a.xyz','b.abc','do_stuff.sh $SOURCES -o $TARGET')

It may be a simple command but you know it depends on a file "templatefile.wxy".

You can either write a full builder with Scanner (which would probably be overkill in this case). Or use Command + Depends.

bdbaddog
  • 3,357
  • 2
  • 22
  • 33