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
|
2016-04-08 07:32:07 +02:00
|
|
|
@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
|
2016-10-19 06:31:36 +02:00
|
|
|
@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
|
2010-04-29 17:17:20 +02:00
|
|
|
@REM This program and the accompanying materials
|
2006-04-22 00:54:32 +02:00
|
|
|
@REM are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
@REM which accompanies this distribution. The full text of the license may be found at
|
|
|
|
@REM http://opensource.org/licenses/bsd-license.php
|
2006-05-09 08:11:05 +02:00
|
|
|
@REM
|
2006-04-22 00:54:32 +02:00
|
|
|
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
@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%
|
|
|
|
|
2016-10-19 06:31:36 +02:00
|
|
|
@REM The Nt32 Emluation Platform requires Microsoft Libraries
|
|
|
|
@REM and headers to interface with Windows.
|
|
|
|
if /I "%1"=="--nt32" (
|
|
|
|
if /I "%2"=="X64" (
|
|
|
|
shift
|
|
|
|
call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"
|
|
|
|
) else (
|
|
|
|
call "%BASE_TOOLS_PATH%\get_vsvars.bat"
|
|
|
|
)
|
|
|
|
shift
|
|
|
|
)
|
|
|
|
|
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
|
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.
|
2017-06-22 20:59:49 +02:00
|
|
|
@echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32 [X64]] [Reconfig] [Rebuild] [ForceRebuild]"
|
2016-10-19 06:31:36 +02:00
|
|
|
@echo --nt32 [X64] If a compiler tool chain is not available in the
|
|
|
|
@echo environment, call a script to attempt to set one up.
|
|
|
|
@echo This flag is only required if building the
|
|
|
|
@echo Nt32Pkg/Nt32Pkg.dsc system emulator.
|
|
|
|
@echo If the X64 argument is set, and a compiler tool chain is
|
|
|
|
@echo not available, attempt to set up a tool chain that will
|
|
|
|
@echo create X64 binaries. Setting these two options have the
|
|
|
|
@echo potential side effect of changing tool chains used for a
|
|
|
|
@echo rebuild.
|
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.
|
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
|