I have a rakefile which takes a C++ source tree, and creates objects 
elsewhere.

i.e., source/dir/file.cpp compiles to build/dir/file.o.  I created a 
rule for this, and all works well.

Often it is handy to compile a single file based on just the source 
path, without wanting to resolve what the object file will be.  (i.e, 
from Vim, calling 'rake expand("%")' ).

So I created a task like this:

task :singleobj do |t|
        src = ENV['srcfile']
        obj = src.pathmap( "%{^source,build}.o" )
        sh( "rake #{obj}" )
end

This allows me to issue the command from Vim
'rake singleobj srcfile=source/dir/file.cpp'

This is good, but the rake command is called twice.  Is there a way I 
can avoid calling rake recursively?

Thanks,

~S

_______________________________________________
Rake-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rake-devel

Reply via email to