blob: 91b83c637d21ead17e07639b06bc7b6b9af383bf [file] [log] [blame]
bbahnsen878ddf12006-04-21 22:54:32 +00001@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
yshi8a29212b2006-05-09 06:11:05 +00007@REM
bbahnsen878ddf12006-04-21 22:54:32 +00008@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
lhauch9dac0c32006-10-10 23:03:33 +000013@REM set JAVA_HOME=C:\Java\jdk1.5.0_06
yshi8a29212b2006-05-09 06:11:05 +000014@REM set ANT_HOME=C:\ANT
15@REM set XMLBEANS_HOME=C:\xmlbeans
16@REM set CYGWIN_HOME=C:\cygwin
bbahnsen878ddf12006-04-21 22:54:32 +000017
wuyizhong2fcfed32006-10-17 07:07:24 +000018@REM usage: edksetup.bat [Rebuild] [ForceRebuild] [Reconfig]
lhauch302e0e42006-06-09 15:26:28 +000019@REM if the argument, skip is present, only the paths and the
20@REM test and set of environment settings are performed.
bbahnsen878ddf12006-04-21 22:54:32 +000021
22@REM ##############################################################
23@REM # You should not have to modify anything below this line
24@REM #
25
26@echo off
27
yshi8a29212b2006-05-09 06:11:05 +000028@REM
jwang363fab94e2007-06-22 06:25:37 +000029@REM Set the WORKSPACE to the current working directory
30@REM
jwang36b7509082007-10-11 08:58:33 +000031pushd .
32cd %~dp0
jwang363fab94e2007-06-22 06:25:37 +000033set WORKSPACE=%CD%
34
jwang3626096d32007-10-15 01:58:41 +000035@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
jwang36b7509082007-10-11 08:58:33 +000041@if /I not "%1"=="--nt32" goto check_new_build
jwang36402bbc72007-10-31 09:12:54 +000042if not defined VCINSTALLDIR (
43 if defined VS71COMNTOOLS (
44 call "%VS71COMNTOOLS%\vsvars32.bat"
45 ) else (
46 if defined VS80COMNTOOLS (
47 call "%VS80COMNTOOLS%\vsvars32.bat"
48 ) else (
49 echo.
50 echo !!! WARNING !!! Cannot find Visual Studio !!!
51 echo.
52 )
53 )
54)
jwang36b7509082007-10-11 08:58:33 +000055shift
jwang36b7509082007-10-11 08:58:33 +000056
57:check_new_build
jwang363fab94e2007-06-22 06:25:37 +000058@if /I "%1"=="NewBuild" goto NewBuild
59
60:AntBuild
61@REM
yshi8a29212b2006-05-09 06:11:05 +000062@REM Check the required system environment variables
63@REM
64
bbahnsen878ddf12006-04-21 22:54:32 +000065:check_vc
yshi8a29212b2006-05-09 06:11:05 +000066if defined VCINSTALLDIR goto check_cygwin
bbahnsen878ddf12006-04-21 22:54:32 +000067if defined VS71COMNTOOLS (
jwang36402bbc72007-10-31 09:12:54 +000068 call "%VS71COMNTOOLS%\vsvars32.bat"
bbahnsen878ddf12006-04-21 22:54:32 +000069) else (
70 echo.
jwang36402bbc72007-10-31 09:12:54 +000071 echo !!! WARNING !!! Cannot find Visual Studio !!!
bbahnsen878ddf12006-04-21 22:54:32 +000072 echo.
73)
74
yshi8a29212b2006-05-09 06:11:05 +000075:check_cygwin
76if defined CYGWIN_HOME goto check_java
77if exist c:\cygwin (
78 set CYGWIN_HOME=c:\cygwin
lhauch42b67fc2006-04-25 19:59:29 +000079) else (
yshi8a29212b2006-05-09 06:11:05 +000080 echo.
jwang36402bbc72007-10-31 09:12:54 +000081 echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
yshi8a29212b2006-05-09 06:11:05 +000082 echo.
bbahnsen878ddf12006-04-21 22:54:32 +000083)
84
yshi8a29212b2006-05-09 06:11:05 +000085:check_java
86if "%JAVA_HOME%"=="" goto no_jdk
87
88:check_ant
bbahnsen02996842006-04-21 23:36:37 +000089if "%ANT_HOME%"=="" goto no_ant
lhauch42b67fc2006-04-25 19:59:29 +000090if not exist %ANT_HOME%\lib\ant-contrib.jar goto no_antcontrib
91
yshi8a29212b2006-05-09 06:11:05 +000092:check_xmlbeans
bbahnsen02996842006-04-21 23:36:37 +000093if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
lhauch42b67fc2006-04-25 19:59:29 +000094if not exist %XMLBEANS_HOME%\lib\saxon8.jar goto no_saxon8
95
qouyang2da89682006-06-08 09:11:56 +000096set FRAMEWORK_TOOLS_PATH=%WORKSPACE%\Tools\bin
lhauch6de5f952006-06-09 18:07:09 +000097
wuyizhonga9008cd2006-11-01 03:12:47 +000098if not defined ORIGINAL_CLASSPATH set ORIGINAL_CLASSPATH=%CLASSPATH%
jwang36eb614e72006-10-17 06:24:21 +000099set CLASSPATH=%ORIGINAL_CLASSPATH%
100
lhauch6de5f952006-06-09 18:07:09 +0000101if defined WORKSPACE_TOOLS_PATH goto check_path
102set PATH=%FRAMEWORK_TOOLS_PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;%XMLBEANS_HOME%\bin;%PATH%
103set WORKSPACE_TOOLS_PATH=%FRAMEWORK_TOOLS_PATH%
lhauch11f009f2006-07-24 16:03:47 +0000104echo Setting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
lhauch6de5f952006-06-09 18:07:09 +0000105goto path_ok
106
107:check_path
108if "%FRAMEWORK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok
109set PATH=%FRAMEWORK_TOOLS_PATH%;%PATH%
lhauch13681232006-08-08 19:48:49 +0000110set WORKSPACE_TOOLS_PATH=%WORKSPACE%\Tools\bin
lhauch11f009f2006-07-24 16:03:47 +0000111echo Resetting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
lhauch6de5f952006-06-09 18:07:09 +0000112
113:path_ok
114
wuyizhongd02920e2006-12-12 05:35:03 +0000115@if /I "%1"=="ForceRebuild" goto ForceBuild
116@if /I "%1"=="Reconfig" goto Reconfig
yshi8a29212b2006-05-09 06:11:05 +0000117
lhauch70edbc32006-07-14 06:46:15 +0000118@IF NOT EXIST "Tools\Jars\Common.jar" goto NormalBuild
klu2fb102512006-07-31 19:06:25 +0000119@IF NOT EXIST "Tools\Jars\PcdTools.jar" goto NormalBuild
lhauch70edbc32006-07-14 06:46:15 +0000120@IF NOT EXIST "Tools\Jars\GenBuild.jar" goto NormalBuild
121@IF NOT EXIST "Tools\Jars\SurfaceArea.jar" goto NormalBuild
122@IF NOT EXIST "Tools\Jars\cpptasks.jar" goto NormalBuild
123@IF NOT EXIST "Tools\Jars\frameworktasks.jar" goto NormalBuild
124@IF NOT EXIST "Tools\bin\FrameworkWizard.jar" goto NormalBuild
125@IF NOT EXIST "Tools\bin\CompressDll.dll" goto NormalBuild
126@IF NOT EXIST "Tools\bin\CompressDll.lib" goto NormalBuild
127@IF NOT EXIST "Tools\bin\CreateMtFile.exe" goto NormalBuild
128@IF NOT EXIST "Tools\bin\EfiCompress.exe" goto NormalBuild
129@IF NOT EXIST "Tools\bin\EfiRom.exe" goto NormalBuild
130@IF NOT EXIST "Tools\bin\FlashMap.exe" goto NormalBuild
131@IF NOT EXIST "Tools\bin\FwImage.exe" goto NormalBuild
132@IF NOT EXIST "Tools\bin\GenAcpiTable.exe" goto NormalBuild
133@IF NOT EXIST "Tools\bin\GenCRC32Section.exe" goto NormalBuild
134@IF NOT EXIST "Tools\bin\GenCapsuleHdr.exe" goto NormalBuild
135@IF NOT EXIST "Tools\bin\GenDepex.exe" goto NormalBuild
136@IF NOT EXIST "Tools\bin\GenFfsFile.exe" goto NormalBuild
137@IF NOT EXIST "Tools\bin\GenFvImage.exe" goto NormalBuild
lhauch70edbc32006-07-14 06:46:15 +0000138@IF NOT EXIST "Tools\bin\GenSection.exe" goto NormalBuild
139@IF NOT EXIST "Tools\bin\GenTEImage.exe" goto NormalBuild
140@IF NOT EXIST "Tools\bin\GuidChk.exe" goto NormalBuild
141@IF NOT EXIST "Tools\bin\MakeDeps.exe" goto NormalBuild
142@IF NOT EXIST "Tools\bin\ModifyInf.exe" goto NormalBuild
143@IF NOT EXIST "Tools\bin\PeiRebase_Ia32.exe" goto NormalBuild
144@IF NOT EXIST "Tools\bin\PeiRebase_Ipf.exe" goto NormalBuild
145@IF NOT EXIST "Tools\bin\PeiRebase_X64.exe" goto NormalBuild
146@IF NOT EXIST "Tools\bin\SecApResetVectorFixup.exe" goto NormalBuild
147@IF NOT EXIST "Tools\bin\SecFixup.exe" goto NormalBuild
148@IF NOT EXIST "Tools\bin\SetStamp.exe" goto NormalBuild
149@IF NOT EXIST "Tools\bin\SplitFile.exe" goto NormalBuild
150@IF NOT EXIST "Tools\bin\StrGather.exe" goto NormalBuild
151@IF NOT EXIST "Tools\bin\Strip.exe" goto NormalBuild
152@IF NOT EXIST "Tools\bin\VfrCompile.exe" goto NormalBuild
153@IF NOT EXIST "Tools\bin\ZeroDebugData.exe" goto NormalBuild
154@IF NOT EXIST "Tools\bin\antlr.exe" goto NormalBuild
155@IF NOT EXIST "Tools\bin\dlg.exe" goto NormalBuild
yshi8a29212b2006-05-09 06:11:05 +0000156
wuyizhongd02920e2006-12-12 05:35:03 +0000157@if /I "%1"=="Rebuild" goto NormalBuild
lhauch11f009f2006-07-24 16:03:47 +0000158@if NOT "%1"=="" goto Usage
lhauch70edbc32006-07-14 06:46:15 +0000159
160goto skipbuild
161
qouyang3a9b7222006-08-28 13:06:24 +0000162:ForceBuild
jwang36eb614e72006-10-17 06:24:21 +0000163call ant -f %WORKSPACE%\Tools\build.xml -noclasspath cleanall
lhauch70edbc32006-07-14 06:46:15 +0000164
165:NormalBuild
yshi8a29212b2006-05-09 06:11:05 +0000166@REM
167@REM Start to build the Framework Tools
168@REM
169
170echo.
171echo Building the Framework Tools
172echo.
173
174@REM
175@REM We are going to create the SurfaceArea.jar file first so that the other
176@REM Java Programs can use it.
177@REM It needs the XMLBEANS libraries in order to compile.
178@REM
jwang36d2f9b392006-10-19 07:12:29 +0000179set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
180set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
181set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
182set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
183set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
184set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
185set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
bbahnsen878ddf12006-04-21 22:54:32 +0000186
yshi8a29212b2006-05-09 06:11:05 +0000187call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea
bbahnsen878ddf12006-04-21 22:54:32 +0000188
yshi8a29212b2006-05-09 06:11:05 +0000189@REM
bbahnsen878ddf12006-04-21 22:54:32 +0000190@REM Now we can make the other Java Programs
lhauch53cef582006-04-28 19:32:18 +0000191@REM All of the remaining Java Programs require the SurfaceArea library to compile
yshi8a29212b2006-05-09 06:11:05 +0000192@REM
jwang36d2f9b392006-10-19 07:12:29 +0000193set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
qouyangb9546cc2006-06-20 11:57:17 +0000194
yshi8a29212b2006-05-09 06:11:05 +0000195call ant -f %WORKSPACE%\Tools\build.xml JavaCode
bbahnsen878ddf12006-04-21 22:54:32 +0000196
yshi8a29212b2006-05-09 06:11:05 +0000197@REM
198@REM We have all of the Java Programs and add-in classes created, so we can start
199@REM using the cpp-tasks to create our tools
200@REM
jwang36d2f9b392006-10-19 07:12:29 +0000201set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
202set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
203set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
204set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
205set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
206set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
207set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
bbahnsen878ddf12006-04-21 22:54:32 +0000208
yshi8a29212b2006-05-09 06:11:05 +0000209call ant -f %WORKSPACE%\Tools\build.xml C_Code
bbahnsen878ddf12006-04-21 22:54:32 +0000210
yshi8a29212b2006-05-09 06:11:05 +0000211@REM
212@REM Done!!!
213@REM
bbahnsen878ddf12006-04-21 22:54:32 +0000214goto end
215
216:no_jdk
217echo.
bbahnsen02996842006-04-21 23:36:37 +0000218echo !!! Please install Java, and set JAVA_HOME !!!
219echo.
yshi8a29212b2006-05-09 06:11:05 +0000220goto end
bbahnsen02996842006-04-21 23:36:37 +0000221
222:no_ant
223echo.
224echo !!! Please install Apache Ant, and set ANT_HOME !!!
225echo.
yshi8a29212b2006-05-09 06:11:05 +0000226goto end
bbahnsen02996842006-04-21 23:36:37 +0000227
lhauch42b67fc2006-04-25 19:59:29 +0000228:no_antcontrib
229echo.
230echo !!! Please install Ant-contrib to ANT_HOME !!!
231echo.
yshi8a29212b2006-05-09 06:11:05 +0000232goto end
lhauch42b67fc2006-04-25 19:59:29 +0000233
bbahnsen02996842006-04-21 23:36:37 +0000234:no_xmlbeans
235echo.
236echo !!! Please install XML Beans, and set XMLBEANS_HOME !!!
bbahnsen878ddf12006-04-21 22:54:32 +0000237echo.
yshi8a29212b2006-05-09 06:11:05 +0000238goto end
bbahnsen878ddf12006-04-21 22:54:32 +0000239
lhauch42b67fc2006-04-25 19:59:29 +0000240:no_saxon8
241echo.
242echo !!! Please copy saxon8.jar file to XMLBEANS_HOME\lib !!!
243echo.
yshi8a29212b2006-05-09 06:11:05 +0000244goto end
lhauch42b67fc2006-04-25 19:59:29 +0000245
lhauch302e0e42006-06-09 15:26:28 +0000246:skipbuild
247@REM
248@REM This just sets up the CLASSPATH, the rest of the environment should have been set already.
249@REM
lhauch302e0e42006-06-09 15:26:28 +0000250echo.
lhauch6de5f952006-06-09 18:07:09 +0000251echo WORKSPACE: %WORKSPACE%
lhauch302e0e42006-06-09 15:26:28 +0000252echo JAVA_HOME: %JAVA_HOME%
253echo ANT_HOME: %ANT_HOME%
254echo XMLBEANS_HOME: %XMLBEANS_HOME%
255echo CYGWIN_HOME: %CYGWIN_HOME%
lhauch302e0e42006-06-09 15:26:28 +0000256echo PATH: %PATH%
257echo.
jwang36d2f9b392006-10-19 07:12:29 +0000258set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
259set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
260set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
261set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
262set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
263set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
jwang3651ac2ff2007-01-10 02:15:11 +0000264set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-dom.jar;%CLASSPATH%
265set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-xpath.jar;%CLASSPATH%
jwang36d2f9b392006-10-19 07:12:29 +0000266set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
267set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
268set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
269set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
270set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
271set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
272set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
273set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
274set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
lhauch11f009f2006-07-24 16:03:47 +0000275echo CLASSPATH: %CLASSPATH%
lhauch302e0e42006-06-09 15:26:28 +0000276goto end
277
wuyizhong2fcfed32006-10-17 07:07:24 +0000278:Reconfig
279@REM
280@REM Reinstall all config files
281@REM
282call ant -f %WORKSPACE%\Tools\build.xml reconfig
283goto end
284
lhauch70edbc32006-07-14 06:46:15 +0000285:Usage
286echo.
jwang36402bbc72007-10-31 09:12:54 +0000287echo Usage: "%0 [--nt32] [NewBuild | Rebuild | ForceRebuild | Reconfig]"
jwang3626096d32007-10-15 01:58:41 +0000288echo --nt32 Call vsvars32.bat for NT32 platform build
289echo NewBuild Using new build tools in BaseTools package
jwang36402bbc72007-10-31 09:12:54 +0000290echo Rebuild Incremental build, only build those updated tools (Ant build only)
291echo ForceRebuild Rebuild all tools neither updated or not (Ant build only)
292echo Reconfig Reinstall target.txt, tools_def.txt, FrameworkDatabase.db (Ant build only)
wuyizhong2fcfed32006-10-17 07:07:24 +0000293echo.
294echo Note that target.template, tools_def.template, FrameworkDatabase.template will be
295echo only copied to target.txt, tools_def.txt, FrameworkDatabase.db respectively if they
296echo are not existed. Using option [Reconfig] to do the force copy.
lhauch70edbc32006-07-14 06:46:15 +0000297echo.
jwang3626096d32007-10-15 01:58:41 +0000298@goto end
lhauch70edbc32006-07-14 06:46:15 +0000299
jwang363fab94e2007-06-22 06:25:37 +0000300:NewBuild
jljusten5c240d72007-10-17 01:59:27 +0000301@IF NOT EXIST "BaseTools\toolsetup.bat" goto AntBuild
302if not defined EDK_TOOLS_PATH set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
303@call BaseTools\toolsetup.bat
jwang363fab94e2007-06-22 06:25:37 +0000304@goto end
305
bbahnsen878ddf12006-04-21 22:54:32 +0000306:end
jwang36b7509082007-10-11 08:58:33 +0000307@popd
bbahnsen878ddf12006-04-21 22:54:32 +0000308@echo on
309