make/windows/create.bat

Wed, 27 Apr 2016 01:25:04 +0800

author
aoqi
date
Wed, 27 Apr 2016 01:25:04 +0800
changeset 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Initial load
http://hg.openjdk.java.net/jdk8u/jdk8u/hotspot/
changeset: 6782:28b50d07f6f8
tag: jdk8u25-b17

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

mercurial