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