ruby-changes:11944
From: nobu <ko1@a...>
Date: Sun, 31 May 2009 23:29:52 +0900 (JST)
Subject: [ruby-changes:11944] Ruby:r23608 (ruby_1_8, trunk): * lib/mkmf.rb (create_makefile): checks for duplication of source
nobu 2009-05-31 23:28:04 +0900 (Sun, 31 May 2009) New Revision: 23608 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23608 Log: * lib/mkmf.rb (create_makefile): checks for duplication of source files. Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/lib/mkmf.rb trunk/ChangeLog trunk/lib/mkmf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 23607) +++ ChangeLog (revision 23608) @@ -1,3 +1,8 @@ +Sun May 31 23:28:00 2009 Nobuyoshi Nakada <nobu@r...> + + * lib/mkmf.rb (create_makefile): checks for duplication of source + files. + Sun May 31 23:26:36 2009 Nobuyoshi Nakada <nobu@r...> * file.c (istrailinggarbage): fixed typo. Index: lib/mkmf.rb =================================================================== --- lib/mkmf.rb (revision 23607) +++ lib/mkmf.rb (revision 23608) @@ -1643,20 +1643,22 @@ 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? Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 23607) +++ ruby_1_8/ChangeLog (revision 23608) @@ -1,3 +1,8 @@ +Sun May 31 23:28:00 2009 Nobuyoshi Nakada <nobu@r...> + + * lib/mkmf.rb (create_makefile): checks for duplication of source + files. + Sun May 31 23:26:36 2009 Nobuyoshi Nakada <nobu@r...> * file.c (istrailinggarbage): fixed typo. Index: ruby_1_8/lib/mkmf.rb =================================================================== --- ruby_1_8/lib/mkmf.rb (revision 23607) +++ ruby_1_8/lib/mkmf.rb (revision 23608) @@ -1457,20 +1457,19 @@ srcprefix ||= '$(srcdir)' Config::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 + objs.delete_if {|b, f| f.size == 1} + unless objs.empty? + raise "source files duplication - #{objs.sort.map {|b, f| f.inspect}.join(", ")}" end - elsif !(srcs = $srcs) - srcs = $objs.collect {|obj| obj.sub(/\.o\z/, '.c')} + else + $objs.collect! {|o| o.chomp(".o") << ext} unless $OBJEXT == "o" + $srcs ||= $objs.collect {|o| o.chomp(ext) << ".c"} end - $srcs = srcs - for i in $objs - i.sub!(/\.o\z/, ".#{$OBJEXT}") - end target = nil if $objs.empty? -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/