diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-31 14:28:04 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-31 14:28:04 +0000 |
commit | 17d88c0333db35379ae109c6a2a7c570ef4a3d6a (patch) | |
tree | 8be7a4d36615bdd72d31f4c1015a2bc6111ab06d | |
parent | d6d8d973c848c6e6e4691a0e98aa280c09b2f307 (diff) | |
download | ruby-17d88c0333db35379ae109c6a2a7c570ef4a3d6a.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/mkmf.rb | 22 |
2 files changed, 17 insertions, 10 deletions
@@ -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. diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 4612e30e46..cf68f398c3 100644 --- a/lib/mkmf.rb +++ b/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? |