summaryrefslogtreecommitdiff
path: root/lib/rake/loaders/makefile.rb
diff options
context:
space:
mode:
authorjim <jim@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-18 01:17:04 +0000
committerjim <jim@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-18 01:17:04 +0000
commitb7c95b923ab51753c4d48344694618b27b5ea827 (patch)
tree96a19fcbeba8608d3028eac3e5f28f43bd7b99dd /lib/rake/loaders/makefile.rb
parent2fc415a166df3bf46aad2a6a80182fc2cbe5aead (diff)
Updated Rake files to version 0.8.2
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rake/loaders/makefile.rb')
-rw-r--r--lib/rake/loaders/makefile.rb23
1 files changed, 9 insertions, 14 deletions
diff --git a/lib/rake/loaders/makefile.rb b/lib/rake/loaders/makefile.rb
index f66eb3b35f7..9ade098a1bf 100644
--- a/lib/rake/loaders/makefile.rb
+++ b/lib/rake/loaders/makefile.rb
@@ -7,31 +7,26 @@ module Rake
# Load the makefile dependencies in +fn+.
def load(fn)
- buffer = ''
open(fn) do |mf|
- mf.each do |line|
- next if line =~ /^\s*#/
- buffer << line
- if buffer =~ /\\$/
- buffer.sub!(/\\\n/, ' ')
- state = :append
- else
- process_line(buffer)
- buffer = ''
- end
+ lines = mf.read
+ lines.gsub!(/#[^\n]*\n/m, "")
+ lines.gsub!(/\\\n/, ' ')
+ lines.split("\n").each do |line|
+ process_line(line)
end
end
- process_line(buffer) if buffer != ''
end
private
# Process one logical line of makefile data.
def process_line(line)
- file_task, args = line.split(':')
+ file_tasks, args = line.split(':')
return if args.nil?
dependents = args.split
- file file_task => dependents
+ file_tasks.strip.split.each do |file_task|
+ file file_task => dependents
+ end
end
end