]>
Commit | Line | Data |
---|---|---|
8014e7ce | 1 | @REM @file\r |
2 | @REM Windows batch file to setup a WORKSPACE environment\r | |
878ddf1f | 3 | @REM\r |
cc7c6a37 | 4 | @REM Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r |
92063b0b | 5 | @REM (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r |
24542fb2 | 6 | @REM This program and the accompanying materials\r |
878ddf1f | 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 | |
a29212b2 | 10 | @REM\r |
878ddf1f | 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 | |
a29212b2 | 15 | @REM set CYGWIN_HOME=C:\cygwin\r |
878ddf1f | 16 | \r |
8014e7ce | 17 | @REM usage: \r |
18 | @REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]\r | |
302e0e4a | 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 | |
878ddf1f | 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 | |
3fab94ed | 28 | @REM\r |
29 | @REM Set the WORKSPACE to the current working directory\r | |
30 | @REM\r | |
b7509087 | 31 | pushd .\r |
32 | cd %~dp0\r | |
d27bd9e9 | 33 | \r |
dff2673e | 34 | if not defined WORKSPACE (\r |
7ef23d9c | 35 | goto SetWorkSpace\r |
d27bd9e9 LG |
36 | )\r |
37 | \r | |
dff2673e LG |
38 | if %WORKSPACE% == %CD% (\r |
39 | @REM Workspace is not changed.\r | |
7ef23d9c | 40 | goto ParseArgs\r |
dff2673e LG |
41 | )\r |
42 | \r | |
43 | :SetWorkSpace\r | |
d27bd9e9 LG |
44 | @REM set new workspace\r |
45 | @REM clear EFI_SOURCE and EDK_SOURCE for the new workspace\r | |
dcc80786 LG |
46 | if not defined WORKSPACE (\r |
47 | set WORKSPACE=%CD%\r | |
48 | set EFI_SOURCE=\r | |
49 | set EDK_SOURCE=\r | |
50 | )\r | |
3fab94ed | 51 | \r |
d27bd9e9 | 52 | :ParseArgs\r |
7ef23d9c OM |
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 | |
8014e7ce | 59 | \r |
7ef23d9c | 60 | if /I "%1"=="NewBuild" shift\r |
cc7c6a37 LG |
61 | if not defined EDK_TOOLS_PATH (\r |
62 | if exist %WORKSPACE%\BaseTools (\r | |
63 | set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools\r | |
64 | ) else (\r | |
65 | if defined PACKAGES_PATH (\r | |
66 | for %%i IN (%PACKAGES_PATH%) DO (\r | |
67 | if exist %%~fi\BaseTools (\r | |
68 | set EDK_TOOLS_PATH=%%~fi\BaseTools\r | |
92063b0b | 69 | goto checkNt32Flag\r |
cc7c6a37 | 70 | )\r |
dcc80786 | 71 | )\r |
cc7c6a37 LG |
72 | ) else (\r |
73 | echo.\r | |
74 | echo !!! ERROR !!! Cannot find BaseTools !!!\r | |
75 | echo. \r | |
76 | goto BadBaseTools\r | |
dcc80786 | 77 | )\r |
dcc80786 LG |
78 | )\r |
79 | )\r | |
dcc80786 | 80 | \r |
92063b0b | 81 | :checkNt32Flag\r |
4e908975 LG |
82 | if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%\r |
83 | \r | |
92063b0b CS |
84 | @REM The Nt32 Emluation Platform requires Microsoft Libraries\r |
85 | @REM and headers to interface with Windows.\r | |
86 | if /I "%1"=="--nt32" (\r | |
87 | if /I "%2"=="X64" (\r | |
88 | shift\r | |
89 | call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"\r | |
90 | ) else (\r | |
91 | call "%BASE_TOOLS_PATH%\get_vsvars.bat"\r | |
92 | )\r | |
93 | shift\r | |
94 | )\r | |
95 | \r | |
dcc80786 | 96 | :checkBaseTools\r |
7ef23d9c OM |
97 | IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools\r |
98 | call %EDK_TOOLS_PATH%\toolsetup.bat %*\r | |
99 | if /I "%1"=="Reconfig" shift\r | |
910e2062 | 100 | goto check_NASM\r |
7ef23d9c | 101 | goto check_cygwin\r |
8014e7ce | 102 | \r |
103 | :BadBaseTools\r | |
104 | @REM\r | |
7ef23d9c | 105 | REM Need the BaseTools Package in order to build\r |
8014e7ce | 106 | @REM\r |
7ef23d9c OM |
107 | @echo.\r |
108 | @echo !!! ERROR !!! The BaseTools Package was not found !!!\r | |
109 | @echo.\r | |
110 | @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,\r | |
111 | @echo For example,\r | |
112 | @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools\r | |
113 | @echo The setup script, toolsetup.bat must reside in this folder.\r | |
114 | @echo.\r | |
115 | goto end\r | |
8014e7ce | 116 | \r |
910e2062 YZ |
117 | :check_NASM\r |
118 | if not defined NASM_PREFIX (\r | |
119 | @echo.\r | |
120 | @echo !!! WARNING !!! NASM_PREFIX environment variable is not set\r | |
121 | @if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"\r | |
122 | @if exist "C:\nasm\nasm.exe" @echo Found nasm.exe, setting the environment variable to C:\nasm\\r | |
123 | @if not exist "C:\nasm\nasm.exe" echo Attempting to build modules that require NASM will fail.\r | |
124 | )\r | |
125 | \r | |
a29212b2 | 126 | :check_cygwin\r |
1f9c8606 OM |
127 | if defined CYGWIN_HOME (\r |
128 | if not exist "%CYGWIN_HOME%" (\r | |
129 | @echo.\r | |
130 | @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!\r | |
131 | @echo.\r | |
132 | )\r | |
133 | ) else (\r | |
7ef23d9c OM |
134 | if exist c:\cygwin (\r |
135 | set CYGWIN_HOME=c:\cygwin\r | |
8014e7ce | 136 | ) else (\r |
3a6b4559 | 137 | @echo.\r |
138 | @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!\r | |
139 | @echo.\r | |
8014e7ce | 140 | )\r |
1f9c8606 | 141 | )\r |
878ddf1f | 142 | \r |
1f9c8606 OM |
143 | :cygwin_done\r |
144 | if "%1"=="" goto end\r | |
2fcfed38 | 145 | \r |
70edbc34 | 146 | :Usage\r |
3a6b4559 | 147 | @echo.\r |
92063b0b CS |
148 | @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32 [X64]] [Reconfig]"\r |
149 | @echo --nt32 [X64] If a compiler tool chain is not available in the\r | |
150 | @echo environment, call a script to attempt to set one up.\r | |
151 | @echo This flag is only required if building the\r | |
152 | @echo Nt32Pkg/Nt32Pkg.dsc system emulator.\r | |
153 | @echo If the X64 argument is set, and a compiler tool chain is\r | |
154 | @echo not available, attempt to set up a tool chain that will\r | |
155 | @echo create X64 binaries. Setting these two options have the\r | |
156 | @echo potential side effect of changing tool chains used for a\r | |
157 | @echo rebuild.\r | |
3a6b4559 | 158 | @echo.\r |
159 | @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r | |
160 | @echo.\r | |
161 | @echo Note that target.template, tools_def.template and build_rules.template\r | |
1f9c8606 OM |
162 | @echo will only be copied to target.txt, tools_def.txt and build_rule.txt\r |
163 | @echo respectively if they do not exist. Use option [Reconfig] to force the copy.\r | |
3a6b4559 | 164 | @echo.\r |
7ef23d9c | 165 | goto end\r |
3fab94ed | 166 | \r |
878ddf1f | 167 | :end\r |
7ef23d9c | 168 | popd\r |
878ddf1f | 169 | \r |