make/windows/create.bat

Wed, 15 Dec 2010 07:11:31 -0800

author
sla
date
Wed, 15 Dec 2010 07:11:31 -0800
changeset 2369
aa6e219afbf1
parent 2314
f95d63e2154a
child 2540
15d6977f04b0
permissions
-rw-r--r--

7006354: Updates to Visual Studio project creation and development launcher
Summary: Updates to Visual Studio project creation and development launcher
Reviewed-by: stefank, coleenp

     1 @echo off
     2 REM
     3 REM Copyright (c) 1999, 2010, 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
    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 ProjectCreator 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++.
    32 REM
    33 REM Since we don't have uname and we could be cross-compiling,
    34 REM Use the compiler to determine which ARCH we are building
    35 REM 
    36 REM Note: Running this batch file from the Windows command shell requires
    37 REM that "grep" be accessible on the PATH. An MKS install does this.
    38 REM 
    40 cl 2>NUL >NUL
    41 if %errorlevel% == 0 goto nexttest
    42 echo Make sure cl.exe is in your PATH before running this script.
    43 goto end
    45 :nexttest
    46 grep -V 2>NUL >NUL
    47 if %errorlevel% == 0 goto testit
    48 echo Make sure grep.exe is in your PATH before running this script. Either cygwin or MKS should work.
    49 goto end
    52 :testit
    53 cl 2>&1 | grep "IA-64" >NUL
    54 if %errorlevel% == 0 goto isia64
    55 cl 2>&1 | grep "AMD64" >NUL
    56 if %errorlevel% == 0 goto amd64
    57 set ARCH=x86
    58 set BUILDARCH=i486
    59 set Platform_arch=x86
    60 set Platform_arch_model=x86_32
    61 goto done
    62 :amd64
    63 set ARCH=x86
    64 set BUILDARCH=amd64
    65 set Platform_arch=x86
    66 set Platform_arch_model=x86_64
    67 goto done
    68 :isia64
    69 set ARCH=ia64
    70 set BUILDARCH=ia64
    71 set Platform_arch=ia64
    72 set Platform_arch_model=ia64
    73 :done
    75 setlocal
    77 if "%1" == "" goto usage
    79 if not "%2" == "" goto usage
    81 REM Set HotSpotWorkSpace to the directy two steps above this script
    82 for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi)
    83 set HotSpotBuildRoot=%HotSpotWorkSpace%build
    84 set HotSpotBuildSpace=%HotSpotBuildRoot%\vs
    85 set HotSpotJDKDist=%1
    88 REM figure out MSC version
    89 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i
    91 echo **************************************************************
    92 set ProjectFile=jvm.vcproj
    93 if "%MSC_VER%" == "1200" (
    94 set ProjectFile=jvm.dsp
    95 echo Will generate VC6 project {unsupported}
    96 ) else (
    97 if "%MSC_VER%" == "1400" (
    98 echo Will generate VC8 {Visual Studio 2005}
    99 ) else (
   100 if "%MSC_VER%" == "1500" (
   101 echo Will generate VC9 {Visual Studio 2008}
   102 ) else (
   103 if "%MSC_VER%" == "1600" (
   104 echo Detected Visual Studio 2010, but
   105 echo will generate VC9 {Visual Studio 2008}
   106 echo Use conversion wizard in VS 2010.
   107 ) else (
   108 echo Will generate VC7 project {Visual Studio 2003 .NET}
   109 )
   110 )
   111 )
   112 )
   113 echo                            %ProjectFile%
   114 echo **************************************************************
   116 REM Test all variables to see whether the directories they
   117 REM reference exist
   119 if exist %HotSpotWorkSpace% goto test1
   121 echo Error: directory pointed to by HotSpotWorkSpace
   122 echo does not exist, or the variable is not set.
   123 echo.
   124 goto usage
   126 :test1
   127 if exist %HotSpotBuildSpace% goto test2
   128 if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace%
   129 if exist %HotSpotBuildSpace% goto test2
   130 echo Error: directory pointed to by HotSpotBuildSpace
   131 echo does not exist, or the variable is not set.
   132 echo.
   133 goto usage
   135 :test2
   136 if exist %HotSpotJDKDist% goto test3
   137 echo Error: directory pointed to by %HotSpotJDKDist%
   138 echo does not exist, or the variable is not set.
   139 echo.
   140 goto usage
   142 :test3
   143 if not "%HOTSPOTMKSHOME%" == "" goto makedir
   144 if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin
   145 if not "%HOTSPOTMKSHOME%" == "" goto makedir
   146 echo Warning: please set variable HOTSPOTMKSHOME to place where 
   147 echo          your MKS/Cygwin installation is
   148 echo.
   149 goto usage
   151 :makedir
   152 echo NOTE: Using the following settings:
   153 echo   HotSpotWorkSpace=%HotSpotWorkSpace%
   154 echo   HotSpotBuildSpace=%HotSpotBuildSpace%
   155 echo   HotSpotJDKDist=%HotSpotJDKDist%
   158 REM This is now safe to do.
   159 :copyfiles
   160 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do (
   161 if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated
   162 copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL
   163 )
   165 REM force regneration of ProjectFile
   166 if exist %HotSpotBuildSpace%\%ProjectFile% del %HotSpotBuildSpace%\%ProjectFile%
   168 for /D %%i in (compiler1, compiler2, tiered, core, kernel) do (
   169 echo -- %%i --
   170 echo # Generated file!                                                        >    %HotSpotBuildSpace%\%%i\local.make
   171 echo # Changing a variable below and then deleting %ProjectFile% will cause  >>    %HotSpotBuildSpace%\%%i\local.make
   172 echo # %ProjectFile% to be regenerated with the new values.  Changing the    >>    %HotSpotBuildSpace%\%%i\local.make
   173 echo # version requires rerunning create.bat.                                >>    %HotSpotBuildSpace%\%%i\local.make
   174 echo.                                      >>    %HotSpotBuildSpace%\%%i\local.make
   175 echo Variant=%%i			   >>    %HotSpotBuildSpace%\%%i\local.make
   176 echo WorkSpace=%HotSpotWorkSpace%   	   >>    %HotSpotBuildSpace%\%%i\local.make
   177 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace%   >>    %HotSpotBuildSpace%\%%i\local.make
   178 echo HOTSPOTBUILDROOT=%HotSpotBuildRoot%   >>    %HotSpotBuildSpace%\%%i\local.make
   179 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >>    %HotSpotBuildSpace%\%%i\local.make
   180 echo HOTSPOTJDKDIST=%HotSpotJDKDist%       >>    %HotSpotBuildSpace%\%%i\local.make
   181 echo ARCH=%ARCH%                           >>    %HotSpotBuildSpace%\%%i\local.make
   182 echo BUILDARCH=%BUILDARCH%                 >>    %HotSpotBuildSpace%\%%i\local.make
   183 echo Platform_arch=%Platform_arch%         >>    %HotSpotBuildSpace%\%%i\local.make
   184 echo Platform_arch_model=%Platform_arch_model% >>    %HotSpotBuildSpace%\%%i\local.make
   186 for /D %%j in (debug, fastdebug, product) do (
   187 if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j
   188 )
   190 pushd %HotSpotBuildSpace%\%%i\generated
   191 nmake /nologo
   192 popd
   194 )
   196 pushd %HotSpotBuildRoot%
   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
   199 nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %HotSpotBuildRoot%/%ProjectFile%
   201 popd
   203 goto end
   205 :usage
   206 echo Usage: create HotSpotJDKDist
   207 echo.
   208 echo This is the VS build setup script (as opposed to the batch
   209 echo build execution script). It creates a build directory if necessary,
   210 echo copies the appropriate files out of the workspace into it, and
   211 echo builds and runs ProjectCreator in it. This has the side-effect of creating
   212 echo the %ProjectFile% file in the build space, which is then used in Visual C++.
   213 echo.
   214 echo The HotSpotJDKDist defines the JDK that should be used when running the JVM.
   215 echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection.
   216 echo.
   217 echo NOTE that it is now NOT safe to modify any of the files in the build
   218 echo space, since they may be overwritten whenever this script is run or
   219 echo nmake is run in that directory.
   221 :end
   223 endlocal

mercurial