提交 2bb561ea 编写于 作者: N nobu

* common.mk (REVISION_H): keeps timestamp of revision.h.

  [ruby-core:22900]

* tool/ifchange, win32/ifchange.bat: extended --timestamp option.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
上级 40819d45
Mon Mar 16 12:30:07 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@ruby-lang.org>
* Makefile.in, common.mk, win32/Makefile.sub: added preprocessing rules.
......@@ -16,6 +16,7 @@ STATIC_RUBY = static-ruby
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-ext: $(EXT_SRCS)
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,9 +689,12 @@ prereq: incs srcs preludes
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=.
......
#!/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 @@ if [ "$temp" = - ]; then
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 @@ else
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
@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 @@ del %src%
: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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册