]>
Commit | Line | Data |
---|---|---|
8014e7ce | 1 | @REM @file\r |
2 | @REM Windows batch file to setup a WORKSPACE environment\r | |
878ddf1f | 3 | @REM\r |
670c903a | 4 | @REM Copyright (c) 2006 - 2019, 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 | 25 | pushd .\r |
26 | cd %~dp0\r | |
d27bd9e9 | 27 | \r |
dff2673e | 28 | if not defined WORKSPACE (\r |
7ef23d9c | 29 | goto SetWorkSpace\r |
d27bd9e9 LG |
30 | )\r |
31 | \r | |
dff2673e LG |
32 | if %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 |
39 | if not defined WORKSPACE (\r |
40 | set WORKSPACE=%CD%\r | |
dcc80786 | 41 | )\r |
3fab94ed | 42 | \r |
d27bd9e9 | 43 | :ParseArgs\r |
7ef23d9c OM |
44 | if /I "%1"=="-h" goto Usage\r |
45 | if /I "%1"=="-help" goto Usage\r | |
46 | if /I "%1"=="--help" goto Usage\r | |
47 | if /I "%1"=="/h" goto Usage\r | |
48 | if /I "%1"=="/?" goto Usage\r | |
49 | if /I "%1"=="/help" goto Usage\r | |
8014e7ce | 50 | \r |
7ef23d9c | 51 | if /I "%1"=="NewBuild" shift\r |
cc7c6a37 | 52 | if 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 | |
59 | if %WORKSPACE:~-1% EQU \ (\r | |
60 | @set EDK_BASETOOLS=%WORKSPACE%BaseTools\r | |
61 | ) else (\r | |
62 | @set EDK_BASETOOLS=%WORKSPACE%\BaseTools\r | |
63 | )\r | |
64 | if 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 |
84 | if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%\r |
85 | \r | |
dcc80786 | 86 | :checkBaseTools\r |
7ef23d9c OM |
87 | IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools\r |
88 | call %EDK_TOOLS_PATH%\toolsetup.bat %*\r | |
89 | if /I "%1"=="Reconfig" shift\r | |
910e2062 | 90 | goto check_NASM\r |
7ef23d9c | 91 | goto check_cygwin\r |
8014e7ce | 92 | \r |
93 | :BadBaseTools\r | |
94 | @REM\r | |
7ef23d9c | 95 | REM Need the BaseTools Package in order to build\r |
8014e7ce | 96 | @REM\r |
7ef23d9c OM |
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 | |
8014e7ce | 106 | \r |
910e2062 YZ |
107 | :check_NASM\r |
108 | if 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 | |
cc617b6e ZL |
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 | |
119 | if 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 | |
a29212b2 | 128 | :check_cygwin\r |
1f9c8606 OM |
129 | if 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 |
146 | if /I "%1"=="Rebuild" shift\r |
147 | if /I "%1"=="ForceRebuild" shift\r | |
670c903a | 148 | if /I "%1"=="VS2019" shift\r |
6759212f DB |
149 | if /I "%1"=="VS2017" shift\r |
150 | if /I "%1"=="VS2015" shift\r | |
151 | if /I "%1"=="VS2013" shift\r | |
152 | if /I "%1"=="VS2012" shift\r | |
1f9c8606 | 153 | if "%1"=="" goto end\r |
2fcfed38 | 154 | \r |
70edbc34 | 155 | :Usage\r |
3a6b4559 | 156 | @echo.\r |
670c903a | 157 | @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [Reconfig] [Rebuild] [ForceRebuild] [VS2019] [VS2017] [VS2015] [VS2013] [VS2012]"\r |
3a6b4559 | 158 | @echo.\r |
159 | @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r | |
1e6add9e CR |
160 | @echo Rebuild Perform incremental rebuild of BaseTools binaries.\r |
161 | @echo ForceRebuild Force a full rebuild of BaseTools binaries.\r | |
6759212f DB |
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 | |
670c903a | 166 | @echo VS2019 Set the env for VS2019 build.\r |
3a6b4559 | 167 | @echo.\r |
168 | @echo Note that target.template, tools_def.template and build_rules.template\r | |
1f9c8606 OM |
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 | |
3a6b4559 | 171 | @echo.\r |
7ef23d9c | 172 | goto end\r |
3fab94ed | 173 | \r |
878ddf1f | 174 | :end\r |
7ef23d9c | 175 | popd\r |