]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - edksetup.bat
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / edksetup.bat
... / ...
CommitLineData
1@REM @file\r
2@REM Windows batch file to setup a WORKSPACE environment\r
3@REM\r
4@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
5@REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
6@REM SPDX-License-Identifier: BSD-2-Clause-Patent\r
7@REM\r
8\r
9@REM set CYGWIN_HOME=C:\cygwin\r
10\r
11@REM usage:\r
12@REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]\r
13@REM if the argument, skip is present, only the paths and the\r
14@REM test and set of environment settings are performed.\r
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
22@REM\r
23@REM Set the WORKSPACE to the current working directory\r
24@REM\r
25pushd .\r
26cd %~dp0\r
27\r
28if not defined WORKSPACE (\r
29 goto SetWorkSpace\r
30)\r
31\r
32if %WORKSPACE% == %CD% (\r
33 @REM Workspace is not changed.\r
34 goto ParseArgs\r
35)\r
36\r
37:SetWorkSpace\r
38@REM set new workspace\r
39if not defined WORKSPACE (\r
40 set WORKSPACE=%CD%\r
41)\r
42\r
43:ParseArgs\r
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
50\r
51if /I "%1"=="NewBuild" shift\r
52if not defined EDK_TOOLS_PATH (\r
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
73 )\r
74 )\r
75 ) else (\r
76 echo.\r
77 echo !!! ERROR !!! Cannot find BaseTools !!!\r
78 echo.\r
79 goto BadBaseTools\r
80 )\r
81)\r
82\r
83:checkNt32Flag\r
84if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%\r
85\r
86:checkBaseTools\r
87IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools\r
88call %EDK_TOOLS_PATH%\toolsetup.bat %*\r
89if /I "%1"=="Reconfig" shift\r
90goto check_NASM\r
91goto check_cygwin\r
92\r
93:BadBaseTools\r
94 @REM\r
95 REM Need the BaseTools Package in order to build\r
96 @REM\r
97 @echo.\r
98 @echo !!! ERROR !!! The BaseTools Package was not found !!!\r
99 @echo.\r
100 @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,\r
101 @echo For example,\r
102 @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools\r
103 @echo The setup script, toolsetup.bat must reside in this folder.\r
104 @echo.\r
105 goto end\r
106\r
107:check_NASM\r
108if not defined NASM_PREFIX (\r
109 @echo.\r
110 @echo !!! WARNING !!! NASM_PREFIX environment variable is not set\r
111 @if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"\r
112 @if exist "C:\nasm\nasm.exe" @echo Found nasm.exe, setting the environment variable to C:\nasm\\r
113 @if not exist "C:\nasm\nasm.exe" echo Attempting to build modules that require NASM will fail.\r
114)\r
115\r
116:check_CLANGPDB\r
117@REM In Windows, set CLANG_HOST_BIN=n to use nmake command\r
118@set CLANG_HOST_BIN=n\r
119if not defined CLANG_BIN (\r
120 @echo.\r
121 @echo !!! WARNING !!! CLANG_BIN environment variable is not set\r
122 @if exist "C:\Program Files\LLVM\bin\clang.exe" (\r
123 @set "CLANG_BIN=C:\Program Files\LLVM\bin\"\r
124 @echo Found LLVM, setting CLANG_BIN environment variable to C:\Program Files\LLVM\bin\\r
125 )\r
126)\r
127\r
128:check_cygwin\r
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
136 if exist c:\cygwin (\r
137 set CYGWIN_HOME=c:\cygwin\r
138 ) else (\r
139 @echo.\r
140 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!\r
141 @echo.\r
142 )\r
143)\r
144\r
145:cygwin_done\r
146if /I "%1"=="Rebuild" shift\r
147if /I "%1"=="ForceRebuild" shift\r
148if /I "%1"=="VS2019" shift\r
149if /I "%1"=="VS2017" shift\r
150if /I "%1"=="VS2015" shift\r
151if /I "%1"=="VS2013" shift\r
152if /I "%1"=="VS2012" shift\r
153if "%1"=="" goto end\r
154\r
155:Usage\r
156 @echo.\r
157 @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"\r
158 @echo.\r
159 @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r
160 @echo Rebuild Perform incremental rebuild of BaseTools binaries.\r
161 @echo ForceRebuild Force a full rebuild of BaseTools binaries.\r
162 @echo VS2012 Set the env for VS2012 build.\r
163 @echo VS2013 Set the env for VS2013 build.\r
164 @echo VS2015 Set the env for VS2015 build.\r
165 @echo VS2017 Set the env for VS2017 build.\r
166 @echo VS2019 Set the env for VS2019 build.\r
167 @echo.\r
168 @echo Note that target.template, tools_def.template and build_rules.template\r
169 @echo will only be copied to target.txt, tools_def.txt and build_rule.txt\r
170 @echo respectively if they do not exist. Use option [Reconfig] to force the copy.\r
171 @echo.\r
172 goto end\r
173\r
174:end\r
175 popd\r