1@REM @file 2@REM Windows batch file to setup a WORKSPACE environment 3@REM 4@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> 5@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR> 6@REM This program and the accompanying materials 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 10@REM 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 15@REM set CYGWIN_HOME=C:\cygwin 16 17@REM usage: 18@REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig] 19@REM if the argument, skip is present, only the paths and the 20@REM test and set of environment settings are performed. 21 22@REM ############################################################## 23@REM # You should not have to modify anything below this line 24@REM # 25 26@echo off 27 28@REM 29@REM Set the WORKSPACE to the current working directory 30@REM 31pushd . 32cd %~dp0 33 34if not defined WORKSPACE ( 35 goto SetWorkSpace 36) 37 38if %WORKSPACE% == %CD% ( 39 @REM Workspace is not changed. 40 goto ParseArgs 41) 42 43:SetWorkSpace 44@REM set new workspace 45@REM clear EFI_SOURCE and EDK_SOURCE for the new workspace 46if not defined WORKSPACE ( 47 set WORKSPACE=%CD% 48 set EFI_SOURCE= 49 set EDK_SOURCE= 50) 51 52:ParseArgs 53if /I "%1"=="-h" goto Usage 54if /I "%1"=="-help" goto Usage 55if /I "%1"=="--help" goto Usage 56if /I "%1"=="/h" goto Usage 57if /I "%1"=="/?" goto Usage 58if /I "%1"=="/help" goto Usage 59 60if /I "%1"=="NewBuild" shift 61if not defined EDK_TOOLS_PATH ( 62 if exist %WORKSPACE%\BaseTools ( 63 set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools 64 ) else ( 65 if defined PACKAGES_PATH ( 66 for %%i IN (%PACKAGES_PATH%) DO ( 67 if exist %%~fi\BaseTools ( 68 set EDK_TOOLS_PATH=%%~fi\BaseTools 69 goto checkNt32Flag 70 ) 71 ) 72 ) else ( 73 echo. 74 echo !!! ERROR !!! Cannot find BaseTools !!! 75 echo. 76 goto BadBaseTools 77 ) 78 ) 79) 80 81:checkNt32Flag 82if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH% 83 84@REM The Nt32 Emluation Platform requires Microsoft Libraries 85@REM and headers to interface with Windows. 86if /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 96:checkBaseTools 97IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools 98call %EDK_TOOLS_PATH%\toolsetup.bat %* 99if /I "%1"=="Reconfig" shift 100goto check_NASM 101goto check_cygwin 102 103:BadBaseTools 104 @REM 105 REM Need the BaseTools Package in order to build 106 @REM 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 116 117:check_NASM 118if 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 126:check_cygwin 127if 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 ( 134 if exist c:\cygwin ( 135 set CYGWIN_HOME=c:\cygwin 136 ) else ( 137 @echo. 138 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!! 139 @echo. 140 ) 141) 142 143:cygwin_done 144if "%1"=="" goto end 145 146:Usage 147 @echo. 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. 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 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. 164 @echo. 165 goto end 166 167:end 168 popd 169 170