kusano 7d535a
@rem default builds static library.
kusano 7d535a
@rem you can pass the following arguments (case insensitive):
kusano 7d535a
@rem - "DLL" to build a DLL instead of a static library
kusano 7d535a
@rem - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT)
kusano 7d535a
@echo off
kusano 7d535a
kusano 7d535a
if Test%BUILD_ALT_DIR%==Test goto usage
kusano 7d535a
kusano 7d535a
rem process commandline parameters
kusano 7d535a
set TARGET=LIBRARY
kusano 7d535a
set STATIC_LIBC=
kusano 7d535a
set version=1.0
kusano 7d535a
kusano 7d535a
if "%1" == "" goto no_more_args
kusano 7d535a
rem /I for case insensitive
kusano 7d535a
if /I Test%1==TestDLL set TARGET=DYNLINK
kusano 7d535a
if /I Test%1==Test/MT set STATIC_LIBC=1
kusano 7d535a
:no_more_args
kusano 7d535a
kusano 7d535a
cd ..\libusb\os
kusano 7d535a
echo TARGETTYPE=%TARGET% > target
kusano 7d535a
copy target+..\..\msvc\libusb_sources sources >NUL 2>&1
kusano 7d535a
del target
kusano 7d535a
@echo on
kusano 7d535a
build -cwgZ
kusano 7d535a
@echo off
kusano 7d535a
if errorlevel 1 goto builderror
kusano 7d535a
cd ..\..
kusano 7d535a
kusano 7d535a
set cpudir=i386
kusano 7d535a
set destType=Win32
kusano 7d535a
if %_BUILDARCH%==x86 goto isI386
kusano 7d535a
set cpudir=amd64
kusano 7d535a
set destType=x64
kusano 7d535a
:isI386
kusano 7d535a
kusano 7d535a
set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir%
kusano 7d535a
kusano 7d535a
set dstPath=%destType%\Debug
kusano 7d535a
if %DDKBUILDENV%==chk goto isDebug
kusano 7d535a
set dstPath=%destType%\Release
kusano 7d535a
:isDebug
kusano 7d535a
kusano 7d535a
if exist %destType% goto md2
kusano 7d535a
mkdir %destType%
kusano 7d535a
:md2
kusano 7d535a
if exist %dstPath% goto md3
kusano 7d535a
mkdir %dstPath%
kusano 7d535a
:md3
kusano 7d535a
if exist %dstPath%\dll goto md4
kusano 7d535a
mkdir %dstPath%\dll
kusano 7d535a
:md4
kusano 7d535a
if exist %dstPath%\lib goto md5
kusano 7d535a
md %dstPath%\lib
kusano 7d535a
:md5
kusano 7d535a
if exist %dstPath%\examples goto md6
kusano 7d535a
md %dstPath%\examples
kusano 7d535a
:md6
kusano 7d535a
@echo on
kusano 7d535a
kusano 7d535a
@if /I NOT Test%1==TestDLL goto copylib
kusano 7d535a
copy %srcPath%\libusb-%version%.dll %dstPath%\dll
kusano 7d535a
copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
kusano 7d535a
:copylib
kusano 7d535a
copy %srcPath%\libusb-%version%.lib %dstPath%\lib
kusano 7d535a
kusano 7d535a
@echo off
kusano 7d535a
kusano 7d535a
if exist examples\listdevs_ddkbuild goto md7
kusano 7d535a
md examples\listdevs_ddkbuild
kusano 7d535a
:md7
kusano 7d535a
kusano 7d535a
cd examples\listdevs_ddkbuild
kusano 7d535a
copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
kusano 7d535a
@echo on
kusano 7d535a
build -cwgZ
kusano 7d535a
@echo off
kusano 7d535a
if errorlevel 1 goto buildlistdevserror
kusano 7d535a
cd ..\..
kusano 7d535a
kusano 7d535a
set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
kusano 7d535a
@echo on
kusano 7d535a
kusano 7d535a
copy %srcPath%\listdevs.exe %dstPath%\examples
kusano 7d535a
copy %srcPath%\listdevs.pdb %dstPath%\examples
kusano 7d535a
kusano 7d535a
cd msvc
kusano 7d535a
goto done
kusano 7d535a
kusano 7d535a
kusano 7d535a
:builderror
kusano 7d535a
cd ..\..\msvc
kusano 7d535a
echo Build failed
kusano 7d535a
goto done
kusano 7d535a
kusano 7d535a
:buildlistdevserror
kusano 7d535a
cd ..\..\msvc
kusano 7d535a
echo listdevs build failed
kusano 7d535a
goto done
kusano 7d535a
kusano 7d535a
:usage
kusano 7d535a
echo ddk_build must be run in a WDK build environment
kusano 7d535a
pause
kusano 7d535a
goto done
kusano 7d535a
kusano 7d535a
:done