From: Luis Lavena Date: 2006-03-26T09:41:53+09:00 Subject: Re: Using Rake to compile FreeBASIC code Jim Weirich wrote: > Ok, the rule needs to bridge the gap between test/test_bf.bas and > mains/test/test_bf.o. The regular expression part of the rule (the > r{^mains/.*\.o$}) is fine, it should match "mains/test/test_bf.o". The > list of procs are probably what's wrong. > > [ proc { |fn| File.basename(fn).ext('bas') }, > proc { 'mains' } > ] > > will produce the list: > > [ 'test_bf.bas', 'mains' ] > > which is wrong. What you want is: > > [ 'test/test_bf.bas', 'mains/test' ] > > So, just write two procs to produce that and put that in the rule. > > Also, you will probably need to add a line that will describe how to > make the 'mains/test' directory (Just saying "directory 'mains/test'" is > adequate). Thank you again Jim, following your indications I solved it (btw, this use of proc is just like lamda, right?) This is the new rule: # Rule to compile main objects from source. rule %r{^mains/.*\.o$} => [ proc { |fn| fn.sub(%r{^mains/}, '').ext('bas') }, proc { |fn| File.dirname(fn) } ] do |t| sh "fbc -c #{t.source} -o #{t.name} -m #{File.basename(t.source).ext}" end Guess could be solved more "elegant", but it works :-) I added a directory task into fb_project to intelligently add when is needed (mains/other or leave just mains) Thank you for your time (again). Regards, Luis -- Posted via http://www.ruby-forum.com/.