]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Scripts/ShowEnvironment.bat
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Scripts / ShowEnvironment.bat
1 @REM @file
2 @REM Windows batch file to display the Windows environment
3 @REM
4 @REM This script will be used to show the current EDK II build environment.
5 @REM it may be called by the Edk2Setup.bat (that will be renamed to edksetup.bat) or
6 @REM run as stand-alone application.
7 @REM
8 @REM Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
9 @REM SPDX-License-Identifier: BSD-2-Clause-Patent
10 @REM
11 @echo off
12 @set SE_SVN_REVISION=$Revision: 8 $
13 @set SE_VERSION=0.7.0.
14 @if "%SCRIPT%"=="EDKSETUP_BAT" goto SkipCmdlineArgumentCheck
15
16 :parse_cmd_line
17 @if /I "%1"=="-h" @goto Usage
18 @if /I "%1"=="--help" @goto Usage
19 @if /I "%1"=="/?" @goto Usage
20 @if /I "%1"=="-v" @goto Version
21 @if /I "%1"=="--version" @goto Version
22
23 :Usage
24 @echo Usage: ShowEnvironment.bat [Options]
25 @echo Copyright(c) 2014, Intel Corporation. All rights reserved.
26 @echo.
27 @echo Options:
28 @echo --help, -h Print this help screen and exit
29 @echo --version, -v Print this tool's version and exit
30 @echo.
31 @goto End
32
33 :Version
34 @echo ShowEnvironment.bat Version: %SE_VERSION%%SE_SVN_REVISION:~11,-1%
35 @echo Copyright(c) 2014, Intel Corporation. All rights reserved.
36
37 :SkipCmdlineArgumentCheck
38 if defined SRC_CONF @goto SetEnv
39
40 @echo.
41 @echo #############################################################################
42 @if defined WORKSPACE @echo WORKSPACE = %WORKSPACE%
43 @if not defined WORKSPACE @echo WORKSPACE = Not Set
44 @if defined PACKAGES_PATH @echo PACKAGES_PATH = %PACKAGES_PATH%
45 @if defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
46 @if not defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH = Not Set
47 @if defined BASE_TOOLS_PATH @echo BASE_TOOLS_PATH = %BASE_TOOLS_PATH%
48 @if defined EDK_TOOLS_BIN @echo EDK_TOOLS_BIN = %EDK_TOOLS_BIN%
49 @if "%NT32PKG%"=="TRUE" (
50 @echo.
51 @echo NOTE: Please configure your build to use the following TOOL_CHAIN_TAG
52 @echo when building NT32Pkg/Nt32Pkg.dsc
53 @if defined VCINSTALLDIR @call :CheckVsVer
54 @set TEST_VS=
55 )
56 @if defined HIDE_PATH goto End
57
58
59 @echo ############################## PATH #########################################
60 @setlocal DisableDelayedExpansion
61 @set "var=%PATH%"
62 @set "var=%var:"=""%"
63 @set "var=%var:^=^^%"
64 @set "var=%var:&=^&%"
65 @set "var=%var:|=^|%"
66 @set "var=%var:<=^<%"
67 @set "var=%var:>=^>%"
68 @set "var=%var:;=^;^;%"
69 @set var=%var:""="%
70 @set "var=%var:"=""Q%"
71 @set "var=%var:;;="S"S%"
72 @set "var=%var:^;^;=;%"
73 @set "var=%var:""="%"
74 @setlocal EnableDelayedExpansion
75 @set "var=!var:"Q=!"
76 @for %%a in ("!var:"S"S=";"!") do (
77 @if "!!"=="" endlocal
78 @if %%a neq "" echo %%~a
79 )
80 @goto End
81
82 :CheckVsVer
83 @set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\"
84 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
85 @echo TOOL_CHAIN_TAG = VS2008x86
86 @goto :EOF
87 )
88 @set "TEST_VS=C:\Program Files\Microsoft Visual Studio 9.0\"
89 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
90 @echo TOOL_CHAIN_TAG = VS2008
91 @goto :EOF
92 )
93
94 @set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\"
95 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
96 @echo TOOL_CHAIN_TAG = VS2010x86
97 @goto :EOF
98 )
99 @set "TEST_VS=C:\Program Files\Microsoft Visual Studio 10.0\"
100 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
101 @echo TOOL_CHAIN_TAG = VS2010
102 @goto :EOF
103 )
104
105 @set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\"
106 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
107 @echo TOOL_CHAIN_TAG = VS2012x86
108 @goto :EOF
109 )
110 @set "TEST_VS=C:\Program Files\Microsoft Visual Studio 11.0\"
111 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
112 @echo TOOL_CHAIN_TAG = VS2012
113 @goto :EOF
114 )
115
116 @set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\"
117 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
118 @echo TOOL_CHAIN_TAG = VS2013x86
119 @goto :EOF
120 )
121 @set "TEST_VS=C:\Program Files\Microsoft Visual Studio 12.0\"
122 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
123 @echo TOOL_CHAIN_TAG = VS2013
124 @goto :EOF
125 )
126
127 @set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\"
128 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
129 @echo TOOL_CHAIN_TAG = VS2015x86
130 @goto :EOF
131 )
132 @set "TEST_VS=C:\Program Files\Microsoft Visual Studio 14.0\"
133 @if "%VSINSTALLDIR%"=="%TEST_VS%" (
134 @echo TOOL_CHAIN_TAG = VS2015
135 @goto :EOF
136 )
137 @goto :EOF
138
139 :SetEnv
140 @set FIRST_COPY=FALSE
141 @set MISSING_TARGET_TEMPLATE=FALSE
142 @set MISSING_TOOLS_DEF_TEMPLATE=FALSE
143 @set MISSING_BUILD_RULE_TEMPLATE=FALSE
144 @if not exist "%SRC_CONF%\target.template" @set MISSING_TARGET_TEMPLATE=TRUE
145 @if not exist "%SRC_CONF%\tools_def.template" @set MISSING_TOOLS_DEF_TEMPLATE=TRUE
146 @if not exist "%SRC_CONF%\build_rule.template" @set MISSING_BUILD_RULE_TEMPLATE=TRUE
147
148 @if not exist "%WORKSPACE%\Conf\target.txt" (
149 @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
150 @echo copying ... target.template to %WORKSPACE%\Conf\target.txt
151 @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
152 @set FIRST_COPY=TRUE
153 )
154 @if not exist "%WORKSPACE%\Conf\tools_def.txt" (
155 @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
156 @echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
157 @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt" > nul
158 @set FIRST_COPY=TRUE
159 )
160 @if not exist "%WORKSPACE%\Conf\build_rule.txt" (
161 @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
162 @echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
163 @copy /Y "%SRC_CONF%\build_rule.template" "%WORKSPACE%\Conf\build_rule.txt" > nul
164 @set FIRST_COPY=TRUE
165 )
166
167 @if "%FIRST_COPY%"=="TRUE" @goto End
168 @if not "%RECONFIG%"=="TRUE" @goto End
169
170 @if "%RECONFIG%"=="TRUE" (
171 @echo.
172 @echo Over-writing the files in the WORKSPACE\Conf directory
173 @echo using the default template files
174 @echo.
175 @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
176 @echo over-write ... target.template to %WORKSPACE%\Conf\target.txt
177 @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
178
179 @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
180 @echo over-write ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
181 @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt" > nul
182
183 @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
184 @echo over-write ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
185 @copy /Y "%SRC_CONF%\build_rule.template" "%WORKSPACE%\Conf\build_rule.txt" > nul
186 @goto End
187 )
188
189 :MissingTemplates
190 @echo.
191 @if "%RECONFIG%"=="TRUE" @echo ERROR : Reconfig failed
192 @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\target.template"
193 @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\tools_def.template"
194 @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\build_rule.template"
195 @echo.
196 @set MISSING_TARGET_TEMPLATE=
197 @set MISSING_TOOLS_DEF_TEMPLATE=
198 @set MISSING_BUILD_RULE_TEMPLATE=
199 @set FIRST_COPY=
200 @set SE_VERSION=
201 @set SE_SVN_REVISION=
202 @if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
203 exit /B 1
204
205 :End
206 @set MISSING_TARGET_TEMPLATE=
207 @set MISSING_TOOLS_DEF_TEMPLATE=
208 @set MISSING_BUILD_RULE_TEMPLATE=
209 @set FIRST_COPY=
210 @set SE_VERSION=
211 @set SE_SVN_REVISION=
212 @if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
213 exit /B 0