summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-27 05:55:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-27 05:55:32 +0000
commitafdd2fa7e9498eb08c276d96440595edd9273be5 (patch)
tree5c084dd80be73f7a1f295651fd0747abd04258b0
parente3e2a2c7151b3b10c0093cb29d76953e1d4a7d72 (diff)
mkmf.rb: clean generated files
* lib/mkmf.rb (try_link0): remove generated files other than the executable file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/mkmf.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 42e39ca..4a3a105 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -526,6 +526,7 @@ MSG
end
def try_link0(src, opt="", *opts, &b) # :nodoc:
+ exe = CONFTEST+$EXEEXT
cmd = link_command("", opt)
if $universal
require 'tmpdir'
@@ -539,7 +540,10 @@ MSG
end
else
try_do(src, cmd, *opts, &b)
- end and File.executable?(CONFTEST+$EXEEXT)
+ end and File.executable?(exe) or return nil
+ exe
+ ensure
+ MakeMakefile.rm_rf(*Dir["#{CONFTEST}*"]-[exe])
end
# Returns whether or not the +src+ can be compiled as a C source and linked
@@ -553,10 +557,9 @@ MSG
# [+src+] a String which contains a C source
# [+opt+] a String which contains linker options
def try_link(src, opt="", *opts, &b)
- try_link0(src, opt, *opts, &b)
- ensure
- MakeMakefile.rm_f "#{CONFTEST}*"
- MakeMakefile.rm_rf "#{CONFTEST}.dSYM"
+ exe = try_link0(src, opt, *opts, &b) or return false
+ MakeMakefile.rm_f exe
+ true
end
# Returns whether or not the +src+ can be compiled as a C source. +opt+ is
@@ -730,7 +733,7 @@ int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const
end
end
ensure
- MakeMakefile.rm_f "#{CONFTEST}*"
+ MakeMakefile.rm_f "#{CONFTEST}#{$EXEEXT}"
end
end
nil