1 @echo off
   2 REM
   3 REM Copyright (c) 1997, 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 Set HotSpotWorkSpace to the directory two steps above this script
  27 for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi)
  28 
  29 REM
  30 REM Since we don't have uname and we could be cross-compiling,
  31 REM Use the compiler to determine which ARCH we are building
  32 REM 
  33 cl 2>&1 1>&3 | findstr x64>NUL
  34 if %errorlevel% == 0 goto amd64
  35 set VCPROJ=%HotSpotWorkSpace%\build\vs-i486\jvm.vcxproj
  36 set PLATFORM=x86
  37 goto testmkshome
  38 :amd64
  39 set VCPROJ=%HotSpotWorkSpace%\build\vs-amd64\jvm.vcxproj
  40 set PLATFORM=x64
  41 goto testmkshome
  42 
  43 :testmkshome
  44 if not "%HOTSPOTMKSHOME%" == "" goto testjavahome
  45 if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin
  46 if not "%HOTSPOTMKSHOME%" == "" goto testjavahome
  47 if exist c:\cygwin64\bin set HOTSPOTMKSHOME=c:\cygwin64\bin
  48 if not "%HOTSPOTMKSHOME%" == "" goto testjavahome
  49 echo Error: please set variable HOTSPOTMKSHOME to place where 
  50 echo          your MKS/Cygwin installation is
  51 echo.
  52 goto end
  53 
  54 :testjavahome
  55 if not "%JAVA_HOME%" == "" goto testbuildversion
  56 echo Error: please set variable JAVA_HOME to a bootstrap JDK 
  57 echo.
  58 goto end
  59 
  60 :testbuildversion
  61 if "%1" == "compiler1" goto testdebuglevel
  62 if "%1" == "tiered"    goto testdebuglevel
  63 goto usage
  64 
  65 :testdebuglevel
  66 if "%2" == "product"   goto build
  67 if "%2" == "debug"     goto build
  68 if "%2" == "fastdebug" goto build
  69 goto usage
  70 
  71 :build
  72 if NOT EXIST %VCPROJ% call %~dp0\create.bat %JAVA_HOME%
  73 msbuild /Property:Platform=%PLATFORM% /Property:Configuration=%1_%2 /v:m %VCPROJ%
  74 goto end
  75 
  76 :usage
  77 echo Usage: build version debuglevel
  78 echo.
  79 echo where:
  80 echo version is "compiler1" or "tiered",
  81 echo debuglevel is "product", "debug" or "fastdebug"
  82 exit /b 1
  83 
  84 :end
  85 exit /b %errorlevel%