]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - edksetup.bat
DynamicTablesPkg: add package .dsc file
[mirror_edk2.git] / edksetup.bat
... / ...
CommitLineData
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
31pushd .\r
32cd %~dp0\r
33\r
34if not defined WORKSPACE (\r
35 goto SetWorkSpace\r
36)\r
37\r
38if %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
45if not defined WORKSPACE (\r
46 set WORKSPACE=%CD%\r
47)\r
48\r
49:ParseArgs\r
50if /I "%1"=="-h" goto Usage\r
51if /I "%1"=="-help" goto Usage\r
52if /I "%1"=="--help" goto Usage\r
53if /I "%1"=="/h" goto Usage\r
54if /I "%1"=="/?" goto Usage\r
55if /I "%1"=="/help" goto Usage\r
56\r
57if /I "%1"=="NewBuild" shift\r
58if not defined EDK_TOOLS_PATH (\r
59 goto SetEdkToolsPath\r
60) else (\r
61 goto checkNt32Flag\r
62)\r
63\r
64:SetEdkToolsPath\r
65if %WORKSPACE:~-1% EQU \ (\r
66 @set EDK_BASETOOLS=%WORKSPACE%BaseTools\r
67) else (\r
68 @set EDK_BASETOOLS=%WORKSPACE%\BaseTools\r
69)\r
70if exist %EDK_BASETOOLS% (\r
71 set EDK_TOOLS_PATH=%EDK_BASETOOLS%\r
72 set EDK_BASETOOLS=\r
73) else (\r
74 if defined PACKAGES_PATH (\r
75 for %%i IN (%PACKAGES_PATH%) DO (\r
76 if exist %%~fi\BaseTools (\r
77 set EDK_TOOLS_PATH=%%~fi\BaseTools\r
78 goto checkNt32Flag\r
79 )\r
80 )\r
81 ) else (\r
82 echo.\r
83 echo !!! ERROR !!! Cannot find BaseTools !!!\r
84 echo.\r
85 goto BadBaseTools\r
86 )\r
87)\r
88\r
89:checkNt32Flag\r
90if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%\r
91\r
92@REM The Nt32 Emulation Platform requires Microsoft Libraries\r
93@REM and headers to interface with Windows.\r
94if /I "%1"=="--nt32" (\r
95 if /I "%2"=="X64" (\r
96 shift\r
97 call "%BASE_TOOLS_PATH%\Scripts\SetVisualStudio.bat"\r
98 ) else (\r
99 call "%BASE_TOOLS_PATH%\get_vsvars.bat"\r
100 )\r
101 shift\r
102)\r
103\r
104:checkBaseTools\r
105IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools\r
106call %EDK_TOOLS_PATH%\toolsetup.bat %*\r
107if /I "%1"=="Reconfig" shift\r
108goto check_NASM\r
109goto check_cygwin\r
110\r
111:BadBaseTools\r
112 @REM\r
113 REM Need the BaseTools Package in order to build\r
114 @REM\r
115 @echo.\r
116 @echo !!! ERROR !!! The BaseTools Package was not found !!!\r
117 @echo.\r
118 @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,\r
119 @echo For example,\r
120 @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools\r
121 @echo The setup script, toolsetup.bat must reside in this folder.\r
122 @echo.\r
123 goto end\r
124\r
125:check_NASM\r
126if not defined NASM_PREFIX (\r
127 @echo.\r
128 @echo !!! WARNING !!! NASM_PREFIX environment variable is not set\r
129 @if exist "C:\nasm\nasm.exe" @set "NASM_PREFIX=C:\nasm\"\r
130 @if exist "C:\nasm\nasm.exe" @echo Found nasm.exe, setting the environment variable to C:\nasm\\r
131 @if not exist "C:\nasm\nasm.exe" echo Attempting to build modules that require NASM will fail.\r
132)\r
133\r
134:check_cygwin\r
135if defined CYGWIN_HOME (\r
136 if not exist "%CYGWIN_HOME%" (\r
137 @echo.\r
138 @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!\r
139 @echo.\r
140 )\r
141) else (\r
142 if exist c:\cygwin (\r
143 set CYGWIN_HOME=c:\cygwin\r
144 ) else (\r
145 @echo.\r
146 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!\r
147 @echo.\r
148 )\r
149)\r
150\r
151:cygwin_done\r
152if /I "%1"=="Rebuild" shift\r
153if /I "%1"=="ForceRebuild" shift\r
154if "%1"=="" goto end\r
155\r
156:Usage\r
157 @echo.\r
158 @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32 [X64]] [Reconfig] [Rebuild] [ForceRebuild]"\r
159 @echo --nt32 [X64] If a compiler tool chain is not available in the\r
160 @echo environment, call a script to attempt to set one up.\r
161 @echo This flag is only required if building the\r
162 @echo Nt32Pkg/Nt32Pkg.dsc system emulator.\r
163 @echo If the X64 argument is set, and a compiler tool chain is\r
164 @echo not available, attempt to set up a tool chain that will\r
165 @echo create X64 binaries. Setting these two options have the\r
166 @echo potential side effect of changing tool chains used for a\r
167 @echo rebuild.\r
168 @echo.\r
169 @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.\r
170 @echo Rebuild Perform incremental rebuild of BaseTools binaries.\r
171 @echo ForceRebuild Force a full rebuild of BaseTools binaries.\r
172 @echo.\r
173 @echo Note that target.template, tools_def.template and build_rules.template\r
174 @echo will only be copied to target.txt, tools_def.txt and build_rule.txt\r
175 @echo respectively if they do not exist. Use option [Reconfig] to force the copy.\r
176 @echo.\r
177 goto end\r
178\r
179:end\r
180 popd\r