]> git.proxmox.com Git - mirror_edk2.git/blob - edksetup.bat
Port PlatformDriOverrideDxe into R9.
[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 if 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 )
55 shift
56
57 :check_new_build
58 @if /I "%1"=="NewBuild" goto NewBuild
59
60 :AntBuild
61 @REM
62 @REM Check the required system environment variables
63 @REM
64
65 :check_vc
66 if defined VCINSTALLDIR goto check_cygwin
67 if defined VS71COMNTOOLS (
68 call "%VS71COMNTOOLS%\vsvars32.bat"
69 ) else (
70 echo.
71 echo !!! WARNING !!! Cannot find Visual Studio !!!
72 echo.
73 )
74
75 :check_cygwin
76 if defined CYGWIN_HOME goto check_java
77 if exist c:\cygwin (
78 set CYGWIN_HOME=c:\cygwin
79 ) else (
80 echo.
81 echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
82 echo.
83 )
84
85 :check_java
86 if "%JAVA_HOME%"=="" goto no_jdk
87
88 :check_ant
89 if "%ANT_HOME%"=="" goto no_ant
90 if not exist %ANT_HOME%\lib\ant-contrib.jar goto no_antcontrib
91
92 :check_xmlbeans
93 if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
94 if not exist %XMLBEANS_HOME%\lib\saxon8.jar goto no_saxon8
95
96 set FRAMEWORK_TOOLS_PATH=%WORKSPACE%\Tools\bin
97
98 if not defined ORIGINAL_CLASSPATH set ORIGINAL_CLASSPATH=%CLASSPATH%
99 set CLASSPATH=%ORIGINAL_CLASSPATH%
100
101 if defined WORKSPACE_TOOLS_PATH goto check_path
102 set PATH=%FRAMEWORK_TOOLS_PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;%XMLBEANS_HOME%\bin;%PATH%
103 set WORKSPACE_TOOLS_PATH=%FRAMEWORK_TOOLS_PATH%
104 echo Setting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
105 goto path_ok
106
107 :check_path
108 if "%FRAMEWORK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok
109 set PATH=%FRAMEWORK_TOOLS_PATH%;%PATH%
110 set WORKSPACE_TOOLS_PATH=%WORKSPACE%\Tools\bin
111 echo Resetting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
112
113 :path_ok
114
115 @if /I "%1"=="ForceRebuild" goto ForceBuild
116 @if /I "%1"=="Reconfig" goto Reconfig
117
118 @IF NOT EXIST "Tools\Jars\Common.jar" goto NormalBuild
119 @IF NOT EXIST "Tools\Jars\PcdTools.jar" goto NormalBuild
120 @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
138 @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
156
157 @if /I "%1"=="Rebuild" goto NormalBuild
158 @if NOT "%1"=="" goto Usage
159
160 goto skipbuild
161
162 :ForceBuild
163 call ant -f %WORKSPACE%\Tools\build.xml -noclasspath cleanall
164
165 :NormalBuild
166 @REM
167 @REM Start to build the Framework Tools
168 @REM
169
170 echo.
171 echo Building the Framework Tools
172 echo.
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
179 set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
180 set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
181 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
182 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
183 set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
184 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
185 set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
186
187 call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea
188
189 @REM
190 @REM Now we can make the other Java Programs
191 @REM All of the remaining Java Programs require the SurfaceArea library to compile
192 @REM
193 set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
194
195 call ant -f %WORKSPACE%\Tools\build.xml JavaCode
196
197 @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
201 set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
202 set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
203 set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
204 set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
205 set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
206 set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
207 set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
208
209 call ant -f %WORKSPACE%\Tools\build.xml C_Code
210
211 @REM
212 @REM Done!!!
213 @REM
214 goto end
215
216 :no_jdk
217 echo.
218 echo !!! Please install Java, and set JAVA_HOME !!!
219 echo.
220 goto end
221
222 :no_ant
223 echo.
224 echo !!! Please install Apache Ant, and set ANT_HOME !!!
225 echo.
226 goto end
227
228 :no_antcontrib
229 echo.
230 echo !!! Please install Ant-contrib to ANT_HOME !!!
231 echo.
232 goto end
233
234 :no_xmlbeans
235 echo.
236 echo !!! Please install XML Beans, and set XMLBEANS_HOME !!!
237 echo.
238 goto end
239
240 :no_saxon8
241 echo.
242 echo !!! Please copy saxon8.jar file to XMLBEANS_HOME\lib !!!
243 echo.
244 goto end
245
246 :skipbuild
247 @REM
248 @REM This just sets up the CLASSPATH, the rest of the environment should have been set already.
249 @REM
250 echo.
251 echo WORKSPACE: %WORKSPACE%
252 echo JAVA_HOME: %JAVA_HOME%
253 echo ANT_HOME: %ANT_HOME%
254 echo XMLBEANS_HOME: %XMLBEANS_HOME%
255 echo CYGWIN_HOME: %CYGWIN_HOME%
256 echo PATH: %PATH%
257 echo.
258 set CLASSPATH=%XMLBEANS_HOME%\lib;%CLASSPATH%
259 set CLASSPATH=%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar;%CLASSPATH%
260 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean.jar;%CLASSPATH%
261 set CLASSPATH=%XMLBEANS_HOME%\lib\xbean_xpath.jar;%CLASSPATH%
262 set CLASSPATH=%XMLBEANS_HOME%\lib\xmlpublic.jar;%CLASSPATH%
263 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8.jar;%CLASSPATH%
264 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-dom.jar;%CLASSPATH%
265 set CLASSPATH=%XMLBEANS_HOME%\lib\saxon8-xpath.jar;%CLASSPATH%
266 set CLASSPATH=%XMLBEANS_HOME%\lib\resolver.jar;%CLASSPATH%
267 set CLASSPATH=%WORKSPACE%\Tools\Jars\SurfaceArea.jar;%CLASSPATH%
268 set CLASSPATH=%WORKSPACE%\Tools\Jars\Common.jar;%CLASSPATH%
269 set CLASSPATH=%WORKSPACE%\Tools\Jars\PcdTools.jar;%CLASSPATH%
270 set CLASSPATH=%WORKSPACE%\Tools\Jars\GenBuild.jar;%CLASSPATH%
271 set CLASSPATH=%WORKSPACE%\Tools\Jars\cpptasks.jar;%CLASSPATH%
272 set CLASSPATH=%WORKSPACE%\Tools\Jars\frameworktasks.jar;%CLASSPATH%
273 set CLASSPATH=%WORKSPACE%\Tools\Bin\FrameworkWizard.jar;%CLASSPATH%
274 set CLASSPATH=%WORKSPACE%\Tools\Bin\MigrationTools.jar;%CLASSPATH%
275 echo CLASSPATH: %CLASSPATH%
276 goto end
277
278 :Reconfig
279 @REM
280 @REM Reinstall all config files
281 @REM
282 call ant -f %WORKSPACE%\Tools\build.xml reconfig
283 goto end
284
285 :Usage
286 echo.
287 echo Usage: "%0 [--nt32] [NewBuild | Rebuild | ForceRebuild | Reconfig]"
288 echo --nt32 Call vsvars32.bat for NT32 platform build
289 echo NewBuild Using new build tools in BaseTools package
290 echo Rebuild Incremental build, only build those updated tools (Ant build only)
291 echo ForceRebuild Rebuild all tools neither updated or not (Ant build only)
292 echo Reconfig Reinstall target.txt, tools_def.txt, FrameworkDatabase.db (Ant build only)
293 echo.
294 echo Note that target.template, tools_def.template, FrameworkDatabase.template will be
295 echo only copied to target.txt, tools_def.txt, FrameworkDatabase.db respectively if they
296 echo are not existed. Using option [Reconfig] to do the force copy.
297 echo.
298 @goto end
299
300 :NewBuild
301 @IF NOT EXIST "BaseTools\toolsetup.bat" goto AntBuild
302 if not defined EDK_TOOLS_PATH set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
303 @call BaseTools\toolsetup.bat
304 @goto end
305
306 :end
307 @popd
308 @echo on
309