refactor some Program functionality into Environment#build_sources()

This commit is contained in:
josh committed 2013-09-12 22:38:52 -04:00
1 parent 711e96cec8
commit 75f2418570
2 files changed
+29 -11

No files matched your search

+2 -11
View File
@@ -15,17 +15,8 @@ module Rscons
end
def run(target, sources, cache, env)
# convert sources to object file names
objects = sources.map do |source|
if source.has_suffix?([env['OBJSUFFIX'], env['LIBSUFFIX']])
source
else
o_file = env.get_build_fname(source, env['OBJSUFFIX', :string])
builder = env.builders.values.find { |b| b.produces?(o_file, source, env) }
builder or raise "No builder found to convert input source #{source.inspect} to an object file."
builder.run(o_file, [source], cache, env) or break
end
end
# build sources to linkable objects
objects = env.build_sources(sources, [env['OBJSUFFIX'], env['LIBSUFFIX']].flatten, cache)
if objects
use_cxx = sources.map do |s|
s.has_suffix?(env['CXXSUFFIX'])