* lib/mkmf.rb (create_makefile): checks for duplication of source
files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d6d8d973c8
commit
17d88c0333
@ -1,3 +1,8 @@
|
||||
Sun May 31 23:28:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/mkmf.rb (create_makefile): checks for duplication of source
|
||||
files.
|
||||
|
||||
Sun May 31 23:26:36 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (istrailinggarbage): fixed typo.
|
||||
|
22
lib/mkmf.rb
22
lib/mkmf.rb
@ -1643,20 +1643,22 @@ def create_makefile(target, srcprefix = nil)
|
||||
srcprefix ||= '$(srcdir)'
|
||||
RbConfig::expand(srcdir = srcprefix.dup)
|
||||
|
||||
ext = ".#{$OBJEXT}"
|
||||
if not $objs
|
||||
$objs = []
|
||||
srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
|
||||
for f in srcs
|
||||
obj = File.basename(f, ".*") << ".o"
|
||||
$objs.push(obj) unless $objs.index(obj)
|
||||
srcs = $srcs || Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
|
||||
objs = srcs.inject(Hash.new {[]}) {|h, f| h[File.basename(f, ".*") << ext] <<= f; h}
|
||||
$objs = objs.keys
|
||||
unless objs.delete_if {|b, f| f.size == 1}.empty?
|
||||
dups = objs.sort.map {|b, f|
|
||||
"#{b[/.*\./]}{#{f.collect {|n| n[/([^.]+)\z/]}.join(',')}}"
|
||||
}
|
||||
abort "source files duplication - #{dups.join(", ")}"
|
||||
end
|
||||
elsif !(srcs = $srcs)
|
||||
srcs = $objs.collect {|o| o.sub(/\.o\z/, '.c')}
|
||||
else
|
||||
$objs.collect! {|o| File.basename(o, ".*") << ext} unless $OBJEXT == "o"
|
||||
srcs = $srcs || $objs.collect {|o| o.chomp(ext) << ".c"}
|
||||
end
|
||||
$srcs = srcs
|
||||
$objs.map! do |obj|
|
||||
obj.sub(/\.o\z/, ".#{$OBJEXT}")
|
||||
end
|
||||
|
||||
target = nil if $objs.empty?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user