2 @REM This stand
-alone program is typically called by the edksetup.bat file
,
3 @REM however it may be executed directly from the BaseTools project folder
4 @REM
if the file is
not executed within a WORKSPACE\BaseTools folder.
6 @REM Copyright
(c
) 2006 - 2016, Intel Corporation. All rights reserved.
<BR
>
7 @REM
(C
) Copyright
2016 Hewlett Packard Enterprise Development LP
<BR
>
9 @REM This program and the accompanying materials are licensed and made available
10 @REM under the terms and conditions of the BSD License which accompanies this
11 @REM distribution. The full text of the license may be found at
:
12 @REM http
://opensource.org
/licenses
/bsd
-license.php
14 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
"AS IS" BASIS
,
15 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND
, EITHER EXPRESS OR
22 @REM ##############################################################
23 @REM # You should
not have to modify anything below this line
26 if /I
"%1"=="-h" goto Usage
27 if /I
"%1"=="-help" goto Usage
28 if /I
"%1"=="--help" goto Usage
29 if /I
"%1"=="/h" goto Usage
30 if /I
"%1"=="/help" goto Usage
31 if /I
"%1"=="/?" goto Usage
35 if "%1"=="" goto setup_workspace
36 if /I
"%1"=="--nt32" (
40 @REM Ignore
--nt32 flag
44 if /I
"%1"=="Reconfig" (
49 if /I
"%1"=="Rebuild" (
54 if /I
"%1"=="ForceRebuild" (
56 set FORCE_REBUILD
=TRUE
59 if "%1"=="" goto setup_workspace
61 if not defined BASE_TOOLS_PATH
(
62 if exist %1\Source
set BASE_TOOLS_PATH
=%1
66 if not defined EDK_TOOLS_PATH
(
67 if exist %1\Bin\Win32
set EDK_TOOLS_PATH
=%1
72 echo !!! ERROR
!!! Unknown argument
, %1 !!!
77 echo !!! ERROR
!!! Unknown argument
, %1 !!!
85 @REM Check the required system environment variables
90 REM check the EDK_TOOLS_PATH
92 if not defined EDK_TOOLS_PATH
goto no_EDK_TOOLS_PATH
93 if exist %EDK_TOOLS_PATH% goto set_PATH
96 if not defined WORKSPACE
(
97 if defined BASE_TOOLS_PATH
(
98 set EDK_TOOLS_PATH
=%BASE_TOOLS_PATH%
102 echo !!! ERROR
!!! Neither BASE_TOOLS_PATH nor EDK_TOOLS_PATH are
set.
!!!
107 if exist %WORKSPACE%\BaseTools\Bin
(
108 set EDK_TOOLS_PATH
=%WORKSPACE%\BaseTools
112 echo !!! ERROR
!!! No tools
path available. Please
set EDK_TOOLS_PATH
!!!
119 if defined WORKSPACE_TOOLS_PATH
goto check_PATH
120 if not defined EDK_TOOLS_BIN
(
121 if exist %EDK_TOOLS_PATH%\Bin\Win32
(
122 set EDK_TOOLS_BIN
=%EDK_TOOLS_PATH%\Bin\Win32
125 echo !!! ERROR
!!! Cannot
find BaseTools Bin Win32
!!!
126 echo Please check the directory
%EDK_TOOLS_PATH%\Bin\Win32
127 echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
132 set PATH=%EDK_TOOLS_BIN%;%PATH%
133 set WORKSPACE_TOOLS_PATH
=%EDK_TOOLS_PATH%
137 if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok
138 if not defined EDK_TOOLS_BIN
(
139 if exist %EDK_TOOLS_PATH%\Bin\Win32
(
140 set EDK_TOOLS_BIN
=%EDK_TOOLS_PATH%\Bin\Win32
143 echo !!! ERROR
!!! Cannot
find BaseTools Bin Win32
!!!
144 echo Please check the directory
%EDK_TOOLS_PATH%\Bin\Win32
145 echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
150 set PATH=%EDK_TOOLS_BIN%;%PATH%
151 set WORKSPACE_TOOLS_PATH
=%EDK_TOOLS_PATH%
152 echo Resetting the
PATH variable to include the EDK_TOOLS_PATH
for this session.
156 REM copy *.template to %CONF_PATH%
158 if not defined WORKSPACE
(
159 if defined RECONFIG
(
161 echo !!! WARNING
!!! WORKSPACE environment variable was
not set, cannot Reconfig
!!!
167 IF NOT exist "%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" (
169 @
echo !!! ERROR
!!! The set_vsprefix_envs.bat was
not found
!!!
173 call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat
175 if not defined CONF_PATH
(
176 set CONF_PATH
=%WORKSPACE%\Conf
179 if NOT exist %CONF_PATH% (
180 if defined PACKAGES_PATH
(
181 for %%i IN
(%PACKAGES_PATH%) DO (
182 if exist %%~fi\Conf
(
183 set CONF_PATH
=%%i\Conf
191 if NOT exist %CONF_PATH% (
194 if defined RECONFIG
(
196 echo Over
-writing the
files in the CONF_PATH directory
197 echo using the default template
files
202 if NOT exist %CONF_PATH%\target.txt
(
203 echo copying ... target.template to
%CONF_PATH%\target.txt
204 if NOT exist %EDK_TOOLS_PATH%\Conf
\target.template
(
205 echo Error
: target.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
207 copy %EDK_TOOLS_PATH%\Conf
\target.template
%CONF_PATH%\target.txt
> nul
209 if defined RECONFIG
echo over
-write ... target.template to
%CONF_PATH%\target.txt
210 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\target.template
%CONF_PATH%\target.txt
> nul
213 if NOT exist %CONF_PATH%\tools_def.txt
(
214 echo copying ... tools_def.template to
%CONF_PATH%\tools_def.txt
215 if NOT exist %EDK_TOOLS_PATH%\Conf
\tools_def.template
(
216 echo Error
: tools_def.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
218 copy %EDK_TOOLS_PATH%\Conf
\tools_def.template
%CONF_PATH%\tools_def.txt
> nul
220 if defined RECONFIG
echo over
-write ... tools_def.template to
%CONF_PATH%\tools_def.txt
221 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\tools_def.template
%CONF_PATH%\tools_def.txt
> nul
224 if NOT exist %CONF_PATH%\build_rule.txt
(
225 echo copying ... build_rule.template to
%CONF_PATH%\build_rule.txt
226 if NOT exist %EDK_TOOLS_PATH%\Conf
\build_rule.template
(
227 echo Error
: build_rule.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
229 copy %EDK_TOOLS_PATH%\Conf
\build_rule.template
%CONF_PATH%\build_rule.txt
> nul
231 if defined RECONFIG
echo over
-write ... build_rule.template to
%CONF_PATH%\build_rule.txt
232 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\build_rule.template
%CONF_PATH%\build_rule.txt
> nul
237 if defined WORKSPACE
(
238 echo WORKSPACE
= %WORKSPACE%
240 if defined PACKAGES_PATH
(
241 echo PACKAGES_PATH
= %PACKAGES_PATH%
243 echo EDK_TOOLS_PATH
= %EDK_TOOLS_PATH%
244 if defined BASE_TOOLS_PATH
(
245 echo BASE_TOOLS_PATH
= %BASE_TOOLS_PATH%
247 if defined EDK_TOOLS_BIN
(
248 echo EDK_TOOLS_BIN
= %EDK_TOOLS_BIN%
250 echo CONF_PATH
= %CONF_PATH%
256 @REM Test
if we are going to have to
do a build
258 if defined FORCE_REBUILD
goto check_build_environment
259 if defined REBUILD
goto check_build_environment
260 if not exist "%EDK_TOOLS_PATH%" goto check_build_environment
262 IF NOT EXIST "%EDK_TOOLS_BIN%\BootSectImage.exe" goto check_c_tools
263 IF NOT EXIST "%EDK_TOOLS_BIN%\EfiLdrImage.exe" goto check_c_tools
264 IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_c_tools
265 IF NOT EXIST "%EDK_TOOLS_BIN%\GenBootSector.exe" goto check_c_tools
266 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_c_tools
267 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_c_tools
268 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_c_tools
269 IF NOT EXIST "%EDK_TOOLS_BIN%\GenPage.exe" goto check_c_tools
270 IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_c_tools
271 IF NOT EXIST "%EDK_TOOLS_BIN%\GenVtf.exe" goto check_c_tools
272 IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_c_tools
273 IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_c_tools
274 IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_c_tools
275 IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_c_tools
277 goto check_python_tools
281 echo !!! ERROR
!!! Binary C tools are missing. They are requried to be built from BaseTools Source.
286 IF NOT EXIST "%EDK_TOOLS_BIN%\build.exe" goto check_build_environment
287 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFds.exe" goto check_build_environment
288 IF NOT EXIST "%EDK_TOOLS_BIN%\TargetTool.exe" goto check_build_environment
289 IF NOT EXIST "%EDK_TOOLS_BIN%\Trim.exe" goto check_build_environment
293 :check_build_environment
294 if defined BASETOOLS_PYTHON_SOURCE
goto VisualStudioAvailable
296 if not defined BASE_TOOLS_PATH
(
297 if not exist "Source\C\Makefile" (
298 if not exist "%EDK_TOOLS_PATH%\Source\C\Makefile" goto no_source_files
299 set BASE_TOOLS_PATH
=%EDK_TOOLS_PATH%
301 set BASE_TOOLS_PATH
=%CD%
305 if not defined PYTHON_HOME
(
306 if defined PYTHONHOME
(
307 set PYTHON_HOME
=%PYTHONHOME%
310 echo !!! ERROR
!!! Binary python tools are missing. PYTHON_HOME environment variable is
not set.
311 echo PYTHON_HOME is required to build or execute the python tools.
317 @REM We have Python
, now test
for FreezePython application
318 if not defined PYTHON_FREEZER_PATH
(
320 echo !!! WARNING
!!! PYTHON_FREEZER_PATH environment variable is
not set.
321 echo Setup environment to
run Python scripts directly.
323 set "PATH=%PATH%;%BASE_TOOLS_PATH%\BinWrappers\WindowsLike"
326 set BASETOOLS_PYTHON_SOURCE
=%BASE_TOOLS_PATH%\Source\Python
327 set PYTHONPATH
=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
330 echo PYTHON_HOME
= %PYTHON_HOME%
331 echo PYTHONPATH
= %PYTHONPATH%
332 if defined PYTHON_FREEZER_PATH
(
333 echo PYTHON_FREEZER_PATH
= %PYTHON_FREEZER_PATH%
337 :VisualStudioAvailable
338 if not defined FORCE_REBUILD
(
339 if not defined REBUILD
(
343 call "%EDK_TOOLS_PATH%\get_vsvars.bat"
344 if not defined VCINSTALLDIR
(
346 @
echo !!! ERROR
!!!! Cannot
find Visual Studio
, required to build C tools
!!!
350 if not defined FORCE_REBUILD
goto IncrementalBuild
356 del /f
/q
%BASE_TOOLS_PATH%\Bin\Win32\
*.
*
358 @REM Let CleanAndBuild fall through to IncrementalBuild
367 if defined PYTHON_FREEZER_PATH
(
368 echo BUILDING PYTHON TOOLS
375 echo !!! WARNING
!!! Cannot make executable from Python code
, executing python scripts instead
!!!
383 echo !!! ERROR
!!! Cannot build BaseTools applications
- no source directory located
!!!
389 echo Usage
: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]]"
391 @
echo base_tools_path BaseTools project
path, BASE_TOOLS_PATH will be
set to this
path.
392 @
echo edk_tools_path EDK_TOOLS_PATH will be
set to this
path.
393 @
echo Rebuild
If sources are available perform an Incremental build
, only
394 @
echo build those updated tools.
395 @
echo ForceRebuild
If sources are available
, rebuild all tools regardless of
396 @
echo whether they have been updated or
not.
397 @
echo Reconfig Reinstall target.txt
, tools_def.txt and build_rule.txt.