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