]> git.proxmox.com Git - mirror_edk2.git/blame - edksetup.bat
UefiPayloadPkg: Enhance UEFI payload for coreboot and Slim Bootloader
[mirror_edk2.git] / edksetup.bat
CommitLineData
8014e7ce 1@REM @file\r
2@REM Windows batch file to setup a WORKSPACE environment\r
878ddf1f 3@REM\r
cc7c6a37 4@REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
92063b0b 5@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
9ca2b9b9 6@REM SPDX-License-Identifier: BSD-2-Clause-Patent\r
878ddf1f 7@REM\r
8\r
a29212b2 9@REM set CYGWIN_HOME=C:\cygwin\r
878ddf1f 10\r
1e6add9e 11@REM usage:\r
8014e7ce 12@REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]\r
302e0e4a 13@REM if the argument, skip is present, only the paths and the\r
1e6add9e 14@REM test and set of environment settings are performed.\r
878ddf1f 15\r
16@REM ##############################################################\r
17@REM # You should not have to modify anything below this line\r
18@REM #\r
19\r
20@echo off\r
21\r
3fab94ed 22@REM\r
23@REM Set the WORKSPACE to the current working directory\r
24@REM\r
b7509087 25pushd .\r
26cd %~dp0\r
d27bd9e9 27\r
dff2673e 28if not defined WORKSPACE (\r
7ef23d9c 29 goto SetWorkSpace\r
d27bd9e9
LG
30)\r
31\r
dff2673e
LG
32if %WORKSPACE% == %CD% (\r
33 @REM Workspace is not changed.\r
7ef23d9c 34 goto ParseArgs\r
dff2673e
LG
35)\r
36\r
37:SetWorkSpace\r
d27bd9e9 38@REM set new workspace\r
dcc80786
LG
39if not defined WORKSPACE (\r
40 set WORKSPACE=%CD%\r
dcc80786 41)\r
3fab94ed 42\r
d27bd9e9 43:ParseArgs\r
7ef23d9c
OM
44if /I "%1"=="-h" goto Usage\r
45if /I "%1"=="-help" goto Usage\r
46if /I "%1"=="--help" goto Usage\r
47if /I "%1"=="/h" goto Usage\r
48if /I "%1"=="/?" goto Usage\r
49if /I "%1"=="/help" goto Usage\r
8014e7ce 50\r
7ef23d9c 51if /I "%1"=="NewBuild" shift\r
cc7c6a37 52if not defined EDK_TOOLS_PATH (\r
40d1adb3
YF
53 goto SetEdkToolsPath\r
54) else (\r
55 goto checkNt32Flag\r
56)\r
57\r
58:SetEdkToolsPath\r
59if %WORKSPACE:~-1% EQU \ (\r
60 @set EDK_BASETOOLS=%WORKSPACE%BaseTools\r
61) else (\r
62 @set EDK_BASETOOLS=%WORKSPACE%\BaseTools\r
63)\r
64if exist %EDK_BASETOOLS% (\r
65 set EDK_TOOLS_PATH=%EDK_BASETOOLS%\r
66 set EDK_BASETOOLS=\r
67) else (\r
68 if defined PACKAGES_PATH (\r
69 for %%i IN (%PACKAGES_PATH%) DO (\r
70 if exist %%~fi\BaseTools (\r
71 set EDK_TOOLS_PATH=%%~fi\BaseTools\r
72 goto checkNt32Flag\r
dcc80786
LG
73 )\r
74 )\r
40d1adb3
YF
75 ) else (\r
76 echo.\r
77 echo !!! ERROR !!! Cannot find BaseTools !!!\r
78 echo.\r
79 goto BadBaseTools\r
dcc80786
LG
80 )\r
81)\r
dcc80786 82\r
92063b0b 83:checkNt32Flag\r
4e908975
LG
84if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%\r
85\r
fb0b35e0 86@REM The Nt32 Emulation Platform requires Microsoft Libraries\r
92063b0b
CS
87@REM and headers to interface with Windows.\r
88if /I "%1"=="--nt32" (\r
89 if /I "%2"=="X64" (\r
90 shift\r
91 call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"\r
92 ) else (\r
93 call "%BASE_TOOLS_PATH%\get_vsvars.bat"\r
94 )\r
95 shift\r
96)\r
97\r
dcc80786 98:checkBaseTools\r
7ef23d9c
OM
99IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools\r
100call %EDK_TOOLS_PATH%\toolsetup.bat %*\r
101if /I "%1"=="Reconfig" shift\r
910e2062 102goto check_NASM\r
7ef23d9c 103goto check_cygwin\r
8014e7ce 104\r
105:BadBaseTools\r
106 @REM\r
7ef23d9c 107 REM Need the BaseTools Package in order to build\r
8014e7ce 108 @REM\r
7ef23d9c
OM
109 @echo.\r
110 @echo !!! ERROR !!! The BaseTools Package was not found !!!\r
111 @echo.\r
112 @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,\r
113 @echo For example,\r
114 @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools\r
115 @echo The setup script, toolsetup.bat must reside in this folder.\r
116 @echo.\r
117 goto end\r
8014e7ce 118\r
910e2062
YZ
119:check_NASM\r
120if not defined NASM_PREFIX (\r
121 @echo.\r
122 @echo !!! WARNING !!! NASM_PREFIX environment variable is not set\r
123 @if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"\r
124 @if exist "C:\nasm\nasm.exe" @echo Found nasm.exe, setting the environment variable to C:\nasm\\r
125 @if not exist "C:\nasm\nasm.exe" echo Attempting to build modules that require NASM will fail.\r
126)\r
127\r
a29212b2 128:check_cygwin\r
1f9c8606
OM
129if defined CYGWIN_HOME (\r
130 if not exist "%CYGWIN_HOME%" (\r
131 @echo.\r
132 @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!\r
133 @echo.\r
134 )\r
135) else (\r
7ef23d9c
OM
136 if exist c:\cygwin (\r
137 set CYGWIN_HOME=c:\cygwin\r
8014e7ce 138 ) else (\r
3a6b4559 139 @echo.\r
140 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!\r
141 @echo.\r
8014e7ce 142 )\r
1f9c8606 143)\r
878ddf1f 144\r
1f9c8606 145:cygwin_done\r
1e6add9e
CR
146if /I "%1"=="Rebuild" shift\r
147if /I "%1"=="ForceRebuild" shift\r
1f9c8606 148if "%1"=="" goto end\r
2fcfed38 149\r
70edbc34 150:Usage\r
3a6b4559 151 @echo.\r
1e6add9e 152 @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32 [X64]] [Reconfig] [Rebuild] [ForceRebuild]"\r
92063b0b
CS
153 @echo --nt32 [X64] If a compiler tool chain is not available in the\r
154 @echo environment, call a script to attempt to set one up.\r
155 @echo This flag is only required if building the\r
156 @echo Nt32Pkg/Nt32Pkg.dsc system emulator.\r
157 @echo If the X64 argument is set, and a compiler tool chain is\r
158 @echo not available, attempt to set up a tool chain that will\r
159 @echo create X64 binaries. Setting these two options have the\r
160 @echo potential side effect of changing tool chains used for a\r
161 @echo rebuild.\r
3a6b4559 162 @echo.\r
163 @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r
1e6add9e
CR
164 @echo Rebuild Perform incremental rebuild of BaseTools binaries.\r
165 @echo ForceRebuild Force a full rebuild of BaseTools binaries.\r
3a6b4559 166 @echo.\r
167 @echo Note that target.template, tools_def.template and build_rules.template\r
1f9c8606
OM
168 @echo will only be copied to target.txt, tools_def.txt and build_rule.txt\r
169 @echo respectively if they do not exist. Use option [Reconfig] to force the copy.\r
3a6b4559 170 @echo.\r
7ef23d9c 171 goto end\r
3fab94ed 172\r
878ddf1f 173:end\r
7ef23d9c 174 popd\r