[前][次][番号順一覧][スレッド一覧]

ruby-changes:21752

From: nobu <ko1@a...>
Date: Sun, 20 Nov 2011 23:22:55 +0900 (JST)
Subject: [ruby-changes:21752] nobu:r33801 (trunk): * ext/extmk.rb (extract_makefile, extmake): regenerate makefiels

nobu	2011-11-20 23:22:44 +0900 (Sun, 20 Nov 2011)

  New Revision: 33801

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33801

  Log:
    * ext/extmk.rb (extract_makefile, extmake): regenerate makefiels
      if globbed source file list is changed.
    * lib/mkmf.rb (create_makefile): store ORIG_SRCS.

  Modified files:
    trunk/ChangeLog
    trunk/ext/extmk.rb
    trunk/lib/mkmf.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33800)
+++ ChangeLog	(revision 33801)
@@ -1,3 +1,10 @@
+Sun Nov 20 23:22:42 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/extmk.rb (extract_makefile, extmake): regenerate makefiels
+	  if globbed source file list is changed.
+
+	* lib/mkmf.rb (create_makefile): store ORIG_SRCS.
+
 Sun Nov 20 22:43:03 2011  NARUSE, Yui  <naruse@r...>
 
 	* enc/unicode.c (PROPERTY_NAME_MAX_SIZE): +1.
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 33800)
+++ lib/mkmf.rb	(revision 33801)
@@ -1924,8 +1924,9 @@
   RbConfig.expand(srcdir = srcprefix.dup)
 
   ext = ".#{$OBJEXT}"
+  orig_srcs = Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
   if not $objs
-    srcs = $srcs || Dir[File.join(srcdir, "*.{#{SRC_EXT.join(%q{,})}}")]
+    srcs = $srcs || orig_srcs
     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?
@@ -1990,7 +1991,8 @@
 target_prefix = #{target_prefix}
 LOCAL_LIBS = #{$LOCAL_LIBS}
 LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS}
-SRCS = #{srcs.collect(&File.method(:basename)).join(' ')}
+ORIG_SRCS = #{orig_srcs.collect(&File.method(:basename)).join(' ')}
+SRCS = $(ORIG_SRCS) #{(srcs - orig_srcs).collect(&File.method(:basename)).join(' ')}
 OBJS = #{$objs.join(" ")}
 TARGET = #{target}
 DLLIB = #{dllib}
Index: ext/extmk.rb
===================================================================
--- ext/extmk.rb	(revision 33800)
+++ ext/extmk.rb	(revision 33801)
@@ -73,6 +73,11 @@
     end
     return false
   end
+  srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")].map {|fn| File.basename(fn)}
+  if !srcs.empty?
+    old_srcs = m[/^ORIG_SRCS[ \t]*=[ \t](.*)/, 1] or return false
+    old_srcs.split.sort == srcs or return false
+  end
   $target = target
   $extconf_h = m[/^RUBY_EXTCONF_H[ \t]*=[ \t]*(\S+)/, 1]
   if $static.nil?
@@ -152,7 +157,7 @@
 	old_objs = $objs
 	old_cleanfiles = $distcleanfiles
 	conf = ["#{$srcdir}/makefile.rb", "#{$srcdir}/extconf.rb"].find {|f| File.exist?(f)}
-	if (($extconf_h && !File.exist?($extconf_h)) ||
+	if (!ok || ($extconf_h && !File.exist?($extconf_h)) ||
 	    !(t = modified?(makefile, MTIMES)) ||
 	    [conf, "#{$srcdir}/depend"].any? {|f| modified?(f, [t])})
         then

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]