specify the type desired for some *SUFFIX variables when they are used

This commit is contained in:
Josh Holtrop 2013-06-27 21:20:18 -04:00
parent 975f6b06c8
commit 37337f80d5
2 changed files with 4 additions and 3 deletions

View File

@ -6,13 +6,14 @@ module Rscons
'CFLAGS' => [], 'CFLAGS' => [],
'CPPFLAGS' => [], 'CPPFLAGS' => [],
'OBJSUFFIX' => '.o', 'OBJSUFFIX' => '.o',
'CSUFFIX' => ['.c'], 'CSUFFIX' => '.c',
'CCCOM' => ['$CC', '-c', '-o', '$TARGET', '$CPPFLAGS', '$CFLAGS', '$SOURCES'] 'CCCOM' => ['$CC', '-c', '-o', '$TARGET', '$CPPFLAGS', '$CFLAGS', '$SOURCES']
} }
end end
def self.produces?(env, target, source) def self.produces?(env, target, source)
target =~ /#{env['OBJSUFFIX']}$/ and env['CSUFFIX'].find {|ext| source =~ /#{ext}$/} (env['OBJSUFFIX', :array].find {|os| target =~ /#{os}$/} and
env['CSUFFIX', :array].find {|cs| source =~ /#{cs}$/})
end end
def run(env, target, source) def run(env, target, source)

View File

@ -19,7 +19,7 @@ module Rscons
if source =~ /#{env['OBJSUFFIX']}$/ or source =~ /#{env['LIBSUFFIX']}$/ if source =~ /#{env['OBJSUFFIX']}$/ or source =~ /#{env['LIBSUFFIX']}$/
source source
else else
o_file = env.stem(source) + env['OBJSUFFIX'] o_file = env.stem(source) + env['OBJSUFFIX', :string]
builder_class = env.builders.values.find { |klass| klass.produces?(env, o_file, source) } builder_class = env.builders.values.find { |klass| klass.produces?(env, o_file, source) }
if builder_class if builder_class
builder = builder_class.new builder = builder_class.new