]>
Commit | Line | Data |
---|---|---|
8014e7ce | 1 | @REM @file\r |
f7496d71 | 2 | @REM This stand-alone program is typically called by the edksetup.bat file,\r |
8014e7ce | 3 | @REM however it may be executed directly from the BaseTools project folder\r |
4 | @REM if the file is not executed within a WORKSPACE\BaseTools folder.\r | |
07a756b9 | 5 | @REM\r |
670c903a | 6 | @REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r |
92063b0b | 7 | @REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r |
8014e7ce | 8 | @REM\r |
2e351cbe | 9 | @REM SPDX-License-Identifier: BSD-2-Clause-Patent\r |
07a756b9 | 10 | @REM\r |
11 | \r | |
12 | @echo off\r | |
8014e7ce | 13 | pushd .\r |
6759212f | 14 | set SCRIPT_ERROR=0\r |
07a756b9 | 15 | \r |
8014e7ce | 16 | @REM ##############################################################\r |
17 | @REM # You should not have to modify anything below this line\r | |
18 | @REM #\r | |
07a756b9 | 19 | \r |
e4ac870f LG |
20 | if /I "%1"=="-h" goto Usage\r |
21 | if /I "%1"=="-help" goto Usage\r | |
22 | if /I "%1"=="--help" goto Usage\r | |
23 | if /I "%1"=="/h" goto Usage\r | |
24 | if /I "%1"=="/help" goto Usage\r | |
25 | if /I "%1"=="/?" goto Usage\r | |
07a756b9 | 26 | \r |
07a756b9 | 27 | \r |
8014e7ce | 28 | :loop\r |
e4ac870f | 29 | if "%1"=="" goto setup_workspace\r |
e4ac870f | 30 | if /I "%1"=="Reconfig" (\r |
8014e7ce | 31 | shift\r |
32 | set RECONFIG=TRUE\r | |
33 | goto loop\r | |
34 | )\r | |
e4ac870f | 35 | if /I "%1"=="Rebuild" (\r |
8014e7ce | 36 | shift\r |
37 | set REBUILD=TRUE\r | |
38 | goto loop\r | |
39 | )\r | |
e4ac870f | 40 | if /I "%1"=="ForceRebuild" (\r |
8014e7ce | 41 | shift\r |
42 | set FORCE_REBUILD=TRUE\r | |
43 | goto loop\r | |
44 | )\r | |
670c903a CCJ |
45 | if /I "%1"=="VS2019" (\r |
46 | shift\r | |
47 | set VS2019=TRUE\r | |
48 | set VSTool=VS2019\r | |
49 | goto loop\r | |
50 | )\r | |
6759212f DB |
51 | if /I "%1"=="VS2017" (\r |
52 | shift\r | |
53 | set VS2017=TRUE\r | |
54 | set VSTool=VS2017\r | |
55 | goto loop\r | |
56 | )\r | |
57 | if /I "%1"=="VS2015" (\r | |
58 | shift\r | |
59 | set VS2015=TRUE\r | |
60 | set VSTool=VS2015\r | |
61 | goto loop\r | |
62 | )\r | |
63 | if /I "%1"=="VS2013" (\r | |
64 | shift\r | |
65 | set VS2013=TRUE\r | |
66 | set VSTool=VS2013\r | |
67 | goto loop\r | |
68 | )\r | |
69 | if /I "%1"=="VS2012" (\r | |
70 | shift\r | |
71 | set VS2012=TRUE\r | |
72 | set VSTool=VS2012\r | |
73 | goto loop\r | |
74 | )\r | |
8014e7ce | 75 | if "%1"=="" goto setup_workspace\r |
76 | if exist %1 (\r | |
77 | if not defined BASE_TOOLS_PATH (\r | |
78 | if exist %1\Source set BASE_TOOLS_PATH=%1\r | |
79 | shift\r | |
80 | goto loop\r | |
81 | )\r | |
82 | if not defined EDK_TOOLS_PATH (\r | |
83 | if exist %1\Bin\Win32 set EDK_TOOLS_PATH=%1\r | |
84 | shift\r | |
85 | goto loop\r | |
86 | )\r | |
87 | echo.\r | |
88 | echo !!! ERROR !!! Unknown argument, %1 !!!\r | |
89 | echo.\r | |
90 | goto end\r | |
91 | ) else (\r | |
92 | echo.\r | |
93 | echo !!! ERROR !!! Unknown argument, %1 !!!\r | |
94 | echo.\r | |
95 | goto end\r | |
96 | )\r | |
97 | goto loop\r | |
98 | \r | |
99 | \r | |
100 | @REM\r | |
101 | @REM Check the required system environment variables\r | |
102 | @REM\r | |
07a756b9 | 103 | \r |
104 | :setup_workspace\r | |
8014e7ce | 105 | REM\r |
106 | REM check the EDK_TOOLS_PATH\r | |
107 | REM\r | |
108 | if not defined EDK_TOOLS_PATH goto no_EDK_TOOLS_PATH\r | |
109 | if exist %EDK_TOOLS_PATH% goto set_PATH\r | |
07a756b9 | 110 | \r |
8014e7ce | 111 | :no_EDK_TOOLS_PATH\r |
112 | if not defined WORKSPACE (\r | |
113 | if defined BASE_TOOLS_PATH (\r | |
114 | set EDK_TOOLS_PATH=%BASE_TOOLS_PATH%\r | |
115 | goto set_PATH\r | |
116 | ) else (\r | |
117 | echo.\r | |
118 | echo !!! ERROR !!! Neither BASE_TOOLS_PATH nor EDK_TOOLS_PATH are set. !!!\r | |
119 | echo.\r | |
120 | goto end\r | |
121 | )\r | |
122 | ) else (\r | |
123 | if exist %WORKSPACE%\BaseTools\Bin (\r | |
124 | set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools\r | |
125 | goto set_PATH\r | |
126 | ) else (\r | |
127 | echo.\r | |
128 | echo !!! ERROR !!! No tools path available. Please set EDK_TOOLS_PATH !!!\r | |
129 | echo.\r | |
130 | goto end\r | |
131 | )\r | |
132 | )\r | |
07a756b9 | 133 | \r |
8014e7ce | 134 | :set_PATH\r |
135 | if defined WORKSPACE_TOOLS_PATH goto check_PATH\r | |
dcc80786 | 136 | if not defined EDK_TOOLS_BIN (\r |
0cd84daa LG |
137 | set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r |
138 | if not exist %EDK_TOOLS_PATH%\Bin\Win32 (\r | |
dcc80786 LG |
139 | echo.\r |
140 | echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!\r | |
141 | echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32\r | |
142 | echo Or configure EDK_TOOLS_BIN env to point Win32 directory.\r | |
f7496d71 | 143 | echo.\r |
dcc80786 LG |
144 | )\r |
145 | )\r | |
146 | set PATH=%EDK_TOOLS_BIN%;%PATH%\r | |
8014e7ce | 147 | set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%\r |
148 | goto PATH_ok\r | |
07a756b9 | 149 | \r |
8014e7ce | 150 | :check_PATH\r |
151 | if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto PATH_ok\r | |
dcc80786 | 152 | if not defined EDK_TOOLS_BIN (\r |
0cd84daa LG |
153 | set EDK_TOOLS_BIN=%EDK_TOOLS_PATH%\Bin\Win32\r |
154 | if not exist %EDK_TOOLS_PATH%\Bin\Win32 (\r | |
dcc80786 LG |
155 | echo.\r |
156 | echo !!! ERROR !!! Cannot find BaseTools Bin Win32!!!\r | |
157 | echo Please check the directory %EDK_TOOLS_PATH%\Bin\Win32\r | |
158 | echo Or configure EDK_TOOLS_BIN env to point Win32 directory.\r | |
f7496d71 | 159 | echo.\r |
dcc80786 LG |
160 | )\r |
161 | )\r | |
162 | set PATH=%EDK_TOOLS_BIN%;%PATH%\r | |
8014e7ce | 163 | set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%\r |
164 | echo Resetting the PATH variable to include the EDK_TOOLS_PATH for this session.\r | |
07a756b9 | 165 | \r |
8014e7ce | 166 | :PATH_ok\r |
07a756b9 | 167 | REM\r |
dcc80786 | 168 | REM copy *.template to %CONF_PATH%\r |
07a756b9 | 169 | REM\r |
8014e7ce | 170 | if not defined WORKSPACE (\r |
171 | if defined RECONFIG (\r | |
172 | echo.\r | |
173 | echo !!! WARNING !!! WORKSPACE environment variable was not set, cannot Reconfig !!!\r | |
174 | echo.\r | |
175 | )\r | |
176 | goto skip_reconfig\r | |
177 | )\r | |
178 | \r | |
314b26a8 YZ |
179 | IF NOT exist "%EDK_TOOLS_PATH%\set_vsprefix_envs.bat" (\r |
180 | @echo.\r | |
181 | @echo !!! ERROR !!! The set_vsprefix_envs.bat was not found !!!\r | |
182 | @echo.\r | |
183 | goto end\r | |
184 | )\r | |
670c903a CCJ |
185 | if defined VS2019 (\r |
186 | call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2019\r | |
187 | ) else if defined VS2017 (\r | |
6759212f DB |
188 | call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2017\r |
189 | ) else if defined VS2015 (\r | |
190 | call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2015\r | |
191 | call %EDK_TOOLS_PATH%\get_vsvars.bat VS2015\r | |
192 | ) else if defined VS2013 (\r | |
193 | call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2013\r | |
194 | call %EDK_TOOLS_PATH%\get_vsvars.bat VS2013\r | |
195 | ) else if defined VS2012 (\r | |
196 | call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat VS2012\r | |
197 | call %EDK_TOOLS_PATH%\get_vsvars.bat VS2012\r | |
198 | ) else (\r | |
199 | call %EDK_TOOLS_PATH%\set_vsprefix_envs.bat\r | |
200 | call %EDK_TOOLS_PATH%\get_vsvars.bat\r | |
201 | )\r | |
202 | if %SCRIPT_ERROR% NEQ 0 (\r | |
203 | @echo.\r | |
204 | @echo !!! ERROR !!! %VSTool% is not installed !!!\r | |
205 | @echo.\r | |
206 | goto end\r | |
207 | )\r | |
314b26a8 | 208 | \r |
1f2cd652 MH |
209 | if not defined CONF_PATH (\r |
210 | set CONF_PATH=%WORKSPACE%\Conf\r | |
ae5cc3c3 | 211 | )\r |
1f2cd652 | 212 | \r |
ae5cc3c3 HW |
213 | if NOT exist %CONF_PATH% (\r |
214 | if defined PACKAGES_PATH (\r | |
215 | for %%i IN (%PACKAGES_PATH%) DO (\r | |
216 | if exist %%~fi\Conf (\r | |
217 | set CONF_PATH=%%i\Conf\r | |
218 | goto CopyConf\r | |
dcc80786 LG |
219 | )\r |
220 | )\r | |
221 | )\r | |
222 | )\r | |
f7496d71 | 223 | \r |
dcc80786 LG |
224 | :CopyConf\r |
225 | if NOT exist %CONF_PATH% (\r | |
226 | mkdir %CONF_PATH%\r | |
07a756b9 | 227 | ) else (\r |
8014e7ce | 228 | if defined RECONFIG (\r |
07a756b9 | 229 | echo.\r |
f0a3f6d9 | 230 | echo Overwriting the files in the CONF_PATH directory\r |
07a756b9 | 231 | echo using the default template files\r |
232 | echo.\r | |
233 | )\r | |
234 | )\r | |
8014e7ce | 235 | \r |
dcc80786 LG |
236 | if NOT exist %CONF_PATH%\target.txt (\r |
237 | echo copying ... target.template to %CONF_PATH%\target.txt\r | |
884f6e76 | 238 | if NOT exist %EDK_TOOLS_PATH%\Conf\target.template (\r |
239 | echo Error: target.template is missing at folder %EDK_TOOLS_PATH%\Conf\\r | |
240 | )\r | |
dcc80786 | 241 | copy %EDK_TOOLS_PATH%\Conf\target.template %CONF_PATH%\target.txt > nul\r |
07a756b9 | 242 | ) else (\r |
f0a3f6d9 | 243 | if defined RECONFIG echo overwrite ... target.template to %CONF_PATH%\target.txt\r |
dcc80786 | 244 | if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\target.template %CONF_PATH%\target.txt > nul\r |
07a756b9 | 245 | )\r |
8014e7ce | 246 | \r |
dcc80786 LG |
247 | if NOT exist %CONF_PATH%\tools_def.txt (\r |
248 | echo copying ... tools_def.template to %CONF_PATH%\tools_def.txt\r | |
884f6e76 | 249 | if NOT exist %EDK_TOOLS_PATH%\Conf\tools_def.template (\r |
250 | echo Error: tools_def.template is missing at folder %EDK_TOOLS_PATH%\Conf\\r | |
251 | )\r | |
dcc80786 | 252 | copy %EDK_TOOLS_PATH%\Conf\tools_def.template %CONF_PATH%\tools_def.txt > nul\r |
07a756b9 | 253 | ) else (\r |
f0a3f6d9 | 254 | if defined RECONFIG echo overwrite ... tools_def.template to %CONF_PATH%\tools_def.txt\r |
dcc80786 | 255 | if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\tools_def.template %CONF_PATH%\tools_def.txt > nul\r |
07a756b9 | 256 | )\r |
8014e7ce | 257 | \r |
dcc80786 LG |
258 | if NOT exist %CONF_PATH%\build_rule.txt (\r |
259 | echo copying ... build_rule.template to %CONF_PATH%\build_rule.txt\r | |
884f6e76 | 260 | if NOT exist %EDK_TOOLS_PATH%\Conf\build_rule.template (\r |
261 | echo Error: build_rule.template is missing at folder %EDK_TOOLS_PATH%\Conf\\r | |
262 | )\r | |
dcc80786 | 263 | copy %EDK_TOOLS_PATH%\Conf\build_rule.template %CONF_PATH%\build_rule.txt > nul\r |
07a756b9 | 264 | ) else (\r |
dcc80786 LG |
265 | if defined RECONFIG echo over-write ... build_rule.template to %CONF_PATH%\build_rule.txt\r |
266 | if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\build_rule.template %CONF_PATH%\build_rule.txt > nul\r | |
07a756b9 | 267 | )\r |
268 | \r | |
dcc80786 LG |
269 | echo PATH = %PATH%\r |
270 | echo.\r | |
271 | if defined WORKSPACE (\r | |
272 | echo WORKSPACE = %WORKSPACE%\r | |
273 | )\r | |
274 | if defined PACKAGES_PATH (\r | |
275 | echo PACKAGES_PATH = %PACKAGES_PATH%\r | |
276 | )\r | |
277 | echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%\r | |
278 | if defined BASE_TOOLS_PATH (\r | |
279 | echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%\r | |
280 | )\r | |
281 | if defined EDK_TOOLS_BIN (\r | |
282 | echo EDK_TOOLS_BIN = %EDK_TOOLS_BIN%\r | |
283 | )\r | |
284 | echo CONF_PATH = %CONF_PATH%\r | |
285 | echo.\r | |
286 | \r | |
8014e7ce | 287 | :skip_reconfig\r |
288 | \r | |
289 | @REM\r | |
290 | @REM Test if we are going to have to do a build\r | |
291 | @REM\r | |
292 | if defined FORCE_REBUILD goto check_build_environment\r | |
293 | if defined REBUILD goto check_build_environment\r | |
dcc80786 | 294 | if not exist "%EDK_TOOLS_PATH%" goto check_build_environment\r |
0cd84daa | 295 | if not exist "%EDK_TOOLS_BIN%" goto check_build_environment\r |
dcc80786 | 296 | \r |
7419aedd | 297 | IF NOT EXIST "%EDK_TOOLS_BIN%\EfiRom.exe" goto check_c_tools\r |
7419aedd LG |
298 | IF NOT EXIST "%EDK_TOOLS_BIN%\GenFfs.exe" goto check_c_tools\r |
299 | IF NOT EXIST "%EDK_TOOLS_BIN%\GenFv.exe" goto check_c_tools\r | |
300 | IF NOT EXIST "%EDK_TOOLS_BIN%\GenFw.exe" goto check_c_tools\r | |
7419aedd | 301 | IF NOT EXIST "%EDK_TOOLS_BIN%\GenSec.exe" goto check_c_tools\r |
7419aedd LG |
302 | IF NOT EXIST "%EDK_TOOLS_BIN%\TianoCompress.exe" goto check_c_tools\r |
303 | IF NOT EXIST "%EDK_TOOLS_BIN%\VfrCompile.exe" goto check_c_tools\r | |
304 | IF NOT EXIST "%EDK_TOOLS_BIN%\VolInfo.exe" goto check_c_tools\r | |
305 | \r | |
7b500c60 | 306 | goto check_build_environment\r |
7419aedd LG |
307 | \r |
308 | :check_c_tools\r | |
309 | echo.\r | |
fb0b35e0 | 310 | echo !!! ERROR !!! Binary C tools are missing. They are required to be built from BaseTools Source.\r |
7419aedd | 311 | echo.\r |
07a756b9 | 312 | \r |
8014e7ce | 313 | :check_build_environment\r |
9c2d68c0 | 314 | set PYTHONHASHSEED=1\r |
8014e7ce | 315 | \r |
316 | if not defined BASE_TOOLS_PATH (\r | |
317 | if not exist "Source\C\Makefile" (\r | |
318 | if not exist "%EDK_TOOLS_PATH%\Source\C\Makefile" goto no_source_files\r | |
319 | set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%\r | |
320 | ) else (\r | |
321 | set BASE_TOOLS_PATH=%CD%\r | |
322 | )\r | |
323 | )\r | |
8014e7ce | 324 | \r |
9c2d68c0 | 325 | :defined_python\r |
7aef7b7c LG |
326 | if defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (\r |
327 | goto check_python_available\r | |
328 | )\r | |
9c2d68c0 ZF |
329 | if defined PYTHON3_ENABLE (\r |
330 | if "%PYTHON3_ENABLE%" EQU "TRUE" (\r | |
7aef7b7c LG |
331 | set PYTHON_COMMAND=py -3\r |
332 | goto check_python_available\r | |
333 | ) else (\r | |
334 | goto check_python2\r | |
335 | )\r | |
336 | )\r | |
337 | if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (\r | |
338 | set PYTHON_COMMAND=py -3\r | |
339 | py -3 %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1\r | |
340 | setlocal enabledelayedexpansion\r | |
341 | set /p PythonCheck=<"PythonCheck.txt"\r | |
342 | del PythonCheck.txt\r | |
343 | if "!PythonCheck!" NEQ "TRUE" (\r | |
344 | if not defined PYTHON_HOME if not defined PYTHONHOME (\r | |
345 | endlocal\r | |
346 | set PYTHON_COMMAND=\r | |
1ccc4d89 | 347 | echo.\r |
7aef7b7c LG |
348 | echo !!! ERROR !!! Binary python tools are missing.\r |
349 | echo PYTHON_COMMAND, PYTHON3_ENABLE or PYTHON_HOME\r | |
350 | echo Environment variable is not set successfully.\r | |
351 | echo They is required to build or execute the python tools.\r | |
1ccc4d89 LG |
352 | echo.\r |
353 | goto end\r | |
9c2d68c0 | 354 | ) else (\r |
7aef7b7c | 355 | goto check_python2\r |
9c2d68c0 | 356 | )\r |
7aef7b7c LG |
357 | ) else (\r |
358 | goto check_freezer_path\r | |
359 | )\r | |
9c2d68c0 ZF |
360 | )\r |
361 | \r | |
7aef7b7c LG |
362 | :check_python2\r |
363 | endlocal\r | |
9c2d68c0 ZF |
364 | if defined PYTHON_HOME (\r |
365 | if EXIST "%PYTHON_HOME%" (\r | |
7aef7b7c LG |
366 | set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r |
367 | goto check_python_available\r | |
9c2d68c0 | 368 | )\r |
7aef7b7c | 369 | )\r |
9c2d68c0 ZF |
370 | if defined PYTHONHOME (\r |
371 | if EXIST "%PYTHONHOME%" (\r | |
372 | set PYTHON_HOME=%PYTHONHOME%\r | |
7aef7b7c LG |
373 | set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r |
374 | goto check_python_available\r | |
375 | )\r | |
376 | )\r | |
377 | echo.\r | |
378 | echo !!! ERROR !!! PYTHON_HOME is not defined or The value of this variable does not exist\r | |
379 | echo.\r | |
380 | goto end\r | |
381 | :check_python_available\r | |
382 | %PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1\r | |
383 | setlocal enabledelayedexpansion\r | |
384 | set /p PythonCheck=<"PythonCheck.txt"\r | |
385 | del PythonCheck.txt\r | |
386 | if "!PythonCheck!" NEQ "TRUE" (\r | |
387 | echo.\r | |
388 | echo ! ERROR ! "%PYTHON_COMMAND%" is not installed or added to environment variables\r | |
389 | echo.\r | |
390 | goto end\r | |
391 | ) else (\r | |
9c2d68c0 | 392 | goto check_freezer_path\r |
8014e7ce | 393 | )\r |
394 | \r | |
1534b622 MC |
395 | \r |
396 | \r | |
9c2d68c0 | 397 | :check_freezer_path\r |
7aef7b7c | 398 | endlocal\r |
1534b622 MC |
399 | \r |
400 | %PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL\r | |
401 | if %ERRORLEVEL% EQU 0 (\r | |
402 | goto use_pip_basetools\r | |
403 | ) else (\r | |
17143c48 RC |
404 | REM reset ERRORLEVEL\r |
405 | type nul>nul\r | |
1534b622 MC |
406 | goto use_builtin_basetools\r |
407 | )\r | |
408 | \r | |
409 | :use_builtin_basetools\r | |
410 | @echo Using EDK2 in-source Basetools\r | |
9c2d68c0 | 411 | if defined BASETOOLS_PYTHON_SOURCE goto print_python_info\r |
7b500c60 | 412 | set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"\r |
7419aedd LG |
413 | set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python\r |
414 | set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%\r | |
1534b622 MC |
415 | goto print_python_info\r |
416 | \r | |
417 | :use_pip_basetools\r | |
418 | @echo Using Pip Basetools\r | |
419 | set "PATH=%BASE_TOOLS_PATH%\BinPipWrappers\WindowsLike;%PATH%"\r | |
420 | set BASETOOLS_PYTHON_SOURCE=edk2basetools\r | |
421 | goto print_python_info\r | |
f7496d71 | 422 | \r |
9c2d68c0 | 423 | :print_python_info\r |
7419aedd | 424 | echo PATH = %PATH%\r |
7aef7b7c | 425 | if defined PYTHON3_ENABLE if "%PYTHON3_ENABLE%" EQU "TRUE" (\r |
9c2d68c0 | 426 | echo PYTHON3_ENABLE = %PYTHON3_ENABLE%\r |
7aef7b7c | 427 | echo PYTHON3 = %PYTHON_COMMAND%\r |
9c2d68c0 | 428 | ) else (\r |
7aef7b7c LG |
429 | echo PYTHON3_ENABLE = FALSE\r |
430 | echo PYTHON_COMMAND = %PYTHON_COMMAND%\r | |
9c2d68c0 | 431 | )\r |
7419aedd | 432 | echo PYTHONPATH = %PYTHONPATH%\r |
8014e7ce | 433 | echo.\r |
434 | \r | |
7419aedd LG |
435 | :VisualStudioAvailable\r |
436 | if not defined FORCE_REBUILD (\r | |
437 | if not defined REBUILD (\r | |
438 | goto end\r | |
439 | )\r | |
440 | )\r | |
6759212f | 441 | \r |
e4ac870f LG |
442 | if not defined VCINSTALLDIR (\r |
443 | @echo.\r | |
444 | @echo !!! ERROR !!!! Cannot find Visual Studio, required to build C tools !!!\r | |
445 | @echo.\r | |
446 | goto end\r | |
8014e7ce | 447 | )\r |
e4ac870f | 448 | if not defined FORCE_REBUILD goto IncrementalBuild\r |
8014e7ce | 449 | \r |
450 | :CleanAndBuild\r | |
451 | pushd .\r | |
452 | cd %BASE_TOOLS_PATH%\r | |
453 | call nmake cleanall\r | |
454 | del /f /q %BASE_TOOLS_PATH%\Bin\Win32\*.*\r | |
455 | popd\r | |
456 | @REM Let CleanAndBuild fall through to IncrementalBuild\r | |
457 | \r | |
458 | \r | |
459 | :IncrementalBuild\r | |
460 | pushd .\r | |
461 | cd %BASE_TOOLS_PATH%\r | |
462 | call nmake c\r | |
463 | popd\r | |
8014e7ce | 464 | goto end\r |
465 | \r | |
466 | \r | |
467 | :no_source_files\r | |
468 | echo.\r | |
469 | echo !!! ERROR !!! Cannot build BaseTools applications - no source directory located !!!\r | |
470 | echo.\r | |
471 | goto end\r | |
472 | \r | |
473 | :Usage\r | |
e4ac870f | 474 | @echo.\r |
670c903a | 475 | echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [ Rebuild | ForceRebuild ] [Reconfig] [base_tools_path [edk_tools_path]] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"\r |
e4ac870f | 476 | @echo.\r |
f7496d71 | 477 | @echo base_tools_path BaseTools project path, BASE_TOOLS_PATH will be set to this path.\r |
e4ac870f | 478 | @echo edk_tools_path EDK_TOOLS_PATH will be set to this path.\r |
f7496d71 | 479 | @echo Rebuild If sources are available perform an Incremental build, only\r |
e4ac870f | 480 | @echo build those updated tools.\r |
f7496d71 | 481 | @echo ForceRebuild If sources are available, rebuild all tools regardless of\r |
e4ac870f LG |
482 | @echo whether they have been updated or not.\r |
483 | @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r | |
6759212f DB |
484 | @echo VS2012 Set the env for VS2012 build.\r |
485 | @echo VS2013 Set the env for VS2013 build.\r | |
486 | @echo VS2015 Set the env for VS2015 build.\r | |
487 | @echo VS2017 Set the env for VS2017 build.\r | |
670c903a | 488 | @echo VS2019 Set the env for VS2019 build.\r |
e4ac870f | 489 | @echo.\r |
07a756b9 | 490 | \r |
491 | :end\r | |
8014e7ce | 492 | set REBUILD=\r |
493 | set FORCE_REBUILD=\r | |
494 | set RECONFIG=\r | |
670c903a | 495 | set VS2019=\r |
6759212f DB |
496 | set VS2017=\r |
497 | set VS2015=\r | |
498 | set VS2013=\r | |
499 | set VS2012=\r | |
500 | set VSTool=\r | |
8014e7ce | 501 | popd\r |
502 | \r |