]> git.proxmox.com Git - mirror_edk2.git/blob - edksetup.bat
Updated edksetup to support VS2005 iff VS2003 is not installed for the NT32 build
[mirror_edk2.git] / edksetup.bat
1 @REM
2 @REM Copyright (c) 2006, Intel Corporation
3 @REM All rights reserved. This program and the accompanying materials
4 @REM are licensed and made available under the terms and conditions of the BSD License
5 @REM which accompanies this distribution. The full text of the license may be found at
6 @REM http://opensource.org/licenses/bsd-license.php
7 @REM
8 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10 @REM
11
12 @REM set following environment in this file or in command shell
13 @REM set JAVA_HOME=C:\Java\jdk1.5.0_06
14 @REM set ANT_HOME=C:\ANT
15 @REM set XMLBEANS_HOME=C:\xmlbeans
16 @REM set CYGWIN_HOME=C:\cygwin
17
18 @REM usage: edksetup.bat [Rebuild] [ForceRebuild] [Reconfig]
19 @REM if the argument, skip is present, only the paths and the
20 @REM test and set of environment settings are performed.
21
22 @REM ##############################################################
23 @REM # You should not have to modify anything below this line
24 @REM #
25
26 @echo off
27
28 @REM
29 @REM Set the WORKSPACE to the current working directory
30 @REM
31 pushd .
32 cd %~dp0
33 set WORKSPACE=%CD%
34
35 @if /I "%1"=="-h" goto Usage
36 @if /I "%1"=="-help" goto Usage
37 @if /I "%1"=="--help" goto Usage
38 @if /I "%1"=="/h" goto Usage
39 @if /I "%1"=="/?" goto Usage
40 @if /I "%1"=="/help" goto Usage
41 @if /I not "%1"=="--nt32" goto check_new_build
42 shift
43 goto check_vc
44
45 :check_new_build
46 @if /I "%1"=="NewBuild" goto NewBuild
47
48 :AntBuild
49 @REM
50 @REM Check the required system environment variables
51 @REM
52
53 :check_vc
54 @REM The following setup is required for building the Nt32Pkg\Nt32.dsc
55 @REM platform emulation environment.
56 if defined VCINSTALLDIR goto check_cygwin
57 if defined VS71COMNTOOLS (
58 @REM Use Visual Studio .NET 2003 if it is installed
59 call "%VS71COMNTOOLS%\vsvars32.bat"
60 ) else if defined VS80COMNTOOLS (
61 @REM Use Visual Studio 2005 iff Visual Studio .NET 2003 is not installed.
62 call "%VS80COMNTOOLS%\vsvars32.bat"
63 ) else (
64 echo.
65 echo !!! WARNING !!!! Cannot find Visual Studio !!!
66 echo.
67 )
68 goto check_new_build
69
70 :check_cygwin
71 if defined CYGWIN_HOME goto check_java
72 if exist c:\cygwin (
73 set CYGWIN_HOME=c:\cygwin
74 ) else (
75 echo.
76 echo !!! WARNING !!!! Not set CYGWIN_HOME, gcc build may not be used !!!
77 echo.
78 )
79
80 :check_java
81 if "%JAVA_HOME%"=="" goto no_jdk
82
83 :check_ant
84 if "%ANT_HOME%"=="" goto no_ant
85 if not exist %ANT_HOME%\lib\ant-contrib.jar goto no_antcontrib
86
87 :check_xmlbeans
88 if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
89 if not exist %XMLBEANS_HOME%\lib\saxon8.jar goto no_saxon8
90
91 set FRAMEWORK_TOOLS_PATH=%WORKSPACE%\Tools\bin
92
93 if not defined ORIGINAL_CLASSPATH set ORIGINAL_CLASSPATH=%CLASSPATH%
94 set CLASSPATH=%ORIGINAL_CLASSPATH%
95
96 if defined WORKSPACE_TOOLS_PATH goto check_path
97 set PATH=%FRAMEWORK_TOOLS_PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;%XMLBEANS_HOME%\bin;%PATH%
98 set WORKSPACE_TOOLS_PATH=%FRAMEWORK_TOOLS_PATH%
99 echo Setting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
100 goto path_ok
101
102 :check_path
103 if "%FRAMEWORK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok
104 set PATH=%FRAMEWORK_TOOLS_PATH%;%PATH%
105 set WORKSPACE_TOOLS_PATH=%WORKSPACE%\Tools\bin
106 echo Resetting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
107
108 :path_ok
109
110 @if /I "%1"=="ForceRebuild" goto ForceBuild
111 @if /I "%1"=="Reconfig" goto Reconfig
112
113 @IF NOT EXIST "Tools\Jars\Common.jar" goto NormalBuild
114 @IF NOT EXIST "Tools\Jars\PcdTools.jar" goto NormalBuild
115 @IF NOT EXIST "Tools\Jars\GenBuild.jar" goto NormalBuild
116 @IF NOT EXIST "Tools\Jars\SurfaceArea.jar" goto NormalBuild
117 @IF NOT EXIST "Tools\Jars\cpptasks.jar" goto NormalBuild
118 @IF NOT EXIST "Tools\Jars\frameworktasks.jar" goto NormalBuild
119 @IF NOT EXIST "Tools\bin\FrameworkWizard.jar" goto NormalBuild
120 @IF NOT EXIST "Tools\bin\CompressDll.dll" goto NormalBuild
121 @IF NOT EXIST "Tools\bin\CompressDll.lib" goto NormalBuild
122 @IF NOT EXIST "Tools\bin\CreateMtFile.exe" goto NormalBuild
123 @IF NOT EXIST "Tools\bin\EfiCompress.exe" goto NormalBuild
124 @IF NOT EXIST "Tools\bin\EfiRom.exe" goto NormalBuild
125 @IF NOT EXIST "Tools\bin\FlashMap.exe" goto NormalBuild
126 @IF NOT EXIST "Tools\bin\FwImage.exe" goto NormalBuild
127 @IF NOT EXIST "Tools\bin\GenAcpiTable.exe" goto NormalBuild
128 @IF NOT EXIST "Tools\bin\GenCRC32Section.exe" goto NormalBuild
129 @IF NOT EXIST "Tools\bin\GenCapsuleHdr.exe" goto NormalBuild
130 @IF NOT EXIST "Tools\bin\GenDepex.exe" goto NormalBuild
131 @IF NOT EXIST "Tools\bin\GenFfsFile.exe" goto NormalBuild
132 @IF NOT EXIST "Tools\bin\GenFvImage.exe" goto NormalBuild
133 @IF NOT EXIST "Tools\bin\GenSection.exe" goto NormalBuild
134 @IF NOT EXIST "Tools\bin\GenTEImage.exe" goto NormalBuild
135 @IF NOT EXIST "Tools\bin\GuidChk.exe" goto NormalBuild
136 @IF NOT EXIST "Tools\bin\MakeDeps.exe" goto NormalBuild
137 @IF NOT EXIST "Tools\bin\ModifyInf.exe" goto NormalBuild
138 @IF NOT EXIST "Tools\bin\PeiRebase_Ia32.exe" goto NormalBuild
139 @IF NOT EXIST "Tools\bin\PeiRebase_Ipf.exe" goto NormalBuild
140 @IF NOT EXIST "Tools\bin\PeiRebase_X64.exe" goto NormalBuild
141 @IF NOT EXIST "Tools\bin\SecApResetVectorFixup.exe" goto NormalBuild
142 @IF NOT EXIST "Tools\bin\SecFixup.exe" goto NormalBuild
143 @IF NOT EXIST "Tools\bin\SetStamp.exe" goto NormalBuild
144 @IF NOT EXIST "Tools\bin\SplitFile.exe" goto NormalBuild
145 @IF NOT EXIST "Tools\bin\StrGather.exe" goto NormalBuild
146 @IF NOT EXIST "Tools\bin\Strip.exe" goto NormalBuild
147 @IF NOT EXIST "Tools\bin\VfrCompile.exe" goto NormalBuild
148 @IF NOT EXIST "Tools\bin\ZeroDebugData.exe" goto NormalBuild
149 @IF NOT EXIST "Tools\bin\antlr.exe" goto NormalBuild
150 @IF NOT EXIST "Tools\bin\dlg.exe" goto NormalBuild
151
152 @if /I "%1"=="Rebuild" goto NormalBuild
153 @if NOT "%1"=="" goto Usage
154
155 goto skipbuild
156
157 :ForceBuild
158 call ant -f %WORKSPACE%\Tools\build.xml -noclasspath cleanall
159
160 :NormalBuild
161 @REM
162 @REM Start to build the Framework Tools
163 @REM
164
165 echo.
166 echo Building the Framework Tools
167 echo.
168
169 @REM
170 @REM We are going to create the SurfaceArea.jar file first so that the other
171 @REM Java Programs can use it.
172 @REM It needs the XMLBEANS libraries in order to compile.
173 @REM
174 set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
175 set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
176 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
177 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
178 set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
179 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
180 set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
181
182 call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea
183
184 @REM
185 @REM Now we can make the other Java Programs
186 @REM All of the remaining Java Programs require the SurfaceArea library to compile
187 @REM
188 set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
189
190 call ant -f %WORKSPACE%\Tools\build.xml JavaCode
191
192 @REM
193 @REM We have all of the Java Programs and add-in classes created, so we can start
194 @REM using the cpp-tasks to create our tools
195 @REM
196 set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
197 set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
198 set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
199 set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
200 set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
201 set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
202 set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
203
204 call ant -f %WORKSPACE%\Tools\build.xml C_Code
205
206 @REM
207 @REM Done!!!
208 @REM
209 goto end
210
211 :no_jdk
212 echo.
213 echo !!! Please install Java, and set JAVA_HOME !!!
214 echo.
215 goto end
216
217 :no_ant
218 echo.
219 echo !!! Please install Apache Ant, and set ANT_HOME !!!
220 echo.
221 goto end
222
223 :no_antcontrib
224 echo.
225 echo !!! Please install Ant-contrib to ANT_HOME !!!
226 echo.
227 goto end
228
229 :no_xmlbeans
230 echo.
231 echo !!! Please install XML Beans, and set XMLBEANS_HOME !!!
232 echo.
233 goto end
234
235 :no_saxon8
236 echo.
237 echo !!! Please copy saxon8.jar file to XMLBEANS_HOME\lib !!!
238 echo.
239 goto end
240
241 :skipbuild
242 @REM
243 @REM This just sets up the CLASSPATH, the rest of the environment should have been set already.
244 @REM
245 echo.
246 echo WORKSPACE: %WORKSPACE%
247 echo JAVA_HOME: %JAVA_HOME%
248 echo ANT_HOME: %ANT_HOME%
249 echo XMLBEANS_HOME: %XMLBEANS_HOME%
250 echo CYGWIN_HOME: %CYGWIN_HOME%
251 echo PATH: %PATH%
252 echo.
253 set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
254 set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
255 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
256 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
257 set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
258 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
259 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-dom.jar;%CLASSPATH%
260 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-xpath.jar;%CLASSPATH%
261 set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
262 set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
263 set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
264 set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
265 set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
266 set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
267 set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
268 set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
269 set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
270 echo CLASSPATH: %CLASSPATH%
271 goto end
272
273 :Reconfig
274 @REM
275 @REM Reinstall all config files
276 @REM
277 call ant -f %WORKSPACE%\Tools\build.xml reconfig
278 goto end
279
280 :Usage
281 echo.
282 echo Usage: %0 [--nt32] [NewBuild] [Rebuild] [ForceRebuild] [Reconfig]
283 echo --nt32 Call vsvars32.bat for NT32 platform build
284 echo NewBuild Using new build tools in BaseTools package
285 echo Rebuild: Incremental build, only build those updated tools;
286 echo ForceRebuild: Rebuild all tools neither updated or not;
287 echo Reconfig: Reinstall target.txt, tools_def.txt, FrameworkDatabase.db.
288 echo.
289 echo Note that target.template, tools_def.template, FrameworkDatabase.template will be
290 echo only copied to target.txt, tools_def.txt, FrameworkDatabase.db respectively if they
291 echo are not existed. Using option [Reconfig] to do the force copy.
292 echo.
293 @goto end
294
295 :NewBuild
296 @IF NOT EXIST "BaseTools\toolsetup.bat" goto AntBuild
297 if not defined EDK_TOOLS_PATH set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
298 @call BaseTools\toolsetup.bat
299 @goto end
300
301 :end
302 @popd
303 @echo on
304