blob: 25a5a6e8d7e37f11ab7f0ffd8c4f332c6e16514e [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
45set WORKSPACE=%CD%
46set EFI_SOURCE=
47set EDK_SOURCE=
48
49:ParseArgs
Olivier Martin7ef23d92014-02-24 14:09:00 +000050if /I "%1"=="-h" goto Usage
51if /I "%1"=="-help" goto Usage
52if /I "%1"=="--help" goto Usage
53if /I "%1"=="/h" goto Usage
54if /I "%1"=="/?" goto Usage
55if /I "%1"=="/help" goto Usage
lhauch8014e7c2008-02-22 16:31:23 +000056
Olivier Martin7ef23d92014-02-24 14:09:00 +000057if /I not "%1"=="--nt32" goto no_nt32
lhauch8014e7c2008-02-22 16:31:23 +000058
59@REM Flag, --nt32 is set
60@REM The Nt32 Emluation Platform requires Microsoft Libraries
61@REM and headers to interface with Windows.
62
jwang36402bbc72007-10-31 09:12:54 +000063if not defined VCINSTALLDIR (
lhauchb1763332014-10-30 17:09:25 +000064 if defined VS120COMNTOOLS (
65 call "%VS120COMNTOOLS%\vsvars32.bat"
jwang36402bbc72007-10-31 09:12:54 +000066 ) else (
lhauchb1763332014-10-30 17:09:25 +000067 if defined VS110COMNTOOLS (
68 call "%VS110COMNTOOLS%\vsvars32.bat"
jwang36402bbc72007-10-31 09:12:54 +000069 ) else (
lhauchb1763332014-10-30 17:09:25 +000070 if defined VS100COMNTOOLS (
71 call "%VS100COMNTOOLS%\vsvars32.bat"
ywangc16243d2009-11-16 23:02:57 +000072 ) else (
lhauchb1763332014-10-30 17:09:25 +000073 if defined VS90COMNTOOLS (
74 call "%VS90COMNTOOLS%\vsvars32.bat"
lgao448604ef2012-04-10 07:45:35 +000075 ) else (
lhauchb1763332014-10-30 17:09:25 +000076 if defined VS80COMNTOOLS (
77 call "%VS80COMNTOOLS%\vsvars32.bat"
Liming Gao4c633da2013-09-04 07:41:04 +000078 ) else (
lhauchb1763332014-10-30 17:09:25 +000079 if defined VS71COMNTOOLS (
80 call "%VS71COMNTOOLS%\vsvars32.bat"
81 ) else (
82 echo.
83 echo !!! WARNING !!! Cannot find Visual Studio !!!
84 echo.
85 )
Liming Gao4c633da2013-09-04 07:41:04 +000086 )
lgao448604ef2012-04-10 07:45:35 +000087 )
ywangc16243d2009-11-16 23:02:57 +000088 )
jwang36402bbc72007-10-31 09:12:54 +000089 )
90 )
91)
jwang36b7509082007-10-11 08:58:33 +000092shift
jwang36b7509082007-10-11 08:58:33 +000093
lhauch3a6b4552008-12-31 16:57:24 +000094:no_nt32
Olivier Martin7ef23d92014-02-24 14:09:00 +000095if /I "%1"=="NewBuild" shift
Victor Gouveiac5ed01d2014-06-18 09:01:33 +000096set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
Olivier Martin7ef23d92014-02-24 14:09:00 +000097IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools
98call %EDK_TOOLS_PATH%\toolsetup.bat %*
99if /I "%1"=="Reconfig" shift
100goto check_cygwin
lhauch8014e7c2008-02-22 16:31:23 +0000101
102:BadBaseTools
103 @REM
Olivier Martin7ef23d92014-02-24 14:09:00 +0000104 REM Need the BaseTools Package in order to build
lhauch8014e7c2008-02-22 16:31:23 +0000105 @REM
Olivier Martin7ef23d92014-02-24 14:09:00 +0000106 @echo.
107 @echo !!! ERROR !!! The BaseTools Package was not found !!!
108 @echo.
109 @echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,
110 @echo For example,
111 @echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools
112 @echo The setup script, toolsetup.bat must reside in this folder.
113 @echo.
114 goto end
lhauch8014e7c2008-02-22 16:31:23 +0000115
yshi8a29212b2006-05-09 06:11:05 +0000116:check_cygwin
Olivier Martin1f9c8602014-02-24 14:14:13 +0000117if defined CYGWIN_HOME (
118 if not exist "%CYGWIN_HOME%" (
119 @echo.
120 @echo !!! WARNING !!! CYGWIN_HOME not found, gcc build may not be used !!!
121 @echo.
122 )
123) else (
Olivier Martin7ef23d92014-02-24 14:09:00 +0000124 if exist c:\cygwin (
125 set CYGWIN_HOME=c:\cygwin
lhauch8014e7c2008-02-22 16:31:23 +0000126 ) else (
lhauch3a6b4552008-12-31 16:57:24 +0000127 @echo.
128 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
129 @echo.
lhauch8014e7c2008-02-22 16:31:23 +0000130 )
Olivier Martin1f9c8602014-02-24 14:14:13 +0000131)
bbahnsen878ddf12006-04-21 22:54:32 +0000132
Olivier Martin1f9c8602014-02-24 14:14:13 +0000133:cygwin_done
134if "%1"=="" goto end
wuyizhong2fcfed32006-10-17 07:07:24 +0000135
lhauch70edbc32006-07-14 06:46:15 +0000136:Usage
lhauch3a6b4552008-12-31 16:57:24 +0000137 @echo.
138 @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32] [Reconfig]"
139 @echo --nt32 Call vsvars32.bat for NT32 platform build.
140 @echo.
141 @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
142 @echo.
143 @echo Note that target.template, tools_def.template and build_rules.template
Olivier Martin1f9c8602014-02-24 14:14:13 +0000144 @echo will only be copied to target.txt, tools_def.txt and build_rule.txt
145 @echo respectively if they do not exist. Use option [Reconfig] to force the copy.
lhauch3a6b4552008-12-31 16:57:24 +0000146 @echo.
Olivier Martin7ef23d92014-02-24 14:09:00 +0000147 goto end
jwang363fab94e2007-06-22 06:25:37 +0000148
bbahnsen878ddf12006-04-21 22:54:32 +0000149:end
Olivier Martin7ef23d92014-02-24 14:09:00 +0000150 popd
bbahnsen878ddf12006-04-21 22:54:32 +0000151