| 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 | @echo off\r |
| 13 | \r |
| 14 | REM ##############################################################\r |
| 15 | REM # You should not have to modify anything below this line\r |
| 16 | REM #\r |
| 17 | \r |
| 18 | if /I "%1"=="-h" goto usage\r |
| 19 | if /I "%1"=="-help" goto usage\r |
| 20 | if /I "%1"=="--help" goto usage\r |
| 21 | if /I "%1"=="/h" goto usage\r |
| 22 | if /I "%1"=="/?" goto usage\r |
| 23 | if /I "%1"=="/help" goto usage\r |
| 24 | \r |
| 25 | if NOT "%1"=="" set EDK_TOOLS_PATH=%1\r |
| 26 | \r |
| 27 | REM\r |
| 28 | REM Check the required system environment variables\r |
| 29 | REM\r |
| 30 | \r |
| 31 | :check_vc\r |
| 32 | if defined VCINSTALLDIR goto setup_workspace\r |
| 33 | if defined VS71COMNTOOLS (\r |
| 34 | call "%VS71COMNTOOLS%\vsvars32.bat"\r |
| 35 | ) else (\r |
| 36 | echo.\r |
| 37 | echo !!!WARNING!!! Cannot find Visual Studio !!!\r |
| 38 | echo.\r |
| 39 | )\r |
| 40 | \r |
| 41 | :setup_workspace\r |
| 42 | REM\r |
| 43 | REM check the EDK_TOOLS_PATH\r |
| 44 | REM\r |
| 45 | if not defined EDK_TOOLS_PATH goto no_tools_path\r |
| 46 | if exist %EDK_TOOLS_PATH% goto set_path\r |
| 47 | echo.\r |
| 48 | echo !!!WARNING!!! %EDK_TOOLS_PATH% doesn't exist. %WORKSPACE%\Tools will be used !!!\r |
| 49 | echo.\r |
| 50 | \r |
| 51 | :no_tools_path\r |
| 52 | if exist %WORKSPACE%\BaseTools (\r |
| 53 | set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools\r |
| 54 | ) else (\r |
| 55 | echo.\r |
| 56 | echo !!!WARNING!!! No tools path found. Please set EDK_TOOLS_PATH !!!\r |
| 57 | echo.\r |
| 58 | goto end\r |
| 59 | )\r |
| 60 | \r |
| 61 | :set_path\r |
| 62 | if defined WORKSPACE_TOOLS_PATH goto check_path\r |
| 63 | set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%\r |
| 64 | set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%\r |
| 65 | goto path_ok\r |
| 66 | \r |
| 67 | :check_path\r |
| 68 | if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok\r |
| 69 | set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%\r |
| 70 | set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%\r |
| 71 | echo Resetting the PATH variable to include the EDK_TOOLS_PATH for this WORKSPACE\r |
| 72 | \r |
| 73 | :path_ok\r |
| 74 | echo PATH = %PATH%\r |
| 75 | echo.\r |
| 76 | echo WORKSPACE = %WORKSPACE%\r |
| 77 | echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%\r |
| 78 | echo.\r |
| 79 | \r |
| 80 | REM\r |
| 81 | REM copy *.template to %WORKSPACE%\Conf\r |
| 82 | REM\r |
| 83 | if NOT exist %WORKSPACE%\Conf mkdir %WORKSPACE%\Conf\r |
| 84 | if NOT exist %WORKSPACE%\Conf\FrameworkDatabase.db (\r |
| 85 | echo copying ... FrameworkDatabase.template to %WORKSPACE%\Conf\FrameworkDatabase.db\r |
| 86 | copy %EDK_TOOLS_PATH%\Conf\FrameworkDatabase.template %WORKSPACE%\Conf\FrameworkDatabase.db > nul\r |
| 87 | )\r |
| 88 | if NOT exist %WORKSPACE%\Conf\target.txt (\r |
| 89 | echo copying ... target.template to %WORKSPACE%\Conf\target.txt\r |
| 90 | copy %EDK_TOOLS_PATH%\Conf\target.template %WORKSPACE%\Conf\target.txt > nul\r |
| 91 | )\r |
| 92 | if NOT exist %WORKSPACE%\Conf\tools_def.txt (\r |
| 93 | echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt\r |
| 94 | copy %EDK_TOOLS_PATH%\Conf\tools_def.template %WORKSPACE%\Conf\tools_def.txt > nul\r |
| 95 | )\r |
| 96 | if NOT exist %WORKSPACE%\Conf\build_rule.txt (\r |
| 97 | echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt\r |
| 98 | copy %EDK_TOOLS_PATH%\Conf\build_rule.template %WORKSPACE%\Conf\build_rule.txt > nul\r |
| 99 | )\r |
| 100 | \r |
| 101 | REM\r |
| 102 | REM copy XMLSchema to %EDK_TOOLS_PATH%\Conf\XMLSchema\r |
| 103 | REM\r |
| 104 | REM echo copying ... XMLSchema to %EDK_TOOLS_PATH%\Conf\XMLSchema\r |
| 105 | REM xcopy %WORKSPACE%\Conf\XMLSchema %EDK_TOOLS_PATH%\Conf\XMLSchema /S /I /D /F /Q > nul\r |
| 106 | \r |
| 107 | REM\r |
| 108 | REM Done!!!\r |
| 109 | REM\r |
| 110 | goto end\r |
| 111 | \r |
| 112 | :usage\r |
| 113 | echo.\r |
| 114 | echo "Usage: %0 [/? | /h | /help | -h | -help | --help] [tools_path]"\r |
| 115 | echo.\r |
| 116 | echo tools_path Tools' path. EDK_TOOLS_PATH will be set to this path.\r |
| 117 | echo.\r |
| 118 | \r |
| 119 | :end\r |
| 120 | @echo on\r |
| 121 | \r |