aoqi@0: @echo off aoqi@0: REM aoqi@0: REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: REM aoqi@0: REM This code is free software; you can redistribute it and/or modify it aoqi@0: REM under the terms of the GNU General Public License version 2 only, as aoqi@0: REM published by the Free Software Foundation. aoqi@0: REM aoqi@0: REM This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: REM version 2 for more details (a copy is included in the LICENSE file that aoqi@0: REM accompanied this code). aoqi@0: REM aoqi@0: REM You should have received a copy of the GNU General Public License version aoqi@0: REM 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: REM aoqi@0: REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: REM or visit www.oracle.com if you need additional information or have any aoqi@0: REM questions. aoqi@0: REM aoqi@0: REM aoqi@0: aoqi@0: REM This is the interactive build setup script (as opposed to the batch aoqi@0: REM build execution script). It creates $HotSpotBuildSpace if necessary, aoqi@0: REM copies the appropriate files out of $HotSpotWorkSpace into it, and aoqi@0: REM builds and runs ProjectCreator in it. This has the side-effect of creating aoqi@0: REM the vm.vcproj file in the buildspace, which is then used in Visual C++. aoqi@0: aoqi@0: REM aoqi@0: REM Since we don't have uname and we could be cross-compiling, aoqi@0: REM Use the compiler to determine which ARCH we are building aoqi@0: REM aoqi@0: REM Note: Running this batch file from the Windows command shell requires aoqi@0: REM that "grep" be accessible on the PATH. An MKS install does this. aoqi@0: REM aoqi@0: aoqi@0: cl 2>NUL >NUL aoqi@0: if %errorlevel% == 0 goto nexttest aoqi@0: echo Make sure cl.exe is in your PATH before running this script. aoqi@0: goto end aoqi@0: aoqi@0: :nexttest aoqi@0: grep -V 2>NUL >NUL aoqi@0: if %errorlevel% == 0 goto testit aoqi@0: echo Make sure grep.exe is in your PATH before running this script. Either cygwin or MKS should work. aoqi@0: goto end aoqi@0: aoqi@0: aoqi@0: :testit aoqi@0: cl 2>&1 | grep "x64" >NUL aoqi@0: if %errorlevel% == 0 goto amd64 aoqi@0: set ARCH=x86 aoqi@0: set BUILDARCH=i486 aoqi@0: set Platform_arch=x86 aoqi@0: set Platform_arch_model=x86_32 aoqi@0: goto done aoqi@0: :amd64 aoqi@0: set ARCH=x86 aoqi@0: set BUILDARCH=amd64 aoqi@0: set Platform_arch=x86 aoqi@0: set Platform_arch_model=x86_64 aoqi@0: :done aoqi@0: aoqi@0: setlocal aoqi@0: aoqi@0: if "%1" == "" goto usage aoqi@0: aoqi@0: if not "%2" == "" goto usage aoqi@0: aoqi@0: REM Set HotSpotWorkSpace to the directy two steps above this script aoqi@0: for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi) aoqi@0: set HotSpotBuildRoot=%HotSpotWorkSpace%build aoqi@0: set HotSpotBuildSpace=%HotSpotBuildRoot%\vs-%BUILDARCH% aoqi@0: set HotSpotJDKDist=%1 aoqi@0: aoqi@0: aoqi@0: REM figure out MSC version aoqi@0: for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i aoqi@0: aoqi@0: echo ************************************************************** aoqi@0: set ProjectFile=%HotSpotBuildSpace%\jvm.vcproj aoqi@0: echo MSC_VER = "%MSC_VER%" aoqi@0: if "%MSC_VER%" == "1200" ( aoqi@0: set ProjectFile=%HotSpotBuildSpace%\jvm.dsp aoqi@0: echo Will generate VC6 project {unsupported} aoqi@0: ) else ( aoqi@0: if "%MSC_VER%" == "1400" ( aoqi@0: echo Will generate VC8 {Visual Studio 2005} aoqi@0: ) else ( aoqi@0: if "%MSC_VER%" == "1500" ( aoqi@0: echo Will generate VC9 {Visual Studio 2008} aoqi@0: ) else ( aoqi@0: if "%MSC_VER%" == "1600" ( aoqi@0: echo Will generate VC10 {Visual Studio 2010} aoqi@0: set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj aoqi@0: ) else ( aoqi@0: if "%MSC_VER%" == "1700" ( aoqi@0: echo Will generate VC10 {compatible with Visual Studio 2012} aoqi@0: echo After opening in VS 2012, click "Update" when prompted. aoqi@0: set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj aoqi@0: ) else ( aoqi@0: echo Will generate VC7 project {Visual Studio 2003 .NET} aoqi@0: ) aoqi@0: ) aoqi@0: ) aoqi@0: ) aoqi@0: ) aoqi@0: echo %ProjectFile% aoqi@0: echo ************************************************************** aoqi@0: aoqi@0: REM Test all variables to see whether the directories they aoqi@0: REM reference exist aoqi@0: aoqi@0: if exist %HotSpotWorkSpace% goto test1 aoqi@0: aoqi@0: echo Error: directory pointed to by HotSpotWorkSpace aoqi@0: echo does not exist, or the variable is not set. aoqi@0: echo. aoqi@0: goto usage aoqi@0: aoqi@0: :test1 aoqi@0: if exist %HotSpotBuildSpace% goto test2 aoqi@0: if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace% aoqi@0: if exist %HotSpotBuildSpace% goto test2 aoqi@0: echo Error: directory pointed to by HotSpotBuildSpace aoqi@0: echo does not exist, or the variable is not set. aoqi@0: echo. aoqi@0: goto usage aoqi@0: aoqi@0: :test2 aoqi@0: if exist %HotSpotJDKDist% goto test3 aoqi@0: echo Error: directory pointed to by %HotSpotJDKDist% aoqi@0: echo does not exist, or the variable is not set. aoqi@0: echo. aoqi@0: goto usage aoqi@0: aoqi@0: :test3 aoqi@0: if not "%HOTSPOTMKSHOME%" == "" goto makedir aoqi@0: if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin aoqi@0: if not "%HOTSPOTMKSHOME%" == "" goto makedir aoqi@0: echo Warning: please set variable HOTSPOTMKSHOME to place where aoqi@0: echo your MKS/Cygwin installation is aoqi@0: echo. aoqi@0: goto usage aoqi@0: aoqi@0: :makedir aoqi@0: echo NOTE: Using the following settings: aoqi@0: echo HotSpotWorkSpace=%HotSpotWorkSpace% aoqi@0: echo HotSpotBuildSpace=%HotSpotBuildSpace% aoqi@0: echo HotSpotJDKDist=%HotSpotJDKDist% aoqi@0: aoqi@0: aoqi@0: REM This is now safe to do. aoqi@0: :copyfiles aoqi@0: for /D %%i in (compiler1, compiler2, tiered ) do ( aoqi@0: if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated aoqi@0: copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL aoqi@0: ) aoqi@0: aoqi@0: REM force regneration of ProjectFile aoqi@0: if exist %ProjectFile% del %ProjectFile% aoqi@0: aoqi@0: for /D %%i in (compiler1, compiler2, tiered ) do ( aoqi@0: echo -- %%i -- aoqi@0: echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo. >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo Variant=%%i >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo WorkSpace=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo HOTSPOTBUILDROOT=%HotSpotBuildRoot% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: echo MSC_VER=%MSC_VER% >> %HotSpotBuildSpace%\%%i\local.make aoqi@0: aoqi@0: for /D %%j in (debug, fastdebug, product) do ( aoqi@0: if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j aoqi@0: ) aoqi@0: aoqi@0: pushd %HotSpotBuildSpace%\%%i\generated aoqi@0: nmake /nologo aoqi@0: popd aoqi@0: aoqi@0: ) aoqi@0: aoqi@0: pushd %HotSpotBuildRoot% aoqi@0: aoqi@0: 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: nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %ProjectFile% aoqi@0: aoqi@0: popd aoqi@0: aoqi@0: goto end aoqi@0: aoqi@0: :usage aoqi@0: echo Usage: create HotSpotJDKDist aoqi@0: echo. aoqi@0: echo This is the VS build setup script (as opposed to the batch aoqi@0: echo build execution script). It creates a build directory if necessary, aoqi@0: echo copies the appropriate files out of the workspace into it, and aoqi@0: echo builds and runs ProjectCreator in it. This has the side-effect of creating aoqi@0: echo the %ProjectFile% file in the build space, which is then used in Visual C++. aoqi@0: echo. aoqi@0: echo The HotSpotJDKDist defines the JDK that should be used when running the JVM. aoqi@0: echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection. aoqi@0: echo. aoqi@0: echo NOTE that it is now NOT safe to modify any of the files in the build aoqi@0: echo space, since they may be overwritten whenever this script is run or aoqi@0: echo nmake is run in that directory. aoqi@0: aoqi@0: :end aoqi@0: aoqi@0: endlocal