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