diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-27 05:55:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-27 05:55:32 +0000 |
commit | 8e5ce127a5ab976a51c3bda1da02588c5a6c3ee7 (patch) | |
tree | 5c084dd80be73f7a1f295651fd0747abd04258b0 | |
parent | 963d535b6d848f95d67cbe0a012e6c0a512550ef (diff) | |
download | ruby-8e5ce127a5ab976a51c3bda1da02588c5a6c3ee7.tar.gz |
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.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 42e39ca454..4a3a105688 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 |