[前][次][番号順一覧][スレッド一覧]

ruby-changes:11355

From: nobu <ko1@a...>
Date: Mon, 16 Mar 2009 12:30:12 +0900 (JST)
Subject: [ruby-changes:11355] Ruby:r22974 (trunk): * common.mk (REVISION_H): keeps timestamp of revision.h.

nobu	2009-03-16 12:30:01 +0900 (Mon, 16 Mar 2009)

  New Revision: 22974

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22974

  Log:
    * common.mk (REVISION_H): keeps timestamp of revision.h.
      [ruby-core:22900]
    * tool/ifchange, win32/ifchange.bat: extended --timestamp option.

  Modified files:
    trunk/ChangeLog
    trunk/common.mk
    trunk/tool/ifchange
    trunk/win32/ifchange.bat

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 22973)
+++ ChangeLog	(revision 22974)
@@ -1,3 +1,10 @@
+Mon Mar 16 12:30:07 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* common.mk (REVISION_H): keeps timestamp of revision.h.
+	  [ruby-core:22900]
+
+	* tool/ifchange, win32/ifchange.bat: extended --timestamp option.
+
 Mon Mar 16 09:28:58 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* Makefile.in, common.mk, win32/Makefile.sub: added preprocessing rules.
Index: common.mk
===================================================================
--- common.mk	(revision 22973)
+++ common.mk	(revision 22974)
@@ -16,6 +16,7 @@
 EXTCONF       = extconf.rb
 RBCONFIG      = ./.rbconfig.time
 LIBRUBY_EXTS  = ./.libruby-with-ext.time
+REVISION_H    = ./.revision.time
 RDOCOUT       = $(EXTOUT)/rdoc
 ID_H_TARGET   = -id.h-
 
@@ -657,7 +658,8 @@
 srcs-enc: $(ENC_MK)
 	$(MAKE) -f $(ENC_MK) RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) srcs
 
-incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}encdb.h {$(VPATH)}transdb.h {$(VPATH)}known_errors.inc $(srcdir)/revision.h
+incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}encdb.h {$(VPATH)}transdb.h {$(VPATH)}known_errors.inc \
+      $(srcdir)/revision.h $(REVISION_H)
 
 insns: $(INSNS)
 
@@ -687,10 +689,13 @@
 preludes: {$(VPATH)}miniprelude.c
 preludes: {$(srcdir)}golf_prelude.c
 
-$(srcdir)/revision.h: $(srcdir)/version.h $(srcdir)/ChangeLog $(srcdir)/tool/file2lastrev.rb $(REVISION_FORCE)
-	@-$(BASERUBY) $(srcdir)/tool/file2lastrev.rb --revision.h "$(@D)" > "$@.tmp"
-	@$(IFCHANGE) "$@" "$@.tmp"
+$(srcdir)/revision.h:
+	@exit > $@
 
+$(REVISION_H): $(srcdir)/version.h $(srcdir)/ChangeLog $(srcdir)/tool/file2lastrev.rb $(REVISION_FORCE)
+	@-$(BASERUBY) $(srcdir)/tool/file2lastrev.rb --revision.h "$(srcdir)" > "$(srcdir)/revision.tmp"
+	@$(IFCHANGE) "--timestamp=$@" "$(srcdir)/revision.h" "$(srcdir)/revision.tmp"
+
 $(EXT_SRCS):
 	$(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) top_srcdir=../.. srcdir=.
 
Index: win32/ifchange.bat
===================================================================
--- win32/ifchange.bat	(revision 22973)
+++ win32/ifchange.bat	(revision 22974)
@@ -1,13 +1,20 @@
 @echo off
 :: usage: ifchange target temporary
 
-if "%1" == "" goto :end
-
 set timestamp=
-if "%1" == "--timestamp" (
-    set timestamp=yes
+:optloop
+for %%I in (%1) do set opt=%%~I
+if "%opt%" == "--timestamp" (
+    set timestamp=.
     shift
+    goto :optloop
+) else if "%opt:~0,12%" == "--timestamp=" (
+    set timestamp=%opt:~12%
+    shift
+    goto :optloop
 )
+if "%opt%" == "" goto :end
+
 set dest=%1
 set src=%2
 set dest=%dest:/=\%
@@ -63,7 +70,8 @@
 
 :nt_end
 if "%timestamp%" == "" goto :end
-    for %%I in ("%dest%") do set timestamp=%%~dpI\.time.%%~nxI
-    if not exist "%timestamp%" copy nul "%timestamp%" > nul
-    goto :end >> "%timestamp%"
+    if "%timestamp%" == "." (
+        for %%I in ("%dest%") do set timestamp=%%~dpI.time.%%~nxI
+    )
+    goto :end > "%timestamp%"
 :end
Index: tool/ifchange
===================================================================
--- tool/ifchange	(revision 22973)
+++ tool/ifchange	(revision 22974)
@@ -1,11 +1,22 @@
 #!/bin/sh
 # usage: ifchange target temporary
 
-unset timestamp
-if [ "$1" = --timestamp ]; then
-    timestamp=yes
+timestamp=
+until [ "$0" = 0 ]; do
+    case "$1" in
+	--timestamp)
+	    timestamp=.
+	    ;;
+	--timestamp=*)
+	    timestamp="${1#*=}" || timestamp=`expr "$1" : '[^=]*=\(.*\)'`
+	    ;;
+	*)
+	    break
+	    ;;
+    esac
     shift
-fi
+done
+
 target="$1"
 temp="$2"
 if [ "$temp" = - ]; then
@@ -13,6 +24,7 @@
     cat > "$temp" || exit $?
     trap 'rm -f "$temp"' 0
 fi
+
 if cmp "$target" "$temp" >/dev/null 2>&1; then
     echo "$target unchanged"
     rm -f "$temp"
@@ -20,6 +32,18 @@
     echo "$target updated"
     mv -f "$temp" "$target"
 fi
-if [ $timestamp ]; then
-    touch `dirname "$target"`/.time.`basename "$target"`
+
+if [ -n "${timestamp}" ]; then
+    if [ x"${timestamp}" = x. ]; then
+	case "$target" in
+	    */*)
+		timestamp="${target%/*}"/.time."${target##*/}" ||
+		timestamp=`dirname "$target"`/.time.`basename "$target"`
+		;;
+	    *)
+		timestamp=.time."$target"
+		;;
+	esac
+    fi
+    : > "$timestamp"
 fi

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]