diff options
-rw-r--r-- | ext/io/console/depend | 2 | ||||
-rwxr-xr-x | tool/checksum.rb | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/ext/io/console/depend b/ext/io/console/depend index 2709f32aa5..9e6eb60fbc 100644 --- a/ext/io/console/depend +++ b/ext/io/console/depend @@ -15,5 +15,5 @@ win32_vk.inc: win32_vk.list {$(srcdir)}.list.chksum: @$(RUBY) -I$(top_srcdir)/tool -rchecksum \ - -e "Checksum.update(ARGV) {|k,f|k.copy(f) rescue k.make(f)}" \ + -e "Checksum.update(ARGV) {|k|k.copy(k.target) rescue k.make(k.target)}" \ -- --make=$(MAKE) -I$(srcdir) $(<F) $(@F:.chksum=.inc) diff --git a/tool/checksum.rb b/tool/checksum.rb index 40f444efd2..0de54a314d 100755 --- a/tool/checksum.rb +++ b/tool/checksum.rb @@ -7,15 +7,22 @@ class Checksum @vpath = vpath end + attr_reader :source, :target + def source=(source) @source = source @checksum = File.basename(source, ".*") + ".chksum" end + def target=(target) + @target = target + end + def update? src = @vpath.read(@source) @len = src.length @sum = src.sum + return false unless @vpath.search(File.method(:exist?), @target) begin data = @vpath.read(@checksum) rescue @@ -47,8 +54,8 @@ class Checksum true end - def make(arg) - system([@make, arg].compact.join(' ')) + def make(*args) + system(@make, *args) end def def_options(opt = (require 'optparse'; OptionParser.new)) @@ -59,7 +66,7 @@ class Checksum def self.update(argv) k = new(VPath.new) - k.source, *argv = k.def_options.parse(*argv) + k.source, k.target, *argv = k.def_options.parse(*argv) k.update {|k| yield(k, *argv)} end end |