blob: b63c29916b0622d3b319751175e67e77398807b6 [file] [log] [blame]
lhauch8014e7c2008-02-22 16:31:23 +00001@REM @file
2@REM Windows batch file to setup a WORKSPACE environment
bbahnsen878ddf12006-04-21 22:54:32 +00003@REM
lhauchb1763332014-10-30 17:09:25 +00004@REM Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
hhtian24542fb2010-04-29 15:17:20 +00005@REM This program and the accompanying materials
bbahnsen878ddf12006-04-21 22:54:32 +00006@REM are licensed and made available under the terms and conditions of the BSD License
7@REM which accompanies this distribution. The full text of the license may be found at
8@REM http://opensource.org/licenses/bsd-license.php
yshi8a29212b2006-05-09 06:11:05 +00009@REM
bbahnsen878ddf12006-04-21 22:54:32 +000010@REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11@REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12@REM
13
yshi8a29212b2006-05-09 06:11:05 +000014@REM set CYGWIN_HOME=C:\cygwin
bbahnsen878ddf12006-04-21 22:54:32 +000015
lhauch8014e7c2008-02-22 16:31:23 +000016@REM usage:
17@REM edksetup.bat [--nt32] [AntBuild] [Rebuild] [ForceRebuild] [Reconfig]
lhauch302e0e42006-06-09 15:26:28 +000018@REM if the argument, skip is present, only the paths and the
19@REM test and set of environment settings are performed.
bbahnsen878ddf12006-04-21 22:54:32 +000020
21@REM ##############################################################
22@REM # You should not have to modify anything below this line
23@REM #
24
25@echo off
26
yshi8a29212b2006-05-09 06:11:05 +000027@REM
jwang363fab94e2007-06-22 06:25:37 +000028@REM Set the WORKSPACE to the current working directory
29@REM
jwang36b7509082007-10-11 08:58:33 +000030pushd .
31cd %~dp0
jwang363fab94e2007-06-22 06:25:37 +000032
lgao4dff26732010-01-26 04:58:56 +000033if not defined WORKSPACE (
Olivier Martin7ef23d92014-02-24 14:09:00 +000034 goto SetWorkSpace
lgao4d27bd9e2010-01-26 02:42:37 +000035)
36
lgao4dff26732010-01-26 04:58:56 +000037if %WORKSPACE% == %CD% (
38 @REM Workspace is not changed.
Olivier Martin7ef23d92014-02-24 14:09:00 +000039 goto ParseArgs
lgao4dff26732010-01-26 04:58:56 +000040)
41
42:SetWorkSpace
lgao4d27bd9e2010-01-26 02:42:37 +000043@REM set new workspace
44@REM clear EFI_SOURCE and EDK_SOURCE for the new workspace
Liming Gaodcc80782015-10-08 09:29:09 +000045if not defined WORKSPACE (
46 set WORKSPACE=%CD%
47 set EFI_SOURCE=
48 set EDK_SOURCE=
49)
lgao4d27bd9e2010-01-26 02:42:37 +000050
51:ParseArgs
Olivier Martin7ef23d92014-02-24 14:09:00 +000052if /I "%1"=="-h" goto Usage
53if /I "%1"=="-help" goto Usage
54if /I "%1"=="--help" goto Usage
55if /I "%1"=="/h" goto Usage
56if /I "%1"=="/?" goto Usage
57if /I "%1"=="/help" goto Usage
lhauch8014e7c2008-02-22 16:31:23 +000058
Olivier Martin7ef23d92014-02-24 14:09:00 +000059if /I not "%1"=="--nt32" goto no_nt32
lhauch8014e7c2008-02-22 16:31:23 +000060
61@REM Flag, --nt32 is set
62@REM The Nt32 Emluation Platform requires Microsoft Libraries
63@REM and headers to interface with Windows.
64
jwang36402bbc72007-10-31 09:12:54 +000065if not defined VCINSTALLDIR (
lhauchb1763332014-10-30 17:09:25 +000066 if defined VS120COMNTOOLS (
67 call "%VS120COMNTOOLS%\vsvars32.bat"
jwang36402bbc72007-10-31 09:12:54 +000068 ) else (
lhauchb1763332014-10-30 17:09:25 +000069 if defined VS110COMNTOOLS (
70 call "%VS110COMNTOOLS%\vsvars32.bat"
jwang36402bbc72007-10-31 09:12:54 +000071 ) else (
lhauchb1763332014-10-30 17:09:25 +000072 if defined VS100COMNTOOLS (
73 call "%VS100COMNTOOLS%\vsvars32.bat"
ywangc16243d2009-11-16 23:02:57 +000074 ) else (
lhauchb1763332014-10-30 17:09:25 +000075 if defined VS90COMNTOOLS (
76 call "%VS90COMNTOOLS%\vsvars32.bat"
lgao448604ef2012-04-10 07:45:35 +000077 ) else (
lhauchb1763332014-10-30 17:09:25 +000078 if defined VS80COMNTOOLS (
79 call "%VS80COMNTOOLS%\vsvars32.bat"
Liming Gao4c633da2013-09-04 07:41:04 +000080 ) else (
lhauchb1763332014-10-30 17:09:25 +000081 if defined VS71COMNTOOLS (
82 call "%VS71COMNTOOLS%\vsvars32.bat"
83 ) else (
84 echo.
85 echo !!! WARNING !!! Cannot find Visual Studio !!!
86 echo.
87 )
Liming Gao4c633da2013-09-04 07:41:04 +000088 )
lgao448604ef2012-04-10 07:45:35 +000089 )
ywangc16243d2009-11-16 23:02:57 +000090 )
jwang36402bbc72007-10-31 09:12:54 +000091 )
92 )
93)
jwang36b7509082007-10-11 08:58:33 +000094shift
jwang36b7509082007-10-11 08:58:33 +000095
lhauch3a6b4552008-12-31 16:57:24 +000096:no_nt32
Liming Gaodcc80782015-10-08 09:29:09 +000097
Olivier Martin7ef23d92014-02-24 14:09:00 +000098if /I "%1"=="NewBuild" shift
Liming Gaodcc80782015-10-08 09:29:09 +000099if exist %WORKSPACE%\BaseTools (
100 set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
101) else (
102 if defined PACKAGES_PATH (
103 for %%i IN (%PACKAGES_PATH%) DO (
104 if exist %%~fi\BaseTools (
105 set EDK_TOOLS_PATH=%%~fi\BaseTools
106 goto checkBaseTools
107 )
108 )
109 ) else (
110 echo.
111 echo !!! ERROR !!! Cannot find BaseTools !!!
112 echo.
113 goto BadBaseTools
114 )
115)
116if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
117
118:checkBaseTools
Olivier Martin7ef23d92014-02-24 14:09:00 +0000119IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools
120call %EDK_TOOLS_PATH%\toolsetup.bat %*
121if /I "%1"=="Reconfig" shift
122goto check_cygwin
lhauch8014e7c2008-02-22 16:31:23 +0000123
124:BadBaseTools
125 @REM
Olivier Martin7ef23d92014-02-24 14:09:00 +0000126 REM Need the BaseTools Package in order to build
lhauch8014e7c2008-02-22 16:31:23 +0000127 @REM
Olivier Martin7ef23d92014-02-24 14:09:00 +0000128 @echo.
129 @echo !!! ERROR !!! The BaseTools Package was not found !!!
130 @echo.
131 @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,
132 @echo For example,
133 @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools
134 @echo The setup script, toolsetup.bat must reside in this folder.
135 @echo.
136 goto end
lhauch8014e7c2008-02-22 16:31:23 +0000137
yshi8a29212b2006-05-09 06:11:05 +0000138:check_cygwin
Olivier Martin1f9c8602014-02-24 14:14:13 +0000139if defined CYGWIN_HOME (
140 if not exist "%CYGWIN_HOME%" (
141 @echo.
142 @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!
143 @echo.
144 )
145) else (
Olivier Martin7ef23d92014-02-24 14:09:00 +0000146 if exist c:\cygwin (
147 set CYGWIN_HOME=c:\cygwin
lhauch8014e7c2008-02-22 16:31:23 +0000148 ) else (
lhauch3a6b4552008-12-31 16:57:24 +0000149 @echo.
150 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
151 @echo.
lhauch8014e7c2008-02-22 16:31:23 +0000152 )
Olivier Martin1f9c8602014-02-24 14:14:13 +0000153)
bbahnsen878ddf12006-04-21 22:54:32 +0000154
Olivier Martin1f9c8602014-02-24 14:14:13 +0000155:cygwin_done
156if "%1"=="" goto end
wuyizhong2fcfed32006-10-17 07:07:24 +0000157
lhauch70edbc32006-07-14 06:46:15 +0000158:Usage
lhauch3a6b4552008-12-31 16:57:24 +0000159 @echo.
160 @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32] [Reconfig]"
161 @echo --nt32 Call vsvars32.bat for NT32 platform build.
162 @echo.
163 @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
164 @echo.
165 @echo Note that target.template, tools_def.template and build_rules.template
Olivier Martin1f9c8602014-02-24 14:14:13 +0000166 @echo will only be copied to target.txt, tools_def.txt and build_rule.txt
167 @echo respectively if they do not exist. Use option [Reconfig] to force the copy.
lhauch3a6b4552008-12-31 16:57:24 +0000168 @echo.
Olivier Martin7ef23d92014-02-24 14:09:00 +0000169 goto end
jwang363fab94e2007-06-22 06:25:37 +0000170
bbahnsen878ddf12006-04-21 22:54:32 +0000171:end
Olivier Martin7ef23d92014-02-24 14:09:00 +0000172 popd
bbahnsen878ddf12006-04-21 22:54:32 +0000173