class Rake::MakefileLoader

Makefile loader to be used with the import file loader.

Constants

SPACE_MARK

Public Instance Methods

load(fn) click to toggle source

Load the makefile dependencies in fn.

   # File lib/rake/loaders/makefile.rb
10 def load(fn)
11   lines = File.read fn
12   lines.gsub!(/\\ /, SPACE_MARK)
13   lines.gsub!(/#[^\n]*\n/m, "")
14   lines.gsub!(/\\\n/, ' ')
15   lines.each_line do |line|
16     process_line(line)
17   end
18 end

Private Instance Methods

process_line(line) click to toggle source

Process one logical line of makefile data.

   # File lib/rake/loaders/makefile.rb
23 def process_line(line)
24   file_tasks, args = line.split(':', 2)
25   return if args.nil?
26   dependents = args.split.map { |d| respace(d) }
27   file_tasks.scan(/\S+/) do |file_task|
28     file_task = respace(file_task)
29     file file_task => dependents
30   end
31 end
respace(str) click to toggle source
   # File lib/rake/loaders/makefile.rb
33 def respace(str)
34   str.tr SPACE_MARK, ' '
35 end