2008-02-22 17:31:23 +01:00
|
|
|
@REM @file
|
|
|
|
@REM Windows batch file to setup a WORKSPACE environment
|
2006-04-22 00:54:32 +02:00
|
|
|
@REM
|
2019-09-19 10:52:26 +02:00
|
|
|
@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
|
2016-10-19 06:31:36 +02:00
|
|
|
@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
2019-04-04 01:02:46 +02:00
|
|
|
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
|
2006-04-22 00:54:32 +02:00
|
|
|
@REM
|
|
|
|
|
2006-05-09 08:11:05 +02:00
|
|
|
@REM set CYGWIN_HOME=C:\cygwin
|
2006-04-22 00:54:32 +02:00
|
|
|
|
2017-06-22 20:59:49 +02:00
|
|
|
@REM usage:
|
2008-02-22 17:31:23 +01:00
|
|
|
@REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]
|
2006-06-09 17:26:28 +02:00
|
|
|
@REM if the argument, skip is present, only the paths and the
|
2017-06-22 20:59:49 +02:00
|
|
|
@REM test and set of environment settings are performed.
|
2006-04-22 00:54:32 +02:00
|
|
|
|
|
|
|
@REM ##############################################################
|
|
|
|
@REM # You should not have to modify anything below this line
|
|
|
|
@REM #
|
|
|
|
|
|
|
|
@echo off
|
|
|
|
|
2007-06-22 08:25:37 +02:00
|
|
|
@REM
|
|
|
|
@REM Set the WORKSPACE to the current working directory
|
|
|
|
@REM
|
2007-10-11 10:58:33 +02:00
|
|
|
pushd .
|
|
|
|
cd %~dp0
|
2010-01-26 03:42:37 +01:00
|
|
|
|
2010-01-26 05:58:56 +01:00
|
|
|
if not defined WORKSPACE (
|
2014-02-24 15:09:00 +01:00
|
|
|
goto SetWorkSpace
|
2010-01-26 03:42:37 +01:00
|
|
|
)
|
|
|
|
|
2010-01-26 05:58:56 +01:00
|
|
|
if %WORKSPACE% == %CD% (
|
|
|
|
@REM Workspace is not changed.
|
2014-02-24 15:09:00 +01:00
|
|
|
goto ParseArgs
|
2010-01-26 05:58:56 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
:SetWorkSpace
|
2010-01-26 03:42:37 +01:00
|
|
|
@REM set new workspace
|
2015-10-08 11:29:09 +02:00
|
|
|
if not defined WORKSPACE (
|
|
|
|
set WORKSPACE=%CD%
|
|
|
|
)
|
2007-06-22 08:25:37 +02:00
|
|
|
|
2010-01-26 03:42:37 +01:00
|
|
|
:ParseArgs
|
2014-02-24 15:09:00 +01:00
|
|
|
if /I "%1"=="-h" goto Usage
|
|
|
|
if /I "%1"=="-help" goto Usage
|
|
|
|
if /I "%1"=="--help" goto Usage
|
|
|
|
if /I "%1"=="/h" goto Usage
|
|
|
|
if /I "%1"=="/?" goto Usage
|
|
|
|
if /I "%1"=="/help" goto Usage
|
2008-02-22 17:31:23 +01:00
|
|
|
|
2014-02-24 15:09:00 +01:00
|
|
|
if /I "%1"=="NewBuild" shift
|
2016-04-08 07:32:07 +02:00
|
|
|
if not defined EDK_TOOLS_PATH (
|
2018-08-07 03:35:33 +02:00
|
|
|
goto SetEdkToolsPath
|
|
|
|
) else (
|
|
|
|
goto checkNt32Flag
|
|
|
|
)
|
|
|
|
|
|
|
|
:SetEdkToolsPath
|
|
|
|
if %WORKSPACE:~-1% EQU \ (
|
|
|
|
@set EDK_BASETOOLS=%WORKSPACE%BaseTools
|
|
|
|
) else (
|
|
|
|
@set EDK_BASETOOLS=%WORKSPACE%\BaseTools
|
|
|
|
)
|
|
|
|
if exist %EDK_BASETOOLS% (
|
|
|
|
set EDK_TOOLS_PATH=%EDK_BASETOOLS%
|
|
|
|
set EDK_BASETOOLS=
|
|
|
|
) else (
|
|
|
|
if defined PACKAGES_PATH (
|
|
|
|
for %%i IN (%PACKAGES_PATH%) DO (
|
|
|
|
if exist %%~fi\BaseTools (
|
|
|
|
set EDK_TOOLS_PATH=%%~fi\BaseTools
|
|
|
|
goto checkNt32Flag
|
2015-10-08 11:29:09 +02:00
|
|
|
)
|
|
|
|
)
|
2018-08-07 03:35:33 +02:00
|
|
|
) else (
|
|
|
|
echo.
|
|
|
|
echo !!! ERROR !!! Cannot find BaseTools !!!
|
|
|
|
echo.
|
|
|
|
goto BadBaseTools
|
2015-10-08 11:29:09 +02:00
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2016-10-19 06:31:36 +02:00
|
|
|
:checkNt32Flag
|
2016-10-26 05:31:52 +02:00
|
|
|
if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
|
|
|
|
|
2015-10-08 11:29:09 +02:00
|
|
|
:checkBaseTools
|
2014-02-24 15:09:00 +01:00
|
|
|
IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools
|
|
|
|
call %EDK_TOOLS_PATH%\toolsetup.bat %*
|
|
|
|
if /I "%1"=="Reconfig" shift
|
2016-07-15 11:41:17 +02:00
|
|
|
goto check_NASM
|
2014-02-24 15:09:00 +01:00
|
|
|
goto check_cygwin
|
2008-02-22 17:31:23 +01:00
|
|
|
|
|
|
|
:BadBaseTools
|
|
|
|
@REM
|
2014-02-24 15:09:00 +01:00
|
|
|
REM Need the BaseTools Package in order to build
|
2008-02-22 17:31:23 +01:00
|
|
|
@REM
|
2014-02-24 15:09:00 +01:00
|
|
|
@echo.
|
|
|
|
@echo !!! ERROR !!! The BaseTools Package was not found !!!
|
|
|
|
@echo.
|
|
|
|
@echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,
|
|
|
|
@echo For example,
|
|
|
|
@echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools
|
|
|
|
@echo The setup script, toolsetup.bat must reside in this folder.
|
|
|
|
@echo.
|
|
|
|
goto end
|
2008-02-22 17:31:23 +01:00
|
|
|
|
2016-07-15 11:41:17 +02:00
|
|
|
:check_NASM
|
|
|
|
if not defined NASM_PREFIX (
|
|
|
|
@echo.
|
|
|
|
@echo !!! WARNING !!! NASM_PREFIX environment variable is not set
|
|
|
|
@if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"
|
|
|
|
@if exist "C:\nasm\nasm.exe" @echo Found nasm.exe, setting the environment variable to C:\nasm\
|
|
|
|
@if not exist "C:\nasm\nasm.exe" echo Attempting to build modules that require NASM will fail.
|
|
|
|
)
|
|
|
|
|
2006-05-09 08:11:05 +02:00
|
|
|
:check_cygwin
|
2014-02-24 15:14:13 +01:00
|
|
|
if defined CYGWIN_HOME (
|
|
|
|
if not exist "%CYGWIN_HOME%" (
|
|
|
|
@echo.
|
|
|
|
@echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!
|
|
|
|
@echo.
|
|
|
|
)
|
|
|
|
) else (
|
2014-02-24 15:09:00 +01:00
|
|
|
if exist c:\cygwin (
|
|
|
|
set CYGWIN_HOME=c:\cygwin
|
2008-02-22 17:31:23 +01:00
|
|
|
) else (
|
2008-12-31 17:57:24 +01:00
|
|
|
@echo.
|
|
|
|
@echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
|
|
|
|
@echo.
|
2008-02-22 17:31:23 +01:00
|
|
|
)
|
2014-02-24 15:14:13 +01:00
|
|
|
)
|
2006-04-22 00:54:32 +02:00
|
|
|
|
2014-02-24 15:14:13 +01:00
|
|
|
:cygwin_done
|
2017-06-22 20:59:49 +02:00
|
|
|
if /I "%1"=="Rebuild" shift
|
|
|
|
if /I "%1"=="ForceRebuild" shift
|
2019-09-19 10:52:26 +02:00
|
|
|
if /I "%1"=="VS2019" shift
|
2019-06-12 05:28:46 +02:00
|
|
|
if /I "%1"=="VS2017" shift
|
|
|
|
if /I "%1"=="VS2015" shift
|
|
|
|
if /I "%1"=="VS2013" shift
|
|
|
|
if /I "%1"=="VS2012" shift
|
2014-02-24 15:14:13 +01:00
|
|
|
if "%1"=="" goto end
|
2006-10-17 09:07:24 +02:00
|
|
|
|
2006-07-14 08:46:15 +02:00
|
|
|
:Usage
|
2008-12-31 17:57:24 +01:00
|
|
|
@echo.
|
2019-09-19 10:52:26 +02:00
|
|
|
@echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"
|
2008-12-31 17:57:24 +01:00
|
|
|
@echo.
|
|
|
|
@echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
|
2017-06-22 20:59:49 +02:00
|
|
|
@echo Rebuild Perform incremental rebuild of BaseTools binaries.
|
|
|
|
@echo ForceRebuild Force a full rebuild of BaseTools binaries.
|
2019-06-12 05:28:46 +02:00
|
|
|
@echo VS2012 Set the env for VS2012 build.
|
|
|
|
@echo VS2013 Set the env for VS2013 build.
|
|
|
|
@echo VS2015 Set the env for VS2015 build.
|
|
|
|
@echo VS2017 Set the env for VS2017 build.
|
2019-09-19 10:52:26 +02:00
|
|
|
@echo VS2019 Set the env for VS2019 build.
|
2008-12-31 17:57:24 +01:00
|
|
|
@echo.
|
|
|
|
@echo Note that target.template, tools_def.template and build_rules.template
|
2014-02-24 15:14:13 +01:00
|
|
|
@echo will only be copied to target.txt, tools_def.txt and build_rule.txt
|
|
|
|
@echo respectively if they do not exist. Use option [Reconfig] to force the copy.
|
2008-12-31 17:57:24 +01:00
|
|
|
@echo.
|
2014-02-24 15:09:00 +01:00
|
|
|
goto end
|
2007-06-22 08:25:37 +02:00
|
|
|
|
2006-04-22 00:54:32 +02:00
|
|
|
:end
|
2014-02-24 15:09:00 +01:00
|
|
|
popd
|