annotate make/windows/create.bat @ 6587:7ec6629578ac

8043492: ad_x86_64_misc.obj : error LNK2011: precompiled object not linked in; image may not run Summary: Added _build_pch_file.obj to LD_FLAGS and cleaned up support for older Visual Studio versions Reviewed-by: twisti, lfoltan, sla, kvn
author ctornqvi
date Fri, 06 Jun 2014 14:46:42 +0200
parents f462e61bce87
children 42900ccffe87
rev   line source
duke@0 1 @echo off
duke@0 2 REM
ctornqvi@6587 3 REM Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
duke@0 5 REM
duke@0 6 REM This code is free software; you can redistribute it and/or modify it
duke@0 7 REM under the terms of the GNU General Public License version 2 only, as
duke@0 8 REM published by the Free Software Foundation.
duke@0 9 REM
duke@0 10 REM This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 11 REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 12 REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 13 REM version 2 for more details (a copy is included in the LICENSE file that
duke@0 14 REM accompanied this code).
duke@0 15 REM
duke@0 16 REM You should have received a copy of the GNU General Public License version
duke@0 17 REM 2 along with this work; if not, write to the Free Software Foundation,
duke@0 18 REM Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 19 REM
trims@1472 20 REM Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 21 REM or visit if you need additional information or have any
trims@1472 22 REM questions.
duke@0 23 REM
duke@0 24 REM
duke@0 25
duke@0 26 REM This is the interactive build setup script (as opposed to the batch
duke@0 27 REM build execution script). It creates $HotSpotBuildSpace if necessary,
duke@0 28 REM copies the appropriate files out of $HotSpotWorkSpace into it, and
stefank@1879 29 REM builds and runs ProjectCreator in it. This has the side-effect of creating
duke@0 30 REM the vm.vcproj file in the buildspace, which is then used in Visual C++.
duke@0 31
duke@0 32 REM
duke@0 33 REM Since we don't have uname and we could be cross-compiling,
duke@0 34 REM Use the compiler to determine which ARCH we are building
duke@0 35 REM
dcubed@1328 36 REM Note: Running this batch file from the Windows command shell requires
dcubed@1328 37 REM that "grep" be accessible on the PATH. An MKS install does this.
dcubed@1328 38 REM
sla@1934 39
sla@1934 40 cl 2>NUL >NUL
sla@1934 41 if %errorlevel% == 0 goto nexttest
sla@1934 42 echo Make sure cl.exe is in your PATH before running this script.
sla@1934 43 goto end
sla@1934 44
sla@1934 45 :nexttest
sla@1934 46 grep -V 2>NUL >NUL
sla@1934 47 if %errorlevel% == 0 goto testit
sla@1934 48 echo Make sure grep.exe is in your PATH before running this script. Either cygwin or MKS should work.
sla@1934 49 goto end
sla@1934 50
sla@1934 51
sla@1934 52 :testit
sla@2105 53 cl 2>&1 | grep "x64" >NUL
duke@0 54 if %errorlevel% == 0 goto amd64
duke@0 55 set ARCH=x86
duke@0 56 set BUILDARCH=i486
duke@0 57 set Platform_arch=x86
duke@0 58 set Platform_arch_model=x86_32
sla@1934 59 goto done
duke@0 60 :amd64
duke@0 61 set ARCH=x86
duke@0 62 set BUILDARCH=amd64
duke@0 63 set Platform_arch=x86
duke@0 64 set Platform_arch_model=x86_64
sla@1934 65 :done
duke@0 66
duke@0 67 setlocal
duke@0 68
duke@0 69 if "%1" == "" goto usage
duke@0 70
sla@1934 71 if not "%2" == "" goto usage
duke@0 72
sla@1934 73 REM Set HotSpotWorkSpace to the directy two steps above this script
sla@1934 74 for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi)
sla@1934 75 set HotSpotBuildRoot=%HotSpotWorkSpace%build
sla@2105 76 set HotSpotBuildSpace=%HotSpotBuildRoot%\vs-%BUILDARCH%
sla@1934 77 set HotSpotJDKDist=%1
sla@1934 78
duke@0 79
duke@0 80 REM figure out MSC version
kamg@91 81 for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/') do set %%i
duke@0 82
duke@0 83 echo **************************************************************
iklam@5170 84 echo MSC_VER = "%MSC_VER%"
sla@2240 85 set ProjectFile=%HotSpotBuildSpace%\jvm.vcxproj
sla@2240 86 echo %ProjectFile%
duke@0 87 echo **************************************************************
duke@0 88
duke@0 89 REM Test all variables to see whether the directories they
duke@0 90 REM reference exist
duke@0 91
duke@0 92 if exist %HotSpotWorkSpace% goto test1
duke@0 93
duke@0 94 echo Error: directory pointed to by HotSpotWorkSpace
duke@0 95 echo does not exist, or the variable is not set.
duke@0 96 echo.
duke@0 97 goto usage
duke@0 98
duke@0 99 :test1
duke@0 100 if exist %HotSpotBuildSpace% goto test2
duke@0 101 if not "%HotSpotBuildSpace%" == "" mkdir %HotSpotBuildSpace%
duke@0 102 if exist %HotSpotBuildSpace% goto test2
duke@0 103 echo Error: directory pointed to by HotSpotBuildSpace
duke@0 104 echo does not exist, or the variable is not set.
duke@0 105 echo.
duke@0 106 goto usage
duke@0 107
duke@0 108 :test2
duke@0 109 if exist %HotSpotJDKDist% goto test3
duke@0 110 echo Error: directory pointed to by %HotSpotJDKDist%
duke@0 111 echo does not exist, or the variable is not set.
duke@0 112 echo.
duke@0 113 goto usage
duke@0 114
duke@0 115 :test3
duke@0 116 if not "%HOTSPOTMKSHOME%" == "" goto makedir
sla@1934 117 if exist c:\cygwin\bin set HOTSPOTMKSHOME=c:\cygwin\bin
sla@1934 118 if not "%HOTSPOTMKSHOME%" == "" goto makedir
duke@0 119 echo Warning: please set variable HOTSPOTMKSHOME to place where
duke@0 120 echo your MKS/Cygwin installation is
duke@0 121 echo.
duke@0 122 goto usage
duke@0 123
duke@0 124 :makedir
duke@0 125 echo NOTE: Using the following settings:
duke@0 126 echo HotSpotWorkSpace=%HotSpotWorkSpace%
duke@0 127 echo HotSpotBuildSpace=%HotSpotBuildSpace%
duke@0 128 echo HotSpotJDKDist=%HotSpotJDKDist%
duke@0 129
duke@0 130
duke@0 131 REM This is now safe to do.
duke@0 132 :copyfiles
dcubed@5065 133 for /D %%i in (compiler1, compiler2, tiered ) do (
sla@1934 134 if NOT EXIST %HotSpotBuildSpace%\%%i\generated mkdir %HotSpotBuildSpace%\%%i\generated
sla@1934 135 copy %HotSpotWorkSpace%\make\windows\projectfiles\%%i\* %HotSpotBuildSpace%\%%i\generated > NUL
duke@0 136 )
duke@0 137
duke@0 138 REM force regneration of ProjectFile
sla@2105 139 if exist %ProjectFile% del %ProjectFile%
duke@0 140
dcubed@5065 141 for /D %%i in (compiler1, compiler2, tiered ) do (
sla@1934 142 echo -- %%i --
sla@1934 143 echo # Generated file! > %HotSpotBuildSpace%\%%i\local.make
duke@0 144 echo # Changing a variable below and then deleting %ProjectFile% will cause >> %HotSpotBuildSpace%\%%i\local.make
duke@0 145 echo # %ProjectFile% to be regenerated with the new values. Changing the >> %HotSpotBuildSpace%\%%i\local.make
sla@1934 146 echo # version requires rerunning create.bat. >> %HotSpotBuildSpace%\%%i\local.make
duke@0 147 echo. >> %HotSpotBuildSpace%\%%i\local.make
sla@1934 148 echo Variant=%%i >> %HotSpotBuildSpace%\%%i\local.make
sla@1934 149 echo WorkSpace=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 150 echo HOTSPOTWORKSPACE=%HotSpotWorkSpace% >> %HotSpotBuildSpace%\%%i\local.make
sla@1934 151 echo HOTSPOTBUILDROOT=%HotSpotBuildRoot% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 152 echo HOTSPOTBUILDSPACE=%HotSpotBuildSpace% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 153 echo HOTSPOTJDKDIST=%HotSpotJDKDist% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 154 echo ARCH=%ARCH% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 155 echo BUILDARCH=%BUILDARCH% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 156 echo Platform_arch=%Platform_arch% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 157 echo Platform_arch_model=%Platform_arch_model% >> %HotSpotBuildSpace%\%%i\local.make
sla@2105 158 echo MSC_VER=%MSC_VER% >> %HotSpotBuildSpace%\%%i\local.make
duke@0 159
sla@1934 160 for /D %%j in (debug, fastdebug, product) do (
sla@1934 161 if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j
sla@1934 162 )
sla@1934 163
sla@1934 164 pushd %HotSpotBuildSpace%\%%i\generated
duke@0 165 nmake /nologo
duke@0 166 popd
stefank@1879 167
duke@0 168 )
duke@0 169
sla@1934 170 pushd %HotSpotBuildRoot%
stefank@1879 171
sla@1934 172 REM It doesn't matter which variant we use here, "compiler1" is as good as any of the others - we need the common variables
sla@2105 173 nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %ProjectFile%
stefank@1879 174
stefank@1879 175 popd
stefank@1879 176
duke@0 177 goto end
duke@0 178
duke@0 179 :usage
sla@1934 180 echo Usage: create HotSpotJDKDist
duke@0 181 echo.
sla@1934 182 echo This is the VS build setup script (as opposed to the batch
sla@1934 183 echo build execution script). It creates a build directory if necessary,
sla@1934 184 echo copies the appropriate files out of the workspace into it, and
stefank@1879 185 echo builds and runs ProjectCreator in it. This has the side-effect of creating
duke@0 186 echo the %ProjectFile% file in the build space, which is then used in Visual C++.
sla@1934 187 echo.
sla@1934 188 echo The HotSpotJDKDist defines the JDK that should be used when running the JVM.
duke@0 189 echo Environment variable FORCE_MSC_VER allows to override MSVC version autodetection.
duke@0 190 echo.
duke@0 191 echo NOTE that it is now NOT safe to modify any of the files in the build
duke@0 192 echo space, since they may be overwritten whenever this script is run or
duke@0 193 echo nmake is run in that directory.
duke@0 194
duke@0 195 :end
duke@0 196
duke@0 197 endlocal