summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-18 08:34:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-18 08:34:45 +0000
commitc1c86a37df4afa6a4c9f9a55d8fe4a6667b4032d (patch)
tree3eb4b921b9040e659afc237b12bd08cf696fc2bd /lib
parente06379839c3a47e7da1da572047616231e0d16ad (diff)
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/mkmf.rb35
1 files changed, 16 insertions, 19 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 59544825c2..debb1bfb65 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -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