blob: 7c7f52f6dd145c0c96a8b7286716383cdcb2fd7d [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
lhauch8014e7c2008-02-22 16:31:23 +00004@REM Copyright (c) 2006 - 2008, Intel Corporation
bbahnsen878ddf12006-04-21 22:54:32 +00005@REM All rights reserved. This program and the accompanying materials
6@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
lgao4d27bd9e2010-01-26 02:42:37 +000033if defined WORKSPACE (
34 if %WORKSPACE% == %CD% (
35 @REM workspace is not changed.
36 @goto ParseArgs
37 )
38)
39
40@REM set new workspace
41@REM clear EFI_SOURCE and EDK_SOURCE for the new workspace
42set WORKSPACE=%CD%
43set EFI_SOURCE=
44set EDK_SOURCE=
45
46:ParseArgs
jwang3626096d32007-10-15 01:58:41 +000047@if /I "%1"=="-h" goto Usage
48@if /I "%1"=="-help" goto Usage
49@if /I "%1"=="--help" goto Usage
50@if /I "%1"=="/h" goto Usage
51@if /I "%1"=="/?" goto Usage
52@if /I "%1"=="/help" goto Usage
lhauch8014e7c2008-02-22 16:31:23 +000053
lhauch3a6b4552008-12-31 16:57:24 +000054@if /I not "%1"=="--nt32" goto no_nt32
lhauch8014e7c2008-02-22 16:31:23 +000055
56@REM Flag, --nt32 is set
57@REM The Nt32 Emluation Platform requires Microsoft Libraries
58@REM and headers to interface with Windows.
59
jwang36402bbc72007-10-31 09:12:54 +000060if not defined VCINSTALLDIR (
61 if defined VS71COMNTOOLS (
62 call "%VS71COMNTOOLS%\vsvars32.bat"
63 ) else (
64 if defined VS80COMNTOOLS (
65 call "%VS80COMNTOOLS%\vsvars32.bat"
66 ) else (
ywangc16243d2009-11-16 23:02:57 +000067 if defined VS90COMNTOOLS (
68 call "%VS90COMNTOOLS%\vsvars32.bat"
69 ) else (
70 echo.
71 echo !!! WARNING !!! Cannot find Visual Studio !!!
72 echo.
73 )
jwang36402bbc72007-10-31 09:12:54 +000074 )
75 )
76)
jwang36b7509082007-10-11 08:58:33 +000077shift
jwang36b7509082007-10-11 08:58:33 +000078
lhauch3a6b4552008-12-31 16:57:24 +000079:no_nt32
lhauch8014e7c2008-02-22 16:31:23 +000080@if /I "%1"=="NewBuild" shift
81@if not defined EDK_TOOLS_PATH set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
82@IF NOT EXIST "%EDK_TOOLS_PATH%\toolsetup.bat" goto BadBaseTools
83@call %EDK_TOOLS_PATH%\toolsetup.bat %*
lhauch3a6b4552008-12-31 16:57:24 +000084@if /I "%1"=="Reconfig" shift
85@goto check_cygwin
lhauch8014e7c2008-02-22 16:31:23 +000086
87:BadBaseTools
88 @REM
89 @REM Need the BaseTools Package in order to build
90 @REM
91 echo.
92 echo !!! ERROR !!! The BaseTools Package was not found !!!
93 echo.
94 echo Set the system environment variable, EDK_TOOLS_PATH to the BaseTools,
95 echo For example,
96 echo set EDK_TOOLS_PATH=C:\MyTools\BaseTools
97 echo The setup script, toolsetup.bat must reside in this folder.
98 echo.
99 @goto end
100
yshi8a29212b2006-05-09 06:11:05 +0000101:check_cygwin
lhauch3a6b4552008-12-31 16:57:24 +0000102 @if exist c:\cygwin (
103 @set CYGWIN_HOME=c:\cygwin
lhauch8014e7c2008-02-22 16:31:23 +0000104 ) else (
lhauch3a6b4552008-12-31 16:57:24 +0000105 @echo.
106 @echo !!! WARNING !!! No CYGWIN_HOME set, gcc build may not be used !!!
107 @echo.
lhauch8014e7c2008-02-22 16:31:23 +0000108 )
bbahnsen878ddf12006-04-21 22:54:32 +0000109
lhauch11f009f2006-07-24 16:03:47 +0000110@if NOT "%1"=="" goto Usage
lhauch3a6b4552008-12-31 16:57:24 +0000111@goto end
wuyizhong2fcfed32006-10-17 07:07:24 +0000112
lhauch70edbc32006-07-14 06:46:15 +0000113:Usage
lhauch3a6b4552008-12-31 16:57:24 +0000114 @echo.
115 @echo Usage: "%0 [-h | -help | --help | /h | /help | /?] [--nt32] [Reconfig]"
116 @echo --nt32 Call vsvars32.bat for NT32 platform build.
117 @echo.
118 @echo Reconfig Reinstall target.txt, tools_def.txt and build_rule.txt.
119 @echo.
120 @echo Note that target.template, tools_def.template and build_rules.template
121 @echo will be only copied to target.txt, tools_def.txt and build_rule.txt
122 @echo respectively if they do not exist. Using option [Reconfig] to force the copy.
123 @echo.
lhauch8014e7c2008-02-22 16:31:23 +0000124 @goto end
jwang363fab94e2007-06-22 06:25:37 +0000125
bbahnsen878ddf12006-04-21 22:54:32 +0000126:end
lhauch8014e7c2008-02-22 16:31:23 +0000127 @popd
128 @echo on
bbahnsen878ddf12006-04-21 22:54:32 +0000129