1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2017-02-27 05:55:32 +00:00
parent e3e2a2c715
commit afdd2fa7e9

View file

@ -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