aboutsummaryrefslogtreecommitdiff
path: root/ports/winnt/vs2013/ntpd/gen-ntp_keyword.bat
diff options
context:
space:
mode:
Diffstat (limited to 'ports/winnt/vs2013/ntpd/gen-ntp_keyword.bat')
-rw-r--r--ports/winnt/vs2013/ntpd/gen-ntp_keyword.bat26
1 files changed, 20 insertions, 6 deletions
diff --git a/ports/winnt/vs2013/ntpd/gen-ntp_keyword.bat b/ports/winnt/vs2013/ntpd/gen-ntp_keyword.bat
index 3013b8f15c67..b56632738f8b 100644
--- a/ports/winnt/vs2013/ntpd/gen-ntp_keyword.bat
+++ b/ports/winnt/vs2013/ntpd/gen-ntp_keyword.bat
@@ -4,23 +4,37 @@ REM helper to invoke keyword-gen and possibly update ntp_keyword.h
REM Usage:
REM gen-ntp_keyword dir_containing_keyword-gen.exe
REM
-if "%1"=="" goto Usage
-if not exist %1\keyword-gen.exe goto ExeNotFound
-%1\keyword-gen.exe ..\..\..\..\ntpd\ntp_parser.h > new_keyword.h
+
+set HDR_FILE=..\..\..\..\ntpd\ntp_keyword.h
+set UTD_FILE=..\..\..\..\ntpd\keyword-gen-utd
+
+if "{%1}" == "{}" goto Usage
+if not exist "%1\keyword-gen.exe" goto ExeNotFound
+"%1\keyword-gen.exe" ..\..\..\..\ntpd\ntp_parser.h > new_keyword.h
+
+REM check if we must create both files from scratch
+if not exist "%HDR_FILE%" goto createFiles
+if not exist "%UTD_FILE%" goto createFiles
+
findstr /v diff_ignore_line new_keyword.h > new_keyword_cmp.h
-findstr /v diff_ignore_line ..\..\..\..\ntpd\ntp_keyword.h > ntp_keyword_cmp.h
+findstr /v diff_ignore_line "%HDR_FILE%" > ntp_keyword_cmp.h
set meat_changed=0
fc /L ntp_keyword_cmp.h new_keyword_cmp.h > NUL
if errorlevel 1 set meat_changed=1
del ntp_keyword_cmp.h new_keyword_cmp.h
if "0"=="%meat_changed%" goto SkipUpdate
-xcopy /yf new_keyword.h ..\..\..\..\ntpd\ntp_keyword.h
-findstr diff_ignore_line new_keyword.h > ..\..\..\..\ntpd\keyword-gen-utd
+
+:createFiles
+copy /y /v new_keyword.h "%HDR_FILE%" > NUL
+findstr diff_ignore_line new_keyword.h > "%UTD_FILE%"
echo updated keyword-gen-utd and ntp_keyword.h
goto SkipSkipMsg
:skipUpdate
echo ntp_keyword.h is unchanged
+REM 'touch' the files by replacing them with a concatenation of itself and NUL:
+copy /b "%HDR_FILE%" + NUL "%HDR_FILE%" > NUL
+copy /b "%UTD_FILE%" + NUL "%UTD_FILE%" > NUL
:SkipSkipMsg
set meat_changed=