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