?? ddkbuild.bat
字號(hào):
set ddk=NET
set wdf=1
goto buildswitchdone
)
:buildswitchdone
::
:: =====================
:: arg sanity tests
:: =====================
::
if %verbose% EQU 1 @echo sanity tests
if "%w2kflag%" EQU "" goto BadTarget
if "%BASEDIR%" EQU "" goto ErrNoBASEDIR
set path=%BASEDIR%\bin;%path%
if "%scriptDebug%" EQU "on" @echo PATH: %PATH%
::
:: =====================
:: check drvfast switch
:: =====================
::
if /I "%1" EQU "-drvfast" (
if %verbose% EQU 1 @echo drvfast support
set prefast=prefast
if EXIST %basedir%\bin\drvfast.cmd (
set setenv=drvfast.cmd
) else if EXIST %basedir%\bin\drvfast.bat (
set setenv=drvfast.bat
)
shift
)
::
:: =====================
:: check prefast switch
:: =====================
::
if /I "%1" EQU "-prefast" (
if %verbose% EQU 1 @echo prefast support
set prefast=prefast
shift
)
::
:: =====================
:: check CUV switch
:: =====================
::
if /I "%1" EQU "-cuv" (
if %verbose% EQU 1 @echo CUV support
set VERIFIER_DDK_EXTENSIONS=1
shift
)
::
:: END of position independent switches
::
if /I "%1" EQU "free" (
set mode=%fre%
) else if /I "%1" EQU "checked" (
set mode=%chk%
)
if "%mode%" EQU "" goto ErrBadMode
shift
if "%1" EQU "" goto ErrNoDir
if not exist %1 goto ErrNoDir
set buildDir=%1
shift
::
:: ====================
:: force prefast log file to build dir so we know where it is and
:: so it does not conflict with other activities
:: ===================
::
if "%prefast%" NEQ "" (
set prefast_log=.\prefast.xml
set prefast=!prefast! /log=!prefast_log!
)
set batfile=%BASEDIR%\bin\%setenv%
if "%xp2k%" EQU "1" set batfile=%BASEDIR%\bin\w2k\set2k.bat
::
:: =====================
:: invoke the DDK's setenv script
:: =====================
::
if %verbose% EQU 1 @echo run ddk setenv
pushd .
if "%w2kflag%" NEQ "" (
if %verbose% EQU 1 @echo check for .net sp1 ddk
for /F "usebackq" %%x IN (`findstr /M "_BscMake" %batfile%`) do (
if %verbose% EQU 1 @echo call %batfile% %BASEDIR% %mode% %xp64% %wnet% bscmake
call %batfile% %BASEDIR% %mode% %xp64% %wnet% bscmake
if "%NO_BROWSER_FILE%" NEQ "" (
set NO_BROWSER_FILE=
if %verbose% EQU 1 @echo deleted NO_BROWSER_FILE
)
goto wnetddkdone
)
if %verbose% EQU 1 @echo call %batfile% %BASEDIR% %mode% %xp64% %wnet%
call %batfile% %BASEDIR% %mode% %xp64% %wnet%
) else (
call %batfile% %BASEDIR% %mode%
)
:wnetddkdone
popd
::
:: ======================
:: latest WDF beta has its own extra setenv script, so run it if it exists
:: =======================
::
if %verbose% EQU 1 @echo WDF_ROOT "%WDF_ROOT%" wdf "%wdf%"
if %wdf% EQU 1 (
if %verbose% EQU 1 @echo check for wdf environment scripts
if EXIST %WDF_ROOT%\set_wdf_env.cmd (
if %verbose% EQU 1 @echo run wdf set env
call %WDF_ROOT%\set_wdf_env.cmd
)
)
@echo %scriptDebug%
::
:: =====================
:: fixup the multiprocessor flag
:: so that Visual Studio doesn't get confused
:: =====================
::
if %verbose% EQU 1 @echo fix MP flags
set mpFlag=-M
if "%BUILD_ALT_DIR%" EQU "" goto NT4
set W2kEXT=%BUILD_ALT_DIR%
set mpFlag=-MI
:NT4
if "%NUMBER_OF_PROCESSORS%"=="" set mpFlag=
if "%NUMBER_OF_PROCESSORS%" EQU "1" set mpFlag=
set bflags=-e
set bscFlags="/n"
::
:: ===================
:: add any remaining commandline arguments to extraArgs
:: ===================
::
if %verbose% EQU 1 @echo add extra commandline args
:moreargs
if "%~1" NEQ "" (
if "%~1" EQU "/a" (
set extraArgs=%extraArgs% -cfe
) else (
set extraArgs=%extraArgs% %~1
)
shift
goto moreargs
)
:: set quietMode=
:: if %quiet% EQU 1 set moreExtraArgs=%moreExtraArgs% ^> NUL 2^>^&1
:: if %quiet% EQU 1 set quietMode= ^> NUL 2^>^&1
if EXIST %buildDir%\build%W2kEXT%.err erase %buildDir%\build%W2kEXT%.err
if EXIST %buildDir%\build%W2kEXT%.wrn erase %buildDir%\build%W2kEXT%.wrn
if EXIST %buildDir%\build%W2kEXT%.log erase %buildDir%\build%W2kEXT%.log
if %quiet% EQU 0 (
@echo.
@echo DDKBUILD using %ddk% DDK in directory %buildDir%
@echo for %mode% version basedir %BASEDIR% extension %W2kEXT%
@echo commandline: "%prefast% build %bflags% %mpFlag% %extraArgs% %quietMode%"
@echo.
)
if %verbose% EQU 1 @echo run build using path %path%
pushd .
pushd %buildDir%
::
:: ===================
:: if quiet mode all output goes to NUL
:: ===================
::
if %quiet% EQU 1 (
%prefast% build %bflags% %mpFlag% %extraArgs% >NUL 2>&1
) else (
%prefast% build %bflags% %mpFlag% %extraArgs%
)
set status=%ERRORLEVEL%
if %status%==1 set status=0
popd
popd
@echo %scriptDebug%
::
:: ===================
:: assume that the onscreen errors are complete!
:: ===================
::
if %verbose% EQU 1 @echo process error and warning messages
if %quiet% EQU 0 @echo =============== build warnings ======================
if exist %buildDir%\build%W2kEXT%.log (
if %quiet% EQU 1 (
findstr "warning.*[CDLU][0-9]* error.*[CDLU][0-9]*" %buildDir%\build%W2kEXT%.log
) else (
findstr "warning.*[CDLU][0-9]*" %buildDir%\build%W2kEXT%.log
)
)
if %verbose% EQU 1 @echo check for warning and error log files
if exist %buildDir%\build%W2kEXT%.wrn (
set status=3
if %quiet% EQU 0 (
@echo.
@echo warnings found in build!
@echo.
)
)
if exist %buildDir%\build%W2kEXT%.err (
set status=4
if %quiet% EQU 0 (
@echo.
@echo errors found in build!
@echo.
)
)
if %quiet% EQU 0 (
@echo.
@echo.
@echo build complete status %status%
)
::
:: ===================
:: BSCMAKE support
:: ===================
::
if %verbose% EQU 1 @echo building browse information files
@echo %scriptDebug%
if EXIST buildbrowse.cmd goto doBrowsescript
set sbrlist=sbrList.txt
if not EXIST sbrList%CPU%.txt goto sbrDefault
set sbrlist=sbrList%CPU%.txt
:sbrDefault
if not EXIST %sbrlist% goto postBuildEvents
if %bscFlags% == "" goto noBscFlags
bscmake %bscFlags% @%sbrlist%
goto buildExit
::
:: ===================
:: error handlers
:: ===================
::
:noBscFlags
bscmake @%sbrlist%
goto buildExit
:doBrowsescript
call buildBrowse %mode% %w2kflag%
goto buildExit
:ErrBadMode
@echo error: first param must be "checked" or "free"
goto usage
:ErrNoBASEDIR
@echo error: BASEDIR environment variable not set, reinstall DDK!
goto usage
:NoW2kBase
@echo error: W2KBASE environment variable not set!
goto usage
:NoW2k64Base
@echo error: W2K64BASE environment variable not set!
goto usage
:NoXPBase
@echo error: XPBASE environment variable not set!
goto usage
:NoWNBase
@echo error: WNETBASE environment variable not set!
goto usage
:NoWLHBase
@echo error: WLHBASE environment variable not set!
goto usage
:ErrnoDir
@echo Error: invalid build directory specified
goto usage
:BadTarget
@echo Error: invalid TARGET specified
goto usage
:NoWDFroot
@echo Error: WDF_ROOT environment variable not set!
goto usage
:NoWDFddk
@echo Error: WDF_DDK environment variable not set!
goto usage
:usage
if %quiet% EQU 0 start http:\\www.hollistech.com\Resources\ddkbuild\ddkbuildhelp3_13.htm
@echo usage: ddkbuild [-debug^|-verbose^|-quiet] "TARGET" [-prefast^|-drvfast^|-cuv] "checked | free" "directory-to-build" [flags]
@echo.
@echo -debug turns on script echoing for debug purposes
@echo.
@echo -verbose announce various script activities to standard out
@echo.
@echo -quiet no output to standard out EXCEPT warnings and errors. (And modifies prefast behavior)
@echo.
@echo TARGET can be any of the following combinations of DDK and target platform:
@echo.
@echo -W2K indicates development system uses W2KBASE environment variable
@echo to locate the win2000 ddk, otherwise BASEDIR is used (optional.)
@echo.
@echo -W2K64 indicates development syatem uses W2K64BASE environment variable
@echo to locate the win2000 64 ddk, otherwise BASEDIR is used (optional.)
@echo.
@echo -XP indicates development system uses XPBASE environment variable
@echo to locate the XP ddk, otherwise BASEDIR is used (optional.)
@echo.
@echo -XP64 indicates development system uses XPBASE environment variable
@echo to locate the XP ddk and builds IA64 binaries (optional.)
@echo.
@echo -XPW2K indicates development system uses the XPBASE environment variable
@echo to locate the XP ddk and builds W2K binaries (optional.)
@echo.
@echo -WNET indicates development system uses WNETBASE environment variable
@echo to locate the .Net ddk and builds .net binaries (optional.)
@echo.
@echo -WNETW2K indicates development system uses the WNETBASE environment variable
@echo to locate the .Net ddk and builds W2K binaries (optional.)
@echo.
@echo -WNETXP indicates development system uses WNETBASE environment variable
@echo to locate the .Net ddk and builds xp binaries (optional.)
@echo.
@echo -WNET64 indicates development system uses WNETBASE environment variable
@echo to locate the .Net ddk and builds 64bit binaries (optional.)
@echo.
@echo -WNETA64 indicates development system uses WNETBASE environment variable
@echo to locate the .Net ddk and builds AMD 64bit binaries (optional.)
@echo.
@echo -WLH indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds Longhorn binaries (optional.)
@echo.
@echo -WLH64 indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds IA64 Longhorn binaries (optional.)
@echo.
@echo -WLHA64 indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds AMD64 Longhorn binaries (optional.)
@echo.
:: @echo -WLHW2K indicates development system uses the WLHBASE environment variable
:: @echo to locate the Longhorn ddk and builds W2K binaries (optional.)
:: @echo.
@echo -WLHXP indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds XP binaries (optional.)
@echo.
@echo -WLHXP64 indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds XP IA64 binaries (optional.)
@echo.
@echo -WLHNET indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds .net binaries (optional.)
@echo.
@echo -WLHNET64 indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds IA64 .bet binaries (optional.)
@echo.
@echo -WLHNETA64 indicates development system uses the WLHBASE environment variable
@echo to locate the Longhorn ddk and builds AMD64 .net binaries (optional.)
@echo.
@echo -WDF indicates development system uses the WDF_DDK and WDF_ROOT environment variables
@echo to locate the WDF supported DDK and builds a W2K3 binary (optional).
@echo.
@echo -WDFXP indicates development system uses the WDF_DDK and WDF_ROOT environment variables
@echo to locate the WDF supported DDK and builds an XP binary (optional).
@echo.
@echo.
@echo -WDFW2K indicates development system uses the WDF_DDK and WDF_ROOT environment variables
@echo to locate the WDF supported DDK and builds an Windowa 2000 binary (optional).
@echo.
@echo.
@echo -WDF64 indicates development system uses the WDF_DDK and WDF_ROOT environment variables
@echo to locate the WDF supported DDK and builds an W2K3 IA64 (Itanium) binary (optional).
@echo.
@echo.
@echo -WDFA64 indicates development system uses the WDF_DDK and WDF_ROOT environment variables
@echo to locate the WDF supported DDK and builds an W2K3 X64 (AMD and Intel) binary (optional).
@echo.
@echo -prefast run prefast rather than a normal build if quiet mode is not set, the prefast browser is opened
@echo after prefast is run otherwise prefast errors and warnings goto stdout
@echo.
@echo -drvfast run the 'driver fast' version of prefast if the ddk supports it
@echo.
@echo -cuv use code usage verifier when building driver
@echo.
@echo checked indicates a checked build.
@echo.
@echo free indicates a free build (must choose one or the other of free or checked.)
@echo.
@echo directory path to build directory, try . (cwd).
@echo.
@echo flags any random flags or arguments you think should be passed to build (note that the
@echo visual studio /a for clean build is translated to the equivalent build flag.)
@echo Note also that multiple arguments can be specified by using quotes to contain
@echo the set of arguments, as in "-Z foo blortz w2k xp"
@echo.
@echo ex: ddkbuild -XP checked .
@echo.
@echo NOTE: windows .net DDK versions supported must be build 3663 or later
@echo.
set status=2
goto buildExit
:: ======================
:: post build events
:: currently supports prefast view
:: ======================
:postBuildEvents
if %verbose% EQU 1 @echo post build prefast processing %prefast% %prefast_log%
if "%prefast%" NEQ "" (
if "%prefast_log%" NEQ "" (
if exist "%prefast_log%" (
if %quiet% EQU 1 (
findstr DEFECTCODE %prefast_log% > NUL 2>&1
if not ERRORLEVEL 1 %prefast% list | findstr "warning [0-9]* FUNCTION: PATH:"
) else (
%prefast% view
)
)
)
)
goto buildExit
:: ======================
:: bad shell error handlers
:: ======================
:wrongplatform
@echo Sorry: NT4/W2K/XP/.net only!
set status=5
goto buildExit
:nt4ddkbuild
@echo Sorry ddkbuild supports windows2000 or later platforms only
set status=6
goto buildExit
:buildExit
exit /b %status%
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -