1 @echo off
   2 REM
   3 REM Copyright (c) 1999, 2009, 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 MakeDeps 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 REM 
  32 REM The generated project file depends upon the include databases. If
  33 REM those are changed then MakeDeps is rerun.
  34 
  35 REM
  36 REM Since we don't have uname and we could be cross-compiling,
  37 REM Use the compiler to determine which ARCH we are building
  38 REM 
  39 REM Note: Running this batch file from the Windows command shell requires
  40 REM that "grep" be accessible on the PATH. An MKS install does this.
  41 REM 
  42 cl 2>&1 | grep "IA-64" >NUL
  43 if %errorlevel% == 0 goto isia64
  44 cl 2>&1 | grep "AMD64" >NUL
  45 if %errorlevel% == 0 goto amd64
  46 set ARCH=x86
  47 set BUILDARCH=i486
  48 set Platform_arch=x86
  49 set Platform_arch_model=x86_32
  50 goto end
  51 :amd64
  52 set ARCH=x86
  53 set BUILDARCH=amd64
  54 set Platform_arch=x86
  55 set Platform_arch_model=x86_64
  56 goto end
  57 :isia64
  58 set ARCH=ia64
  59 set BUILDARCH=ia64
  60 set Platform_arch=ia64
  61 set Platform_arch_model=ia64
  62 :end
  63 
  64 setlocal
  65 
  66 if "%1" == "" goto usage
  67 
  68 if not "%4" == "" goto usage
  69 
  70 set HotSpotWorkSpace=%1
  71 set HotSpotBuildSpace=%2
  72 set HotSpotJDKDist=%3
  73 
  74 REM figure out MSC version
  75 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i
  76 
  77 echo **************************************************************
  78 set ProjectFile=vm.vcproj
  79 if "%MSC_VER%" == "1200" (
  80 set ProjectFile=vm.dsp
  81 echo Will generate VC6 project {unsupported}
  82 ) else (
  83 if "%MSC_VER%" == "1400" (
  84 echo Will generate VC8 {Visual Studio 2005}
  85 ) else (
  86 if "%MSC_VER%" == "1500" (
  87 echo Will generate VC9 {Visual Studio 2008}
  88 ) else (
  89 echo Will generate VC7 project {Visual Studio 2003 .NET}
  90 )
  91 )
  92 )
  93 echo                            %ProjectFile%
  94 echo **************************************************************
  95 
  96 REM Test all variables to see whether the directories they
  97 REM reference exist
  98 
  99 if exist %HotSpotWorkSpace% goto test1
 100 
 101 echo Error: directory pointed to by HotSpotWorkSpace
 102 echo does not exist, or the variable is not set.
 103 echo.
 104 goto usage
 105 
 106 :test1
 107 if exist %HotSpotBuildSpace% goto test2
 108 if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace%
 109 if exist %HotSpotBuildSpace% goto test2
 110 echo Error: directory pointed to by HotSpotBuildSpace
 111 echo does not exist, or the variable is not set.
 112 echo.
 113 goto usage
 114 
 115 :test2
 116 if exist %HotSpotJDKDist% goto test3
 117 echo Error: directory pointed to by %HotSpotJDKDist%
 118 echo does not exist, or the variable is not set.
 119 echo.
 120 goto usage
 121 
 122 :test3
 123 if not "%HOTSPOTMKSHOME%" == "" goto makedir
 124 echo Warning: please set variable HOTSPOTMKSHOME to place where 
 125 echo          your MKS/Cygwin installation is
 126 echo.
 127 goto usage
 128 
 129 :makedir
 130 echo NOTE: Using the following settings:
 131 echo   HotSpotWorkSpace=%HotSpotWorkSpace%
 132 echo   HotSpotBuildSpace=%HotSpotBuildSpace%
 133 echo   HotSpotJDKDist=%HotSpotJDKDist%
 134 
 135 
 136 REM This is now safe to do.
 137 :copyfiles
 138 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do (
 139 if NOT EXIST %HotSpotBuildSpace%\%%i mkdir %HotSpotBuildSpace%\%%i
 140 copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\ > NUL
 141 )
 142 
 143 REM force regneration of ProjectFile
 144 if exist %HotSpotBuildSpace%\%ProjectFile% del %HotSpotBuildSpace%\%ProjectFile%
 145 
 146 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do (
 147 
 148 echo # Generated file!                                                 >    %HotSpotBuildSpace%\%%i\local.make
 149 echo # Changing a variable below and then deleting %ProjectFile% will cause  >>    %HotSpotBuildSpace%\%%i\local.make
 150 echo # %ProjectFile% to be regenerated with the new values.  Changing the    >>    %HotSpotBuildSpace%\%%i\local.make
 151 echo # version requires rerunning create.bat.                         >>    %HotSpotBuildSpace%\%%i\local.make
 152 echo.                                      >>    %HotSpotBuildSpace%\%%i\local.make
 153 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace%   >>    %HotSpotBuildSpace%\%%i\local.make
 154 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >>    %HotSpotBuildSpace%\%%i\local.make
 155 echo HOTSPOTJDKDIST=%HotSpotJDKDist%       >>    %HotSpotBuildSpace%\%%i\local.make
 156 echo ARCH=%ARCH%                           >>    %HotSpotBuildSpace%\%%i\local.make
 157 echo BUILDARCH=%BUILDARCH%                 >>    %HotSpotBuildSpace%\%%i\local.make
 158 echo Platform_arch=%Platform_arch%         >>    %HotSpotBuildSpace%\%%i\local.make
 159 echo Platform_arch_model=%Platform_arch_model% >>    %HotSpotBuildSpace%\%%i\local.make
 160 
 161 REM build config specific stuff
 162 
 163 pushd %HotSpotBuildSpace%\%%i
 164 nmake /nologo
 165 popd
 166 )
 167 
 168 goto end
 169 
 170 :usage
 171 echo Usage: create HotSpotWorkSpace HotSpotBuildSpace HotSpotJDKDist
 172 echo.
 173 echo This is the interactive build setup script (as opposed to the batch
 174 echo build execution script). It creates HotSpotBuildSpace if necessary,
 175 echo copies the appropriate files out of HotSpotWorkSpace into it, and
 176 echo builds and runs MakeDeps in it. This has the side-effect of creating
 177 echo the %ProjectFile% file in the build space, which is then used in Visual C++.
 178 echo The HotSpotJDKDist defines place where JVM binaries should be placed.
 179 echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection.
 180 echo.
 181 echo The generated project file depends upon the include databases. If
 182 echo those are changed then MakeDeps is rerun.
 183 echo.
 184 echo NOTE that it is now NOT safe to modify any of the files in the build
 185 echo space, since they may be overwritten whenever this script is run or
 186 echo nmake is run in that directory.
 187 
 188 :end
 189 
 190 endlocal