@echo off
REM # buildwin.cmd
REM #   build ipmiutil for windows
REM #
REM # First download a copy of getopt.c getopt.h.
REM #   copy getopt.*   util
REM # Then download and build a copy of openssl for Windows,
REM # and copy the built openssl files needed to lib & inc.
REM #   copy libeay32.lib ssleay32.lib  lib
REM #   copy libeay32.dll ssleay32.dll  util
REM #   copy openssl\*.h   lib\lanplus\inc\openssl
REM #
REM # Edit VCDIR for your Visual Studio VC directory.  

REM # For VS8:
REM set VCDIR="C:\Program Files\Microsoft Visual Studio 8\VC"
REM set SDKDIR=%VCDIR%\platformsdk
REM set PATH=%PATH%;%VCDIR%\bin;%SDKDIR%\bin;%VCDIR%\..\common7\ide;%VCDIR%\..\common7\tools\bin
REM set VCINCL_ADD=/I%SDKDIR%\include /D_CRT_SECURE_NO_DEPRECATE
REM set VCLIB_ADD=/LIBPATH:%SDKDIR%\lib
REM VS8 does not have libc.lib, use libcmt.lib instead in util\ipmiutil.mak.

REM # For VS8(laptop):
set VCDIR=c:\dev\visualstudio8\vc
set SDKDIR=C:\dev\winsdk
set VCINCL_ADD=/I%SDKDIR%\include /I%SDKDIR%\include\crt /D_CRT_SECURE_NO_DEPRECATE
set VCLIB_ADD=/LIBPATH:%SDKDIR%\lib /LIBPATH:%VCDIR%\lib
set PATH=%VCDIR%\bin;%SDKDIR%\bin;%VCDIR%\..\common7\ide;%VCDIR%\..\common7\tools\bin;%PATH%

REM # For VS9:
REM set VCDIR="C:\Program Files\Microsoft Visual Studio 9.0\VC"
REM set SDKDIR="C:\Program Files\Microsoft SDKs\Windows\v6.0A"
REM set PATH=%VCDIR%\bin;%SDKDIR%\bin;%VCDIR%\..\common7\ide;%VCDIR%\..\common7\tools\bin;%PATH%
REM set VCINCL_ADD=/I%SDKDIR%\include /D_CRT_SECURE_NO_DEPRECATE
REM set VCLIB_ADD=/LIBPATH:%SDKDIR%\lib

REM # For VS6:
REM set VCDIR=c:\dev\visualstudio\vc98
REM set SDKDIR="C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK"
REM set VCINCL_ADD=/I%SDKDIR%\include 
REM set VCLIB_ADD=/LIBPATH:%SDKDIR%\lib

REM # Common:
REM set PATH=%VCDIR%\bin;%SDKDIR%\bin;%PATH%
REM set INCLUDE=%VCDIR%\include;%SDKDIR%\include
REM set LIB=%VCDIR%\lib;%LIB%
set INCLUDE=%SDKDIR%\include;%SDKDIR%\include\crt;%VCDIR%\include
set LIB=%SDKDIR%\lib;%VCDIR%\lib

REM TODO, prebuild checking:
REM check for getopt.c,h
REM check for ssl libs
REM check for ssl includes
REM call mkssl

cd lib
nmake /nologo -f ipmilib.mak all
cd ..
REM # echo make lib done

cd util
nmake /nologo -f ipmiutil.mak all
cd ..
REM # echo make util done

echo buildwin ipmiutil done
