1) Incorporated generating top level makefile. Now platform build is possible (no...
[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 NOT "%1"=="" set EDK_TOOLS_PATH=%1
26
27 REM
28 REM Check the required system environment variables
29 REM
30
31 :check_vc
32 if defined VCINSTALLDIR goto setup_workspace
33 if defined VS71COMNTOOLS (
34 call "%VS71COMNTOOLS%\vsvars32.bat"
35 ) else (
36 echo.
37 echo !!!WARNING!!! Cannot find Visual Studio !!!
38 echo.
39 )
40
41 :setup_workspace
42 REM
43 REM check the EDK_TOOLS_PATH
44 REM
45 if not defined EDK_TOOLS_PATH goto no_tools_path
46 if exist %EDK_TOOLS_PATH% goto set_path
47 echo.
48 echo !!!WARNING!!! %EDK_TOOLS_PATH% doesn't exist. %WORKSPACE%\Tools will be used !!!
49 echo.
50
51 :no_tools_path
52 if exist %WORKSPACE%\BaseTools (
53 set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
54 ) else (
55 echo.
56 echo !!!WARNING!!! No tools path found. Please set EDK_TOOLS_PATH !!!
57 echo.
58 goto end
59 )
60
61 :set_path
62 if defined WORKSPACE_TOOLS_PATH goto check_path
63 set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%
64 set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
65 goto path_ok
66
67 :check_path
68 if "%EDK_TOOLS_PATH%"=="%WORKSPACE_TOOLS_PATH%" goto path_ok
69 set PATH=%EDK_TOOLS_PATH%\Bin;%EDK_TOOLS_PATH%\Bin\Win32;%PATH%
70 set WORKSPACE_TOOLS_PATH=%EDK_TOOLS_PATH%
71 echo Resetting the PATH variable to include the EDK_TOOLS_PATH for this WORKSPACE
72
73 :path_ok
74 echo PATH = %PATH%
75 echo.
76 echo WORKSPACE = %WORKSPACE%
77 echo EDK_TOOLS_PATH = %EDK_TOOLS_PATH%
78 echo.
79
80 REM
81 REM copy *.template to %WORKSPACE%\Conf
82 REM
83 if NOT exist %WORKSPACE%\Conf mkdir %WORKSPACE%\Conf
84 if NOT exist %WORKSPACE%\Conf\FrameworkDatabase.db (
85 echo copying ... FrameworkDatabase.template to %WORKSPACE%\Conf\FrameworkDatabase.db
86 copy %EDK_TOOLS_PATH%\Conf\FrameworkDatabase.template %WORKSPACE%\Conf\FrameworkDatabase.db > nul
87 )
88 if NOT exist %WORKSPACE%\Conf\target.txt (
89 echo copying ... target.template to %WORKSPACE%\Conf\target.txt
90 copy %EDK_TOOLS_PATH%\Conf\target.template %WORKSPACE%\Conf\target.txt > nul
91 )
92 if NOT exist %WORKSPACE%\Conf\tools_def.txt (
93 echo copying ... tools_def.template to %WORKSPACE%\Conf\tools_def.txt
94 copy %EDK_TOOLS_PATH%\Conf\tools_def.template %WORKSPACE%\Conf\tools_def.txt > nul
95 )
96 if NOT exist %WORKSPACE%\Conf\build_rule.txt (
97 echo copying ... build_rule.template to %WORKSPACE%\Conf\build_rule.txt
98 copy %EDK_TOOLS_PATH%\Conf\build_rule.template %WORKSPACE%\Conf\build_rule.txt > nul
99 )
100
101 REM
102 REM copy XMLSchema to %EDK_TOOLS_PATH%\Conf\XMLSchema
103 REM
104 REM echo copying ... XMLSchema to %EDK_TOOLS_PATH%\Conf\XMLSchema
105 REM xcopy %WORKSPACE%\Conf\XMLSchema %EDK_TOOLS_PATH%\Conf\XMLSchema /S /I /D /F /Q > nul
106
107 REM
108 REM Done!!!
109 REM
110 goto end
111
112 :usage
113 echo.
114 echo "Usage: %0 [/? | /h | /help | -h | -help | --help] [tools_path]"
115 echo.
116 echo tools_path Tools' path. EDK_TOOLS_PATH will be set to this path.
117 echo.
118
119 :end
120 @echo on
121