diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rwxr-xr-x | ext/extmk.rb | 7 | ||||
-rw-r--r-- | lib/mkmf.rb | 6 |
3 files changed, 17 insertions, 3 deletions
@@ -1,3 +1,10 @@ +Sun Nov 20 23:22:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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@ruby-lang.org> * enc/unicode.c (PROPERTY_NAME_MAX_SIZE): +1. diff --git a/ext/extmk.rb b/ext/extmk.rb index 5665a966a8..058c6db7de 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -73,6 +73,11 @@ def extract_makefile(makefile, keep = true) 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 @@ def extmake(target) 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 diff --git a/lib/mkmf.rb b/lib/mkmf.rb index a3dcadb9ef..a0779237f8 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -1924,8 +1924,9 @@ def create_makefile(target, srcprefix = nil) 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 @@ extout_prefix = #{$extout_prefix} 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} |