www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Added --makedepend flag to rdmd

reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
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
Jun 05 2011
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 06/05/2011 10:48 AM, 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;

Ehm, I meant to not include the .d suffixes... // file test1.d; import test2; // file test2.d; import test3, mylib.test4; Andrei
Jun 05 2011
next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Stupid stupid me, I was using makeDepend instead of makedepend.

Works fine on Windoze, sorry for the noise.

On 6/5/11, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Well your changes don't seem to work on Windows. For this layout:

 main.d  // module main
 foo/test.d // module foo.test

 I get back:
 Failed: dmd --makeDepend -v -o- "main.d" -I"." >main.d.deps

 I'll try to figure out what's going on and make a pull if I can get it to
 work.

Jun 05 2011
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I think what confused me was that I was reading the code and saw this:
"makedepend", &makeDepend,

Heh. :)
Jun 05 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Well your changes don't seem to work on Windows. For this layout:

main.d  // module main
foo/test.d // module foo.test

I get back:
Failed: dmd --makeDepend -v -o- "main.d" -I"." >main.d.deps

I'll try to figure out what's going on and make a pull if I can get it to work.
Jun 05 2011
prev sibling parent Graham St Jack <Graham.StJack internode.on.net> writes:
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/451ffed8ff985465a521
4f7671494ac1d3744b4 


 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
Jun 06 2011