diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/Makefile.sub | 11 | ||||
-rwxr-xr-x | win32/ifchange.bat | 41 |
2 files changed, 36 insertions, 16 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 6ce665912e..9f2c309ead 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -63,6 +63,7 @@ YFLAGS = -o y.tab.c AR = lib -nologo PURIFY = AUTOCONF = autoconf +IFCHANGE = $(COMSPEC) /C $(srcdir:/=\)\win32\ifchange.bat RM = $(COMSPEC) /C $(srcdir:/=\)\win32\rm.bat CP = copy > nul MV = move > nul @@ -246,14 +247,6 @@ ASMEXT = asm INSTALLED_LIST= .installed.list -!if [find "revision.h" $(srcdir:/=\)\version.h > nul 2> nul] == 0 -REVISION_H = revision.h -REVISION_UP = revision-up -!else -REVISION_H = version.h -REVISION_UP = -!endif - !if !defined(WINMAINOBJ) WINMAINOBJ = winmain.$(OBJEXT) !endif @@ -307,7 +300,7 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub !if !exist("$(arch_hdrdir)/ruby") @md $(arch_hdrdir:/=\)\ruby !endif - @$(COMSPEC) /C $(srcdir:/=\)\win32\ifchange.bat $(RUBY_CONFIG_H:/=\) << + @$(IFCHANGE) $(RUBY_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
|