hotspot/make/windows/create.bat
author dcubed
Thu, 25 Mar 2010 16:27:12 -0700
changeset 5093 5fe28adc52ef
parent 3261 c7d5aae8d3f7
child 5547 f4b087cbb361
permissions -rw-r--r--
6938185: 3/4 6923488 breaks Windows command shell builds Summary: Fix build.bat so invoking command shell doesn't exit on error. Fix dirname assumptions. Document some MKS environment dependencies. Reviewed-by: coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
@echo off
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
REM
3261
c7d5aae8d3f7 6862919: Update copyright year
xdono
parents: 2271
diff changeset
     3
REM Copyright 1999-2009 Sun Microsystems, Inc.  All Rights Reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
REM
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
REM This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
REM under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
REM published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
REM
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
REM This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
REM FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
REM version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
REM accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
REM
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
REM You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
REM 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
REM
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
REM Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
REM CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
REM have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
REM  
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
REM
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
REM This is the interactive build setup script (as opposed to the batch
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
REM build execution script). It creates $HotSpotBuildSpace if necessary,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
REM copies the appropriate files out of $HotSpotWorkSpace into it, and
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
REM builds and runs MakeDeps in it. This has the side-effect of creating
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
REM the vm.vcproj file in the buildspace, which is then used in Visual C++.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
REM 
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
REM The generated project file depends upon the include databases. If
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
REM those are changed then MakeDeps is rerun.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
REM
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
REM Since we don't have uname and we could be cross-compiling,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
REM Use the compiler to determine which ARCH we are building
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
REM 
5093
5fe28adc52ef 6938185: 3/4 6923488 breaks Windows command shell builds
dcubed
parents: 3261
diff changeset
    39
REM Note: Running this batch file from the Windows command shell requires
5fe28adc52ef 6938185: 3/4 6923488 breaks Windows command shell builds
dcubed
parents: 3261
diff changeset
    40
REM that "grep" be accessible on the PATH. An MKS install does this.
5fe28adc52ef 6938185: 3/4 6923488 breaks Windows command shell builds
dcubed
parents: 3261
diff changeset
    41
REM 
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
cl 2>&1 | grep "IA-64" >NUL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
if %errorlevel% == 0 goto isia64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
cl 2>&1 | grep "AMD64" >NUL
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
if %errorlevel% == 0 goto amd64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
set ARCH=x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
set BUILDARCH=i486
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
set Platform_arch=x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
set Platform_arch_model=x86_32
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
goto end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
:amd64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
set ARCH=x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
set BUILDARCH=amd64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
set Platform_arch=x86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
set Platform_arch_model=x86_64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
goto end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
:isia64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
set ARCH=ia64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
set BUILDARCH=ia64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
set Platform_arch=ia64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
set Platform_arch_model=ia64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
:end
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
setlocal
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
if "%1" == "" goto usage
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
if not "%4" == "" goto usage
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
set HotSpotWorkSpace=%1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
set HotSpotBuildSpace=%2
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
set HotSpotJDKDist=%3
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
REM figure out MSC version
338
5cf9f61d76f4 6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents: 1
diff changeset
    75
for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
echo **************************************************************
2271
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    78
set ProjectFile=vm.vcproj
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
if "%MSC_VER%" == "1200" (
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
set ProjectFile=vm.dsp
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
echo Will generate VC6 project {unsupported}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
) else (
2271
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    83
if "%MSC_VER%" == "1400" (
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    84
echo Will generate VC8 {Visual Studio 2005}
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    85
) else (
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    86
if "%MSC_VER%" == "1500" (
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    87
echo Will generate VC9 {Visual Studio 2008}
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    88
) else (
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    89
echo Will generate VC7 project {Visual Studio 2003 .NET}
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    90
)
ff6d122287cb 6812297: update project creation for Visual Studio 2005-2008
ikrylov
parents: 670
diff changeset
    91
)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
echo                            %ProjectFile%
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
echo **************************************************************
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
REM Test all variables to see whether the directories they
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
REM reference exist
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
if exist %HotSpotWorkSpace% goto test1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
echo Error: directory pointed to by HotSpotWorkSpace
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
echo does not exist, or the variable is not set.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
echo.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
goto usage
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
:test1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
if exist %HotSpotBuildSpace% goto test2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace%
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
if exist %HotSpotBuildSpace% goto test2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
echo Error: directory pointed to by HotSpotBuildSpace
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
echo does not exist, or the variable is not set.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
echo.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
goto usage
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
:test2
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
if exist %HotSpotJDKDist% goto test3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
echo Error: directory pointed to by %HotSpotJDKDist%
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
echo does not exist, or the variable is not set.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
echo.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
goto usage
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
:test3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
if not "%HOTSPOTMKSHOME%" == "" goto makedir
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
echo Warning: please set variable HOTSPOTMKSHOME to place where 
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
echo          your MKS/Cygwin installation is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
echo.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
goto usage
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
:makedir
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
echo NOTE: Using the following settings:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
echo   HotSpotWorkSpace=%HotSpotWorkSpace%
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
echo   HotSpotBuildSpace=%HotSpotBuildSpace%
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
echo   HotSpotJDKDist=%HotSpotJDKDist%
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
REM This is now safe to do.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
:copyfiles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
for /D %%i in (compiler1, compiler2, tiered, core, kernel) do (
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
if NOT EXIST %HotSpotBuildSpace%\%%i mkdir %HotSpotBuildSpace%\%%i
338
5cf9f61d76f4 6583644: Move all managed/SCCS files out of 'build' into 'make' directory
kamg
parents: 1
diff changeset
   140
copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\ > NUL
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
REM force regneration of ProjectFile
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
if exist %HotSpotBuildSpace%\%ProjectFile% del %HotSpotBuildSpace%\%ProjectFile%
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
for /D %%i in (compiler1, compiler2, tiered, core, kernel) do (
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
echo # Generated file!                                                 >    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
echo # Changing a variable below and then deleting %ProjectFile% will cause  >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
echo # %ProjectFile% to be regenerated with the new values.  Changing the    >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
echo # version requires rerunning create.bat.                         >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
echo.                                      >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
echo HOTSPOTWORKSPACE=%HotSpotWorkSpace%   >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
echo HOTSPOTJDKDIST=%HotSpotJDKDist%       >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
echo ARCH=%ARCH%                           >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
echo BUILDARCH=%BUILDARCH%                 >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
echo Platform_arch=%Platform_arch%         >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
echo Platform_arch_model=%Platform_arch_model% >>    %HotSpotBuildSpace%\%%i\local.make
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
REM build config specific stuff
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
pushd %HotSpotBuildSpace%\%%i
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
nmake /nologo
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
popd
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
goto end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
:usage
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
echo Usage: create HotSpotWorkSpace HotSpotBuildSpace HotSpotJDKDist
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
echo.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
echo This is the interactive build setup script (as opposed to the batch
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
echo build execution script). It creates HotSpotBuildSpace if necessary,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
echo copies the appropriate files out of HotSpotWorkSpace into it, and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
echo builds and runs MakeDeps in it. This has the side-effect of creating
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
echo the %ProjectFile% file in the build space, which is then used in Visual C++.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
echo The HotSpotJDKDist defines place where JVM binaries should be placed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
echo.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
echo The generated project file depends upon the include databases. If
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
echo those are changed then MakeDeps is rerun.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
echo.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
echo NOTE that it is now NOT safe to modify any of the files in the build
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
echo space, since they may be overwritten whenever this script is run or
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
echo nmake is run in that directory.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
:end
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
endlocal