|
1 @echo off |
|
2 REM |
|
3 REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. |
|
4 REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 REM |
|
6 REM This code is free software; you can redistribute it and/or modify it |
|
7 REM under the terms of the GNU General Public License version 2 only, as |
|
8 REM published by the Free Software Foundation. |
|
9 REM |
|
10 REM This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 REM version 2 for more details (a copy is included in the LICENSE file that |
|
14 REM accompanied this code). |
|
15 REM |
|
16 REM You should have received a copy of the GNU General Public License version |
|
17 REM 2 along with this work; if not, write to the Free Software Foundation, |
|
18 REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 REM |
|
20 REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 REM or visit www.oracle.com if you need additional information or have any |
|
22 REM questions. |
|
23 REM |
|
24 REM |
|
25 |
|
26 REM This is the interactive build setup script (as opposed to the batch |
|
27 REM build execution script). It creates $HotSpotBuildSpace if necessary, |
|
28 REM copies the appropriate files out of $HotSpotWorkSpace into it, and |
|
29 REM builds and runs ProjectCreator in it. This has the side-effect of creating |
|
30 REM the vm.vcproj file in the buildspace, which is then used in Visual C++. |
|
31 |
|
32 REM |
|
33 REM Since we don't have uname and we could be cross-compiling, |
|
34 REM Use the compiler to determine which ARCH we are building |
|
35 REM |
|
36 REM Note: Running this batch file from the Windows command shell requires |
|
37 REM that "grep" be accessible on the PATH. An MKS install does this. |
|
38 REM |
|
39 |
|
40 cl 2>NUL >NUL |
|
41 if %errorlevel% == 0 goto nexttest |
|
42 echo Make sure cl.exe is in your PATH before running this script. |
|
43 goto end |
|
44 |
|
45 :nexttest |
|
46 grep -V 2>NUL >NUL |
|
47 if %errorlevel% == 0 goto testit |
|
48 echo Make sure grep.exe is in your PATH before running this script. Either cygwin or MKS should work. |
|
49 goto end |
|
50 |
|
51 |
|
52 :testit |
|
53 cl 2>&1 | grep "x64" >NUL |
|
54 if %errorlevel% == 0 goto amd64 |
|
55 set ARCH=x86 |
|
56 set BUILDARCH=i486 |
|
57 set Platform_arch=x86 |
|
58 set Platform_arch_model=x86_32 |
|
59 goto done |
|
60 :amd64 |
|
61 set ARCH=x86 |
|
62 set BUILDARCH=amd64 |
|
63 set Platform_arch=x86 |
|
64 set Platform_arch_model=x86_64 |
|
65 :done |
|
66 |
|
67 setlocal |
|
68 |
|
69 if "%1" == "" goto usage |
|
70 |
|
71 if not "%2" == "" goto usage |
|
72 |
|
73 REM Set HotSpotWorkSpace to the directy two steps above this script |
|
74 for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi) |
|
75 set HotSpotBuildRoot=%HotSpotWorkSpace%build |
|
76 set HotSpotBuildSpace=%HotSpotBuildRoot%\vs-%BUILDARCH% |
|
77 set HotSpotJDKDist=%1 |
|
78 |
|
79 |
|
80 REM figure out MSC version |
|
81 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i |
|
82 |
|
83 echo ************************************************************** |
|
84 set ProjectFile=%HotSpotBuildSpace%\jvm.vcproj |
|
85 echo MSC_VER = "%MSC_VER%" |
|
86 if "%MSC_VER%" == "1200" ( |
|
87 set ProjectFile=%HotSpotBuildSpace%\jvm.dsp |
|
88 echo Will generate VC6 project {unsupported} |
|
89 ) else ( |
|
90 if "%MSC_VER%" == "1400" ( |
|
91 echo Will generate VC8 {Visual Studio 2005} |
|
92 ) else ( |
|
93 if "%MSC_VER%" == "1500" ( |
|
94 echo Will generate VC9 {Visual Studio 2008} |
|
95 ) else ( |
|
96 if "%MSC_VER%" == "1600" ( |
|
97 echo Will generate VC10 {Visual Studio 2010} |
|
98 set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj |
|
99 ) else ( |
|
100 if "%MSC_VER%" == "1700" ( |
|
101 echo Will generate VC10 {compatible with Visual Studio 2012} |
|
102 echo After opening in VS 2012, click "Update" when prompted. |
|
103 set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj |
|
104 ) else ( |
|
105 echo Will generate VC7 project {Visual Studio 2003 .NET} |
|
106 ) |
|
107 ) |
|
108 ) |
|
109 ) |
|
110 ) |
|
111 echo %ProjectFile% |
|
112 echo ************************************************************** |
|
113 |
|
114 REM Test all variables to see whether the directories they |
|
115 REM reference exist |
|
116 |
|
117 if exist %HotSpotWorkSpace% goto test1 |
|
118 |
|
119 echo Error: directory pointed to by HotSpotWorkSpace |
|
120 echo does not exist, or the variable is not set. |
|
121 echo. |
|
122 goto usage |
|
123 |
|
124 :test1 |
|
125 if exist %HotSpotBuildSpace% goto test2 |
|
126 if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace% |
|
127 if exist %HotSpotBuildSpace% goto test2 |
|
128 echo Error: directory pointed to by HotSpotBuildSpace |
|
129 echo does not exist, or the variable is not set. |
|
130 echo. |
|
131 goto usage |
|
132 |
|
133 :test2 |
|
134 if exist %HotSpotJDKDist% goto test3 |
|
135 echo Error: directory pointed to by %HotSpotJDKDist% |
|
136 echo does not exist, or the variable is not set. |
|
137 echo. |
|
138 goto usage |
|
139 |
|
140 :test3 |
|
141 if not "%HOTSPOTMKSHOME%" == "" goto makedir |
|
142 if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin |
|
143 if not "%HOTSPOTMKSHOME%" == "" goto makedir |
|
144 echo Warning: please set variable HOTSPOTMKSHOME to place where |
|
145 echo your MKS/Cygwin installation is |
|
146 echo. |
|
147 goto usage |
|
148 |
|
149 :makedir |
|
150 echo NOTE: Using the following settings: |
|
151 echo HotSpotWorkSpace=%HotSpotWorkSpace% |
|
152 echo HotSpotBuildSpace=%HotSpotBuildSpace% |
|
153 echo HotSpotJDKDist=%HotSpotJDKDist% |
|
154 |
|
155 |
|
156 REM This is now safe to do. |
|
157 :copyfiles |
|
158 for /D %%i in (compiler1, compiler2, tiered ) do ( |
|
159 if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated |
|
160 copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL |
|
161 ) |
|
162 |
|
163 REM force regneration of ProjectFile |
|
164 if exist %ProjectFile% del %ProjectFile% |
|
165 |
|
166 for /D %%i in (compiler1, compiler2, tiered ) do ( |
|
167 echo -- %%i -- |
|
168 echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make |
|
169 echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make |
|
170 echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%%i\local.make |
|
171 echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%%i\local.make |
|
172 echo. >> %HotSpotBuildSpace%\%%i\local.make |
|
173 echo Variant=%%i >> %HotSpotBuildSpace%\%%i\local.make |
|
174 echo WorkSpace=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make |
|
175 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make |
|
176 echo HOTSPOTBUILDROOT=%HotSpotBuildRoot% >> %HotSpotBuildSpace%\%%i\local.make |
|
177 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%%i\local.make |
|
178 echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%%i\local.make |
|
179 echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%%i\local.make |
|
180 echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%%i\local.make |
|
181 echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%%i\local.make |
|
182 echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%%i\local.make |
|
183 echo MSC_VER=%MSC_VER% >> %HotSpotBuildSpace%\%%i\local.make |
|
184 |
|
185 for /D %%j in (debug, fastdebug, product) do ( |
|
186 if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j |
|
187 ) |
|
188 |
|
189 pushd %HotSpotBuildSpace%\%%i\generated |
|
190 nmake /nologo |
|
191 popd |
|
192 |
|
193 ) |
|
194 |
|
195 pushd %HotSpotBuildRoot% |
|
196 |
|
197 REM It doesn't matter which variant we use here, "compiler1" is as good as any of the others - we need the common variables |
|
198 nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %ProjectFile% |
|
199 |
|
200 popd |
|
201 |
|
202 goto end |
|
203 |
|
204 :usage |
|
205 echo Usage: create HotSpotJDKDist |
|
206 echo. |
|
207 echo This is the VS build setup script (as opposed to the batch |
|
208 echo build execution script). It creates a build directory if necessary, |
|
209 echo copies the appropriate files out of the workspace into it, and |
|
210 echo builds and runs ProjectCreator in it. This has the side-effect of creating |
|
211 echo the %ProjectFile% file in the build space, which is then used in Visual C++. |
|
212 echo. |
|
213 echo The HotSpotJDKDist defines the JDK that should be used when running the JVM. |
|
214 echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection. |
|
215 echo. |
|
216 echo NOTE that it is now NOT safe to modify any of the files in the build |
|
217 echo space, since they may be overwritten whenever this script is run or |
|
218 echo nmake is run in that directory. |
|
219 |
|
220 :end |
|
221 |
|
222 endlocal |