From: Yang Luo Date: Sat, 13 Aug 2016 00:52:51 +0000 (+0800) Subject: version.h can be automatically generated from VERSION on Windows. X-Git-Tag: libpcap-1.8.1~74^2 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/f089402c651de344270686d2c47dd5c75b9aad20 version.h can be automatically generated from VERSION on Windows. --- diff --git a/GenVersion.bat b/GenVersion.bat new file mode 100644 index 00000000..b22aee3d --- /dev/null +++ b/GenVersion.bat @@ -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 diff --git a/Win32/Prj/wpcap.vcxproj b/Win32/Prj/wpcap.vcxproj index 6d01c087..dfc58c34 100644 --- a/Win32/Prj/wpcap.vcxproj +++ b/Win32/Prj/wpcap.vcxproj @@ -113,7 +113,8 @@ ws2_32.lib;..\..\..\..\packetWin7\Dll\Project\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies) - win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l + ..\..\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 @@ -140,7 +141,8 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.yws2_32.lib;..\..\..\..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies) - win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l + ..\..\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 @@ -169,7 +171,8 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.yws2_32.lib;..\..\..\..\packetWin7\Dll\Project\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies) - win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l + ..\..\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 @@ -197,7 +200,8 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.yws2_32.lib;..\..\..\..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\Packet.lib;%(AdditionalDependencies) - win_flex -Ppcap_ -7 --outfile=..\..\scanner.c --header-file=..\..\scanner.h ..\..\scanner.l + ..\..\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 @@ -239,4 +243,4 @@ win_bison -ppcap_ --yacc --output=..\..\grammar.c --defines ..\..\grammar.y - + \ No newline at end of file diff --git a/version.h.in b/version.h.in new file mode 100644 index 00000000..76f4bb1a --- /dev/null +++ b/version.h.in @@ -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%%";