summaryrefslogtreecommitdiff
path: root/win32/ifchange.bat
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-25 09:27:30 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-25 09:27:30 (GMT)
commit6d91bf3b0c423f647094846b8c9ec2c8d9829f9e (patch)
treeee9aead6dcce83d168b8d51c302d436a034ff87c /win32/ifchange.bat
parenta984e00b80d78fdb9f6d2e0ec3bdfb0a80a06105 (diff)
* common.mk (revision.h): extracts revision number with ``svn info''.
* common.mk (up): target to update from the repository. * Makefile.in, {win,bcc}32/Makefile.sub (IFCHANGE): tool to update a file if changed. * tool/ifchange: for unixen. * win32/ifchange.bat: some fix git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32/ifchange.bat')
-rwxr-xr-xwin32/ifchange.bat41
1 files changed, 34 insertions, 7 deletions
diff --git a/win32/ifchange.bat b/win32/ifchange.bat
index 4fca646..8411099 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