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

* 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
This commit is contained in:
nobu 2009-03-16 03:30:01 +00:00
parent 40819d4599
commit 2bb561ea5f
4 changed files with 61 additions and 17 deletions

View file

@ -1,3 +1,10 @@
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.

View file

@ -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=.

View file

@ -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 @@ 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

View file

@ -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 @@ 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