make/windows/create.bat

Mon, 14 Feb 2011 22:21:18 -0500

author
tonyp
date
Mon, 14 Feb 2011 22:21:18 -0500
changeset 2538
f7702f8c0e25
parent 2369
aa6e219afbf1
child 2540
15d6977f04b0
permissions
-rw-r--r--

Merge

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

mercurial