1 @echo off 2 REM 3 REM Copyright (c) 1999, 2015, 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 echo MSC_VER = "%MSC_VER%" 85 set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj 86 echo %ProjectFile% 87 echo ************************************************************** 88 89 REM Test all variables to see whether the directories they 90 REM reference exist 91 92 if exist %HotSpotWorkSpace% goto test1 93 94 echo Error: directory pointed to by HotSpotWorkSpace 95 echo does not exist, or the variable is not set. 96 echo. 97 goto usage 98 99 :test1 100 if exist %HotSpotBuildSpace% goto test2 101 if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace% 102 if exist %HotSpotBuildSpace% goto test2 103 echo Error: directory pointed to by HotSpotBuildSpace 104 echo does not exist, or the variable is not set. 105 echo. 106 goto usage 107 108 :test2 109 if exist %HotSpotJDKDist% goto test3 110 echo Error: directory pointed to by %HotSpotJDKDist% 111 echo does not exist, or the variable is not set. 112 echo. 113 goto usage 114 115 :test3 116 if not "%HOTSPOTMKSHOME%" == "" goto makedir 117 if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin 118 if not "%HOTSPOTMKSHOME%" == "" goto makedir 119 echo Warning: please set variable HOTSPOTMKSHOME to place where 120 echo your MKS/Cygwin installation is 121 echo. 122 goto usage 123 124 :generatefiles 125 if NOT EXIST %HotSpotBuildSpace%\%1\generated mkdir %HotSpotBuildSpace%\%1\generated 126 copy %HotSpotWorkSpace%\make\windows\projectfiles\%1\* %HotSpotBuildSpace%\%1\generated > NUL 127 128 REM force regneration of ProjectFile 129 if exist %ProjectFile% del %ProjectFile% 130 131 echo -- %1 -- 132 echo # Generated file! > %HotSpotBuildSpace%\%1\local.make 133 echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%1\local.make 134 echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%1\local.make 135 echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%1\local.make 136 echo. >> %HotSpotBuildSpace%\%1\local.make 137 echo Variant=%1 >> %HotSpotBuildSpace%\%1\local.make 138 echo WorkSpace=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%1\local.make 139 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%1\local.make 140 echo HOTSPOTBUILDROOT=%HotSpotBuildRoot% >> %HotSpotBuildSpace%\%1\local.make 141 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%1\local.make 142 echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%1\local.make 143 echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%1\local.make 144 echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%1\local.make 145 echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%1\local.make 146 echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%1\local.make 147 echo MSC_VER=%MSC_VER% >> %HotSpotBuildSpace%\%1\local.make 148 149 for /D %%j in (debug, fastdebug, product) do ( 150 if NOT EXIST %HotSpotBuildSpace%\%1\%%j mkdir %HotSpotBuildSpace%\%1\%%j 151 ) 152 153 pushd %HotSpotBuildSpace%\%1\generated 154 nmake /nologo 155 popd 156 157 goto :eof 158 159 160 :makedir 161 echo NOTE: Using the following settings: 162 echo HotSpotWorkSpace=%HotSpotWorkSpace% 163 echo HotSpotBuildSpace=%HotSpotBuildSpace% 164 echo HotSpotJDKDist=%HotSpotJDKDist% 165 166 echo COPYFILES %BUILDARCH% 167 if "%BUILDARCH%" == "i486" call :generatefiles compiler1 168 call :generatefiles tiered 169 170 pushd %HotSpotBuildRoot% 171 REM It doesn't matter which variant we use here, "tiered" is as good as any of the others - we need the common variables 172 nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\tiered\local.make %ProjectFile% 173 174 popd 175 176 goto end 177 178 :usage 179 echo Usage: create HotSpotJDKDist 180 echo. 181 echo This is the VS build setup script (as opposed to the batch 182 echo build execution script). It creates a build directory if necessary, 183 echo copies the appropriate files out of the workspace into it, and 184 echo builds and runs ProjectCreator in it. This has the side-effect of creating 185 echo the %ProjectFile% file in the build space, which is then used in Visual C++. 186 echo. 187 echo The HotSpotJDKDist defines the JDK that should be used when running the JVM. 188 echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection. 189 echo. 190 echo NOTE that it is now NOT safe to modify any of the files in the build 191 echo space, since they may be overwritten whenever this script is run or 192 echo nmake is run in that directory. 193 194 :end 195 196 endlocal