create.bat 7.5 KB
Newer Older
D
duke 已提交
1 2
@echo off
REM
3
REM Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
REM
REM This code is free software; you can redistribute it and/or modify it
REM under the terms of the GNU General Public License version 2 only, as
REM published by the Free Software Foundation.
REM
REM This code is distributed in the hope that it will be useful, but WITHOUT
REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
REM FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
REM version 2 for more details (a copy is included in the LICENSE file that
REM accompanied this code).
REM
REM You should have received a copy of the GNU General Public License version
REM 2 along with this work; if not, write to the Free Software Foundation,
REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
REM
20 21 22
REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
REM or visit www.oracle.com if you need additional information or have any
REM questions.
D
duke 已提交
23 24 25 26 27 28
REM  
REM

REM This is the interactive build setup script (as opposed to the batch
REM build execution script). It creates $HotSpotBuildSpace if necessary,
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
D
duke 已提交
30 31 32 33 34 35
REM the vm.vcproj file in the buildspace, which is then used in Visual C++.

REM
REM Since we don't have uname and we could be cross-compiling,
REM Use the compiler to determine which ARCH we are building
REM 
36 37 38
REM Note: Running this batch file from the Windows command shell requires
REM that "grep" be accessible on the PATH. An MKS install does this.
REM 
39 40 41 42 43 44 45 46 47 48 49 50 51 52

cl 2>NUL >NUL
if %errorlevel% == 0 goto nexttest
echo Make sure cl.exe is in your PATH before running this script.
goto end

:nexttest
grep -V 2>NUL >NUL
if %errorlevel% == 0 goto testit
echo Make sure grep.exe is in your PATH before running this script. Either cygwin or MKS should work.
goto end


:testit
53
cl 2>&1 | grep "x64" >NUL
D
duke 已提交
54 55 56 57 58
if %errorlevel% == 0 goto amd64
set ARCH=x86
set BUILDARCH=i486
set Platform_arch=x86
set Platform_arch_model=x86_32
59
goto done
D
duke 已提交
60 61 62 63 64
:amd64
set ARCH=x86
set BUILDARCH=amd64
set Platform_arch=x86
set Platform_arch_model=x86_64
65
:done
D
duke 已提交
66 67 68 69 70

setlocal

if "%1" == "" goto usage

71 72 73 74 75
if not "%2" == "" goto usage

REM Set HotSpotWorkSpace to the directy two steps above this script
for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi)
set HotSpotBuildRoot=%HotSpotWorkSpace%build
76
set HotSpotBuildSpace=%HotSpotBuildRoot%\vs-%BUILDARCH%
77
set HotSpotJDKDist=%1
D
duke 已提交
78 79 80


REM figure out MSC version
81
for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i
D
duke 已提交
82 83

echo **************************************************************
84
set ProjectFile=%HotSpotBuildSpace%\jvm.vcproj
D
duke 已提交
85
if "%MSC_VER%" == "1200" (
86
set ProjectFile=%HotSpotBuildSpace%\jvm.dsp
D
duke 已提交
87 88
echo Will generate VC6 project {unsupported}
) else (
89 90 91 92 93 94
if "%MSC_VER%" == "1400" (
echo Will generate VC8 {Visual Studio 2005}
) else (
if "%MSC_VER%" == "1500" (
echo Will generate VC9 {Visual Studio 2008}
) else (
95
if "%MSC_VER%" == "1600" (
96 97
echo Will generate VC10 {Visual Studio 2010}
set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj
98
) else (
99 100 101
echo Will generate VC7 project {Visual Studio 2003 .NET}
)
)
D
duke 已提交
102
)
103
)
104
echo %ProjectFile%
D
duke 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
echo **************************************************************

REM Test all variables to see whether the directories they
REM reference exist

if exist %HotSpotWorkSpace% goto test1

echo Error: directory pointed to by HotSpotWorkSpace
echo does not exist, or the variable is not set.
echo.
goto usage

:test1
if exist %HotSpotBuildSpace% goto test2
if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace%
if exist %HotSpotBuildSpace% goto test2
echo Error: directory pointed to by HotSpotBuildSpace
echo does not exist, or the variable is not set.
echo.
goto usage

:test2
if exist %HotSpotJDKDist% goto test3
echo Error: directory pointed to by %HotSpotJDKDist%
echo does not exist, or the variable is not set.
echo.
goto usage

