1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/windows/create.bat Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,222 @@ 1.4 +@echo off 1.5 +REM 1.6 +REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 +REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 +REM 1.9 +REM This code is free software; you can redistribute it and/or modify it 1.10 +REM under the terms of the GNU General Public License version 2 only, as 1.11 +REM published by the Free Software Foundation. 1.12 +REM 1.13 +REM This code is distributed in the hope that it will be useful, but WITHOUT 1.14 +REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.15 +REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.16 +REM version 2 for more details (a copy is included in the LICENSE file that 1.17 +REM accompanied this code). 1.18 +REM 1.19 +REM You should have received a copy of the GNU General Public License version 1.20 +REM 2 along with this work; if not, write to the Free Software Foundation, 1.21 +REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.22 +REM 1.23 +REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.24 +REM or visit www.oracle.com if you need additional information or have any 1.25 +REM questions. 1.26 +REM 1.27 +REM 1.28 + 1.29 +REM This is the interactive build setup script (as opposed to the batch 1.30 +REM build execution script). It creates $HotSpotBuildSpace if necessary, 1.31 +REM copies the appropriate files out of $HotSpotWorkSpace into it, and 1.32 +REM builds and runs ProjectCreator in it. This has the side-effect of creating 1.33 +REM the vm.vcproj file in the buildspace, which is then used in Visual C++. 1.34 + 1.35 +REM 1.36 +REM Since we don't have uname and we could be cross-compiling, 1.37 +REM Use the compiler to determine which ARCH we are building 1.38 +REM 1.39 +REM Note: Running this batch file from the Windows command shell requires 1.40 +REM that "grep" be accessible on the PATH. An MKS install does this. 1.41 +REM 1.42 + 1.43 +cl 2>NUL >NUL 1.44 +if %errorlevel% == 0 goto nexttest 1.45 +echo Make sure cl.exe is in your PATH before running this script. 1.46 +goto end 1.47 + 1.48 +:nexttest 1.49 +grep -V 2>NUL >NUL 1.50 +if %errorlevel% == 0 goto testit 1.51 +echo Make sure grep.exe is in your PATH before running this script. Either cygwin or MKS should work. 1.52 +goto end 1.53 + 1.54 + 1.55 +:testit 1.56 +cl 2>&1 | grep "x64" >NUL 1.57 +if %errorlevel% == 0 goto amd64 1.58 +set ARCH=x86 1.59 +set BUILDARCH=i486 1.60 +set Platform_arch=x86 1.61 +set Platform_arch_model=x86_32 1.62 +goto done 1.63 +:amd64 1.64 +set ARCH=x86 1.65 +set BUILDARCH=amd64 1.66 +set Platform_arch=x86 1.67 +set Platform_arch_model=x86_64 1.68 +:done 1.69 + 1.70 +setlocal 1.71 + 1.72 +if "%1" == "" goto usage 1.73 + 1.74 +if not "%2" == "" goto usage 1.75 + 1.76 +REM Set HotSpotWorkSpace to the directy two steps above this script 1.77 +for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi) 1.78 +set HotSpotBuildRoot=%HotSpotWorkSpace%build 1.79 +set HotSpotBuildSpace=%HotSpotBuildRoot%\vs-%BUILDARCH% 1.80 +set HotSpotJDKDist=%1 1.81 + 1.82 + 1.83 +REM figure out MSC version 1.84 +for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i 1.85 + 1.86 +echo ************************************************************** 1.87 +set ProjectFile=%HotSpotBuildSpace%\jvm.vcproj 1.88 +echo MSC_VER = "%MSC_VER%" 1.89 +if "%MSC_VER%" == "1200" ( 1.90 +set ProjectFile=%HotSpotBuildSpace%\jvm.dsp 1.91 +echo Will generate VC6 project {unsupported} 1.92 +) else ( 1.93 +if "%MSC_VER%" == "1400" ( 1.94 +echo Will generate VC8 {Visual Studio 2005} 1.95 +) else ( 1.96 +if "%MSC_VER%" == "1500" ( 1.97 +echo Will generate VC9 {Visual Studio 2008} 1.98 +) else ( 1.99 +if "%MSC_VER%" == "1600" ( 1.100 +echo Will generate VC10 {Visual Studio 2010} 1.101 +set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj 1.102 +) else ( 1.103 +if "%MSC_VER%" == "1700" ( 1.104 +echo Will generate VC10 {compatible with Visual Studio 2012} 1.105 +echo After opening in VS 2012, click "Update" when prompted. 1.106 +set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj 1.107 +) else ( 1.108 +echo Will generate VC7 project {Visual Studio 2003 .NET} 1.109 +) 1.110 +) 1.111 +) 1.112 +) 1.113 +) 1.114 +echo %ProjectFile% 1.115 +echo ************************************************************** 1.116 + 1.117 +REM Test all variables to see whether the directories they 1.118 +REM reference exist 1.119 + 1.120 +if exist %HotSpotWorkSpace% goto test1 1.121 + 1.122 +echo Error: directory pointed to by HotSpotWorkSpace 1.123 +echo does not exist, or the variable is not set. 1.124 +echo. 1.125 +goto usage 1.126 + 1.127 +:test1 1.128 +if exist %HotSpotBuildSpace% goto test2 1.129 +if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace% 1.130 +if exist %HotSpotBuildSpace% goto test2 1.131 +echo Error: directory pointed to by HotSpotBuildSpace 1.132 +echo does not exist, or the variable is not set. 1.133 +echo. 1.134 +goto usage 1.135 + 1.136 +:test2 1.137 +if exist %HotSpotJDKDist% goto test3 1.138 +echo Error: directory pointed to by %HotSpotJDKDist% 1.139 +echo does not exist, or the variable is not set. 1.140 +echo. 1.141 +goto usage 1.142 + 1.143 +:test3 1.144 +if not "%HOTSPOTMKSHOME%" == "" goto makedir 1.145 +if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin 1.146 +if not "%HOTSPOTMKSHOME%" == "" goto makedir 1.147 +echo Warning: please set variable HOTSPOTMKSHOME to place where 1.148 +echo your MKS/Cygwin installation is 1.149 +echo. 1.150 +goto usage 1.151 + 1.152 +:makedir 1.153 +echo NOTE: Using the following settings: 1.154 +echo HotSpotWorkSpace=%HotSpotWorkSpace% 1.155 +echo HotSpotBuildSpace=%HotSpotBuildSpace% 1.156 +echo HotSpotJDKDist=%HotSpotJDKDist% 1.157 + 1.158 + 1.159 +REM This is now safe to do. 1.160 +:copyfiles 1.161 +for /D %%i in (compiler1, compiler2, tiered ) do ( 1.162 +if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated 1.163 +copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL 1.164 +) 1.165 + 1.166 +REM force regneration of ProjectFile 1.167 +if exist %ProjectFile% del %ProjectFile% 1.168 + 1.169 +for /D %%i in (compiler1, compiler2, tiered ) do ( 1.170 +echo -- %%i -- 1.171 +echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make 1.172 +echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make 1.173 +echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%%i\local.make 1.174 +echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%%i\local.make 1.175 +echo. >> %HotSpotBuildSpace%\%%i\local.make 1.176 +echo Variant=%%i >> %HotSpotBuildSpace%\%%i\local.make 1.177 +echo WorkSpace=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make 1.178 +echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make 1.179 +echo HOTSPOTBUILDROOT=%HotSpotBuildRoot% >> %HotSpotBuildSpace%\%%i\local.make 1.180 +echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%%i\local.make 1.181 +echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%%i\local.make 1.182 +echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%%i\local.make 1.183 +echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%%i\local.make 1.184 +echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%%i\local.make 1.185 +echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%%i\local.make 1.186 +echo MSC_VER=%MSC_VER% >> %HotSpotBuildSpace%\%%i\local.make 1.187 + 1.188 +for /D %%j in (debug, fastdebug, product) do ( 1.189 +if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j 1.190 +) 1.191 + 1.192 +pushd %HotSpotBuildSpace%\%%i\generated 1.193 +nmake /nologo 1.194 +popd 1.195 + 1.196 +) 1.197 + 1.198 +pushd %HotSpotBuildRoot% 1.199 + 1.200 +REM It doesn't matter which variant we use here, "compiler1" is as good as any of the others - we need the common variables 1.201 +nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %ProjectFile% 1.202 + 1.203 +popd 1.204 + 1.205 +goto end 1.206 + 1.207 +:usage 1.208 +echo Usage: create HotSpotJDKDist 1.209 +echo. 1.210 +echo This is the VS build setup script (as opposed to the batch 1.211 +echo build execution script). It creates a build directory if necessary, 1.212 +echo copies the appropriate files out of the workspace into it, and 1.213 +echo builds and runs ProjectCreator in it. This has the side-effect of creating 1.214 +echo the %ProjectFile% file in the build space, which is then used in Visual C++. 1.215 +echo. 1.216 +echo The HotSpotJDKDist defines the JDK that should be used when running the JVM. 1.217 +echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection. 1.218 +echo. 1.219 +echo NOTE that it is now NOT safe to modify any of the files in the build 1.220 +echo space, since they may be overwritten whenever this script is run or 1.221 +echo nmake is run in that directory. 1.222 + 1.223 +:end 1.224 + 1.225 +endlocal