diff --git a/ChangeLog b/ChangeLog index 7bd2801b05..a8fe92c908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jun 23 11:17:24 2008 Nobuyoshi Nakada + + * Makefile.in, common.mk, {win,bcc}32/Makefile.sub (revision.h): auto + update. [ruby-core:17373] + Sun Jun 22 14:16:28 2008 Nobuyoshi Nakada * ext/readline/extconf.rb (have_readline_func): readline on Mac OS X diff --git a/Makefile.in b/Makefile.in index 38bbe24874..044b758820 100644 --- a/Makefile.in +++ b/Makefile.in @@ -201,3 +201,10 @@ test-rubyspec: @if [ ! -d $(srcdir)/rubyspec ]; then echo No rubyspec here. make update-rubyspec first.; exit 1; fi $(RUNRUBY) $(srcdir)/rubyspec/mspec/bin/mspec -r$(srcdir)/ext/purelib.rb $(srcdir)/rubyspec/spec/rubyspec/$(MAJOR).$(MINOR) + +$(srcdir)/revision.h: revision.h.tmp + @if [ -f "$@" ] && { [ ! -s $? ] || cmp "$@" $? >/dev/null; }; then \ + $(RM) $?; \ + else \ + mv -f $? "$@"; \ + fi diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub index 713b5c69df..651107dee9 100644 --- a/bcc32/Makefile.sub +++ b/bcc32/Makefile.sub @@ -61,6 +61,7 @@ AR = tlib PURIFY = AUTOCONF = autoconf +IFCHANGE = $(srcdir:/=\)\win32\ifchange.bat RM = $(srcdir:/=\)\win32\rm.bat !if !defined(PROCESSOR_ARCHITECTURE) @@ -201,6 +202,9 @@ rubyw: $(WPROGRAM) !include $(srcdir)/common.mk +revision.h: revision.h.tmp + @$(IFCHANGE) "$(srcdir)/$@" "revision.h.tmp" + $(MKFILES): $(srcdir)/bcc32/Makefile.sub $(srcdir)/bcc32/configure.bat $(srcdir)/bcc32/setup.mak $(COMSPEC) /C $(srcdir:/=\)\bcc32\configure.bat $(configure_args) @echo $(MKFILES) should be updated, re-run $(MAKE). @@ -216,7 +220,7 @@ config: config.status config.status: $(CONFIG_H) $(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub - @$(srcdir:/=\)\win32\ifchange.bat config.h &&| + @$(IFCHANGE) config.h &&| \#define HAVE_SYS_TYPES_H 1 \#define HAVE_SYS_STAT_H 1 \#define HAVE_STDLIB_H 1 diff --git a/bcc32/setup.mak b/bcc32/setup.mak index 483292ed51..13a6539586 100644 --- a/bcc32/setup.mak +++ b/bcc32/setup.mak @@ -84,6 +84,7 @@ $(BANG)endif -version-: nul @cpp32 -I$(srcdir) -P- -o$(MAKEFILE) > nul &&| +\#define RUBY_REVISION 0 \#include "version.h" MAJOR = RUBY_VERSION_MAJOR MINOR = RUBY_VERSION_MINOR diff --git a/common.mk b/common.mk index a4c9b7039a..39420cf60b 100644 --- a/common.mk +++ b/common.mk @@ -78,6 +78,8 @@ PRE_LIBRUBY_UPDATE = $(MINIRUBY) -e 'ARGV[1] or File.unlink(ARGV[0]) rescue nil' TESTSDIR = $(srcdir)/test TESTWORKDIR = testwork +VCS = svn + all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY) @$(MINIRUBY) $(srcdir)/ext/extmk.rb --make="$(MAKE)" $(EXTMK_ARGS) prog: $(PROGRAM) $(WPROGRAM) @@ -464,7 +466,12 @@ variable.$(OBJEXT): {$(VPATH)}variable.c {$(VPATH)}ruby.h config.h \ {$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h {$(VPATH)}util.h version.$(OBJEXT): {$(VPATH)}version.c {$(VPATH)}ruby.h config.h \ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \ - {$(VPATH)}version.h + {$(VPATH)}version.h {$(VPATH)}revision.h dist: $(PROGRAM) $(RUNRUBY) $(srcdir)/distruby.rb + +revision.h.tmp: $(REVISION_FORCE) + @set LC_MESSAGES=C + -@$(SET_LC_MESSAGES) $(VCS) info "$(srcdir)" | \ + sed -n "s/.*Rev:/#define RUBY_REVISION/p" > "$@" diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 1301d86fff..e632b067e6 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -57,6 +57,7 @@ YACC = byacc AR = lib -nologo PURIFY = AUTOCONF = autoconf +IFCHANGE = $(COMSPEC) /C $(srcdir:/=\)\win32\ifchange.bat RM = $(COMSPEC) /C $(srcdir:/=\)\win32\rm.bat !if !defined(PROCESSOR_ARCHITECTURE) @@ -261,6 +262,9 @@ rubyw: $(WPROGRAM) !include $(srcdir)/common.mk +revision.h: revision.h.tmp + @$(IFCHANGE) "$(srcdir)/$@" "revision.h.tmp" + $(MKFILES): $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub $(win_srcdir)/configure.bat $(win_srcdir)/setup.mak $(COMSPEC) /C $(win_srcdir:/=\)\configure.bat $(configure_args) @echo $(MKFILES) should be updated, re-run $(MAKE). @@ -280,7 +284,7 @@ BANG = ! $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub @echo Creating config.h - @$(COMSPEC) /C $(srcdir:/=\)\win32\ifchange.bat config.h << + @$(IFCHANGE) config.h << #if _MSC_VER != $(MSC_VER) #error MSC version unmatch: _MSC_VER: $(MSC_VER) is expected. #endif diff --git a/win32/ifchange.bat b/win32/ifchange.bat index 4fca646ea2..8411099020 100755 --- a/win32/ifchange.bat +++ b/win32/ifchange.bat @@ -1,13 +1,23 @@ @echo off :: usage: ifchange target temporary +if "%1" == "" goto :end + +set dest=%1 +set src=%2 +set dest=%dest:/=\% +set src=%src:/=\% +if not "%dest%" == "" if not "%dest%" == "%%dest:/=\%%" goto :nt + +if not exist %2 goto :end + :: check if fc.exe works. -echo foo > conftest1.tmp -echo bar > conftest2.tmp -fc.exe conftest1.tmp conftest2.tmp > nul +echo foo > conftst1.tmp +echo bar > conftst2.tmp +fc.exe conftst1.tmp conftst2.tmp > nul if not errorlevel 1 goto :brokenfc -del conftest1.tmp > nul -del conftest2.tmp > nul +del conftst1.tmp > nul +del conftst2.tmp > nul :: target does not exist or new file differs from it. if not exist %1 goto :update @@ -27,6 +37,23 @@ echo assuming %1 should be changed. :update echo %1 updated. -if exist %1 del %1 -copy %2 %1 > nul +:: if exist %1 del %1 +dir /b %2 +copy %2 %1 +del %2 +goto :end + +:nt +if not exist %src% goto :end +if exist %dest% ( + fc.exe %dest% %src% > nul && ( + echo %dest% unchanged. + del %src% + goto :end + ) +) +echo %dest% updated. +copy %src% %dest% > nul +del %src% + :end diff --git a/win32/setup.mak b/win32/setup.mak index 1df2e2ed33..18a0ef7596 100644 --- a/win32/setup.mak +++ b/win32/setup.mak @@ -117,6 +117,7 @@ int main(int argc, char **argv) -version-: nul @$(APPEND) @$(CPP) -I$(srcdir) <<"Creating $(MAKEFILE)" | find "=" >>$(MAKEFILE) +#define RUBY_REVISION 0 #include "version.h" MAJOR = RUBY_VERSION_MAJOR MINOR = RUBY_VERSION_MINOR