]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/toolsetup.bat
Remove BINARY_MODULE = true attribute from binary module inf file, because this attri...
[mirror_edk2.git] / BaseTools / toolsetup.bat
1 @REM
2 @REM Copyright (c) 2006, Intel Corporation
3 @REM All rights reserved. This program and the accompanying materials
4 @REM are licensed and made available under the terms and conditions of the BSD License
5 @REM which accompanies this distribution. The full text of the license may be found at
6 @REM http://opensource.org/licenses/bsd-license.php
7 @REM
8 @REM THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 @REM WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10 @REM
11
12 @echo off
13
14 REM ##############################################################
15 REM # You should not have to modify anything below this line
16 REM #
17
18 if /I "%1"=="-h" goto usage
19 if /I "%1"=="-help" goto usage
20 if /I "%1"=="--help" goto usage
21 if /I "%1"=="/h" goto usage
22 if /I "%1"=="/?" goto usage
23 if /I "%1"=="/help" goto usage
24
25 if /I "%1"=="Reconfig" (
26 if NOT "%2"=="" set EDK_TOOLS_PATH=%2
27 ) else (
28 if NOT "%1"=="" set EDK_TOOLS_PATH=%1
29 )
30
31 REM
32 REM Check the required system environment variables
33 REM
34
35 :check_vc
36 if defined VCINSTALLDIR goto setup_workspace
37 if defined VS71COMNTOOLS (
38 call "%VS71COMNTOOLS%\vsvars32.bat"
39 ) else (
40 echo.
41 echo !!!WARNING!!! Cannot find Visual Studio !!!
42 echo.
43 )
44
45 :setup_workspace
46 REM
47 REM check the EDK_TOOLS_PATH
48 REM
49 if not defined EDK_TOOLS_PATH goto no_tools_path
50 if exist %EDK_TOOLS_PATH% goto set_path
51 echo.
52 echo !!!WARNING!!! %EDK_TOOLS_PATH% doesn't exist. %WORKSPACE%\BaseTools will be used !!!
53 echo.
54
55 :no_tools_path
56 if exist %WORKSPACE%\BaseTools (
57 set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
58 ) else (
59 echo.
60 echo !!!WARNING!!! No tools path found. Please set EDK_TOOLS_PATH !!!
61 echo.
62 goto end
63 )
64
65 :set_path
66 if defined WORKSPACE_TOOLS_PATH goto check_path
67 set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%
68 set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
69 goto path_ok
70
71 :check_path
72 if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok
73 set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%
74 set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
75 echo Resetting the PATH variable to include the EDK_TOOLS_PATH for this WORKSPACE
76
77 :path_ok
78 echo PATH = %PATH%
79 echo.
80 echo WORKSPACE = %WORKSPACE%
81 echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
82 echo.
83
84 REM
85 REM copy *.template to %WORKSPACE%\Conf
86 REM
87 if NOT exist %WORKSPACE%\Conf (
88 mkdir %WORKSPACE%\Conf
89 ) else (
90 if /I "%1"=="Reconfig" (
91 echo.
92 echo Over-writing the files in the WORKSPACE\Conf directory
93 echo using the default template files
94 echo.
95 )
96 )
97 if NOT exist %WORKSPACE%\Conf\FrameworkDatabase.db (
98 echo copying ... FrameworkDatabase.template to %WORKSPACE%\Conf\FrameworkDatabase.db
99 copy %EDK_TOOLS_PATH%\Conf\FrameworkDatabase.template %WORKSPACE%\Conf\FrameworkDatabase.db > nul
100 ) else (
101 if /I "%1"=="Reconfig" copy /Y %EDK_TOOLS_PATH%\Conf\FrameworkDatabase.template %WORKSPACE%\Conf\FrameworkDatabase.db > nul
102 )
103 if NOT exist %WORKSPACE%\Conf\target.txt (
104 echo copying ... target.template to %WORKSPACE%\Conf\target.txt
105 copy %EDK_TOOLS_PATH%\Conf\target.template %WORKSPACE%\Conf\target.txt > nul
106 ) else (
107 if /I "%1"=="Reconfig" copy /Y %EDK_TOOLS_PATH%\Conf\target.template %WORKSPACE%\Conf\target.txt > nul
108 )
109 if NOT exist %WORKSPACE%\Conf\tools_def.txt (
110 echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
111 copy %EDK_TOOLS_PATH%\Conf\tools_def.template %WORKSPACE%\Conf\tools_def.txt > nul
112 ) else (
113 if /I "%1"=="Reconfig" copy /Y %EDK_TOOLS_PATH%\Conf\tools_def.template %WORKSPACE%\Conf\tools_def.txt > nul
114 )
115 if NOT exist %WORKSPACE%\Conf\build_rule.txt (
116 echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
117 copy %EDK_TOOLS_PATH%\Conf\build_rule.template %WORKSPACE%\Conf\build_rule.txt > nul
118 ) else (
119 if /I "%1"=="Reconfig" copy /Y %EDK_TOOLS_PATH%\Conf\build_rule.template %WORKSPACE%\Conf\build_rule.txt > nul
120 )
121
122 REM
123 REM copy XMLSchema to %EDK_TOOLS_PATH%\Conf\XMLSchema
124 REM
125 REM echo copying ... XMLSchema to %EDK_TOOLS_PATH%\Conf\XMLSchema
126 REM xcopy %WORKSPACE%\Conf\XMLSchema %EDK_TOOLS_PATH%\Conf\XMLSchema /S /I /D /F /Q > nul
127
128 REM
129 REM Done!!!
130 REM
131 goto end
132
133 :usage
134 echo.
135 echo "Usage: %0 [/? | /h | /help | -h | -help | --help] [Reconfig] [tools_path]"
136 echo.
137 echo tools_path Tools' path. EDK_TOOLS_PATH will be set to this path.
138 echo.
139
140 :end
141 @echo on
142