-call ant -f %WORKSPACE%Tools\build.xml SurfaceArea\r
-\r
-@REM Now we can make the other Java Programs\r
-@REM All of the remaining Java Programs require the SurfaceArea library to compile\r
-set CLASSPATH=%CLASSPATH%;%WORKSPACE%Tools\Jars\SurfaceArea.jar\r
-\r
-call ant -f %WORKSPACE%Tools\build.xml JavaCode\r
-\r
-@REM We have all of the Java Programs and add-in classes created, so we can start using the cpp-tasks to create our tools\r
-set CLASSPATH=%CLASSPATH%;%WORKSPACE%Tools\Jars\SurfaceArea.jar;%WORKSPACE%Tools\Jars\GenBuild.jar\r
-set CLASSPATH=%CLASSPATH%;%WORKSPACE%Tools\Jars\cpptasks.jar;%WORKSPACE%Tools\Jars\frameworktasks.jar\r
-\r
-call ant -f %WORKSPACE%Tools\build.xml C_Code\r
-\r
-goto end\r
-\r
-:no_jdk\r
-echo.\r
-echo !!! Please install Java, and set JAVA_HOME !!!\r
-echo.\r
-goto end \r
-\r
-:no_ant\r
-echo.\r
-echo !!! Please install Apache Ant, and set ANT_HOME !!!\r
-echo.\r
-goto end \r
-\r
-:no_antcontrib\r
-echo.\r
-echo !!! Please install Ant-contrib to ANT_HOME !!!\r
-echo.\r
-goto end \r
-\r
-:no_xmlbeans\r
-echo.\r
-echo !!! Please install XML Beans, and set XMLBEANS_HOME !!!\r
-echo.\r
-goto end \r
+if /I "%1"=="NewBuild" shift\r
+if exist %WORKSPACE%\BaseTools (\r
+ set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools\r
+) else (\r
+ if defined PACKAGES_PATH (\r
+ for %%i IN (%PACKAGES_PATH%) DO (\r
+ if exist %%~fi\BaseTools (\r
+ set EDK_TOOLS_PATH=%%~fi\BaseTools\r
+ goto checkBaseTools\r
+ )\r
+ )\r
+ ) else (\r
+ echo.\r
+ echo !!! ERROR !!! Cannot find BaseTools !!!\r
+ echo. \r
+ goto BadBaseTools\r
+ )\r
+)\r
+if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%\r
+\r
+:checkBaseTools\r
+IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools\r
+call %EDK_TOOLS_PATH%\toolsetup.bat %*\r
+if /I "%1"=="Reconfig" shift\r
+goto check_cygwin\r
+\r
+:BadBaseTools\r
+ @REM\r
+ REM Need the BaseTools Package in order to build\r
+ @REM\r
+ @echo.\r
+ @echo !!! ERROR !!! The BaseTools Package was not found !!!\r
+ @echo.\r
+ @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,\r
+ @echo For example,\r
+ @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools\r
+ @echo The setup script, toolsetup.bat must reside in this folder.\r
+ @echo.\r
+ goto end\r
+\r
+:check_cygwin\r
+if defined CYGWIN_HOME (\r
+ if not exist "%CYGWIN_HOME%" (\r
+ @echo.\r
+ @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!\r
+ @echo.\r
+ )\r
+) else (\r
+ if exist c:\cygwin (\r
+ set CYGWIN_HOME=c:\cygwin\r
+ ) else (\r
+ @echo.\r
+ @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!\r
+ @echo.\r
+ )\r
+)\r