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 - 2013, Intel Corporation. All rights reserved.
<BR
>
8 @REM This program and the accompanying materials are licensed and made available
9 @REM under the terms and conditions of the BSD License which accompanies this
10 @REM distribution. The full text of the license may be found at
:
11 @REM http
://opensource.org
/licenses
/bsd
-license.php
13 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN
"AS IS" BASIS
,
14 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND
, EITHER EXPRESS OR
21 @REM ##############################################################
22 @REM # You should
not have to modify anything below this line
25 if /I
"%1"=="-h" goto Usage
26 if /I
"%1"=="-help" goto Usage
27 if /I
"%1"=="--help" goto Usage
28 if /I
"%1"=="/h" goto Usage
29 if /I
"%1"=="/help" goto Usage
30 if /I
"%1"=="/?" goto Usage
34 if "%1"=="" goto setup_workspace
35 if /I
"%1"=="--nt32" (
36 @REM Ignore
--nt32 flag
40 if /I
"%1"=="Reconfig" (
45 if /I
"%1"=="Rebuild" (
50 if /I
"%1"=="ForceRebuild" (
52 set FORCE_REBUILD
=TRUE
55 if "%1"=="" goto setup_workspace
57 if not defined BASE_TOOLS_PATH
(
58 if exist %1\Source
set BASE_TOOLS_PATH
=%1
62 if not defined EDK_TOOLS_PATH
(
63 if exist %1\Bin\Win32
set EDK_TOOLS_PATH
=%1
68 echo !!! ERROR
!!! Unknown argument
, %1 !!!
73 echo !!! ERROR
!!! Unknown argument
, %1 !!!
81 @REM Check the required system environment variables
86 REM check the EDK_TOOLS_PATH
88 if not defined EDK_TOOLS_PATH
goto no_EDK_TOOLS_PATH
89 if exist %EDK_TOOLS_PATH% goto set_PATH
92 if not defined WORKSPACE
(
93 if defined BASE_TOOLS_PATH
(
94 set EDK_TOOLS_PATH
=%BASE_TOOLS_PATH%
98 echo !!! ERROR
!!! Neither BASE_TOOLS_PATH nor EDK_TOOLS_PATH are
set.
!!!
103 if exist %WORKSPACE%\BaseTools\Bin
(
104 set EDK_TOOLS_PATH
=%WORKSPACE%\BaseTools
108 echo !!! ERROR
!!! No tools
path available. Please
set EDK_TOOLS_PATH
!!!
115 if defined WORKSPACE_TOOLS_PATH
goto check_PATH
116 if not defined EDK_TOOLS_BIN
(
117 if exist %EDK_TOOLS_PATH%\Bin\Win32
(
118 set EDK_TOOLS_BIN
=%EDK_TOOLS_PATH%\Bin\Win32
121 echo !!! ERROR
!!! Cannot
find BaseTools Bin Win32
!!!
122 echo Please check the directory
%EDK_TOOLS_PATH%\Bin\Win32
123 echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
128 set PATH=%EDK_TOOLS_BIN%;%PATH%
129 set WORKSPACE_TOOLS_PATH
=%EDK_TOOLS_PATH%
133 if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok
134 if not defined EDK_TOOLS_BIN
(
135 if exist %EDK_TOOLS_PATH%\Bin\Win32
(
136 set EDK_TOOLS_BIN
=%EDK_TOOLS_PATH%\Bin\Win32
139 echo !!! ERROR
!!! Cannot
find BaseTools Bin Win32
!!!
140 echo Please check the directory
%EDK_TOOLS_PATH%\Bin\Win32
141 echo Or configure EDK_TOOLS_BIN env to point Win32 directory.
146 set PATH=%EDK_TOOLS_BIN%;%PATH%
147 set WORKSPACE_TOOLS_PATH
=%EDK_TOOLS_PATH%
148 echo Resetting the
PATH variable to include the EDK_TOOLS_PATH
for this session.
152 REM copy *.template to %CONF_PATH%
154 if not defined WORKSPACE
(
155 if defined RECONFIG
(
157 echo !!! WARNING
!!! WORKSPACE environment variable was
not set, cannot Reconfig
!!!
163 set CONF_PATH
=%WORKSPACE%\Conf
164 if NOT exist %CONF_PATH% (
165 if defined PACKAGES_PATH
(
166 for %%i IN
(%PACKAGES_PATH%) DO (
167 if exist %%~fi\Conf
(
168 set CONF_PATH
=%%i\Conf
176 if NOT exist %CONF_PATH% (
179 if defined RECONFIG
(
181 echo Over
-writing the
files in the CONF_PATH directory
182 echo using the default template
files
187 if NOT exist %CONF_PATH%\target.txt
(
188 echo copying ... target.template to
%CONF_PATH%\target.txt
189 if NOT exist %EDK_TOOLS_PATH%\Conf
\target.template
(
190 echo Error
: target.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
192 copy %EDK_TOOLS_PATH%\Conf
\target.template
%CONF_PATH%\target.txt
> nul
194 if defined RECONFIG
echo over
-write ... target.template to
%CONF_PATH%\target.txt
195 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\target.template
%CONF_PATH%\target.txt
> nul
198 if NOT exist %CONF_PATH%\tools_def.txt
(
199 echo copying ... tools_def.template to
%CONF_PATH%\tools_def.txt
200 if NOT exist %EDK_TOOLS_PATH%\Conf
\tools_def.template
(
201 echo Error
: tools_def.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
203 copy %EDK_TOOLS_PATH%\Conf
\tools_def.template
%CONF_PATH%\tools_def.txt
> nul
205 if defined RECONFIG
echo over
-write ... tools_def.template to
%CONF_PATH%\tools_def.txt
206 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\tools_def.template
%CONF_PATH%\tools_def.txt
> nul
209 if NOT exist %CONF_PATH%\build_rule.txt
(
210 echo copying ... build_rule.template to
%CONF_PATH%\build_rule.txt
211 if NOT exist %EDK_TOOLS_PATH%\Conf
\build_rule.template
(
212 echo Error
: build_rule.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
214 copy %EDK_TOOLS_PATH%\Conf
\build_rule.template
%CONF_PATH%\build_rule.txt
> nul
216 if defined RECONFIG
echo over
-write ... build_rule.template to
%CONF_PATH%\build_rule.txt
217 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\build_rule.template
%CONF_PATH%\build_rule.txt
> nul
222 if defined WORKSPACE
(
223 echo WORKSPACE
= %WORKSPACE%
225 if defined PACKAGES_PATH
(
226 echo PACKAGES_PATH
= %PACKAGES_PATH%
228 echo EDK_TOOLS_PATH
= %EDK_TOOLS_PATH%
229 if defined BASE_TOOLS_PATH
(
230 echo BASE_TOOLS_PATH
= %BASE_TOOLS_PATH%
232 if defined EDK_TOOLS_BIN
(
233 echo EDK_TOOLS_BIN
= %EDK_TOOLS_BIN%
235 echo CONF_PATH
= %CONF_PATH%
241 @REM Test
if we are going to have to
do a build
243 if defined FORCE_REBUILD
goto check_build_environment
244 if defined REBUILD
goto check_build_environment
245 if not exist "%EDK_TOOLS_PATH%" goto check_build_environment
247 IF NOT EXIST "%EDK_TOOLS_BIN%\BootSectImage.exe" goto check_build_environment
248 IF NOT EXIST "%EDK_TOOLS_BIN%\build.exe" goto check_build_environment
249 IF NOT EXIST "%EDK_TOOLS_BIN%\EfiLdrImage.exe" goto check_build_environment
250 IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_build_environment
251 IF NOT EXIST "%EDK_TOOLS_BIN%\GenBootSector.exe" goto check_build_environment
252 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFds.exe" goto check_build_environment
253 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_build_environment
254 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_build_environment
255 IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_build_environment
256 IF NOT EXIST "%EDK_TOOLS_BIN%\GenPage.exe" goto check_build_environment
257 IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_build_environment
258 IF NOT EXIST "%EDK_TOOLS_BIN%\GenVtf.exe" goto check_build_environment
259 IF NOT EXIST "%EDK_TOOLS_BIN%\Split.exe" goto check_build_environment
260 IF NOT EXIST "%EDK_TOOLS_BIN%\TargetTool.exe" goto check_build_environment
261 IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_build_environment
262 IF NOT EXIST "%EDK_TOOLS_BIN%\Trim.exe" goto check_build_environment
263 IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_build_environment
264 IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_build_environment
268 :check_build_environment
270 if not defined FORCE_REBUILD
(
272 echo Rebuilding of tools is
not required. Binaries of the latest
,
273 echo tested versions of the tools have been tested and included in the
274 echo EDK II repository.
276 echo If you really want to build the tools
, use the ForceRebuild option.
281 if not defined BASE_TOOLS_PATH
(
282 if not exist "Source\C\Makefile" (
283 if not exist "%EDK_TOOLS_PATH%\Source\C\Makefile" goto no_source_files
284 set BASE_TOOLS_PATH
=%EDK_TOOLS_PATH%
286 set BASE_TOOLS_PATH
=%CD%
289 set PATH=%BASE_TOOLS_PATH%\Bin\Win32
;%PATH%
291 set BASETOOLS_PYTHON_SOURCE
=%BASE_TOOLS_PATH%\Source\Python
292 set PYTHONPATH
=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
294 if not defined PYTHON_HOME
(
295 if defined PYTHONHOME
(
296 set PYTHON_HOME
=%PYTHONHOME%
299 echo !!! ERROR
!!! PYTHON_HOME is required to build or execute the tools
, please
set it.
!!!
305 @REM We have Python
, now test
for FreezePython application
306 if not defined PYTHON_FREEZER_PATH
(
307 @REM see
if we can
find FreezePython.ex
308 if exist "%PYTHON_HOME%\Tools\cx_Freeze-3.0.3\FreezePython.exe" (
309 set PYTHON_FREEZER_PATH
=%PYTHON_HOME%\Tools\cx_Freeze
-3.0.3
311 if exist "%PYTHON_HOME%\Tools\cx_Freeze\FreezePython.exe" (
312 set PYTHON_FREEZER_PATH
=%PYTHON_HOME%\Tools\cx_Freeze
314 if exist "C:\cx_Freeze\FreezePython.exe" (
315 set PYTHON_FREEZER_PATH
=C
:\cx_Freeze
317 if exist "C:\cx_Freeze-3.0.3" (
318 set PYTHON_FREEZER_PATH
=C
:\cx_Freeze
-3.0.3
320 if not defined PYTHON_FREEZER_PATH
(
322 echo !!! WARNING
!!! Will
not be able to compile Python programs to .exe
323 echo Will setup environment to
run Python scripts directly.
325 set PATH=%BASETOOLS_PYTHON_SOURCE%\Trim
;%PATH%
326 set PATH=%BASETOOLS_PYTHON_SOURCE%\GenFds
;%PATH%
327 set PATH=%BASETOOLS_PYTHON_SOURCE%\build
;%PATH%
328 set PATHEXT
=%PATHEXT%;.py
332 echo BASE_TOOLS_PATH
= %BASE_TOOLS_PATH%
333 echo PYTHON_PATH
= %PYTHON_PATH%
334 echo PYTHON_FREEZER_PATH
= %PYTHON_FREEZER_PATH%
337 call "%EDK_TOOLS_PATH%\get_vsvars.bat"
338 if not defined VCINSTALLDIR
(
340 @
echo !!! ERROR
!!!! Cannot
find Visual Studio
, required to build C tools
!!!
345 :VisualStudioAvailable
346 if not defined FORCE_REBUILD
goto IncrementalBuild
352 del /f
/q
%BASE_TOOLS_PATH%\Bin\Win32\
*.
*
354 @REM Let CleanAndBuild fall through to IncrementalBuild
363 if defined PYTHON_FREEZER_PATH
(
364 echo BUILDING PYTHON TOOLS
371 echo !!! WARNING
!!! Cannot make executable from Python code
, executing python scripts instead
!!!
379 echo !!! ERROR
!!! Cannot build BaseTools applications
- no source directory located
!!!
385 echo Usage
: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]]"
387 @
echo base_tools_path BaseTools project
path, BASE_TOOLS_PATH will be
set to this
path.
388 @
echo edk_tools_path EDK_TOOLS_PATH will be
set to this
path.
389 @
echo Rebuild
If sources are available perform an Incremental build
, only
390 @
echo build those updated tools.
391 @
echo ForceRebuild
If sources are available
, rebuild all tools regardless of
392 @
echo whether they have been updated or
not.
393 @
echo Reconfig Reinstall target.txt
, tools_def.txt and build_rule.txt.