class Rake::MakefileLoader

  1. lib/rake/loaders/makefile.rb
Parent: Rake

Makefile loader to be used with the import file loader.

Methods

Public Instance

  1. load

Private Instance

  1. process_line
  2. respace

Included modules

  1. Rake::DSL

Constants

SPACE_MARK = "\0"  

Public Instance methods

load (fn)

Load the makefile dependencies in fn.

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

Private Instance methods

process_line (line)

Process one logical line of makefile data.

[show source]
    # File lib/rake/loaders/makefile.rb, line 23
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)
[show source]
    # File lib/rake/loaders/makefile.rb, line 33
33:     def respace(str)
34:       str.tr SPACE_MARK, ' '
35:     end