• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 This program and the accompanying materials
10@REM are licensed and made available under the terms and conditions of the BSD License
11@REM which accompanies this distribution.  The full text of the license may be found at
12@REM http://opensource.org/licenses/bsd-license.php
13@REM
14@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16@REM
17@echo off
18@set SE_SVN_REVISION=$Revision: 8 $
19@set SE_VERSION=0.7.0.
20@if "%SCRIPT%"=="EDKSETUP_BAT" goto SkipCmdlineArgumentCheck
21
22:parse_cmd_line
23@if /I "%1"=="-h" @goto Usage
24@if /I "%1"=="--help" @goto Usage
25@if /I "%1"=="/?" @goto Usage
26@if /I "%1"=="-v" @goto Version
27@if /I "%1"=="--version" @goto Version
28
29:Usage
30@echo Usage: ShowEnvironment.bat [Options]
31@echo Copyright(c) 2014, Intel Corporation. All rights reserved.
32@echo.
33@echo Options:
34@echo   --help, -h     Print this help screen and exit
35@echo   --version, -v  Print this tool's version and exit
36@echo.
37@goto End
38
39:Version
40@echo ShowEnvironment.bat Version: %SE_VERSION%%SE_SVN_REVISION:~11,-1%
41@echo Copyright(c) 2014, Intel Corporation. All rights reserved.
42
43:SkipCmdlineArgumentCheck
44if defined SRC_CONF @goto SetEnv
45
46@echo.
47@echo #############################################################################
48@if defined WORKSPACE @echo     WORKSPACE            = %WORKSPACE%
49@if not defined WORKSPACE @echo     WORKSPACE            = Not Set
50@if defined PACKAGES_PATH @echo     PACKAGES_PATH        = %PACKAGES_PATH%
51@if defined EDK_TOOLS_PATH @echo     EDK_TOOLS_PATH       = %EDK_TOOLS_PATH%
52@if not defined EDK_TOOLS_PATH @echo     EDK_TOOLS_PATH       = Not Set
53@if defined BASE_TOOLS_PATH @echo     BASE_TOOLS_PATH      = %BASE_TOOLS_PATH%
54@if defined EDK_TOOLS_BIN @echo     EDK_TOOLS_BIN        = %EDK_TOOLS_BIN%
55@if defined PYTHON_FREEZER_PATH @echo     PYTHON_FREEZER_PATH  = %PYTHON_FREEZER_PATH%
56@if "%NT32PKG%"=="TRUE" (
57    @echo.
58    @echo NOTE: Please configure your build to use the following TOOL_CHAIN_TAG
59    @echo       when building NT32Pkg/Nt32Pkg.dsc
60    @if defined VCINSTALLDIR @call :CheckVsVer
61    @set TEST_VS=
62)
63@if defined HIDE_PATH goto End
64
65
66@echo ############################## PATH #########################################
67@setlocal DisableDelayedExpansion
68@set "var=%PATH%"
69@set "var=%var:"=""%"
70@set "var=%var:^=^^%"
71@set "var=%var:&=^&%"
72@set "var=%var:|=^|%"
73@set "var=%var:<=^<%"
74@set "var=%var:>=^>%"
75@set "var=%var:;=^;^;%"
76@set var=%var:""="%
77@set "var=%var:"=""Q%"
78@set "var=%var:;;="S"S%"
79@set "var=%var:^;^;=;%"
80@set "var=%var:""="%"
81@setlocal EnableDelayedExpansion
82@set "var=!var:"Q=!"
83@for %%a in ("!var:"S"S=";"!") do (
84    @if "!!"=="" endlocal
85    @if %%a neq "" echo     %%~a
86)
87@goto End
88
89:CheckVsVer
90@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\"
91@if "%VSINSTALLDIR%"=="%TEST_VS%" (
92    @echo     TOOL_CHAIN_TAG       = VS2008x86
93    @goto :EOF
94)
95@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 9.0\"
96@if "%VSINSTALLDIR%"=="%TEST_VS%" (
97    @echo     TOOL_CHAIN_TAG       = VS2008
98    @goto :EOF
99)
100
101@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\"
102@if "%VSINSTALLDIR%"=="%TEST_VS%" (
103    @echo     TOOL_CHAIN_TAG       = VS2010x86
104    @goto :EOF
105)
106@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 10.0\"
107@if "%VSINSTALLDIR%"=="%TEST_VS%" (
108    @echo     TOOL_CHAIN_TAG       = VS2010
109    @goto :EOF
110)
111
112@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\"
113@if "%VSINSTALLDIR%"=="%TEST_VS%" (
114    @echo     TOOL_CHAIN_TAG       = VS2012x86
115    @goto :EOF
116)
117@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 11.0\"
118@if "%VSINSTALLDIR%"=="%TEST_VS%" (
119    @echo     TOOL_CHAIN_TAG       = VS2012
120    @goto :EOF
121)
122
123@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\"
124@if "%VSINSTALLDIR%"=="%TEST_VS%" (
125    @echo     TOOL_CHAIN_TAG       = VS2013x86
126    @goto :EOF
127)
128@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 12.0\"
129@if "%VSINSTALLDIR%"=="%TEST_VS%" (
130    @echo     TOOL_CHAIN_TAG       = VS2013
131    @goto :EOF
132)
133
134@set "TEST_VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\"
135@if "%VSINSTALLDIR%"=="%TEST_VS%" (
136    @echo     TOOL_CHAIN_TAG       = VS2015x86
137    @goto :EOF
138)
139@set "TEST_VS=C:\Program Files\Microsoft Visual Studio 14.0\"
140@if "%VSINSTALLDIR%"=="%TEST_VS%" (
141    @echo     TOOL_CHAIN_TAG       = VS2015
142    @goto :EOF
143)
144@goto :EOF
145
146:SetEnv
147@set FIRST_COPY=FALSE
148@set MISSING_TARGET_TEMPLATE=FALSE
149@set MISSING_TOOLS_DEF_TEMPLATE=FALSE
150@set MISSING_BUILD_RULE_TEMPLATE=FALSE
151@if not exist "%SRC_CONF%\target.template"  @set MISSING_TARGET_TEMPLATE=TRUE
152@if not exist "%SRC_CONF%\tools_def.template" @set MISSING_TOOLS_DEF_TEMPLATE=TRUE
153@if not exist "%SRC_CONF%\build_rule.template" @set MISSING_BUILD_RULE_TEMPLATE=TRUE
154
155@if not exist "%WORKSPACE%\Conf\target.txt" (
156    @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
157    @echo copying ... target.template to %WORKSPACE%\Conf\target.txt
158    @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
159    @set FIRST_COPY=TRUE
160)
161@if not exist "%WORKSPACE%\Conf\tools_def.txt" (
162    @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
163    @echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
164    @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt" > nul
165    @set FIRST_COPY=TRUE
166)
167@if not exist "%WORKSPACE%\Conf\build_rule.txt" (
168    @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
169    @echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
170    @copy /Y "%SRC_CONF%\build_rule.template" "%WORKSPACE%\Conf\build_rule.txt" > nul
171    @set FIRST_COPY=TRUE
172)
173
174@if "%FIRST_COPY%"=="TRUE" @goto End
175@if not "%RECONFIG%"=="TRUE" @goto End
176
177@if "%RECONFIG%"=="TRUE" (
178    @echo.
179    @echo  Over-writing the files in the WORKSPACE\Conf directory
180    @echo  using the default template files
181    @echo.
182    @if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @goto MissingTemplates
183    @echo over-write ... target.template to %WORKSPACE%\Conf\target.txt
184    @copy /Y "%SRC_CONF%\target.template" "%WORKSPACE%\Conf\target.txt" > nul
185
186    @if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @goto MissingTemplates
187    @echo over-write ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
188    @copy /Y "%SRC_CONF%\tools_def.template" "%WORKSPACE%\Conf\tools_def.txt" > nul
189
190    @if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @goto MissingTemplates
191    @echo over-write ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
192    @copy /Y "%SRC_CONF%\build_rule.template" "%WORKSPACE%\Conf\build_rule.txt" > nul
193    @goto End
194)
195
196:MissingTemplates
197@echo.
198@if "%RECONFIG%"=="TRUE" @echo ERROR : Reconfig failed
199@if "%MISSING_TARGET_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\target.template"
200@if "%MISSING_TOOLS_DEF_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\tools_def.template"
201@if "%MISSING_BUILD_RULE_TEMPLATE%"=="TRUE" @echo ERROR : Unable to locate: "%SRC_CONF%\build_rule.template"
202@echo.
203@set MISSING_TARGET_TEMPLATE=
204@set MISSING_TOOLS_DEF_TEMPLATE=
205@set MISSING_BUILD_RULE_TEMPLATE=
206@set FIRST_COPY=
207@set SE_VERSION=
208@set SE_SVN_REVISION=
209@if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
210exit /B 1
211
212:End
213@set MISSING_TARGET_TEMPLATE=
214@set MISSING_TOOLS_DEF_TEMPLATE=
215@set MISSING_BUILD_RULE_TEMPLATE=
216@set FIRST_COPY=
217@set SE_VERSION=
218@set SE_SVN_REVISION=
219@if not "%SCRIPT%"=="EDKSETUP_BAT" @echo on
220exit /B 0
221