]> The Tcpdump Group git mirrors - libpcap/commitdiff
version.h can be automatically generated from VERSION on Windows. 519/head
authorYang Luo <[email protected]>
Sat, 13 Aug 2016 00:52:51 +0000 (08:52 +0800)
committerYang Luo <[email protected]>
Sat, 13 Aug 2016 00:52:51 +0000 (08:52 +0800)
GenVersion.bat [new file with mode: 0644]
Win32/Prj/wpcap.vcxproj
version.h.in [new file with mode: 0644]

diff --git a/GenVersion.bat b/GenVersion.bat
new file mode 100644 (file)
index 0000000..b22aee3
--- /dev/null
@@ -0,0 +1,25 @@
+REM
+REM Automatically generate version.h based on version.h.in for Windows
+REM The version string comes from VERSION
+REM @echo off
+REM
+
+setlocal enableextensions disabledelayedexpansion
+
+set "search=%%%%LIBPCAP_VERSION%%%%"
+set /p replace=<%0\..\VERSION
+
+set "inputTextFile=%0\..\version.h.in"
+set "outputTextFile=%0\..\version.h"
+
+del "%outputTextFile%" 2>nul
+
+for /f "delims=" %%i in ('type "%inputTextFile%"' ) do (
+       set "line=%%i"
+       setlocal enabledelayedexpansion
+       set "line=!line:%search%=%replace%!"
+       >>"%outputTextFile%" echo(!line!
+       endlocal
+)
+
+echo version.h generated
index 6d01c08793c5f674dca7c57594efe81b140e3fab..dfc58c3459475d1ba02cf15641f5d2ba210b589f 100644 (file)
       <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     <PreBuildEvent>
-      <Command>win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
+      <Command>..\..\GenVersion.bat
+win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
 win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
     </PreBuildEvent>
   </ItemDefinitionGroup>
@@ -140,7 +141,8 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
       <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     <PreBuildEvent>
-      <Command>win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
+      <Command>..\..\GenVersion.bat
+win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
 win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
     </PreBuildEvent>
   </ItemDefinitionGroup>
@@ -169,7 +171,8 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
       <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     <PreBuildEvent>
-      <Command>win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
+      <Command>..\..\GenVersion.bat
+win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
 win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
     </PreBuildEvent>
   </ItemDefinitionGroup>
@@ -197,7 +200,8 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
       <AdditionalDependencies>ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies)</AdditionalDependencies>
     </Link>
     <PreBuildEvent>
-      <Command>win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
+      <Command>..\..\GenVersion.bat
+win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l
 win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Command>
     </PreBuildEvent>
   </ItemDefinitionGroup>
@@ -239,4 +243,4 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y</Com
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
diff --git a/version.h.in b/version.h.in
new file mode 100644 (file)
index 0000000..76f4bb1
--- /dev/null
@@ -0,0 +1,5 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+//
+#include "..\..\version.h"
+static const char pcap_version_string[] = "libpcap version %%LIBPCAP_VERSION%%";