[Rake-devel] problem importing deps

Shea Martin shea08 at eastlink.ca
Wed Jan 17 09:44:45 EST 2007

My source tree looks like this.


I build to a build directory, which afeter a build looks like this:

my .cpp.o rule looks like this:
rule '.o' => [ proc { |target| target.pathmap( 
"%{^#{$config.builddir},#{$config.srcdir}}X.c" ) } ] do | task |
    sh( "gcc -c -o #{task.name} #{task.source}
    sh( "gcc -MM -o #{task.name.ext('.mf')} #{task.source}" )

I import the .mf files using 'import'.

Note: rake fails to import the dep files if I name them anything other 
than .mf.  It is pretty common practise to name these files .d, but rake 
chokes on them then, assuming they are ruby files...

build/dir/file1.mf would look like this:
file1.o: source/dir/file1.h source/another_dir.h c:/path/to/API/hdr.h

rake -P then shows the deps like this:
file1.o as "source/dir/file1.h source/another_dir.h c"

So the import is choking on the colon in the path of hdr.h.  This is the 
first problem. I can work around it by filtering the absolute paths out 
of the .mf file, as I really don't want to do dep checking on files out 
of my local tree anyway.

The second problem is that when I build a file I do it like this:
rake build/dir/file1.o.  The dep checking is never done because the .mf 
file is specifies file.o not build/dir/file.o.  I am not sure what to do 
about this one...

It looks like I may be better just to write my own dep checking tool...

Thought, tips?


More information about the Rake-devel mailing list