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

* lib/mkmf.rb (rm_f): use FileUtils.

* lib/mkmf.rb (modified?): return mtime of the target if
  it exists and newer than times.

* lib/mkmf.rb (install_files): add a current directory
  file even if it does not exist yet.

* lib/mkmf.rb (configuration): do not add $LDFLAGS to
  DLDFLAGS.

* ext/extmk.rb (extmake): check whether Makefile is newer
  than depend and MANIFEST.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-07-18 08:34:45 +00:00
parent e06379839c
commit c1c86a37df
3 changed files with 39 additions and 21 deletions

View file

@ -1,3 +1,19 @@
Fri Jul 18 17:34:39 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* lib/mkmf.rb (rm_f): use FileUtils.
* lib/mkmf.rb (modified?): return mtime of the target if
it exists and newer than times.
* lib/mkmf.rb (install_files): add a current directory
file even if it does not exist yet.
* lib/mkmf.rb (configuration): do not add $LDFLAGS to
DLDFLAGS.
* ext/extmk.rb (extmake): check whether Makefile is newer
than depend and MANIFEST.
Fri Jul 18 14:57:19 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (make_cmdvector): recognize quote within string.

View file

@ -73,7 +73,9 @@ def extmake(target)
$srcdir = File.join($top_srcdir, "ext", $mdir)
unless $ignore
if $static ||
older("./Makefile", *MTIMES + %W"#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb")
!(t = modified?("./Makefile", MTIMES)) ||
%W<#{$srcdir}/makefile.rb #{$srcdir}/extconf.rb
#{$srcdir}/depend #{$srcdir}/MANIFEST>.any? {|f| modified?(f, [t])}
then
$defs = []
Logging::logfile 'mkmf.log'
@ -244,7 +246,7 @@ if $extlist.size > 0
end
src = "void Init_ext() {\n#$extinit}\n"
if older("extinit.c", *MTIMES) || IO.read("extinit.c") != src
if !modified?("extinit.c", MTIMES) || IO.read("extinit.c") != src
open("extinit.c", "w") {|f| f.print src}
end
@ -268,6 +270,9 @@ rubies = []
}
Dir.chdir ".."
if $extlist.size > 0
rm_f(Config::CONFIG["LIBRUBY_SO"])
end
puts "making #{rubies.join(', ')}"
$stdout.flush
$mflags.concat(rubies)

View file

@ -2,6 +2,7 @@
# invoke like: ruby -r mkmf extconf.rb
require 'rbconfig'
require 'fileutils'
require 'shellwords'
CONFIG = Config::MAKEFILE_CONFIG
@ -105,25 +106,13 @@ class Array
end
def rm_f(*files)
targets = []
for file in files
targets.concat Dir[file]
end
if not targets.empty?
File::chmod(0777, *targets)
File::unlink(*targets)
end
FileUtils.rm_f(Dir[files.join("\0")])
end
def older(target, *files)
mtime = proc do |f|
Time === f ? f : f.respond_to?(:mtime) ? f.mtime : File.mtime(f) rescue nil
end
t = mtime[target] or return true
for f in files
return true if t < (mtime[f] or next)
end
false
def modified?(target, times)
(t = File.mtime(target)) rescue return nil
Array === times or times = [times]
t if times.all? {|n| n <= t}
end
module Logging
@ -339,6 +328,7 @@ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
files = File.join(srcdir, files)
len = srcdir.size
end
f = nil
Dir.glob(files) do |f|
f[0..len] = "" if len
d = File.dirname(f)
@ -347,6 +337,12 @@ def install_files(mfile, ifiles, map = nil, srcprefix = nil)
f = File.join(srcprefix, f) if len
path[d] << f
end
unless len or f
d = File.dirname(files)
d.sub!(prefix, "") if prefix
d = (d.empty? || d == ".") ? dir : File.join(dir, d)
path[d] << files
end
end
dirs
end
@ -370,9 +366,10 @@ def checking_for(m)
f = caller[0][/in `(.*)'$/, 1] and f << ": " #` for vim
m = "checking for #{m}... "
message m
Logging::message "#{f}#{m}\n"
Logging::message "#{f}#{m}--------------------\n"
r = yield
message(r ? "yes\n" : "no\n")
message(a = r ? "yes\n" : "no\n")
Logging::message "-------------------- #{a}\n"
r
end