34 REM Use the compiler to determine which ARCH we are building |
34 REM Use the compiler to determine which ARCH we are building |
35 REM |
35 REM |
36 REM Note: Running this batch file from the Windows command shell requires |
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. |
37 REM that "grep" be accessible on the PATH. An MKS install does this. |
38 REM |
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 |
39 cl 2>&1 | grep "IA-64" >NUL |
53 cl 2>&1 | grep "IA-64" >NUL |
40 if %errorlevel% == 0 goto isia64 |
54 if %errorlevel% == 0 goto isia64 |
41 cl 2>&1 | grep "AMD64" >NUL |
55 cl 2>&1 | grep "AMD64" >NUL |
42 if %errorlevel% == 0 goto amd64 |
56 if %errorlevel% == 0 goto amd64 |
43 set ARCH=x86 |
57 set ARCH=x86 |
44 set BUILDARCH=i486 |
58 set BUILDARCH=i486 |
45 set Platform_arch=x86 |
59 set Platform_arch=x86 |
46 set Platform_arch_model=x86_32 |
60 set Platform_arch_model=x86_32 |
47 goto end |
61 goto done |
48 :amd64 |
62 :amd64 |
49 set ARCH=x86 |
63 set ARCH=x86 |
50 set BUILDARCH=amd64 |
64 set BUILDARCH=amd64 |
51 set Platform_arch=x86 |
65 set Platform_arch=x86 |
52 set Platform_arch_model=x86_64 |
66 set Platform_arch_model=x86_64 |
53 goto end |
67 goto done |
54 :isia64 |
68 :isia64 |
55 set ARCH=ia64 |
69 set ARCH=ia64 |
56 set BUILDARCH=ia64 |
70 set BUILDARCH=ia64 |
57 set Platform_arch=ia64 |
71 set Platform_arch=ia64 |
58 set Platform_arch_model=ia64 |
72 set Platform_arch_model=ia64 |
59 :end |
73 :done |
60 |
74 |
61 setlocal |
75 setlocal |
62 |
76 |
63 if "%1" == "" goto usage |
77 if "%1" == "" goto usage |
64 |
78 |
65 if not "%4" == "" goto usage |
79 if not "%2" == "" goto usage |
66 |
80 |
67 set HotSpotWorkSpace=%1 |
81 REM Set HotSpotWorkSpace to the directy two steps above this script |
68 set HotSpotBuildSpace=%2 |
82 for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi) |
69 set HotSpotJDKDist=%3 |
83 set HotSpotBuildRoot=%HotSpotWorkSpace%build |
|
84 set HotSpotBuildSpace=%HotSpotBuildRoot%\vs |
|
85 set HotSpotJDKDist=%1 |
|
86 |
70 |
87 |
71 REM figure out MSC version |
88 REM figure out MSC version |
72 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i |
89 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i |
73 |
90 |
74 echo ************************************************************** |
91 echo ************************************************************** |
75 set ProjectFile=vm.vcproj |
92 set ProjectFile=jvm.vcproj |
76 if "%MSC_VER%" == "1200" ( |
93 if "%MSC_VER%" == "1200" ( |
77 set ProjectFile=vm.dsp |
94 set ProjectFile=jvm.dsp |
78 echo Will generate VC6 project {unsupported} |
95 echo Will generate VC6 project {unsupported} |
79 ) else ( |
96 ) else ( |
80 if "%MSC_VER%" == "1400" ( |
97 if "%MSC_VER%" == "1400" ( |
81 echo Will generate VC8 {Visual Studio 2005} |
98 echo Will generate VC8 {Visual Studio 2005} |
82 ) else ( |
99 ) else ( |
83 if "%MSC_VER%" == "1500" ( |
100 if "%MSC_VER%" == "1500" ( |
84 echo Will generate VC9 {Visual Studio 2008} |
101 echo Will generate VC9 {Visual Studio 2008} |
85 ) else ( |
102 ) else ( |
|
103 if "%MSC_VER%" == "1600" ( |
|
104 echo Detected Visual Studio 2010, but |
|
105 echo will generate VC9 {Visual Studio 2008} |
|
106 echo Use conversion wizard in VS 2010. |
|
107 ) else ( |
86 echo Will generate VC7 project {Visual Studio 2003 .NET} |
108 echo Will generate VC7 project {Visual Studio 2003 .NET} |
|
109 ) |
87 ) |
110 ) |
88 ) |
111 ) |
89 ) |
112 ) |
90 echo %ProjectFile% |
113 echo %ProjectFile% |
91 echo ************************************************************** |
114 echo ************************************************************** |
131 |
156 |
132 |
157 |
133 REM This is now safe to do. |
158 REM This is now safe to do. |
134 :copyfiles |
159 :copyfiles |
135 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do ( |
160 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do ( |
136 if NOT EXIST %HotSpotBuildSpace%\%%i mkdir %HotSpotBuildSpace%\%%i |
161 if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated |
137 copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\ > NUL |
162 copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL |
138 ) |
163 ) |
139 |
164 |
140 REM force regneration of ProjectFile |
165 REM force regneration of ProjectFile |
141 if exist %HotSpotBuildSpace%\%ProjectFile% del %HotSpotBuildSpace%\%ProjectFile% |
166 if exist %HotSpotBuildSpace%\%ProjectFile% del %HotSpotBuildSpace%\%ProjectFile% |
142 |
167 |
143 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do ( |
168 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do ( |
144 |
169 echo -- %%i -- |
145 echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make |
170 echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make |
146 echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make |
171 echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make |
147 echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%%i\local.make |
172 echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%%i\local.make |
148 echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%%i\local.make |
173 echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%%i\local.make |
149 echo. >> %HotSpotBuildSpace%\%%i\local.make |
174 echo. >> %HotSpotBuildSpace%\%%i\local.make |
|
175 echo Variant=%%i >> %HotSpotBuildSpace%\%%i\local.make |
|
176 echo WorkSpace=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make |
150 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make |
177 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make |
|
178 echo HOTSPOTBUILDROOT=%HotSpotBuildRoot% >> %HotSpotBuildSpace%\%%i\local.make |
151 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%%i\local.make |
179 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%%i\local.make |
152 echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%%i\local.make |
180 echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%%i\local.make |
153 echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%%i\local.make |
181 echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%%i\local.make |
154 echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%%i\local.make |
182 echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%%i\local.make |
155 echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%%i\local.make |
183 echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%%i\local.make |
156 echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%%i\local.make |
184 echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%%i\local.make |
157 |
185 |
158 pushd %HotSpotBuildSpace%\%%i |
186 for /D %%j in (debug, fastdebug, product) do ( |
|
187 if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j |
|
188 ) |
|
189 |
|
190 pushd %HotSpotBuildSpace%\%%i\generated |
159 nmake /nologo |
191 nmake /nologo |
160 popd |
192 popd |
161 |
193 |
162 ) |
194 ) |
163 |
195 |
164 pushd %HotSpotBuildSpace% |
196 pushd %HotSpotBuildRoot% |
165 |
197 |
166 echo # Generated file! > local.make |
198 REM It doesn't matter which variant we use here, "compiler1" is as good as any of the others - we need the common variables |
167 echo # Changing a variable below and then deleting %ProjectFile% will cause >> local.make |
199 nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %HotSpotBuildRoot%/%ProjectFile% |
168 echo # %ProjectFile% to be regenerated with the new values. Changing the >> local.make |
|
169 echo # version requires rerunning create.bat. >> local.make |
|
170 echo. >> local.make |
|
171 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> local.make |
|
172 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> local.make |
|
173 echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> local.make |
|
174 echo ARCH=%ARCH% >> local.make |
|
175 echo BUILDARCH=%BUILDARCH% >> local.make |
|
176 echo Platform_arch=%Platform_arch% >> local.make |
|
177 echo Platform_arch_model=%Platform_arch_model% >> local.make |
|
178 |
|
179 nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile %HotSpotBuildSpace%/%ProjectFile% |
|
180 |
200 |
181 popd |
201 popd |
182 |
202 |
183 goto end |
203 goto end |
184 |
204 |
185 :usage |
205 :usage |
186 echo Usage: create HotSpotWorkSpace HotSpotBuildSpace HotSpotJDKDist |
206 echo Usage: create HotSpotJDKDist |
187 echo. |
207 echo. |
188 echo This is the interactive build setup script (as opposed to the batch |
208 echo This is the VS build setup script (as opposed to the batch |
189 echo build execution script). It creates HotSpotBuildSpace if necessary, |
209 echo build execution script). It creates a build directory if necessary, |
190 echo copies the appropriate files out of HotSpotWorkSpace into it, and |
210 echo copies the appropriate files out of the workspace into it, and |
191 echo builds and runs ProjectCreator in it. This has the side-effect of creating |
211 echo builds and runs ProjectCreator in it. This has the side-effect of creating |
192 echo the %ProjectFile% file in the build space, which is then used in Visual C++. |
212 echo the %ProjectFile% file in the build space, which is then used in Visual C++. |
193 echo The HotSpotJDKDist defines place where JVM binaries should be placed. |
213 echo. |
|
214 echo The HotSpotJDKDist defines the JDK that should be used when running the JVM. |
194 echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection. |
215 echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection. |
195 echo. |
216 echo. |
196 echo NOTE that it is now NOT safe to modify any of the files in the build |
217 echo NOTE that it is now NOT safe to modify any of the files in the build |
197 echo space, since they may be overwritten whenever this script is run or |
218 echo space, since they may be overwritten whenever this script is run or |
198 echo nmake is run in that directory. |
219 echo nmake is run in that directory. |