]> git.proxmox.com Git - mirror_edk2.git/blame - edksetup.bat
Code have been checked with spec
[mirror_edk2.git] / edksetup.bat
CommitLineData
8014e7ce 1@REM @file\r
2@REM Windows batch file to setup a WORKSPACE environment\r
878ddf1f 3@REM\r
8014e7ce 4@REM Copyright (c) 2006 - 2008, Intel Corporation\r
878ddf1f 5@REM All rights reserved. This program and the accompanying materials\r
6@REM are licensed and made available under the terms and conditions of the BSD License\r
7@REM which accompanies this distribution. The full text of the license may be found at\r
8@REM http://opensource.org/licenses/bsd-license.php\r
a29212b2 9@REM\r
878ddf1f 10@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12@REM\r
13\r
8014e7ce 14@REM set following environment in this file or in command shell for the older,\r
15@REM JAVA/Ant build\r
9dac0c36 16@REM set JAVA_HOME=C:\Java\jdk1.5.0_06\r
a29212b2 17@REM set ANT_HOME=C:\ANT\r
18@REM set XMLBEANS_HOME=C:\xmlbeans\r
19@REM set CYGWIN_HOME=C:\cygwin\r
878ddf1f 20\r
8014e7ce 21@REM usage: \r
22@REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]\r
302e0e4a 23@REM if the argument, skip is present, only the paths and the\r
24@REM test and set of environment settings are performed. \r
878ddf1f 25\r
26@REM ##############################################################\r
27@REM # You should not have to modify anything below this line\r
28@REM #\r
29\r
30@echo off\r
31\r
3fab94ed 32@REM\r
33@REM Set the WORKSPACE to the current working directory\r
34@REM\r
b7509087 35pushd .\r
36cd %~dp0\r
3fab94ed 37set WORKSPACE=%CD%\r
38\r
26096d36 39@if /I "%1"=="-h" goto Usage\r
40@if /I "%1"=="-help" goto Usage\r
41@if /I "%1"=="--help" goto Usage\r
42@if /I "%1"=="/h" goto Usage\r
43@if /I "%1"=="/?" goto Usage\r
44@if /I "%1"=="/help" goto Usage\r
8014e7ce 45\r
46@if /I not "%1"=="--nt32" goto check_Ant_build\r
47\r
48@REM Flag, --nt32 is set\r
49@REM The Nt32 Emluation Platform requires Microsoft Libraries\r
50@REM and headers to interface with Windows.\r
51\r
402bbc76 52if not defined VCINSTALLDIR (\r
53 if defined VS71COMNTOOLS (\r
54 call "%VS71COMNTOOLS%\vsvars32.bat"\r
55 ) else (\r
56 if defined VS80COMNTOOLS (\r
57 call "%VS80COMNTOOLS%\vsvars32.bat"\r
58 ) else (\r
59 echo.\r
60 echo !!! WARNING !!! Cannot find Visual Studio !!!\r
61 echo.\r
62 )\r
63 )\r
64)\r
b7509087 65shift\r
b7509087 66\r
8014e7ce 67:check_Ant_build\r
68 @if /I "%1"=="AntBuild" goto AntBuild\r
3fab94ed 69\r
a29212b2 70@REM\r
8014e7ce 71@REM Default is new, Makefile Base Build\r
a29212b2 72@REM\r
73\r
8014e7ce 74@if /I "%1"=="NewBuild" shift\r
75@if not defined EDK_TOOLS_PATH set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools\r
76@IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools\r
77@call %EDK_TOOLS_PATH%\toolsetup.bat %*\r
78@goto end\r
79\r
80:BadBaseTools\r
81 @REM\r
82 @REM Need the BaseTools Package in order to build\r
83 @REM\r
878ddf1f 84 echo.\r
8014e7ce 85 echo !!! ERROR !!! The BaseTools Package was not found !!!\r
878ddf1f 86 echo.\r
8014e7ce 87 echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,\r
88 echo For example,\r
89 echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools\r
90 echo The setup script, toolsetup.bat must reside in this folder.\r
91 echo.\r
92 @goto end\r
93\r
94@REM With the exception of the :end and :Usage tags, all information below\r
95@REM these lines is for the JAVA/Ant Build!\r
96\r
97:AntBuild\r
98 @REM\r
99 @REM Check the required system environment variables\r
100 @REM\r
101 @if /I "%1"=="AntBuild" shift\r
102\r
103 set FOUND="FALSE"\r
104 if exist "Tools\Jars" set FOUND="TRUE"\r
105 if exist "%EDK_TOOLS_PATH%\Tools\Jars" set FOUND="TRUE"\r
106 if %FOUND%=="FALSE" (\r
107 echo.\r
108 echo !!! ERROR !!! You have selected the Java/Ant build, however those tools\r
109 echo cannot be found in this WORKSPACE.\r
110 echo.\r
111 echo Please double check that the AntTools project is installed\r
112 echo in this WORKSPACE.\r
113 echo.\r
114 set FOUND=""\r
115 goto end\r
116 )\r
117 set FOUND=""\r
118\r
119:check_vc\r
120 if defined VCINSTALLDIR goto check_cygwin\r
121 if defined VS71COMNTOOLS (\r
122 call "%VS71COMNTOOLS%\vsvars32.bat"\r
123 ) else (\r
124 echo.\r
125 echo !!! WARNING !!! Cannot find Visual Studio !!!\r
126 echo.\r
127 )\r
878ddf1f 128\r
a29212b2 129:check_cygwin\r
8014e7ce 130 if defined CYGWIN_HOME goto check_java\r
131 if exist c:\cygwin (\r
132 set CYGWIN_HOME=c:\cygwin\r
133 ) else (\r
134 echo.\r
135 echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!\r
136 echo.\r
137 )\r
878ddf1f 138\r
a29212b2 139:check_java\r
8014e7ce 140 if "%JAVA_HOME%"=="" goto no_jdk\r
a29212b2 141\r
142:check_ant\r
8014e7ce 143 if "%ANT_HOME%"=="" goto no_ant\r
144 if not exist %ANT_HOME%\lib\ant-contrib.jar goto no_antcontrib\r
42b67fc4 145\r
a29212b2 146:check_xmlbeans\r
8014e7ce 147 if "%XMLBEANS_HOME%"=="" goto no_xmlbeans\r
148 if not exist %XMLBEANS_HOME%\lib\saxon8.jar goto no_saxon8\r
878ddf1f 149\r
2da8968b 150set FRAMEWORK_TOOLS_PATH=%WORKSPACE%\Tools\bin\r
6de5f959 151\r
a9008cdd 152if not defined ORIGINAL_CLASSPATH set ORIGINAL_CLASSPATH=%CLASSPATH%\r
eb614e7e 153set CLASSPATH=%ORIGINAL_CLASSPATH%\r
154\r
6de5f959 155if defined WORKSPACE_TOOLS_PATH goto check_path\r
156set PATH=%FRAMEWORK_TOOLS_PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;%XMLBEANS_HOME%\bin;%PATH%\r
157set WORKSPACE_TOOLS_PATH=%FRAMEWORK_TOOLS_PATH%\r
11f009f1 158echo Setting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE\r
6de5f959 159goto path_ok\r
160\r
161:check_path\r
8014e7ce 162 if "%FRAMEWORK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok\r
163 set PATH=%FRAMEWORK_TOOLS_PATH%;%PATH%\r
164 set WORKSPACE_TOOLS_PATH=%WORKSPACE%\Tools\bin\r
165 echo Resetting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE\r
6de5f959 166\r
167:path_ok\r
168\r
8014e7ce 169 @if /I "%1"=="ForceRebuild" goto ForceBuild\r
170 @if /I "%1"=="Reconfig" goto Reconfig\r
70edbc34 171\r
172@IF NOT EXIST "Tools\Jars\Common.jar" goto NormalBuild\r
fb102512 173@IF NOT EXIST "Tools\Jars\PcdTools.jar" goto NormalBuild\r
70edbc34 174@IF NOT EXIST "Tools\Jars\GenBuild.jar" goto NormalBuild\r
175@IF NOT EXIST "Tools\Jars\SurfaceArea.jar" goto NormalBuild\r
176@IF NOT EXIST "Tools\Jars\cpptasks.jar" goto NormalBuild\r
177@IF NOT EXIST "Tools\Jars\frameworktasks.jar" goto NormalBuild\r
178@IF NOT EXIST "Tools\bin\FrameworkWizard.jar" goto NormalBuild\r
179@IF NOT EXIST "Tools\bin\CompressDll.dll" goto NormalBuild\r
180@IF NOT EXIST "Tools\bin\CompressDll.lib" goto NormalBuild\r
181@IF NOT EXIST "Tools\bin\CreateMtFile.exe" goto NormalBuild\r
182@IF NOT EXIST "Tools\bin\EfiCompress.exe" goto NormalBuild\r
183@IF NOT EXIST "Tools\bin\EfiRom.exe" goto NormalBuild\r
184@IF NOT EXIST "Tools\bin\FlashMap.exe" goto NormalBuild\r
185@IF NOT EXIST "Tools\bin\FwImage.exe" goto NormalBuild\r
186@IF NOT EXIST "Tools\bin\GenAcpiTable.exe" goto NormalBuild\r
187@IF NOT EXIST "Tools\bin\GenCRC32Section.exe" goto NormalBuild\r
188@IF NOT EXIST "Tools\bin\GenCapsuleHdr.exe" goto NormalBuild\r
189@IF NOT EXIST "Tools\bin\GenDepex.exe" goto NormalBuild\r
190@IF NOT EXIST "Tools\bin\GenFfsFile.exe" goto NormalBuild\r
191@IF NOT EXIST "Tools\bin\GenFvImage.exe" goto NormalBuild\r
70edbc34 192@IF NOT EXIST "Tools\bin\GenSection.exe" goto NormalBuild\r
193@IF NOT EXIST "Tools\bin\GenTEImage.exe" goto NormalBuild\r
194@IF NOT EXIST "Tools\bin\GuidChk.exe" goto NormalBuild\r
195@IF NOT EXIST "Tools\bin\MakeDeps.exe" goto NormalBuild\r
196@IF NOT EXIST "Tools\bin\ModifyInf.exe" goto NormalBuild\r
197@IF NOT EXIST "Tools\bin\PeiRebase_Ia32.exe" goto NormalBuild\r
198@IF NOT EXIST "Tools\bin\PeiRebase_Ipf.exe" goto NormalBuild\r
199@IF NOT EXIST "Tools\bin\PeiRebase_X64.exe" goto NormalBuild\r
200@IF NOT EXIST "Tools\bin\SecApResetVectorFixup.exe" goto NormalBuild\r
201@IF NOT EXIST "Tools\bin\SecFixup.exe" goto NormalBuild\r
202@IF NOT EXIST "Tools\bin\SetStamp.exe" goto NormalBuild\r
203@IF NOT EXIST "Tools\bin\SplitFile.exe" goto NormalBuild\r
204@IF NOT EXIST "Tools\bin\StrGather.exe" goto NormalBuild\r
205@IF NOT EXIST "Tools\bin\Strip.exe" goto NormalBuild\r
206@IF NOT EXIST "Tools\bin\VfrCompile.exe" goto NormalBuild\r
207@IF NOT EXIST "Tools\bin\ZeroDebugData.exe" goto NormalBuild\r
208@IF NOT EXIST "Tools\bin\antlr.exe" goto NormalBuild\r
209@IF NOT EXIST "Tools\bin\dlg.exe" goto NormalBuild\r
210\r
d02920ea 211@if /I "%1"=="Rebuild" goto NormalBuild\r
11f009f1 212@if NOT "%1"=="" goto Usage\r
70edbc34 213\r
214goto skipbuild\r
215\r
3a9b7229 216:ForceBuild \r
8014e7ce 217 call ant -f %WORKSPACE%\Tools\build.xml -noclasspath cleanall\r
878ddf1f 218\r
70edbc34 219:NormalBuild\r
8014e7ce 220 @REM\r
221 @REM Start to build the Framework Tools\r
222 @REM\r
b9546cc8 223\r
8014e7ce 224 echo.\r
225 echo Building the Framework Tools\r
226 echo.\r
878ddf1f 227\r
8014e7ce 228 @REM\r
229 @REM We are going to create the SurfaceArea.jar file first so that the other\r
230 @REM Java Programs can use it.\r
231 @REM It needs the XMLBEANS libraries in order to compile.\r
232 @REM\r
233 set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%\r
234 set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%\r
235 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%\r
236 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%\r
237 set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%\r
238 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%\r
239 set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%\r
240\r
241 call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea\r
242\r
243 @REM\r
244 @REM Now we can make the other Java Programs\r
245 @REM All of the remaining Java Programs require the SurfaceArea library to compile\r
246 @REM\r
247 set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%\r
248\r
249 call ant -f %WORKSPACE%\Tools\build.xml JavaCode\r
250\r
251 @REM\r
252 @REM We have all of the Java Programs and add-in classes created, so we can start\r
253 @REM using the cpp-tasks to create our tools\r
254 @REM\r
255 set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%\r
256 set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%\r
257 set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%\r
258 set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%\r
259 set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%\r
260 set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%\r
261 set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%\r
262\r
263 call ant -f %WORKSPACE%\Tools\build.xml C_Code\r
264\r
265 @REM\r
266 @REM Done!!!\r
267 @REM\r
268 goto end\r
878ddf1f 269\r
270:no_jdk\r
8014e7ce 271 echo.\r
272 echo !!! Please install Java, and set JAVA_HOME !!!\r
273 echo.\r
274 goto end\r
02996846 275\r
276:no_ant\r
8014e7ce 277 echo.\r
278 echo !!! Please install Apache Ant, and set ANT_HOME !!!\r
279 echo.\r
280 goto end\r
02996846 281\r
42b67fc4 282:no_antcontrib\r
8014e7ce 283 echo.\r
284 echo !!! Please install Ant-contrib to ANT_HOME !!!\r
285 echo.\r
286 goto end\r
42b67fc4 287\r
02996846 288:no_xmlbeans\r
8014e7ce 289 echo.\r
290 echo !!! Please install XML Beans, and set XMLBEANS_HOME !!!\r
291 echo.\r
292 goto end\r
878ddf1f 293\r
42b67fc4 294:no_saxon8\r
8014e7ce 295 echo.\r
296 echo !!! Please copy saxon8.jar file to XMLBEANS_HOME\lib !!!\r
297 echo.\r
298 goto end\r
42b67fc4 299\r
302e0e4a 300:skipbuild\r
8014e7ce 301 @REM\r
302 @REM This just sets up the CLASSPATH, the rest of the environment should have been set already.\r
303 @REM\r
304 echo.\r
305 echo WORKSPACE: %WORKSPACE%\r
306 echo JAVA_HOME: %JAVA_HOME%\r
307 echo ANT_HOME: %ANT_HOME%\r
308 echo XMLBEANS_HOME: %XMLBEANS_HOME%\r
309 echo CYGWIN_HOME: %CYGWIN_HOME%\r
310 echo PATH: %PATH%\r
311 echo.\r
312 set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%\r
313 set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%\r
314 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%\r
315 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%\r
316 set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%\r
317 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%\r
318 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-dom.jar;%CLASSPATH%\r
319 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-xpath.jar;%CLASSPATH%\r
320 set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%\r
321 set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%\r
322 set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%\r
323 set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%\r
324 set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%\r
325 set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%\r
326 set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%\r
327 set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%\r
328 set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%\r
329 echo CLASSPATH: %CLASSPATH%\r
330 goto end\r
302e0e4a 331\r
2fcfed38 332:Reconfig\r
8014e7ce 333 @REM\r
334 @REM Reinstall all config files\r
335 @REM\r
336 call ant -f %WORKSPACE%\Tools\build.xml reconfig\r
337 goto end\r
2fcfed38 338\r
70edbc34 339:Usage\r
8014e7ce 340 echo.\r
341 echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32] [AntBuild | Rebuild | ForceRebuild ] [Reconfig]"\r
342 echo --nt32 Call vsvars32.bat for NT32 platform build.\r
343 echo.\r
344 echo Rebuild If sources are available perform an Incremental build, only \r
345 echo build those updated tools.\r
346 echo ForceRebuild If sources are available, rebuild all tools regardless of \r
347 echo whether they have been updated or not.\r
348 echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r
349 echo.\r
350 echo JAVA/ANT Build\r
351 echo AntBuild Using older Java/ANT build tools in Tools directory.\r
352 echo Rebuild Incremental build, only build those updated tools.\r
353 echo ForceRebuild Rebuild all tools regardless of whether they have been updated or not.\r
354 echo Reconfig Reinstall target.txt, tools_def.txt and FrameworkDatabase.db.\r
355 echo.\r
356 echo Note that target.template, tools_def.template, build_rules.template and the \r
357 echo FrameworkDatabase.template will be only copied to target.txt, tools_def.txt, build_rule.txt and\r
358 echo FrameworkDatabase.db respectively if they do not exist. Using option [Reconfig] to force the copy. \r
359 echo.\r
360 @goto end\r
3fab94ed 361\r
878ddf1f 362:end\r
8014e7ce 363 @popd\r
364 @echo on\r
878ddf1f 365\r