Patrick Doyle wrote:
> Hi Brock,
> I think I may have just found the source of your problem:
> 
> If you look at rake/loaders/makefile.rb (which, on my Windoze system
> is somewhere near
> ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake/loaders/makefile.rb),
> you will see something that looks like:
> 
>     # Process one logical line of makefile data.
>     def process_line(line)
>       file_task, args = line.split(':')
>       return if args.nil?
>       dependents = args.split
>       file file_task => dependents
>     end
> 
> This will not handle C:\blah filenames correctly -- it split's them at
> the first colon (":").
> 
> You could use that file as a source of inspiration to write your own
> Rake::MakefileLoader#load method that correctly parses CCS generated
> dependency files (perhaps splitting the file task from its dependents
> after the first ".obj:", perhaps recognizing/depending on the hope
> that/ CCS only places one dependency per line, etc...).
> 
> I'm not yet proficient enough in Ruby, and especially regular
> expression matching to just rattle this off (but I know resources are
> online to fill in all the bits I'm missing, or have gotten just plain
> wrong), but you could probably replace the line of code that reads
> 
>----- snip! -------
> 
> Does that make sense?  (Once you figure out the right way to do
> pattern matching in Ruby)
> 
> --wpd

Patrick:

You da man!

You "inspired" me to write my own CCS-generated dependency file parser. 
It was actually quite simple - thanks to your hints above. I am finally 
moving ahead again. In case you, or anyone else, is interested, here is 
what I modified from my original rakefile (added 2 def's to process the 
dependency files and modified the :build_depend task to call).

###############################################################################
desc 'Build_depend task that depends on the dependency files'
task :build_depend => DEPEND_FILES do
    puts "Importing file dependencies..."
    DEPEND_FILES.each do |dep_file|
        process_dpend_file(dep_file)
    end
end

def process_dpend_line(line)
    objfile, prereq = line.split(': ')
    return if prereq.nil?
    file objfile => prereq
end

def process_dpend_file(dfile)
    open(dfile) do |file_lines|
        file_lines.each do |line|
            process_dpend_line(line.chomp)
        end
    end
end
###############################################################################


Thanks again,
Brock
-- 
Posted via http://www.ruby-forum.com/.