lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 1 | @REM @file
|
| 2 | @REM Windows batch file to setup a WORKSPACE environment
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 3 | @REM
|
lhauch | b176333 | 2014-10-30 17:09:25 +0000 | [diff] [blame] | 4 | @REM Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
hhtian | 24542fb | 2010-04-29 15:17:20 +0000 | [diff] [blame] | 5 | @REM This program and the accompanying materials
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 6 | @REM are licensed and made available under the terms and conditions of the BSD License
|
| 7 | @REM which accompanies this distribution. The full text of the license may be found at
|
| 8 | @REM http://opensource.org/licenses/bsd-license.php
|
yshi8 | a29212b | 2006-05-09 06:11:05 +0000 | [diff] [blame] | 9 | @REM
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 10 | @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
| 11 | @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
| 12 | @REM
|
| 13 |
|
yshi8 | a29212b | 2006-05-09 06:11:05 +0000 | [diff] [blame] | 14 | @REM set CYGWIN_HOME=C:\cygwin
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 15 |
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 16 | @REM usage:
|
| 17 | @REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]
|
lhauch | 302e0e4 | 2006-06-09 15:26:28 +0000 | [diff] [blame] | 18 | @REM if the argument, skip is present, only the paths and the
|
| 19 | @REM test and set of environment settings are performed.
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 20 |
|
| 21 | @REM ##############################################################
|
| 22 | @REM # You should not have to modify anything below this line
|
| 23 | @REM #
|
| 24 |
|
| 25 | @echo off
|
| 26 |
|
yshi8 | a29212b | 2006-05-09 06:11:05 +0000 | [diff] [blame] | 27 | @REM
|
jwang36 | 3fab94e | 2007-06-22 06:25:37 +0000 | [diff] [blame] | 28 | @REM Set the WORKSPACE to the current working directory
|
| 29 | @REM
|
jwang36 | b750908 | 2007-10-11 08:58:33 +0000 | [diff] [blame] | 30 | pushd .
|
| 31 | cd %~dp0
|
jwang36 | 3fab94e | 2007-06-22 06:25:37 +0000 | [diff] [blame] | 32 |
|
lgao4 | dff2673 | 2010-01-26 04:58:56 +0000 | [diff] [blame] | 33 | if not defined WORKSPACE (
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 34 | goto SetWorkSpace
|
lgao4 | d27bd9e | 2010-01-26 02:42:37 +0000 | [diff] [blame] | 35 | )
|
| 36 |
|
lgao4 | dff2673 | 2010-01-26 04:58:56 +0000 | [diff] [blame] | 37 | if %WORKSPACE% == %CD% (
|
| 38 | @REM Workspace is not changed.
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 39 | goto ParseArgs
|
lgao4 | dff2673 | 2010-01-26 04:58:56 +0000 | [diff] [blame] | 40 | )
|
| 41 |
|
| 42 | :SetWorkSpace
|
lgao4 | d27bd9e | 2010-01-26 02:42:37 +0000 | [diff] [blame] | 43 | @REM set new workspace
|
| 44 | @REM clear EFI_SOURCE and EDK_SOURCE for the new workspace
|
Liming Gao | dcc8078 | 2015-10-08 09:29:09 +0000 | [diff] [blame] | 45 | if not defined WORKSPACE (
|
| 46 | set WORKSPACE=%CD%
|
| 47 | set EFI_SOURCE=
|
| 48 | set EDK_SOURCE=
|
| 49 | )
|
lgao4 | d27bd9e | 2010-01-26 02:42:37 +0000 | [diff] [blame] | 50 |
|
| 51 | :ParseArgs
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 52 | if /I "%1"=="-h" goto Usage
|
| 53 | if /I "%1"=="-help" goto Usage
|
| 54 | if /I "%1"=="--help" goto Usage
|
| 55 | if /I "%1"=="/h" goto Usage
|
| 56 | if /I "%1"=="/?" goto Usage
|
| 57 | if /I "%1"=="/help" goto Usage
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 58 |
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 59 | if /I not "%1"=="--nt32" goto no_nt32
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 60 |
|
| 61 | @REM Flag, --nt32 is set
|
| 62 | @REM The Nt32 Emluation Platform requires Microsoft Libraries
|
| 63 | @REM and headers to interface with Windows.
|
| 64 |
|
jwang36 | 402bbc7 | 2007-10-31 09:12:54 +0000 | [diff] [blame] | 65 | if not defined VCINSTALLDIR (
|
lhauch | b176333 | 2014-10-30 17:09:25 +0000 | [diff] [blame] | 66 | if defined VS120COMNTOOLS (
|
| 67 | call "%VS120COMNTOOLS%\vsvars32.bat"
|
jwang36 | 402bbc7 | 2007-10-31 09:12:54 +0000 | [diff] [blame] | 68 | ) else (
|
lhauch | b176333 | 2014-10-30 17:09:25 +0000 | [diff] [blame] | 69 | if defined VS110COMNTOOLS (
|
| 70 | call "%VS110COMNTOOLS%\vsvars32.bat"
|
jwang36 | 402bbc7 | 2007-10-31 09:12:54 +0000 | [diff] [blame] | 71 | ) else (
|
lhauch | b176333 | 2014-10-30 17:09:25 +0000 | [diff] [blame] | 72 | if defined VS100COMNTOOLS (
|
| 73 | call "%VS100COMNTOOLS%\vsvars32.bat"
|
ywang | c16243d | 2009-11-16 23:02:57 +0000 | [diff] [blame] | 74 | ) else (
|
lhauch | b176333 | 2014-10-30 17:09:25 +0000 | [diff] [blame] | 75 | if defined VS90COMNTOOLS (
|
| 76 | call "%VS90COMNTOOLS%\vsvars32.bat"
|
lgao4 | 48604ef | 2012-04-10 07:45:35 +0000 | [diff] [blame] | 77 | ) else (
|
lhauch | b176333 | 2014-10-30 17:09:25 +0000 | [diff] [blame] | 78 | if defined VS80COMNTOOLS (
|
| 79 | call "%VS80COMNTOOLS%\vsvars32.bat"
|
Liming Gao | 4c633da | 2013-09-04 07:41:04 +0000 | [diff] [blame] | 80 | ) else (
|
lhauch | b176333 | 2014-10-30 17:09:25 +0000 | [diff] [blame] | 81 | if defined VS71COMNTOOLS (
|
| 82 | call "%VS71COMNTOOLS%\vsvars32.bat"
|
| 83 | ) else (
|
| 84 | echo.
|
| 85 | echo !!! WARNING !!! Cannot find Visual Studio !!!
|
| 86 | echo.
|
| 87 | )
|
Liming Gao | 4c633da | 2013-09-04 07:41:04 +0000 | [diff] [blame] | 88 | )
|
lgao4 | 48604ef | 2012-04-10 07:45:35 +0000 | [diff] [blame] | 89 | )
|
ywang | c16243d | 2009-11-16 23:02:57 +0000 | [diff] [blame] | 90 | )
|
jwang36 | 402bbc7 | 2007-10-31 09:12:54 +0000 | [diff] [blame] | 91 | )
|
| 92 | )
|
| 93 | )
|
jwang36 | b750908 | 2007-10-11 08:58:33 +0000 | [diff] [blame] | 94 | shift
|
jwang36 | b750908 | 2007-10-11 08:58:33 +0000 | [diff] [blame] | 95 |
|
lhauch | 3a6b455 | 2008-12-31 16:57:24 +0000 | [diff] [blame] | 96 | :no_nt32
|
Liming Gao | dcc8078 | 2015-10-08 09:29:09 +0000 | [diff] [blame] | 97 |
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 98 | if /I "%1"=="NewBuild" shift
|
Liming Gao | dcc8078 | 2015-10-08 09:29:09 +0000 | [diff] [blame] | 99 | if exist %WORKSPACE%\BaseTools (
|
| 100 | set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
|
| 101 | ) else (
|
| 102 | if defined PACKAGES_PATH (
|
| 103 | for %%i IN (%PACKAGES_PATH%) DO (
|
| 104 | if exist %%~fi\BaseTools (
|
| 105 | set EDK_TOOLS_PATH=%%~fi\BaseTools
|
| 106 | goto checkBaseTools
|
| 107 | )
|
| 108 | )
|
| 109 | ) else (
|
| 110 | echo.
|
| 111 | echo !!! ERROR !!! Cannot find BaseTools !!!
|
| 112 | echo.
|
| 113 | goto BadBaseTools
|
| 114 | )
|
| 115 | )
|
| 116 | if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
|
| 117 |
|
| 118 | :checkBaseTools
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 119 | IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools
|
| 120 | call %EDK_TOOLS_PATH%\toolsetup.bat %*
|
| 121 | if /I "%1"=="Reconfig" shift
|
| 122 | goto check_cygwin
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 123 |
|
| 124 | :BadBaseTools
|
| 125 | @REM
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 126 | REM Need the BaseTools Package in order to build
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 127 | @REM
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 128 | @echo.
|
| 129 | @echo !!! ERROR !!! The BaseTools Package was not found !!!
|
| 130 | @echo.
|
| 131 | @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,
|
| 132 | @echo For example,
|
| 133 | @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools
|
| 134 | @echo The setup script, toolsetup.bat must reside in this folder.
|
| 135 | @echo.
|
| 136 | goto end
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 137 |
|
yshi8 | a29212b | 2006-05-09 06:11:05 +0000 | [diff] [blame] | 138 | :check_cygwin
|
Olivier Martin | 1f9c860 | 2014-02-24 14:14:13 +0000 | [diff] [blame] | 139 | if defined CYGWIN_HOME (
|
| 140 | if not exist "%CYGWIN_HOME%" (
|
| 141 | @echo.
|
| 142 | @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!
|
| 143 | @echo.
|
| 144 | )
|
| 145 | ) else (
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 146 | if exist c:\cygwin (
|
| 147 | set CYGWIN_HOME=c:\cygwin
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 148 | ) else (
|
lhauch | 3a6b455 | 2008-12-31 16:57:24 +0000 | [diff] [blame] | 149 | @echo.
|
| 150 | @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
|
| 151 | @echo.
|
lhauch | 8014e7c | 2008-02-22 16:31:23 +0000 | [diff] [blame] | 152 | )
|
Olivier Martin | 1f9c860 | 2014-02-24 14:14:13 +0000 | [diff] [blame] | 153 | )
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 154 |
|
Olivier Martin | 1f9c860 | 2014-02-24 14:14:13 +0000 | [diff] [blame] | 155 | :cygwin_done
|
| 156 | if "%1"=="" goto end
|
wuyizhong | 2fcfed3 | 2006-10-17 07:07:24 +0000 | [diff] [blame] | 157 |
|
lhauch | 70edbc3 | 2006-07-14 06:46:15 +0000 | [diff] [blame] | 158 | :Usage
|
lhauch | 3a6b455 | 2008-12-31 16:57:24 +0000 | [diff] [blame] | 159 | @echo.
|
| 160 | @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32] [Reconfig]"
|
| 161 | @echo --nt32 Call vsvars32.bat for NT32 platform build.
|
| 162 | @echo.
|
| 163 | @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
|
| 164 | @echo.
|
| 165 | @echo Note that target.template, tools_def.template and build_rules.template
|
Olivier Martin | 1f9c860 | 2014-02-24 14:14:13 +0000 | [diff] [blame] | 166 | @echo will only be copied to target.txt, tools_def.txt and build_rule.txt
|
| 167 | @echo respectively if they do not exist. Use option [Reconfig] to force the copy.
|
lhauch | 3a6b455 | 2008-12-31 16:57:24 +0000 | [diff] [blame] | 168 | @echo.
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 169 | goto end
|
jwang36 | 3fab94e | 2007-06-22 06:25:37 +0000 | [diff] [blame] | 170 |
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 171 | :end
|
Olivier Martin | 7ef23d9 | 2014-02-24 14:09:00 +0000 | [diff] [blame] | 172 | popd
|
bbahnsen | 878ddf1 | 2006-04-21 22:54:32 +0000 | [diff] [blame] | 173 |
|