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*$/
|
if line =~ /^(.*)\\\s*$/
|
||||||
buildup += ' ' + $1
|
buildup += ' ' + $1
|
||||||
else
|
else
|
||||||
if line =~ /^(.*): (.*)$/
|
buildup += ' ' + line
|
||||||
target, tdeps = $1.strip, $2
|
if buildup =~ /^(.*): (.*)$/
|
||||||
if target == target
|
mf_target, mf_deps = $1.strip, $2
|
||||||
deps += tdeps.split(' ').map(&:strip)
|
if mf_target == target
|
||||||
|
deps += mf_deps.split(' ').map(&:strip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
buildup = ''
|
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