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