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