|
|
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
1.1.1.2 ! root 25: set NO_SAFESEH=1
1.1 root 26:
27:
28: :: Windows DDK root
29:
30: set TC_WINDDK_BUILD=6000
31:
32: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\WinDDK\%TC_WINDDK_BUILD%
33: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
34:
35: set TC_WINDDK_ROOT=%SYSTEMDRIVE%\SDK\WinDDK\%TC_WINDDK_BUILD%
36: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
37:
38: set TC_WINDDK_ROOT=%%WINDDK_%TC_WINDDK_BUILD%_ROOT%%
39: for /F "usebackq" %%r in (`echo %TC_WINDDK_ROOT%`) do set TC_WINDDK_ROOT=%%r
40: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
41:
42: set TC_WINDDK_ROOT=%WINDDK_ROOT%
43: if exist "%TC_WINDDK_ROOT%\bin\setenv.bat" goto ddk_found
44:
45: 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
46: exit /B 1
47:
48: :ddk_found
49:
50:
51: :: CPU architecture
52:
53: if "%TC_ARG_ARCH%"=="-x64" (
54: set TC_BUILD_ARCH=AMD64 WNET
55: set TC_BUILD_ARCH_DIR=amd64
1.1.1.2 ! root 56: set TC_ARCH=x64
1.1 root 57: set TC_ARCH_SUFFIX=-x64
58: ) else (
59: set TC_BUILD_ARCH=WXP
60: set TC_BUILD_ARCH_DIR=i386
1.1.1.2 ! root 61: set TC_ARCH=x86
1.1 root 62: set TC_ARCH_SUFFIX=
63: )
64:
65:
66: :: Build type
67:
68: if "%TC_ARG_TYPE%"=="-debug" (
69: set TC_BUILD_TYPE=chk
70: set TC_C_DEFINES=%TC_C_DEFINES% -DDEBUG -D_DEBUG
71: set TC_BUILD_ALT_DIR=_driver_debug
72: set TC_COPY_DIR="..\Debug"
73: ) else (
74: set TC_BUILD_TYPE=fre
75: set TC_BUILD_ALT_DIR=_driver_release
1.1.1.2 ! root 76: set TC_C_FLAGS=%TC_C_FLAGS% -w34189
1.1 root 77: set TC_COPY_DIR="..\Release"
78: )
79:
80:
81: :: WDK environment
82:
83: pushd .
84: call %TC_WINDDK_ROOT%\bin\setenv %TC_WINDDK_ROOT% %TC_BUILD_TYPE% %TC_BUILD_ARCH% || exit /B %errorlevel%
85: popd
86:
87:
88: :: Build
89:
90: if "%TC_ARG_CMD%"=="-rebuild" (set TC_BUILD_OPTS=-c)
91:
92: pushd .
93: :build_dirs
94:
95: if "%~1"=="" goto done
96: cd /D "%~1" || exit /B %errorlevel%
97:
98: if "%TC_ARG_CMD%"=="-clean" (
99: rd /s /q obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR% 2>NUL:
100: rd /q obj%TC_BUILD_ALT_DIR% 2>NUL:
101: ) else (
102:
103: set USER_C_FLAGS=%TC_C_FLAGS% -FAcs -Fa%~1\obj%TC_BUILD_ALT_DIR%\%TC_BUILD_ARCH_DIR%\
104: set C_DEFINES=%TC_C_DEFINES%
105: set LINKER_FLAGS=%TC_LINKER_FLAGS%
106: set RCOPTIONS=/I %MFC_INC_PATH%
107: set BUILD_ALT_DIR=%TC_BUILD_ALT_DIR%
108:
109: build %TC_BUILD_OPTS% -Z -w -nmake /S -nmake /C 2>build_errors.log 1>&2
110:
111: if errorlevel 1 (
112: type build_errors.log
113: exit /B 1
114: )
115: del /q build_errors.log build%BUILD_ALT_DIR%.* 2>NUL:
116: )
117:
118: shift
119:
120: goto build_dirs
121: :done
122: popd
123:
124:
125: if "%TC_ARG_CMD%"=="-clean" exit /B 0
126:
127: md "%TC_COPY_DIR%\Setup Files" >NUL: 2>NUL:
128: 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:
129:
130: if errorlevel 1 (
131: echo BuildDriver.cmd: error: Cannot copy target.>&2
132: exit /B 1
133: )
134:
135: exit /B 0
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.