Don't add objects files more than once during linking

This commit is contained in:
Moritz Bunkus 2011-01-20 15:03:15 +01:00
parent da1ff39b7e
commit c581304069

View File

@ -61,10 +61,10 @@ class Target
file_mode = (options[:type] || :file) == :file
new_sources = list.collect { |entry| file_mode ? (entry.respond_to?(:to_a) ? entry.to_a : entry) : FileList["#{entry}/*.c", "#{entry}/*.cpp"].to_a }.flatten
new_deps = new_sources.collect { |file| [ file.ext(ext_map[ file.pathmap('%x') ] || 'o'), file ] }
@sources += new_sources
@objects += new_deps.collect(&:first).select { |file| /\.o$/.match file }
@dependencies += new_deps.collect(&:first)
@file_deps += new_deps
@sources = ( @sources + new_sources ).uniq
@objects = ( @objects + new_deps.collect(&:first).select { |file| /\.o$/.match file } ).uniq
@dependencies = ( @dependencies + new_deps.collect(&:first) ).uniq
@file_deps = ( @file_deps + new_deps ).uniq
self
end