1@rem default builds static library. 2@rem you can pass the following arguments (case insensitive): 3@rem - "DLL" to build a DLL instead of a static library 4@rem - "/MT" to build a static library compatible with MSVC's /MT option (LIBCMT vs MSVCRT) 5@echo off 6 7if Test%BUILD_ALT_DIR%==Test goto usage 8 9rem process commandline parameters 10set TARGET=LIBRARY 11set STATIC_LIBC= 12set version=1.0 13 14if "%1" == "" goto no_more_args 15rem /I for case insensitive 16if /I Test%1==TestDLL set TARGET=DYNLINK 17if /I Test%1==Test/MT set STATIC_LIBC=1 18:no_more_args 19 20cd ..\libusb\os 21echo TARGETTYPE=%TARGET% > target 22copy target+..\..\msvc\libusb_sources sources >NUL 2>&1 23del target 24@echo on 25build -cwgZ 26@echo off 27if errorlevel 1 goto builderror 28cd ..\.. 29 30set cpudir=i386 31set destType=Win32 32if %_BUILDARCH%==x86 goto isI386 33set cpudir=amd64 34set destType=x64 35:isI386 36 37set srcPath=libusb\os\obj%BUILD_ALT_DIR%\%cpudir% 38 39set dstPath=%destType%\Debug 40if %DDKBUILDENV%==chk goto isDebug 41set dstPath=%destType%\Release 42:isDebug 43 44if exist %destType% goto md2 45mkdir %destType% 46:md2 47if exist %dstPath% goto md3 48mkdir %dstPath% 49:md3 50if exist %dstPath%\dll goto md4 51mkdir %dstPath%\dll 52:md4 53if exist %dstPath%\lib goto md5 54md %dstPath%\lib 55:md5 56if exist %dstPath%\examples goto md6 57md %dstPath%\examples 58:md6 59@echo on 60 61@if /I NOT Test%1==TestDLL goto copylib 62copy %srcPath%\libusb-%version%.dll %dstPath%\dll 63copy %srcPath%\libusb-%version%.pdb %dstPath%\dll 64:copylib 65copy %srcPath%\libusb-%version%.lib %dstPath%\lib 66 67@echo off 68 69if exist examples\listdevs_ddkbuild goto md7 70md examples\listdevs_ddkbuild 71:md7 72 73cd examples\listdevs_ddkbuild 74copy ..\..\msvc\listdevs_sources sources >NUL 2>&1 75@echo on 76build -cwgZ 77@echo off 78if errorlevel 1 goto buildlistdevserror 79cd ..\.. 80 81set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir% 82@echo on 83 84copy %srcPath%\listdevs.exe %dstPath%\examples 85copy %srcPath%\listdevs.pdb %dstPath%\examples 86 87cd msvc 88goto done 89 90 91:builderror 92cd ..\..\msvc 93echo Build failed 94goto done 95 96:buildlistdevserror 97cd ..\..\msvc 98echo listdevs build failed 99goto done 100 101:usage 102echo ddk_build must be run in a WDK build environment 103pause 104goto done 105 106:done 107