fix parsing Makefile dependencies when they spanned multiple lines
This commit is contained in:
parent
3f33336fff
commit
75977981c0
@ -212,10 +212,11 @@ module Rscons
|
||||
if line =~ /^(.*)\\\s*$/
|
||||
buildup += ' ' + $1
|
||||
else
|
||||
if line =~ /^(.*): (.*)$/
|
||||
target, tdeps = $1.strip, $2
|
||||
if target == target
|
||||
deps += tdeps.split(' ').map(&:strip)
|
||||
buildup += ' ' + line
|
||||
if buildup =~ /^(.*): (.*)$/
|
||||
mf_target, mf_deps = $1.strip, $2
|
||||
if mf_target == target
|
||||
deps += mf_deps.split(' ').map(&:strip)
|
||||
end
|
||||
end
|
||||
buildup = ''
|
||||
|
24
spec/rscons/environment_spec.rb
Normal file
24
spec/rscons/environment_spec.rb
Normal file
@ -0,0 +1,24 @@
|
||||
module Rscons
|
||||
describe Environment do
|
||||
describe '.parse_makefile_deps' do
|
||||
it 'handles dependencies on one line' do
|
||||
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
||||
module.o: source.cc
|
||||
EOS
|
||||
env = Environment.new
|
||||
env.parse_makefile_deps('makefile', 'module.o').should == ['source.cc']
|
||||
end
|
||||
|
||||
it 'handles dependencies split across many lines' do
|
||||
File.should_receive(:read).with('makefile').and_return(<<EOS)
|
||||
module.o: module.c \\
|
||||
module.h \\
|
||||
other.h
|
||||
EOS
|
||||
env = Environment.new
|
||||
env.parse_makefile_deps('makefile', 'module.o').should == [
|
||||
'module.c', 'module.h', 'other.h']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user