Annotation of truecrypt/driver/builddriver.cmd, revision 1.1.1.1

1.1       root        1: ::
                      2: :: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: ::
                      4: :: Governed by the TrueCrypt License 2.4 the full text of which is contained
                      5: :: in the file License.txt included in TrueCrypt binary and source code
                      6: :: distribution packages.
                      7: ::
                      8: 
                      9: :: Usage: BuildDriver <-build|-rebuild|-clean> <-release|-debug> <-x86|-x64> <dir1> [dir2] ...
                     10: 
                     11: @echo off
                     12: set TC_ARG_CMD=%~1
                     13: shift
                     14: set TC_ARG_TYPE=%~1
                     15: shift
                     16: set TC_ARG_ARCH=%~1
                     17: shift
                     18: 
                     19: 
                     20: :: Build options
                     21: 
                     22: set TC_C_DEFINES=-D_WIN32 -DNT4_DRIVER
                     23: set TC_C_FLAGS=-nologo -I..
                     24: set TC_LINKER_FLAGS=-nologo
                     25: 
                     26: 
                     27: :: Windows DDK root
                     28: 
                     29: set TC_WINDDK_BUILD=6000
                     30: 
                     31: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\WinDDK\%TC_WINDDK_BUILD%
                     32: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     33: 
                     34: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\SDK\WinDDK\%TC_WINDDK_BUILD%
                     35: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     36: 
                     37: set TC_WINDDK_ROOT=%%WINDDK_%TC_WINDDK_BUILD%_ROOT%%
                     38: for /F "usebackq" %%r in (`echo %TC_WINDDK_ROOT%`) do set TC_WINDDK_ROOT=%%r
                     39: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     40: 
                     41: set TC_WINDDK_ROOT=%WINDDK_ROOT%
                     42: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     43: 
                     44: echo BuildDriver.cmd: error: Windows Driver Development Kit not found at the default directory. Set WINDDK_ROOT or WINDDK_%TC_WINDDK_BUILD%_ROOT environment variable to point to your Windows DDK installation directory. >&2
                     45: exit /B 1
                     46: 
                     47: :ddk_found
                     48: 
                     49: 
                     50: :: CPU architecture
                     51: 
                     52: if "%TC_ARG_ARCH%"=="-x64" (
                     53:        set TC_BUILD_ARCH=AMD64 WNET
                     54:        set TC_BUILD_ARCH_DIR=amd64
                     55:        set TC_ARCH_SUFFIX=-x64
                     56: ) else (
                     57:        set TC_BUILD_ARCH=WXP
                     58:        set TC_BUILD_ARCH_DIR=i386
                     59:        set TC_ARCH_SUFFIX=
                     60: )
                     61: 
                     62: 
                     63: :: Build type
                     64: 
                     65: if "%TC_ARG_TYPE%"=="-debug" (
                     66:        set TC_BUILD_TYPE=chk
                     67:        set TC_C_DEFINES=%TC_C_DEFINES% -DDEBUG -D_DEBUG
                     68:        set TC_BUILD_ALT_DIR=_driver_debug
                     69:        set TC_COPY_DIR="..\Debug"
                     70: ) else (
                     71:        set TC_BUILD_TYPE=fre
                     72:        set TC_BUILD_ALT_DIR=_driver_release
                     73:        set TC_COPY_DIR="..\Release"
                     74: )
                     75: 
                     76: 
                     77: :: WDK environment
                     78: 
                     79: pushd .
                     80: call %TC_WINDDK_ROOT%\bin\setenv %TC_WINDDK_ROOT% %TC_BUILD_TYPE% %TC_BUILD_ARCH% || exit /B %errorlevel%
                     81: popd
                     82: 
                     83: 
                     84: :: Build
                     85: 
                     86: if "%TC_ARG_CMD%"=="-rebuild" (set TC_BUILD_OPTS=-c)
                     87: 
                     88: pushd .
                     89: :build_dirs
                     90: 
                     91:        if "%~1"=="" goto done
                     92:        cd /D "%~1" || exit /B %errorlevel%
                     93: 
                     94:        if "%TC_ARG_CMD%"=="-clean" (
                     95:                rd /s /q obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR% 2>NUL:
                     96:                rd /q obj%TC_BUILD_ALT_DIR% 2>NUL:
                     97:        ) else (
                     98: 
                     99:                set USER_C_FLAGS=%TC_C_FLAGS% -FAcs -Fa%~1\obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\
                    100:                set C_DEFINES=%TC_C_DEFINES%
                    101:                set LINKER_FLAGS=%TC_LINKER_FLAGS%
                    102:                set RCOPTIONS=/I %MFC_INC_PATH%
                    103:                set BUILD_ALT_DIR=%TC_BUILD_ALT_DIR%
                    104: 
                    105:                build %TC_BUILD_OPTS% -Z -w -nmake /S -nmake /C 2>build_errors.log 1>&2
                    106:                
                    107:                if errorlevel 1 (
                    108:                        type build_errors.log
                    109:                        exit /B 1
                    110:                )
                    111:                del /q build_errors.log build%BUILD_ALT_DIR%.* 2>NUL:
                    112:        )
                    113: 
                    114:        shift
                    115:        
                    116: goto build_dirs
                    117: :done
                    118: popd
                    119: 
                    120: 
                    121: if "%TC_ARG_CMD%"=="-clean" exit /B 0
                    122: 
                    123: md "%TC_COPY_DIR%\Setup Files" >NUL: 2>NUL:
                    124: copy /B /Y obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\truecrypt.sys "%TC_COPY_DIR%\Setup Files\truecrypt%TC_ARCH_SUFFIX%.sys" >NUL:
                    125: 
                    126: if errorlevel 1 (
                    127:        echo BuildDriver.cmd: error: Cannot copy target.>&2
                    128:        exit /B 1
                    129: )
                    130: 
                    131: exit /B 0

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.