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