]> git.proxmox.com Git - mirror_edk2.git/blob - edksetup.bat
Vlv2TbltDevicePkg:Change RESET_VALUE of FADT
[mirror_edk2.git] / edksetup.bat
1 @REM @file
2 @REM Windows batch file to setup a WORKSPACE environment
3 @REM
4 @REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 @REM This program and the accompanying materials
6 @REM are licensed and made available under the terms and conditions of the BSD License
7 @REM which accompanies this distribution. The full text of the license may be found at
8 @REM http://opensource.org/licenses/bsd-license.php
9 @REM
10 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 @REM
13
14 @REM set CYGWIN_HOME=C:\cygwin
15
16 @REM usage:
17 @REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]
18 @REM if the argument, skip is present, only the paths and the
19 @REM test and set of environment settings are performed.
20
21 @REM ##############################################################
22 @REM # You should not have to modify anything below this line
23 @REM #
24
25 @echo off
26
27 @REM
28 @REM Set the WORKSPACE to the current working directory
29 @REM
30 pushd .
31 cd %~dp0
32
33 if not defined WORKSPACE (
34 goto SetWorkSpace
35 )
36
37 if %WORKSPACE% == %CD% (
38 @REM Workspace is not changed.
39 goto ParseArgs
40 )
41
42 :SetWorkSpace
43 @REM set new workspace
44 @REM clear EFI_SOURCE and EDK_SOURCE for the new workspace
45 if not defined WORKSPACE (
46 set WORKSPACE=%CD%
47 set EFI_SOURCE=
48 set EDK_SOURCE=
49 )
50
51 :ParseArgs
52 if /I "%1"=="-h" goto Usage
53 if /I "%1"=="-help" goto Usage
54 if /I "%1"=="--help" goto Usage
55 if /I "%1"=="/h" goto Usage
56 if /I "%1"=="/?" goto Usage
57 if /I "%1"=="/help" goto Usage
58
59 if /I not "%1"=="--nt32" goto no_nt32
60
61 @REM Flag, --nt32 is set
62 @REM The Nt32 Emluation Platform requires Microsoft Libraries
63 @REM and headers to interface with Windows.
64
65 if not defined VCINSTALLDIR (
66 if defined VS140COMNTOOLS (
67 call "%VS140COMNTOOLS%\vsvars32.bat"
68 ) else (
69 if defined VS120COMNTOOLS (
70 call "%VS120COMNTOOLS%\vsvars32.bat"
71 ) else (
72 if defined VS110COMNTOOLS (
73 call "%VS110COMNTOOLS%\vsvars32.bat"
74 ) else (
75 if defined VS100COMNTOOLS (
76 call "%VS100COMNTOOLS%\vsvars32.bat"
77 ) else (
78 if defined VS90COMNTOOLS (
79 call "%VS90COMNTOOLS%\vsvars32.bat"
80 ) else (
81 if defined VS80COMNTOOLS (
82 call "%VS80COMNTOOLS%\vsvars32.bat"
83 ) else (
84 if defined VS71COMNTOOLS (
85 call "%VS71COMNTOOLS%\vsvars32.bat"
86 ) else (
87 echo.
88 echo !!! WARNING !!! Cannot find Visual Studio !!!
89 echo.
90 )
91 )
92 )
93 )
94 )
95 )
96 )
97 )
98 shift
99
100 :no_nt32
101
102 if /I "%1"=="NewBuild" shift
103 if not defined EDK_TOOLS_PATH (
104 if exist %WORKSPACE%\BaseTools (
105 set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
106 ) else (
107 if defined PACKAGES_PATH (
108 for %%i IN (%PACKAGES_PATH%) DO (
109 if exist %%~fi\BaseTools (
110 set EDK_TOOLS_PATH=%%~fi\BaseTools
111 goto checkBaseTools
112 )
113 )
114 ) else (
115 echo.
116 echo !!! ERROR !!! Cannot find BaseTools !!!
117 echo.
118 goto BadBaseTools
119 )
120 )
121 )
122 if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
123
124 :checkBaseTools
125 IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools
126 call %EDK_TOOLS_PATH%\toolsetup.bat %*
127 if /I "%1"=="Reconfig" shift
128 goto check_NASM
129 goto check_cygwin
130
131 :BadBaseTools
132 @REM
133 REM Need the BaseTools Package in order to build
134 @REM
135 @echo.
136 @echo !!! ERROR !!! The BaseTools Package was not found !!!
137 @echo.
138 @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,
139 @echo For example,
140 @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools
141 @echo The setup script, toolsetup.bat must reside in this folder.
142 @echo.
143 goto end
144
145 :check_NASM
146 if not defined NASM_PREFIX (
147 @echo.
148 @echo !!! WARNING !!! NASM_PREFIX environment variable is not set
149 @if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"
150 @if exist "C:\nasm\nasm.exe" @echo Found nasm.exe, setting the environment variable to C:\nasm\
151 @if not exist "C:\nasm\nasm.exe" echo Attempting to build modules that require NASM will fail.
152 )
153
154 :check_cygwin
155 if defined CYGWIN_HOME (
156 if not exist "%CYGWIN_HOME%" (
157 @echo.
158 @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!
159 @echo.
160 )
161 ) else (
162 if exist c:\cygwin (
163 set CYGWIN_HOME=c:\cygwin
164 ) else (
165 @echo.
166 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
167 @echo.
168 )
169 )
170
171 :cygwin_done
172 if "%1"=="" goto end
173
174 :Usage
175 @echo.
176 @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32] [Reconfig]"
177 @echo --nt32 Call vsvars32.bat for NT32 platform build.
178 @echo.
179 @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
180 @echo.
181 @echo Note that target.template, tools_def.template and build_rules.template
182 @echo will only be copied to target.txt, tools_def.txt and build_rule.txt
183 @echo respectively if they do not exist. Use option [Reconfig] to force the copy.
184 @echo.
185 goto end
186
187 :end
188 popd
189