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