blob: 740537faa699fd5f0166eede603ac5a6501dfb3f [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
31set WORKSPACE=%CD%
32
33@if /I "%1"=="NewBuild" goto NewBuild
34
35:AntBuild
36@REM
yshi8a29212b2006-05-09 06:11:05 +000037@REM Check the required system environment variables
38@REM
39
bbahnsen878ddf12006-04-21 22:54:32 +000040:check_vc
yshi8a29212b2006-05-09 06:11:05 +000041if defined VCINSTALLDIR goto check_cygwin
bbahnsen878ddf12006-04-21 22:54:32 +000042if defined VS71COMNTOOLS (
wuyizhongb0108f02006-07-19 06:10:12 +000043 call "%VS71COMNTOOLS%\vsvars32.bat"
bbahnsen878ddf12006-04-21 22:54:32 +000044) else (
45 echo.
46 echo !!! WARNING !!!! Cannot find Visual Studio !!!
47 echo.
48)
49
yshi8a29212b2006-05-09 06:11:05 +000050:check_cygwin
51if defined CYGWIN_HOME goto check_java
52if exist c:\cygwin (
53 set CYGWIN_HOME=c:\cygwin
lhauch42b67fc2006-04-25 19:59:29 +000054) else (
yshi8a29212b2006-05-09 06:11:05 +000055 echo.
56 echo !!! WARNING !!!! Not set CYGWIN_HOME, gcc build may not be used !!!
57 echo.
bbahnsen878ddf12006-04-21 22:54:32 +000058)
59
yshi8a29212b2006-05-09 06:11:05 +000060:check_java
61if "%JAVA_HOME%"=="" goto no_jdk
62
63:check_ant
bbahnsen02996842006-04-21 23:36:37 +000064if "%ANT_HOME%"=="" goto no_ant
lhauch42b67fc2006-04-25 19:59:29 +000065if not exist %ANT_HOME%\lib\ant-contrib.jar goto no_antcontrib
66
yshi8a29212b2006-05-09 06:11:05 +000067:check_xmlbeans
bbahnsen02996842006-04-21 23:36:37 +000068if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
lhauch42b67fc2006-04-25 19:59:29 +000069if not exist %XMLBEANS_HOME%\lib\saxon8.jar goto no_saxon8
70
qouyang2da89682006-06-08 09:11:56 +000071set FRAMEWORK_TOOLS_PATH=%WORKSPACE%\Tools\bin
lhauch6de5f952006-06-09 18:07:09 +000072
wuyizhonga9008cd2006-11-01 03:12:47 +000073if not defined ORIGINAL_CLASSPATH set ORIGINAL_CLASSPATH=%CLASSPATH%
jwang36eb614e72006-10-17 06:24:21 +000074set CLASSPATH=%ORIGINAL_CLASSPATH%
75
lhauch6de5f952006-06-09 18:07:09 +000076if defined WORKSPACE_TOOLS_PATH goto check_path
77set PATH=%FRAMEWORK_TOOLS_PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;%XMLBEANS_HOME%\bin;%PATH%
78set WORKSPACE_TOOLS_PATH=%FRAMEWORK_TOOLS_PATH%
lhauch11f009f2006-07-24 16:03:47 +000079echo Setting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
lhauch6de5f952006-06-09 18:07:09 +000080goto path_ok
81
82:check_path
83if "%FRAMEWORK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok
84set PATH=%FRAMEWORK_TOOLS_PATH%;%PATH%
lhauch13681232006-08-08 19:48:49 +000085set WORKSPACE_TOOLS_PATH=%WORKSPACE%\Tools\bin
lhauch11f009f2006-07-24 16:03:47 +000086echo Resetting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
lhauch6de5f952006-06-09 18:07:09 +000087
88:path_ok
89
wuyizhongd02920e2006-12-12 05:35:03 +000090@if /I "%1"=="-h" goto Usage
91@if /I "%1"=="-help" goto Usage
92@if /I "%1"=="--help" goto Usage
93@if /I "%1"=="/h" goto Usage
94@if /I "%1"=="/?" goto Usage
95@if /I "%1"=="/help" goto Usage
96@if /I "%1"=="ForceRebuild" goto ForceBuild
97@if /I "%1"=="Reconfig" goto Reconfig
yshi8a29212b2006-05-09 06:11:05 +000098
lhauch70edbc32006-07-14 06:46:15 +000099@IF NOT EXIST "Tools\Jars\Common.jar" goto NormalBuild
klu2fb102512006-07-31 19:06:25 +0000100@IF NOT EXIST "Tools\Jars\PcdTools.jar" goto NormalBuild
lhauch70edbc32006-07-14 06:46:15 +0000101@IF NOT EXIST "Tools\Jars\GenBuild.jar" goto NormalBuild
102@IF NOT EXIST "Tools\Jars\SurfaceArea.jar" goto NormalBuild
103@IF NOT EXIST "Tools\Jars\cpptasks.jar" goto NormalBuild
104@IF NOT EXIST "Tools\Jars\frameworktasks.jar" goto NormalBuild
105@IF NOT EXIST "Tools\bin\FrameworkWizard.jar" goto NormalBuild
106@IF NOT EXIST "Tools\bin\CompressDll.dll" goto NormalBuild
107@IF NOT EXIST "Tools\bin\CompressDll.lib" goto NormalBuild
108@IF NOT EXIST "Tools\bin\CreateMtFile.exe" goto NormalBuild
109@IF NOT EXIST "Tools\bin\EfiCompress.exe" goto NormalBuild
110@IF NOT EXIST "Tools\bin\EfiRom.exe" goto NormalBuild
111@IF NOT EXIST "Tools\bin\FlashMap.exe" goto NormalBuild
112@IF NOT EXIST "Tools\bin\FwImage.exe" goto NormalBuild
113@IF NOT EXIST "Tools\bin\GenAcpiTable.exe" goto NormalBuild
114@IF NOT EXIST "Tools\bin\GenCRC32Section.exe" goto NormalBuild
115@IF NOT EXIST "Tools\bin\GenCapsuleHdr.exe" goto NormalBuild
116@IF NOT EXIST "Tools\bin\GenDepex.exe" goto NormalBuild
117@IF NOT EXIST "Tools\bin\GenFfsFile.exe" goto NormalBuild
118@IF NOT EXIST "Tools\bin\GenFvImage.exe" goto NormalBuild
lhauch70edbc32006-07-14 06:46:15 +0000119@IF NOT EXIST "Tools\bin\GenSection.exe" goto NormalBuild
120@IF NOT EXIST "Tools\bin\GenTEImage.exe" goto NormalBuild
121@IF NOT EXIST "Tools\bin\GuidChk.exe" goto NormalBuild
122@IF NOT EXIST "Tools\bin\MakeDeps.exe" goto NormalBuild
123@IF NOT EXIST "Tools\bin\ModifyInf.exe" goto NormalBuild
124@IF NOT EXIST "Tools\bin\PeiRebase_Ia32.exe" goto NormalBuild
125@IF NOT EXIST "Tools\bin\PeiRebase_Ipf.exe" goto NormalBuild
126@IF NOT EXIST "Tools\bin\PeiRebase_X64.exe" goto NormalBuild
127@IF NOT EXIST "Tools\bin\SecApResetVectorFixup.exe" goto NormalBuild
128@IF NOT EXIST "Tools\bin\SecFixup.exe" goto NormalBuild
129@IF NOT EXIST "Tools\bin\SetStamp.exe" goto NormalBuild
130@IF NOT EXIST "Tools\bin\SplitFile.exe" goto NormalBuild
131@IF NOT EXIST "Tools\bin\StrGather.exe" goto NormalBuild
132@IF NOT EXIST "Tools\bin\Strip.exe" goto NormalBuild
133@IF NOT EXIST "Tools\bin\VfrCompile.exe" goto NormalBuild
134@IF NOT EXIST "Tools\bin\ZeroDebugData.exe" goto NormalBuild
135@IF NOT EXIST "Tools\bin\antlr.exe" goto NormalBuild
136@IF NOT EXIST "Tools\bin\dlg.exe" goto NormalBuild
yshi8a29212b2006-05-09 06:11:05 +0000137
wuyizhongd02920e2006-12-12 05:35:03 +0000138@if /I "%1"=="Rebuild" goto NormalBuild
lhauch11f009f2006-07-24 16:03:47 +0000139@if NOT "%1"=="" goto Usage
lhauch70edbc32006-07-14 06:46:15 +0000140
141goto skipbuild
142
qouyang3a9b7222006-08-28 13:06:24 +0000143:ForceBuild
jwang36eb614e72006-10-17 06:24:21 +0000144call ant -f %WORKSPACE%\Tools\build.xml -noclasspath cleanall
lhauch70edbc32006-07-14 06:46:15 +0000145
146:NormalBuild
yshi8a29212b2006-05-09 06:11:05 +0000147@REM
148@REM Start to build the Framework Tools
149@REM
150
151echo.
152echo Building the Framework Tools
153echo.
154
155@REM
156@REM We are going to create the SurfaceArea.jar file first so that the other
157@REM Java Programs can use it.
158@REM It needs the XMLBEANS libraries in order to compile.
159@REM
jwang36d2f9b392006-10-19 07:12:29 +0000160set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
161set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
162set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
163set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
164set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
165set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
166set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
bbahnsen878ddf12006-04-21 22:54:32 +0000167
yshi8a29212b2006-05-09 06:11:05 +0000168call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea
bbahnsen878ddf12006-04-21 22:54:32 +0000169
yshi8a29212b2006-05-09 06:11:05 +0000170@REM
bbahnsen878ddf12006-04-21 22:54:32 +0000171@REM Now we can make the other Java Programs
lhauch53cef582006-04-28 19:32:18 +0000172@REM All of the remaining Java Programs require the SurfaceArea library to compile
yshi8a29212b2006-05-09 06:11:05 +0000173@REM
jwang36d2f9b392006-10-19 07:12:29 +0000174set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
qouyangb9546cc2006-06-20 11:57:17 +0000175
yshi8a29212b2006-05-09 06:11:05 +0000176call ant -f %WORKSPACE%\Tools\build.xml JavaCode
bbahnsen878ddf12006-04-21 22:54:32 +0000177
yshi8a29212b2006-05-09 06:11:05 +0000178@REM
179@REM We have all of the Java Programs and add-in classes created, so we can start
180@REM using the cpp-tasks to create our tools
181@REM
jwang36d2f9b392006-10-19 07:12:29 +0000182set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
183set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
184set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
185set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
186set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
187set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
188set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
bbahnsen878ddf12006-04-21 22:54:32 +0000189
yshi8a29212b2006-05-09 06:11:05 +0000190call ant -f %WORKSPACE%\Tools\build.xml C_Code
bbahnsen878ddf12006-04-21 22:54:32 +0000191
yshi8a29212b2006-05-09 06:11:05 +0000192@REM
193@REM Done!!!
194@REM
bbahnsen878ddf12006-04-21 22:54:32 +0000195goto end
196
197:no_jdk
198echo.
bbahnsen02996842006-04-21 23:36:37 +0000199echo !!! Please install Java, and set JAVA_HOME !!!
200echo.
yshi8a29212b2006-05-09 06:11:05 +0000201goto end
bbahnsen02996842006-04-21 23:36:37 +0000202
203:no_ant
204echo.
205echo !!! Please install Apache Ant, and set ANT_HOME !!!
206echo.
yshi8a29212b2006-05-09 06:11:05 +0000207goto end
bbahnsen02996842006-04-21 23:36:37 +0000208
lhauch42b67fc2006-04-25 19:59:29 +0000209:no_antcontrib
210echo.
211echo !!! Please install Ant-contrib to ANT_HOME !!!
212echo.
yshi8a29212b2006-05-09 06:11:05 +0000213goto end
lhauch42b67fc2006-04-25 19:59:29 +0000214
bbahnsen02996842006-04-21 23:36:37 +0000215:no_xmlbeans
216echo.
217echo !!! Please install XML Beans, and set XMLBEANS_HOME !!!
bbahnsen878ddf12006-04-21 22:54:32 +0000218echo.
yshi8a29212b2006-05-09 06:11:05 +0000219goto end
bbahnsen878ddf12006-04-21 22:54:32 +0000220
lhauch42b67fc2006-04-25 19:59:29 +0000221:no_saxon8
222echo.
223echo !!! Please copy saxon8.jar file to XMLBEANS_HOME\lib !!!
224echo.
yshi8a29212b2006-05-09 06:11:05 +0000225goto end
lhauch42b67fc2006-04-25 19:59:29 +0000226
lhauch302e0e42006-06-09 15:26:28 +0000227:skipbuild
228@REM
229@REM This just sets up the CLASSPATH, the rest of the environment should have been set already.
230@REM
lhauch302e0e42006-06-09 15:26:28 +0000231echo.
lhauch6de5f952006-06-09 18:07:09 +0000232echo WORKSPACE: %WORKSPACE%
lhauch302e0e42006-06-09 15:26:28 +0000233echo JAVA_HOME: %JAVA_HOME%
234echo ANT_HOME: %ANT_HOME%
235echo XMLBEANS_HOME: %XMLBEANS_HOME%
236echo CYGWIN_HOME: %CYGWIN_HOME%
lhauch302e0e42006-06-09 15:26:28 +0000237echo PATH: %PATH%
238echo.
jwang36d2f9b392006-10-19 07:12:29 +0000239set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
240set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
241set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
242set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
243set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
244set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
jwang3651ac2ff2007-01-10 02:15:11 +0000245set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-dom.jar;%CLASSPATH%
246set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-xpath.jar;%CLASSPATH%
jwang36d2f9b392006-10-19 07:12:29 +0000247set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
248set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
249set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
250set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
251set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
252set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
253set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
254set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
255set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
lhauch11f009f2006-07-24 16:03:47 +0000256echo CLASSPATH: %CLASSPATH%
lhauch302e0e42006-06-09 15:26:28 +0000257goto end
258
wuyizhong2fcfed32006-10-17 07:07:24 +0000259:Reconfig
260@REM
261@REM Reinstall all config files
262@REM
263call ant -f %WORKSPACE%\Tools\build.xml reconfig
264goto end
265
lhauch70edbc32006-07-14 06:46:15 +0000266:Usage
267echo.
wuyizhong2fcfed32006-10-17 07:07:24 +0000268echo Usage: %0 [Rebuild] [ForceRebuild] [Reconfig]
269echo Rebuild: Incremental build, only build those updated tools;
270echo ForceRebuild: Rebuild all tools neither updated or not;
271echo Reconfig: Reinstall target.txt, tools_def.txt, FrameworkDatabase.db.
272echo.
273echo Note that target.template, tools_def.template, FrameworkDatabase.template will be
274echo only copied to target.txt, tools_def.txt, FrameworkDatabase.db respectively if they
275echo are not existed. Using option [Reconfig] to do the force copy.
lhauch70edbc32006-07-14 06:46:15 +0000276echo.
277
jwang363fab94e2007-06-22 06:25:37 +0000278:NewBuild
279@IF NOT EXIST "BaseTools\toolsetup.bat" goto AntBuild
280@set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
281@call BaseTools\toolsetup.bat
282@goto end
283
bbahnsen878ddf12006-04-21 22:54:32 +0000284:end
285@echo on
286