Thanks very much for this - I need it for the build tool I am working on.


On 06/06/11 01:18, Andrei Alexandrescu wrote:
I just added a --makedepend flag to rdmd:

https://github.com/D-Programming-Language/tools/commit/451ffed8ff985465a52124f7671494ac1d3744b4

It instructs rdmd to simply print to stdout the name of the input file followed by a colon and then by the space-separated files that the input file depends on, directly or indirectly. Example:

// file test1.d;
import test2.d;

// file test2.d;
import test3.d, mylib.test4.d;

With this setup, assuming test3.d and test4.d contain no further non-system imports, the command:

rdmd --makedepend test1.d

will print

test1.d : ./test2.d ./mylib/test4.d ./test3.d

This flag is intended to be useful to larger-scale build tools that need to store and track module interdependencies. In the simplest use case, directing the output of rdmd --makedepend (for each of a project's root files) to a file and then including that file in a makefile will ensure that dependencies are properly maintained.


Cheers,

Andrei


--
Graham St Jack

Reply via email to