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 - 2008, Intel Corporation. All rights reserved.
8 @REM This program and the accompanying materials are licensed and made available
9 @REM under the terms and conditions of the BSD Licensewhich 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 set PATH=%EDK_TOOLS_PATH%\Bin
;%EDK_TOOLS_PATH%\Bin\Win32
;%PATH%
117 set WORKSPACE_TOOLS_PATH
=%EDK_TOOLS_PATH%
121 if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok
122 set PATH=%EDK_TOOLS_PATH%\Bin
;%EDK_TOOLS_PATH%\Bin\Win32
;%PATH%
123 set WORKSPACE_TOOLS_PATH
=%EDK_TOOLS_PATH%
124 echo Resetting the
PATH variable to include the EDK_TOOLS_PATH
for this session.
129 if defined WORKSPACE
(
130 echo WORKSPACE
= %WORKSPACE%
132 echo EDK_TOOLS_PATH
= %EDK_TOOLS_PATH%
133 if defined BASE_TOOLS_PATH
(
134 echo BASE_TOOLS_PATH
= %BASE_TOOLS_PATH%
139 REM copy *.template to %WORKSPACE%\Conf
141 if not defined WORKSPACE
(
142 if defined RECONFIG
(
144 echo !!! WARNING
!!! WORKSPACE environment variable was
not set, cannot Reconfig
!!!
150 if NOT exist %WORKSPACE%\Conf
(
151 mkdir %WORKSPACE%\Conf
153 if defined RECONFIG
(
155 echo Over
-writing the
files in the WORKSPACE\Conf directory
156 echo using the default template
files
161 if NOT exist %WORKSPACE%\Conf\FrameworkDatabase.db
(
162 if defined RECONFIG
echo copying ... FrameworkDatabase.template to
%WORKSPACE%\Conf\FrameworkDatabase.db
163 copy %EDK_TOOLS_PATH%\Conf\FrameworkDatabase.template
%WORKSPACE%\Conf\FrameworkDatabase.db
> nul
165 if defined RECONFIG
echo over
-write ... FrameworkDatabase.template to
%WORKSPACE%\Conf\FrameworkDatabase.db
166 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf\FrameworkDatabase.template
%WORKSPACE%\Conf\FrameworkDatabase.db
> nul
169 if NOT exist %WORKSPACE%\Conf
\target.txt
(
170 echo copying ... target.template to
%WORKSPACE%\Conf
\target.txt
171 if NOT exist %EDK_TOOLS_PATH%\Conf
\target.template
(
172 echo Error
: target.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
174 copy %EDK_TOOLS_PATH%\Conf
\target.template
%WORKSPACE%\Conf
\target.txt
> nul
176 if defined RECONFIG
echo over
-write ... target.template to
%WORKSPACE%\Conf
\target.txt
177 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\target.template
%WORKSPACE%\Conf
\target.txt
> nul
180 if NOT exist %WORKSPACE%\Conf
\tools_def.txt
(
181 echo copying ... tools_def.template to
%WORKSPACE%\Conf
\tools_def.txt
182 if NOT exist %EDK_TOOLS_PATH%\Conf
\tools_def.template
(
183 echo Error
: tools_def.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
185 copy %EDK_TOOLS_PATH%\Conf
\tools_def.template
%WORKSPACE%\Conf
\tools_def.txt
> nul
187 if defined RECONFIG
echo over
-write ... tools_def.template to
%WORKSPACE%\Conf
\tools_def.txt
188 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\tools_def.template
%WORKSPACE%\Conf
\tools_def.txt
> nul
191 if NOT exist %WORKSPACE%\Conf
\build_rule.txt
(
192 echo copying ... build_rule.template to
%WORKSPACE%\Conf
\build_rule.txt
193 if NOT exist %EDK_TOOLS_PATH%\Conf
\build_rule.template
(
194 echo Error
: build_rule.template is missing at folder
%EDK_TOOLS_PATH%\Conf\
196 copy %EDK_TOOLS_PATH%\Conf
\build_rule.template
%WORKSPACE%\Conf
\build_rule.txt
> nul
198 if defined RECONFIG
echo over
-write ... build_rule.template to
%WORKSPACE%\Conf
\build_rule.txt
199 if defined RECONFIG
copy /Y
%EDK_TOOLS_PATH%\Conf
\build_rule.template
%WORKSPACE%\Conf
\build_rule.txt
> nul
205 @REM Test
if we are going to have to
do a build
207 if defined FORCE_REBUILD
goto check_build_environment
208 if defined REBUILD
goto check_build_environment
209 if not exist "%EDK_TOOLS_PATH%\Bin" goto check_build_environment
211 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\BootSectImage.exe" goto check_build_environment
212 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\build.exe" goto check_build_environment
213 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\EfiLdrImage.exe" goto check_build_environment
214 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\EfiRom.exe" goto check_build_environment
215 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenBootSector.exe" goto check_build_environment
216 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFds.exe" goto check_build_environment
217 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFfs.exe" goto check_build_environment
218 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFv.exe" goto check_build_environment
219 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenFw.exe" goto check_build_environment
220 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenPage.exe" goto check_build_environment
221 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenSec.exe" goto check_build_environment
222 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\GenVtf.exe" goto check_build_environment
223 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\MigrationMsa2Inf.exe" goto check_build_environment
224 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\Split.exe" goto check_build_environment
225 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\TargetTool.exe" goto check_build_environment
226 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\TianoCompress.exe" goto check_build_environment
227 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\Trim.exe" goto check_build_environment
228 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\VfrCompile.exe" goto check_build_environment
229 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\Fpd2Dsc.exe" goto check_build_environment
230 IF NOT EXIST "%EDK_TOOLS_PATH%\Bin\Win32\VolInfo.exe" goto check_build_environment
234 :check_build_environment
236 if not defined FORCE_REBUILD
(
238 echo Rebuilding of tools is
not required. Binaries of the latest
,
239 echo tested versions of the tools have been tested and included in the
240 echo EDK II repository.
242 echo If you really want to build the tools
, use the ForceRebuild option.
247 if not defined BASE_TOOLS_PATH
(
248 if not exist "Source\C\Makefile" (
249 if not exist "%EDK_TOOLS_PATH%\Source\C\Makefile" goto no_source_files
250 set BASE_TOOLS_PATH
=%EDK_TOOLS_PATH%
252 set BASE_TOOLS_PATH
=%CD%
255 set PATH=%BASE_TOOLS_PATH%\Bin\Win32
;%PATH%
257 set PYTHONPATH
=%BASE_TOOLS_PATH%\Source\Python
259 if not defined PYTHON_HOME
(
260 if defined PYTHONHOME
(
261 set PYTHON_HOME
=%PYTHONHOME%
264 echo !!! ERROR
!!! PYTHON is required to build or execute the tools
!!!
270 @REM We have Python
, now test
for FreezePython application
271 if not defined PYTHON_FREEZER_PATH
(
272 @REM see
if we can
find FreezePython.ex
273 if exist "%PYTHON_HOME%\Tools\cx_Freeze-3.0.3\FreezePython.exe" (
274 set PYTHON_FREEZER_PATH
=%PYTHON_HOME%\Tools\cx_Freeze
-3.0.3
276 if exist "%PYTHON_HOME%\Tools\cx_Freeze\FreezePython.exe" (
277 set PYTHON_FREEZER_PATH
=%PYTHON_HOME%\Tools\cx_Freeze
279 if exist "C:\cx_Freeze\FreezePython.exe" (
280 set PYTHON_FREEZER_PATH
=C
:\cx_Freeze
282 if exist "C:\cx_Freeze-3.0.3" (
283 set PYTHON_FREEZER_PATH
=C
:\cx_Freeze
-3.0.3
285 if not defined PYTHON_FREEZER_PATH
(
287 echo !!! WARNING
!!! Will
not be able to compile Python programs to .exe
288 echo Will setup environment to
run Python scripts directly.
290 set PYTHONPATH
=%BASE_TOOLS_PATH%\Source\Python
291 set PATH=%PYTHONPATH%\build
;%PYTHONPATH%\GenFds
;%PYTHONPATH%\Trim
;%PATH%
292 set PATHEXT
=%PATHEXT%;.py
296 echo BASE_TOOLS_PATH
= %BASE_TOOLS_PATH%
297 echo PYTHON_PATH
= %PYTHON_PATH%
298 echo PYTHON_FREEZER_PATH
= %PYTHON_FREEZER_PATH%
301 if defined VCINSTALLDIR
goto VisualStudioAvailable
302 if defined VS71COMNTOOLS
(
303 call "%VS71COMNTOOLS%\vsvars32.bat"
305 if defined VS80COMNTOOLS
(
306 call "%VS80COMNTOOLS%\vsvars32.bat"
309 echo !!! ERROR
!!!! Cannot
find Visual Studio
, required to build C tools
!!!
315 :VisualStudioAvailable
316 if defined FORCE_REBUILD
goto CleanAndBuild
317 goto IncrementalBuild
323 del /f
/q
%BASE_TOOLS_PATH%\Bin\Win32\
*.
*
325 @REM Let CleanAndBuild fall through to IncrementalBuild
334 if defined PYTHON_FREEZER_PATH
(
335 echo BUILDING PYTHON TOOLS
342 echo !!! WARNING
!!! Cannot make executable from Python code
, executing python scripts instead
!!!
350 echo !!! ERROR
!!! Cannot build BaseTools applications
- no source directory located
!!!
356 echo Usage
: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]]"
358 echo base_tools_path BaseTools project
path, BASE_TOOLS_PATH will be
set to this
path.
359 echo edk_tools_path EDK_TOOLS_PATH will be
set to this
path.
360 echo Rebuild
If sources are available perform an Incremental build
, only
361 echo build those updated tools.
362 echo ForceRebuild
If sources are available
, rebuild all tools regardless of
363 echo whether they have been updated or
not.
364 echo Reconfig Reinstall target.txt
, tools_def.txt and build_rule.txt.