Prefixed global variable with "m"
[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_04
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]
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 Check the required system environment variables
30 @REM
31
32 :check_vc
33 if defined VCINSTALLDIR goto check_cygwin
34 if defined VS71COMNTOOLS (
35 call "%VS71COMNTOOLS%\vsvars32.bat"
36 ) else (
37 echo.
38 echo !!! WARNING !!!! Cannot find Visual Studio !!!
39 echo.
40 )
41
42 :check_cygwin
43 if defined CYGWIN_HOME goto check_java
44 if exist c:\cygwin (
45 set CYGWIN_HOME=c:\cygwin
46 ) else (
47 echo.
48 echo !!! WARNING !!!! Not set CYGWIN_HOME, gcc build may not be used !!!
49 echo.
50 )
51
52 :check_java
53 if "%JAVA_HOME%"=="" goto no_jdk
54
55 :check_ant
56 if "%ANT_HOME%"=="" goto no_ant
57 if not exist %ANT_HOME%\lib\ant-contrib.jar goto no_antcontrib
58
59 :check_xmlbeans
60 if "%XMLBEANS_HOME%"=="" goto no_xmlbeans
61 if not exist %XMLBEANS_HOME%\lib\saxon8.jar goto no_saxon8
62
63 @REM
64 @REM Set the WORKSPACE to the current working directory
65 @REM
66 set WORKSPACE=%CD%
67
68 set FRAMEWORK_TOOLS_PATH=%WORKSPACE%\Tools\bin
69
70 if defined WORKSPACE_TOOLS_PATH goto check_path
71 set PATH=%FRAMEWORK_TOOLS_PATH%;%JAVA_HOME%\bin;%ANT_HOME%\bin;%XMLBEANS_HOME%\bin;%PATH%
72 set WORKSPACE_TOOLS_PATH=%FRAMEWORK_TOOLS_PATH%
73 echo Setting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
74 goto path_ok
75
76 :check_path
77 if "%FRAMEWORK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok
78 set PATH=%FRAMEWORK_TOOLS_PATH%;%PATH%
79 set WORKSPACE_TOOLS_PATH=%WORKSPACE%\Tools\bin
80 echo Resetting the PATH variable to include the FRAMEWORK_TOOLS_PATH for this WORKSPACE
81
82 :path_ok
83
84 @if "%1"=="-h" goto Usage
85 @if "%1"=="-help" goto Usage
86 @if "%1"=="--help" goto Usage
87 @if "%1"=="/h" goto Usage
88 @if "%1"=="/?" goto Usage
89 @if "%1"=="/help" goto Usage
90
91 @IF NOT EXIST "Tools\Jars\Common.jar" goto NormalBuild
92 @IF NOT EXIST "Tools\Jars\PcdTools.jar" goto NormalBuild
93 @IF NOT EXIST "Tools\Jars\GenBuild.jar" goto NormalBuild
94 @IF NOT EXIST "Tools\Jars\SurfaceArea.jar" goto NormalBuild
95 @IF NOT EXIST "Tools\Jars\cpptasks.jar" goto NormalBuild
96 @IF NOT EXIST "Tools\Jars\frameworktasks.jar" goto NormalBuild
97 @IF NOT EXIST "Tools\bin\FrameworkWizard.jar" goto NormalBuild
98 @IF NOT EXIST "Tools\bin\CompressDll.dll" goto NormalBuild
99 @IF NOT EXIST "Tools\bin\CompressDll.lib" goto NormalBuild
100 @IF NOT EXIST "Tools\bin\CreateMtFile.exe" goto NormalBuild
101 @IF NOT EXIST "Tools\bin\EfiCompress.exe" goto NormalBuild
102 @IF NOT EXIST "Tools\bin\EfiRom.exe" goto NormalBuild
103 @IF NOT EXIST "Tools\bin\FlashMap.exe" goto NormalBuild
104 @IF NOT EXIST "Tools\bin\FwImage.exe" goto NormalBuild
105 @IF NOT EXIST "Tools\bin\GenAcpiTable.exe" goto NormalBuild
106 @IF NOT EXIST "Tools\bin\GenCRC32Section.exe" goto NormalBuild
107 @IF NOT EXIST "Tools\bin\GenCapsuleHdr.exe" goto NormalBuild
108 @IF NOT EXIST "Tools\bin\GenDepex.exe" goto NormalBuild
109 @IF NOT EXIST "Tools\bin\GenFfsFile.exe" goto NormalBuild
110 @IF NOT EXIST "Tools\bin\GenFvImage.exe" goto NormalBuild
111 @IF NOT EXIST "Tools\bin\GenSection.exe" goto NormalBuild
112 @IF NOT EXIST "Tools\bin\GenTEImage.exe" goto NormalBuild
113 @IF NOT EXIST "Tools\bin\GuidChk.exe" goto NormalBuild
114 @IF NOT EXIST "Tools\bin\MakeDeps.exe" goto NormalBuild
115 @IF NOT EXIST "Tools\bin\ModifyInf.exe" goto NormalBuild
116 @IF NOT EXIST "Tools\bin\PeiRebase_Ia32.exe" goto NormalBuild
117 @IF NOT EXIST "Tools\bin\PeiRebase_Ipf.exe" goto NormalBuild
118 @IF NOT EXIST "Tools\bin\PeiRebase_X64.exe" goto NormalBuild
119 @IF NOT EXIST "Tools\bin\SecApResetVectorFixup.exe" goto NormalBuild
120 @IF NOT EXIST "Tools\bin\SecFixup.exe" goto NormalBuild
121 @IF NOT EXIST "Tools\bin\SetStamp.exe" goto NormalBuild
122 @IF NOT EXIST "Tools\bin\SplitFile.exe" goto NormalBuild
123 @IF NOT EXIST "Tools\bin\StrGather.exe" goto NormalBuild
124 @IF NOT EXIST "Tools\bin\Strip.exe" goto NormalBuild
125 @IF NOT EXIST "Tools\bin\VfrCompile.exe" goto NormalBuild
126 @IF NOT EXIST "Tools\bin\ZeroDebugData.exe" goto NormalBuild
127 @IF NOT EXIST "Tools\bin\antlr.exe" goto NormalBuild
128 @IF NOT EXIST "Tools\bin\dlg.exe" goto NormalBuild
129
130 @if "%1"=="Rebuild" goto NormalBuild
131 @if "%1"=="ForceRebuild" goto ForceBuild
132 @if NOT "%1"=="" goto Usage
133
134 goto skipbuild
135
136 :ForceBuild
137 call ant -noclasspath -f %WORKSPACE%\Tools\build.xml cleanall
138
139 :NormalBuild
140 @REM
141 @REM Start to build the Framework Tools
142 @REM
143
144 echo.
145 echo Building the Framework Tools
146 echo.
147
148 @REM
149 @REM We are going to create the SurfaceArea.jar file first so that the other
150 @REM Java Programs can use it.
151 @REM It needs the XMLBEANS libraries in order to compile.
152 @REM
153 set CLASSPATH=%XMLBEANS_HOME%\lib
154 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar
155 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\xbean.jar
156 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\xbean_xpath.jar
157 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\xmlpublic.jar
158 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\saxon8.jar
159 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\resolver.jar
160
161 call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea
162
163 @REM
164 @REM Now we can make the other Java Programs
165 @REM All of the remaining Java Programs require the SurfaceArea library to compile
166 @REM
167 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\SurfaceArea.jar
168
169 call ant -f %WORKSPACE%\Tools\build.xml JavaCode
170
171 @REM
172 @REM We have all of the Java Programs and add-in classes created, so we can start
173 @REM using the cpp-tasks to create our tools
174 @REM
175 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\Common.jar
176 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\PcdTools.jar
177 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\GenBuild.jar
178 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\cpptasks.jar
179 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\frameworktasks.jar
180 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Bin\FrameworkWizard.jar
181 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Bin\MigrationTools.jar
182
183 call ant -f %WORKSPACE%\Tools\build.xml C_Code
184
185 @REM
186 @REM Done!!!
187 @REM
188 goto end
189
190 :no_jdk
191 echo.
192 echo !!! Please install Java, and set JAVA_HOME !!!
193 echo.
194 goto end
195
196 :no_ant
197 echo.
198 echo !!! Please install Apache Ant, and set ANT_HOME !!!
199 echo.
200 goto end
201
202 :no_antcontrib
203 echo.
204 echo !!! Please install Ant-contrib to ANT_HOME !!!
205 echo.
206 goto end
207
208 :no_xmlbeans
209 echo.
210 echo !!! Please install XML Beans, and set XMLBEANS_HOME !!!
211 echo.
212 goto end
213
214 :no_saxon8
215 echo.
216 echo !!! Please copy saxon8.jar file to XMLBEANS_HOME\lib !!!
217 echo.
218 goto end
219
220 :skipbuild
221 @REM
222 @REM This just sets up the CLASSPATH, the rest of the environment should have been set already.
223 @REM
224 echo.
225 echo WORKSPACE: %WORKSPACE%
226 echo JAVA_HOME: %JAVA_HOME%
227 echo ANT_HOME: %ANT_HOME%
228 echo XMLBEANS_HOME: %XMLBEANS_HOME%
229 echo CYGWIN_HOME: %CYGWIN_HOME%
230 echo PATH: %PATH%
231 echo.
232 set CLASSPATH=%XMLBEANS_HOME%\lib
233 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\jsr173_1.0_api.jar
234 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\xbean.jar
235 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\xbean_xpath.jar
236 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\xmlpublic.jar
237 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\saxon8.jar
238 set CLASSPATH=%CLASSPATH%;%XMLBEANS_HOME%\lib\resolver.jar
239 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\SurfaceArea.jar
240 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\Common.jar
241 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\PcdTools.jar
242 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\GenBuild.jar
243 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\cpptasks.jar
244 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\frameworktasks.jar
245 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Bin\FrameworkWizard.jar
246 echo CLASSPATH: %CLASSPATH%
247 goto end
248
249 :Usage
250 echo.
251 echo Usage: %0 [Rebuild] [ForceRebuild]
252 echo.
253
254 :end
255 @echo on
256