Builder.produces? checks both target and source file names
This commit is contained in:
parent
44d57881c2
commit
46c50049aa
@ -1,6 +1,6 @@
|
||||
module Rscons
|
||||
class Builder
|
||||
def self.produces?(env, suffix)
|
||||
def self.produces?(env, target, source)
|
||||
false
|
||||
end
|
||||
end
|
||||
|
@ -6,13 +6,13 @@ module Rscons
|
||||
'CFLAGS' => [],
|
||||
'CPPFLAGS' => [],
|
||||
'OBJSUFFIX' => '.o',
|
||||
'CEXTS' => ['.c'],
|
||||
'CSUFFIX' => ['.c'],
|
||||
'CCCOM' => ['$CC', '-c', '-o', '$TARGET', '$CPPFLAGS', '$CFLAGS', '$SOURCES']
|
||||
}
|
||||
end
|
||||
|
||||
def self.produces?(env, suffix)
|
||||
suffix == env['OBJSUFFIX']
|
||||
def self.produces?(env, target, source)
|
||||
target =~ /#{env['OBJSUFFIX']}$/ and env['CSUFFIX'].find {|ext| source =~ /#{ext}$/}
|
||||
end
|
||||
|
||||
def run(env, target, source)
|
||||
|
@ -19,10 +19,11 @@ module Rscons
|
||||
if source =~ /#{env['OBJSUFFIX']}$/ or source =~ /#{env['LIBSUFFIX']}$/
|
||||
source
|
||||
else
|
||||
builder_class = env.builders.values.find { |klass| klass.produces?(env, env['OBJSUFFIX']) }
|
||||
o_file = env.stem(source) + env['OBJSUFFIX']
|
||||
builder_class = env.builders.values.find { |klass| klass.produces?(env, o_file, source) }
|
||||
if builder_class
|
||||
builder = builder_class.new
|
||||
builder.run(env, env.stem(source) + env['OBJSUFFIX'], source)
|
||||
builder.run(env, o_file, source)
|
||||
else
|
||||
raise "No builder found to convert input source #{source.inspect} to an object file."
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user