From 2ad6b5a8874bdd5bff924415e8103d8d6183f0f4 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 27 May 2006 02:30:10 +0000 Subject: * ext/extmk.rb (extmake): remove extinit files if no statically linked extensions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/extmk.rb | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'ext/extmk.rb') diff --git a/ext/extmk.rb b/ext/extmk.rb index 7066485571..ade62c31d2 100644 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -70,7 +70,7 @@ def extract_makefile(makefile, keep = true) end $target = target $extconf_h = m[/^RUBY_EXTCONF_H[ \t]*=[ \t]*(\S+)/, 1] - $static = m[/^EXTSTATIC[ \t]*=[ \t]*(\S+)/, 1] || false + $static ||= m[/^EXTSTATIC[ \t]*=[ \t]*(\S+)/, 1] || false /^STATIC_LIB[ \t]*=[ \t]*\S+/ =~ m or $static = nil $preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "") $DLDFLAGS += " " + (m[/^DLDFLAGS[ \t]*=[ \t]*(.*)/, 1] || "") @@ -92,7 +92,6 @@ def extmake(target) else $static = false end - $default_static = $static unless $ignore return true if $nodynamic and not $static @@ -131,7 +130,6 @@ def extmake(target) !(t = modified?(makefile, MTIMES)) || %W"#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb #{$srcdir}/depend".any? {|f| modified?(f, [t])}) then - $default_static = $static ok = false init_mkmf Logging::logfile 'mkmf.log' @@ -404,8 +402,13 @@ end $hdrdir = $top_srcdir = srcdir $topdir = "." +extinit = Struct.new(:c, :o) { + def initialize(src) + super("#{src}.c", "#{src}.#{$OBJEXT}") + end +}.new("extinit") if $ignore - FileUtils.rm_f(%W"extinit.c extinit.#{$OBJEXT}") if $clean + FileUtils.rm_f(extinit.to_a) if $clean Dir.chdir ".." if $clean Dir.rmdir('ext') rescue nil @@ -436,16 +439,16 @@ if $extlist.size > 0 end end - src = <