:test3
if not "%HOTSPOTMKSHOME%" == "" goto makedir
135 136
if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin
if not "%HOTSPOTMKSHOME%" == "" goto makedir
D
duke 已提交
137 138 139 140 141 142 143 144 145 146 147 148 149 150
echo Warning: please set variable HOTSPOTMKSHOME to place where 
echo          your MKS/Cygwin installation is
echo.
goto usage

:makedir
echo NOTE: Using the following settings:
echo   HotSpotWorkSpace=%HotSpotWorkSpace%
echo   HotSpotBuildSpace=%HotSpotBuildSpace%
echo   HotSpotJDKDist=%HotSpotJDKDist%


REM This is now safe to do.
:copyfiles
151
for /D %%i in (compiler1, compiler2, tiered ) do (
152 153
if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated
copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL
D
duke 已提交
154 155 156
)

REM force regneration of ProjectFile
157
if exist %ProjectFile% del %ProjectFile%
D
duke 已提交
158

159
for /D %%i in (compiler1, compiler2, tiered ) do (
160 161
echo -- %%i --
echo # Generated file!                                                        >    %HotSpotBuildSpace%\%%i\local.make
D
duke 已提交
162 163
echo # Changing a variable below and then deleting %ProjectFile% will cause  >>    %HotSpotBuildSpace%\%%i\local.make
echo # %ProjectFile% to be regenerated with the new values.  Changing the    >>    %HotSpotBuildSpace%\%%i\local.make
164
echo # version requires rerunning create.bat.                                >>    %HotSpotBuildSpace%\%%i\local.make
D
duke 已提交
165
echo.                                      >>    %HotSpotBuildSpace%\%%i\local.make
166 167
echo Variant=%%i			   >>    %HotSpotBuildSpace%\%%i\local.make
echo WorkSpace=%HotSpotWorkSpace%   	   >>    %HotSpotBuildSpace%\%%i\local.make
D
duke 已提交
168
echo HOTSPOTWORKSPACE=%HotSpotWorkSpace%   >>    %HotSpotBuildSpace%\%%i\local.make
169
echo HOTSPOTBUILDROOT=%HotSpotBuildRoot%   >>    %HotSpotBuildSpace%\%%i\local.make
D
duke 已提交
170 171 172 173 174 175
echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >>    %HotSpotBuildSpace%\%%i\local.make
echo HOTSPOTJDKDIST=%HotSpotJDKDist%       >>    %HotSpotBuildSpace%\%%i\local.make
echo ARCH=%ARCH%                           >>    %HotSpotBuildSpace%\%%i\local.make
echo BUILDARCH=%BUILDARCH%                 >>    %HotSpotBuildSpace%\%%i\local.make
echo Platform_arch=%Platform_arch%         >>    %HotSpotBuildSpace%\%%i\local.make
echo Platform_arch_model=%Platform_arch_model% >>    %HotSpotBuildSpace%\%%i\local.make
176
echo MSC_VER=%MSC_VER% 			   >>    %HotSpotBuildSpace%\%%i\local.make
D
duke 已提交
177

178 179 180 181 182
for /D %%j in (debug, fastdebug, product) do (
if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j
)

pushd %HotSpotBuildSpace%\%%i\generated
D
duke 已提交
183 184
nmake /nologo
popd
185

D
duke 已提交
186 187
)

188
pushd %HotSpotBuildRoot%
189

190
REM It doesn't matter which variant we use here, "compiler1" is as good as any of the others - we need the common variables
191
nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %ProjectFile%
192 193 194

popd

D
duke 已提交
195 196 197
goto end

:usage
198
echo Usage: create HotSpotJDKDist
D
duke 已提交
199
echo.
200 201 202
echo This is the VS build setup script (as opposed to the batch
echo build execution script). It creates a build directory if necessary,
echo copies the appropriate files out of the workspace into it, and
203
echo builds and runs ProjectCreator in it. This has the side-effect of creating
D
duke 已提交
204
echo the %ProjectFile% file in the build space, which is then used in Visual C++.
205 206
echo.
echo The HotSpotJDKDist defines the JDK that should be used when running the JVM.
D
duke 已提交
207 208 209 210 211 212 213 214 215
echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection.
echo.
echo NOTE that it is now NOT safe to modify any of the files in the build
echo space, since they may be overwritten whenever this script is run or
echo nmake is run in that directory.

:end

endlocal