@REM @file\r
-@REM This stand-alone program is typically called by the edksetup.bat file, \r
+@REM This stand-alone program is typically called by the edksetup.bat file,\r
@REM however it may be executed directly from the BaseTools project folder\r
@REM if the file is not executed within a WORKSPACE\BaseTools folder.\r
@REM\r
-@REM Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+@REM Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
@REM\r
@REM This program and the accompanying materials are licensed and made available\r
-@REM under the terms and conditions of the BSD License which accompanies this \r
+@REM under the terms and conditions of the BSD License which accompanies this\r
@REM distribution. The full text of the license may be found at:\r
@REM http://opensource.org/licenses/bsd-license.php\r
@REM\r
@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR \r
+@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR\r
@REM IMPLIED.\r
@REM\r
\r
:loop\r
if "%1"=="" goto setup_workspace\r
if /I "%1"=="--nt32" (\r
+ if /I "%2" == "X64" (\r
+ shift\r
+ )\r
@REM Ignore --nt32 flag\r
shift\r
goto loop\r
:set_PATH\r
if defined WORKSPACE_TOOLS_PATH goto check_PATH\r
if not defined EDK_TOOLS_BIN (\r
- if exist %EDK_TOOLS_PATH%\Bin\Win32 (\r
- set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r
- ) else (\r
+ set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r
+ if not exist %EDK_TOOLS_PATH%\Bin\Win32 (\r
echo.\r
echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!\r
echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32\r
echo Or configure EDK_TOOLS_BIN env to point Win32 directory.\r
- echo. \r
- goto end\r
+ echo.\r
)\r
)\r
set PATH=%EDK_TOOLS_BIN%;%PATH%\r
:check_PATH\r
if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok\r
if not defined EDK_TOOLS_BIN (\r
- if exist %EDK_TOOLS_PATH%\Bin\Win32 (\r
- set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r
- ) else (\r
+ set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r
+ if not exist %EDK_TOOLS_PATH%\Bin\Win32 (\r
echo.\r
echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!\r
echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32\r
echo Or configure EDK_TOOLS_BIN env to point Win32 directory.\r
- echo. \r
- goto end\r
+ echo.\r
)\r
)\r
set PATH=%EDK_TOOLS_BIN%;%PATH%\r
goto skip_reconfig\r
)\r
\r
+IF NOT exist "%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" (\r
+ @echo.\r
+ @echo !!! ERROR !!! The set_vsprefix_envs.bat was not found !!!\r
+ @echo.\r
+ goto end\r
+)\r
+call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat\r
+\r
if not defined CONF_PATH (\r
set CONF_PATH=%WORKSPACE%\Conf\r
)\r
)\r
)\r
)\r
- \r
+\r
:CopyConf\r
if NOT exist %CONF_PATH% (\r
mkdir %CONF_PATH%\r
if defined FORCE_REBUILD goto check_build_environment\r
if defined REBUILD goto check_build_environment\r
if not exist "%EDK_TOOLS_PATH%" goto check_build_environment\r
+if not exist "%EDK_TOOLS_BIN%" goto check_build_environment\r
\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\BootSectImage.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\build.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\EfiLdrImage.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenBootSector.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenFds.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenPage.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\GenVtf.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\TargetTool.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\Trim.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_build_environment\r
-IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_build_environment\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_c_tools\r
+IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_c_tools\r
\r
-goto end\r
+goto check_build_environment\r
\r
-:check_build_environment\r
+:check_c_tools\r
+ echo.\r
+ echo !!! ERROR !!! Binary C tools are missing. They are requried to be built from BaseTools Source.\r
+ echo.\r
\r
- if not defined FORCE_REBUILD (\r
- echo.\r
- echo Rebuilding of tools is not required. Binaries of the latest,\r
- echo tested versions of the tools have been tested and included in the\r
- echo EDK II repository.\r
- echo.\r
- echo If you really want to build the tools, use the ForceRebuild option.\r
- echo.\r
- goto end\r
- )\r
+:check_build_environment\r
+ set PYTHONHASHSEED=1\r
\r
if not defined BASE_TOOLS_PATH (\r
if not exist "Source\C\Makefile" (\r
set BASE_TOOLS_PATH=%CD%\r
)\r
)\r
- set PATH=%BASE_TOOLS_PATH%\Bin\Win32;%PATH%\r
-\r
- set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python\r
- set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%\r
\r
- if not defined PYTHON_HOME (\r
- if defined PYTHONHOME (\r
- set PYTHON_HOME=%PYTHONHOME%\r
- ) else (\r
+:defined_python\r
+if defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (\r
+ goto check_python_available\r
+)\r
+if defined PYTHON3_ENABLE (\r
+ if "%PYTHON3_ENABLE%" EQU "TRUE" (\r
+ set PYTHON_COMMAND=py -3\r
+ goto check_python_available\r
+ ) else (\r
+ goto check_python2\r
+ )\r
+)\r
+if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (\r
+ set PYTHON_COMMAND=py -3\r
+ py -3 %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1\r
+ setlocal enabledelayedexpansion\r
+ set /p PythonCheck=<"PythonCheck.txt"\r
+ del PythonCheck.txt\r
+ if "!PythonCheck!" NEQ "TRUE" (\r
+ if not defined PYTHON_HOME if not defined PYTHONHOME (\r
+ endlocal\r
+ set PYTHON_COMMAND=\r
echo.\r
- echo !!! ERROR !!! PYTHON_HOME is required to build or execute the tools, please set it. !!!\r
+ echo !!! ERROR !!! Binary python tools are missing.\r
+ echo PYTHON_COMMAND, PYTHON3_ENABLE or PYTHON_HOME\r
+ echo Environment variable is not set successfully.\r
+ echo They is required to build or execute the python tools.\r
echo.\r
goto end\r
+ ) else (\r
+ goto check_python2\r
)\r
+ ) else (\r
+ goto check_freezer_path\r
)\r
+)\r
\r
- @REM We have Python, now test for FreezePython application\r
- if not defined PYTHON_FREEZER_PATH (\r
- @REM see if we can find FreezePython.ex\r
- if exist "%PYTHON_HOME%\Tools\cx_Freeze-3.0.3\FreezePython.exe" (\r
- set PYTHON_FREEZER_PATH=%PYTHON_HOME%\Tools\cx_Freeze-3.0.3\r
- ) \r
- if exist "%PYTHON_HOME%\Tools\cx_Freeze\FreezePython.exe" (\r
- set PYTHON_FREEZER_PATH=%PYTHON_HOME%\Tools\cx_Freeze\r
- ) \r
- if exist "C:\cx_Freeze\FreezePython.exe" (\r
- set PYTHON_FREEZER_PATH=C:\cx_Freeze\r
- )\r
- if exist "C:\cx_Freeze-3.0.3" (\r
- set PYTHON_FREEZER_PATH=C:\cx_Freeze-3.0.3\r
- )\r
- if not defined PYTHON_FREEZER_PATH (\r
- echo.\r
- echo !!! WARNING !!! Will not be able to compile Python programs to .exe\r
- echo Will setup environment to run Python scripts directly.\r
- echo.\r
- set "PATH=%BASETOOLS_PYTHON_SOURCE%\Trim;%PATH%"\r
- set "PATH=%BASETOOLS_PYTHON_SOURCE%\GenFds;%PATH%"\r
- set "PATH=%BASETOOLS_PYTHON_SOURCE%\build;%PATH%"\r
- set PATHEXT=%PATHEXT%;.py\r
- )\r
+:check_python2\r
+endlocal\r
+if defined PYTHON_HOME (\r
+ if EXIST "%PYTHON_HOME%" (\r
+ set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r
+ goto check_python_available\r
)\r
- \r
- echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%\r
- echo PYTHON_PATH = %PYTHON_PATH%\r
- echo PYTHON_FREEZER_PATH = %PYTHON_FREEZER_PATH%\r
+)\r
+if defined PYTHONHOME (\r
+ if EXIST "%PYTHONHOME%" (\r
+ set PYTHON_HOME=%PYTHONHOME%\r
+ set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r
+ goto check_python_available\r
+ )\r
+)\r
+echo.\r
+echo !!! ERROR !!! PYTHON_HOME is not defined or The value of this variable does not exist\r
+echo.\r
+goto end\r
+:check_python_available\r
+%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1\r
+ setlocal enabledelayedexpansion\r
+ set /p PythonCheck=<"PythonCheck.txt"\r
+ del PythonCheck.txt\r
+ if "!PythonCheck!" NEQ "TRUE" (\r
+ echo.\r
+ echo ! ERROR ! "%PYTHON_COMMAND%" is not installed or added to environment variables\r
+ echo.\r
+ goto end\r
+ ) else (\r
+ goto check_freezer_path\r
+ )\r
+\r
+:check_freezer_path\r
+ endlocal\r
+ if defined BASETOOLS_PYTHON_SOURCE goto print_python_info\r
+ set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"\r
+ set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python\r
+ set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%\r
+\r
+:print_python_info\r
+ echo PATH = %PATH%\r
+ if defined PYTHON3_ENABLE if "%PYTHON3_ENABLE%" EQU "TRUE" (\r
+ echo PYTHON3_ENABLE = %PYTHON3_ENABLE%\r
+ echo PYTHON3 = %PYTHON_COMMAND%\r
+ ) else (\r
+ echo PYTHON3_ENABLE = FALSE\r
+ echo PYTHON_COMMAND = %PYTHON_COMMAND%\r
+ )\r
+ echo PYTHONPATH = %PYTHONPATH%\r
echo.\r
\r
+:VisualStudioAvailable\r
+ if not defined FORCE_REBUILD (\r
+ if not defined REBUILD (\r
+ goto end\r
+ )\r
+ )\r
call "%EDK_TOOLS_PATH%\get_vsvars.bat"\r
if not defined VCINSTALLDIR (\r
@echo.\r
@echo.\r
goto end\r
)\r
-\r
-:VisualStudioAvailable\r
if not defined FORCE_REBUILD goto IncrementalBuild\r
\r
:CleanAndBuild\r
cd %BASE_TOOLS_PATH%\r
call nmake c\r
popd\r
-\r
- if defined PYTHON_FREEZER_PATH (\r
- echo BUILDING PYTHON TOOLS\r
- pushd .\r
- cd %BASE_TOOLS_PATH%\r
- call nmake python\r
- popd\r
- ) else (\r
- echo.\r
- echo !!! WARNING !!! Cannot make executable from Python code, executing python scripts instead !!!\r
- echo.\r
- )\r
goto end\r
\r
\r
@echo.\r
echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]]"\r
@echo.\r
- @echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path. \r
+ @echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path.\r
@echo edk_tools_path EDK_TOOLS_PATH will be set to this path.\r
- @echo Rebuild If sources are available perform an Incremental build, only \r
+ @echo Rebuild If sources are available perform an Incremental build, only\r
@echo build those updated tools.\r
- @echo ForceRebuild If sources are available, rebuild all tools regardless of \r
+ @echo ForceRebuild If sources are available, rebuild all tools regardless of\r
@echo whether they have been updated or not.\r
@echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r
@echo.\r