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

1.1       root        1: ::
                      2: :: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: ::
1.1.1.3 ! root        4: :: Governed by the TrueCrypt License 2.5 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: 
                     20: :: Build options
                     21: 
                     22: set TC_C_DEFINES=-D_WIN32 -DNT4_DRIVER
                     23: set TC_C_FLAGS=-nologo -I..
1.1.1.3 ! root       24: set TC_LIBRARIAN_FLAGS=-nologo
1.1       root       25: set TC_LINKER_FLAGS=-nologo
1.1.1.2   root       26: set NO_SAFESEH=1
1.1       root       27: 
                     28: 
                     29: :: Windows DDK root
                     30: 
1.1.1.3 ! root       31: set TC_WINDDK_BUILD=6001.18001
1.1       root       32: 
                     33: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\WinDDK\%TC_WINDDK_BUILD%
                     34: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     35: 
1.1.1.3 ! root       36: set TC_WINDDK_ROOT=%WINDDK_ROOT%\%TC_WINDDK_BUILD%
1.1       root       37: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     38: 
                     39: set TC_WINDDK_ROOT=%WINDDK_ROOT%
                     40: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
                     41: 
1.1.1.3 ! root       42: 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       43: exit /B 1
                     44: 
                     45: :ddk_found
                     46: 
                     47: 
                     48: :: CPU architecture
                     49: 
                     50: if "%TC_ARG_ARCH%"=="-x64" (
1.1.1.3 ! root       51:        set TC_BUILD_ARCH=x64 WNET
1.1       root       52:        set TC_BUILD_ARCH_DIR=amd64
1.1.1.2   root       53:        set TC_ARCH=x64
1.1       root       54:        set TC_ARCH_SUFFIX=-x64
                     55: ) else (
                     56:        set TC_BUILD_ARCH=WXP
                     57:        set TC_BUILD_ARCH_DIR=i386
1.1.1.2   root       58:        set TC_ARCH=x86
1.1       root       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
1.1.1.2   root       73:        set TC_C_FLAGS=%TC_C_FLAGS% -w34189
1.1       root       74:        set TC_COPY_DIR="..\Release"
                     75: )
                     76: 
                     77: 
                     78: :: WDK environment
                     79: 
                     80: pushd .
                     81: call %TC_WINDDK_ROOT%\bin\setenv %TC_WINDDK_ROOT% %TC_BUILD_TYPE% %TC_BUILD_ARCH% || exit /B %errorlevel%
                     82: popd
                     83: 
                     84: 
                     85: :: Build
                     86: 
                     87: if "%TC_ARG_CMD%"=="-rebuild" (set TC_BUILD_OPTS=-c)
                     88: 
                     89: pushd .
                     90: :build_dirs
                     91: 
                     92:        if "%~1"=="" goto done
                     93:        cd /D "%~1" || exit /B %errorlevel%
                     94: 
                     95:        if "%TC_ARG_CMD%"=="-clean" (
                     96:                rd /s /q obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR% 2>NUL:
                     97:                rd /q obj%TC_BUILD_ALT_DIR% 2>NUL:
                     98:        ) else (
                     99: 
                    100:                set USER_C_FLAGS=%TC_C_FLAGS% -FAcs -Fa%~1\obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\
                    101:                set C_DEFINES=%TC_C_DEFINES%
                    102:                set RCOPTIONS=/I %MFC_INC_PATH%
1.1.1.3 ! root      103:                set LIBRARIAN_FLAGS=%TC_LIBRARIAN_FLAGS%
        !           104:                set LINKER_FLAGS=%TC_LINKER_FLAGS%
1.1       root      105:                set BUILD_ALT_DIR=%TC_BUILD_ALT_DIR%
                    106: 
                    107:                build %TC_BUILD_OPTS% -Z -w -nmake /S -nmake /C 2>build_errors.log 1>&2
                    108:                
                    109:                if errorlevel 1 (
                    110:                        type build_errors.log
                    111:                        exit /B 1
                    112:                )
                    113:                del /q build_errors.log build%BUILD_ALT_DIR%.* 2>NUL:
                    114:        )
                    115: 
                    116:        shift
                    117:        
                    118: goto build_dirs
                    119: :done
                    120: popd
                    121: 
                    122: 
                    123: if "%TC_ARG_CMD%"=="-clean" exit /B 0
                    124: 
                    125: md "%TC_COPY_DIR%\Setup Files" >NUL: 2>NUL:
                    126: 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:
                    127: 
                    128: if errorlevel 1 (
                    129:        echo BuildDriver.cmd: error: Cannot copy target.>&2
                    130:        exit /B 1
                    131: )
                    132: 
                    133: 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.