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