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

1.1       root        1: ::
1.1.1.5   root        2: :: Copyright (c) 2008-2009 TrueCrypt Foundation. All rights reserved.
1.1       root        3: ::
1.1.1.7 ! root        4: :: Governed by the TrueCrypt License 2.8 the full text of which is contained
1.1       root        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: 
1.1.1.5   root       20: :: Windows Driver Kit build number
                     21: 
1.1.1.7 ! root       22: set TC_WINDDK_BUILD=7600.16385.0
1.1.1.5   root       23: 
                     24: 
1.1.1.4   root       25: :: Check for spaces in the current directory path
                     26: 
                     27: cd | find " " >NUL:
                     28: 
                     29: if %ERRORLEVEL% == 0 (
                     30:        echo BuildDriver.cmd: error: MS Build does not support building of projects stored in a path containing spaces. >&2
                     31:        exit /B 1
                     32: )
                     33: 
                     34: 
1.1       root       35: :: Build options
                     36: 
                     37: set TC_C_DEFINES=-D_WIN32 -DNT4_DRIVER
                     38: set TC_C_FLAGS=-nologo -I..
1.1.1.7 ! root       39: set TC_C_WARNING_LEVEL=-W4
        !            40: set TC_C_DISABLED_WARNINGS=-wd4057 -wd4100 -wd4127 -wd4152 -wd4201 -wd4701 -wd4702 -wd4706
1.1.1.3   root       41: set TC_LIBRARIAN_FLAGS=-nologo
1.1       root       42: set TC_LINKER_FLAGS=-nologo
                     43: 
                     44: 
1.1.1.5   root       45: :: Windows Driver Kit root
1.1       root       46: 
                     47: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\WinDDK\%TC_WINDDK_BUILD%
                     48: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     49: 
1.1.1.3   root       50: set TC_WINDDK_ROOT=%WINDDK_ROOT%\%TC_WINDDK_BUILD%
1.1       root       51: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     52: 
                     53: set TC_WINDDK_ROOT=%WINDDK_ROOT%
                     54: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     55: 
1.1.1.3   root       56: echo BuildDriver.cmd: error: Windows Driver Development Kit not found in the default directory. Set WINDDK_ROOT environment variable to point to your Windows DDK installation directory. >&2
1.1       root       57: exit /B 1
                     58: 
                     59: :ddk_found
                     60: 
                     61: 
                     62: :: CPU architecture
                     63: 
                     64: if "%TC_ARG_ARCH%"=="-x64" (
1.1.1.3   root       65:        set TC_BUILD_ARCH=x64 WNET
1.1       root       66:        set TC_BUILD_ARCH_DIR=amd64
1.1.1.2   root       67:        set TC_ARCH=x64
1.1       root       68:        set TC_ARCH_SUFFIX=-x64
1.1.1.7 ! root       69:        set TC_C_DISABLED_WARNINGS=%TC_C_DISABLED_WARNINGS% -wd4328 -wd4366
1.1       root       70: ) else (
                     71:        set TC_BUILD_ARCH=WXP
                     72:        set TC_BUILD_ARCH_DIR=i386
1.1.1.2   root       73:        set TC_ARCH=x86
1.1       root       74:        set TC_ARCH_SUFFIX=
                     75: )
                     76: 
                     77: 
                     78: :: Build type
                     79: 
                     80: if "%TC_ARG_TYPE%"=="-debug" (
                     81:        set TC_BUILD_TYPE=chk
                     82:        set TC_C_DEFINES=%TC_C_DEFINES% -DDEBUG -D_DEBUG
                     83:        set TC_BUILD_ALT_DIR=_driver_debug
                     84:        set TC_COPY_DIR="..\Debug"
                     85: ) else (
                     86:        set TC_BUILD_TYPE=fre
                     87:        set TC_BUILD_ALT_DIR=_driver_release
                     88:        set TC_COPY_DIR="..\Release"
                     89: )
                     90: 
                     91: 
                     92: :: WDK environment
                     93: 
                     94: pushd .
1.1.1.7 ! root       95: call %TC_WINDDK_ROOT%\bin\setenv %TC_WINDDK_ROOT% %TC_BUILD_TYPE% %TC_BUILD_ARCH% no_oacr || exit /B %errorlevel%
1.1       root       96: popd
                     97: 
                     98: 
                     99: :: Build
                    100: 
                    101: if "%TC_ARG_CMD%"=="-rebuild" (set TC_BUILD_OPTS=-c)
                    102: 
                    103: pushd .
                    104: :build_dirs
                    105: 
                    106:        if "%~1"=="" goto done
                    107:        cd /D "%~1" || exit /B %errorlevel%
                    108: 
                    109:        if "%TC_ARG_CMD%"=="-clean" (
                    110:                rd /s /q obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR% 2>NUL:
                    111:                rd /q obj%TC_BUILD_ALT_DIR% 2>NUL:
                    112:        ) else (
                    113: 
1.1.1.7 ! root      114:                set USER_C_FLAGS=%TC_C_FLAGS% %TC_C_DISABLED_WARNINGS% -FAcs -Fa%~1\obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\
        !           115:                set MSC_WARNING_LEVEL=%TC_C_WARNING_LEVEL%
1.1       root      116:                set C_DEFINES=%TC_C_DEFINES%
                    117:                set RCOPTIONS=/I %MFC_INC_PATH%
1.1.1.3   root      118:                set LIBRARIAN_FLAGS=%TC_LIBRARIAN_FLAGS%
                    119:                set LINKER_FLAGS=%TC_LINKER_FLAGS%
1.1       root      120:                set BUILD_ALT_DIR=%TC_BUILD_ALT_DIR%
                    121: 
                    122:                build %TC_BUILD_OPTS% -Z -w -nmake /S -nmake /C 2>build_errors.log 1>&2
                    123:                
                    124:                if errorlevel 1 (
                    125:                        type build_errors.log
                    126:                        exit /B 1
                    127:                )
                    128:                del /q build_errors.log build%BUILD_ALT_DIR%.* 2>NUL:
                    129:        )
                    130: 
                    131:        shift
                    132:        
                    133: goto build_dirs
                    134: :done
                    135: popd
                    136: 
                    137: 
                    138: if "%TC_ARG_CMD%"=="-clean" exit /B 0
                    139: 
                    140: md "%TC_COPY_DIR%\Setup Files" >NUL: 2>NUL:
                    141: 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:
                    142: 
                    143: if errorlevel 1 (
                    144:        echo BuildDriver.cmd: error: Cannot copy target.>&2
                    145:        exit /B 1
                    146: )
                    147: 
                    148: 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.