make/common/Defs-windows.gmk

Tue, 25 May 2010 15:52:11 -0700

author
ohair
date
Tue, 25 May 2010 15:52:11 -0700
changeset 158
91006f157c46
parent 150
ee2d8f1bef5b
child 194
0f60cf26c5b5
permissions
-rw-r--r--

6943119: Rebrand source copyright notices
Reviewed-by: darcy

duke@1 1 #
ohair@158 2 # Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
duke@1 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 #
duke@1 5 # This code is free software; you can redistribute it and/or modify it
duke@1 6 # under the terms of the GNU General Public License version 2 only, as
ohair@158 7 # published by the Free Software Foundation. Oracle designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
ohair@158 9 # by Oracle in the LICENSE file that accompanied this code.
duke@1 10 #
duke@1 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 # accompanied this code).
duke@1 16 #
duke@1 17 # You should have received a copy of the GNU General Public License version
duke@1 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 #
ohair@158 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@158 22 # or visit www.oracle.com if you need additional information or have any
ohair@158 23 # questions.
duke@1 24 #
duke@1 25
duke@1 26 #
duke@1 27 # Makefile to specify compiler flags for programs and libraries
duke@1 28 # targeted to Windows builds. Should not contain any rules.
duke@1 29 #
duke@1 30
duke@1 31 # Get shared JDK settings
duke@1 32 include $(BUILDDIR)/common/shared/Defs.gmk
duke@1 33
duke@1 34 # CC compiler object code output directive flag value
duke@1 35 CC_OBJECT_OUTPUT_FLAG = -Fo
duke@1 36 CC_PROGRAM_OUTPUT_FLAG = -Fe
duke@1 37
duke@1 38 # The suffix applied to the library name for FDLIBM
duke@1 39 FDDLIBM_SUFFIX = lib
duke@1 40 # The suffix applied to scripts (.bat for windows, nothing for unix)
duke@1 41 SCRIPT_SUFFIX = .bat
duke@1 42
duke@1 43 HPIS = windows
duke@1 44 # LIB_LOCATION, which for windows identifies where .exe files go, may be
duke@1 45 # set by each GNUmakefile. The default is BINDIR.
duke@1 46 ifndef LIB_LOCATION
duke@1 47 LIB_LOCATION = $(BINDIR)
duke@1 48 endif # LIB_LOCATION
duke@1 49
duke@1 50 ifndef PLATFORM_SRC
duke@1 51 PLATFORM_SRC = $(TOPDIR)/src/windows
duke@1 52 endif # PLATFORM_SRC
duke@1 53
duke@1 54 # for backwards compatability, the old "win32" is used here instead of
duke@1 55 # the more proper "windows"
duke@1 56 PLATFORM_INCLUDE_NAME = win32
duke@1 57 PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
duke@1 58
duke@1 59 # The following DLL's are considered MS runtime libraries and should
duke@1 60 # not to be REBASEd, see deploy/make/common/Release.gmk.
tbell@33 61 # msvcrt.dll, msvcrnn.dll [msvcr71 or msvcr80 or msvcr90] : Microsoft runtimes
duke@1 62 MS_RUNTIME_LIBRARIES = msvcrt.dll
tbell@33 63 MSVCRNN_DLL =
duke@1 64 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 65 ifeq ($(COMPILER_VERSION), VS2003)
tbell@33 66 MSVCRNN_DLL = msvcr71.dll
tbell@33 67 MSVCPNN_DLL = msvcp71.dll
tbell@33 68 MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
tbell@33 69 endif
tbell@33 70 ifeq ($(COMPILER_VERSION), VS2005)
tbell@33 71 MSVCRNN_DLL = msvcr80.dll
tbell@33 72 MSVCPNN_DLL = msvcp80.dll
tbell@33 73 MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
tbell@33 74 endif
tbell@33 75 ifeq ($(COMPILER_VERSION), VS2008)
tbell@33 76 MSVCRNN_DLL = msvcr90.dll
tbell@33 77 MSVCPNN_DLL = msvcp90.dll
tbell@33 78 MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
duke@1 79 endif
prr@150 80 ifeq ($(COMPILER_VERSION), VS2010)
prr@150 81 MSVCRNN_DLL = msvcr100.dll
prr@150 82 MSVCPNN_DLL = msvcp100.dll
prr@150 83 MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
prr@150 84 endif
duke@1 85 endif
duke@1 86
duke@1 87 # C Compiler flag definitions
duke@1 88
duke@1 89 #
duke@1 90 # Default optimization
duke@1 91 #
duke@1 92 ifeq ($(CC_VERSION),msvc)
duke@1 93 # Visual Studio .NET 2003 or VS2003 compiler option definitions:
duke@1 94 # -O1 Favors reduced size over speed (-Og -Os -Oy -Ob2 -Gs -GF -Gy)
duke@1 95 # -O2 Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
duke@1 96 # -Ox Full optimization (use -O2) (-Og -Oi -Ot -Oy -Ob2)
duke@1 97 # (Removed in Visual Studio 2005 or VS2005)
duke@1 98 # -Ob2 More aggressive inlining
duke@1 99 # -Og Global optimizations
duke@1 100 # -Oi Replace some functions with intrinsic or special forms
duke@1 101 # -Op Improve floating point calculations (disables some optimizations)
duke@1 102 # (Replaced with -fp:precise in VS2005, /Op is default now)
duke@1 103 # -Os Favor small code
duke@1 104 # -Ot Favor faster code
duke@1 105 # -Oy Frame pointer omission
duke@1 106 # -GB Optimize for pentium (old VC6 option?)
duke@1 107 # -G6 VS2003 version of -GB?
duke@1 108 # -GF Pool strings in read-only memory
duke@1 109 # -Gf Pool strings in read-write memory (the default)
duke@1 110 # -Gs Controls stack probess
duke@1 111 # -GS Adds buffer overflow checks on stacks
duke@1 112 # (Default in VS2005)
duke@1 113 # -GX Enables exception handling
duke@1 114 # (Replaced with /EHsc in VS2005)
duke@1 115 # -Gy Function level linking only
duke@1 116 #
duke@1 117 # NOTE: With VC6, -Ox included -Gs.
duke@1 118 # NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
duke@1 119 # NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
duke@1 120 #
duke@1 121 ifeq ($(COMPILER_VERSION), VC6)
duke@1 122 # VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
duke@1 123 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
duke@1 124 AUTOMATIC_PCH_OPTION =
duke@1 125 GX_OPTION = -GX
duke@1 126 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 127 CC_HIGHEST_OPT = -Ox -Gy -Os -GB
duke@1 128 CC_HIGHER_OPT = -Ox -Gy -Os -GB
duke@1 129 CC_LOWER_OPT = -Ox -Gy -Os -GB
duke@1 130 else
duke@1 131 CC_HIGHEST_OPT = -Ox -Gy -Op
duke@1 132 CC_HIGHER_OPT = -Ox -Gy -Op
duke@1 133 CC_LOWER_OPT = -Ox -Gy -Op
duke@1 134 endif
duke@1 135 endif
duke@1 136 ifeq ($(COMPILER_VERSION), VS2003)
duke@1 137 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
duke@1 138 AUTOMATIC_PCH_OPTION = -YX
duke@1 139 # Also known as VC7 compiler
duke@1 140 GX_OPTION = -GX
duke@1 141 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 142 # Lowered opt level to try and reduce footprint, dll size especially.
duke@1 143 # Was: CC_HIGHEST_OPT = -O2 -G6
duke@1 144 # Was: CC_HIGHER_OPT = -O2
duke@1 145 CC_HIGHEST_OPT = -O2
duke@1 146 CC_HIGHER_OPT = -O1
duke@1 147 CC_LOWER_OPT = -O1
duke@1 148 else
duke@1 149 CC_HIGHEST_OPT = -O2 -Op
duke@1 150 CC_HIGHER_OPT = -O2 -Op
duke@1 151 CC_LOWER_OPT = -O1 -Op
duke@1 152 endif
duke@1 153 endif
duke@1 154 ifeq ($(COMPILER_VERSION), VS2005)
duke@1 155 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
duke@1 156 AUTOMATIC_PCH_OPTION =
duke@1 157 # VS2005 compiler, only with Platform SDK right now?
duke@1 158 GX_OPTION = -EHsc
duke@1 159 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 160 CC_HIGHEST_OPT = -O2
duke@1 161 CC_HIGHER_OPT = -O1
duke@1 162 CC_LOWER_OPT = -O1
duke@1 163 else
duke@1 164 CC_HIGHEST_OPT = -O2
duke@1 165 CC_HIGHER_OPT = -O1
duke@1 166 CC_LOWER_OPT = -O1
duke@1 167 endif
duke@1 168 endif
tbell@33 169 ifeq ($(COMPILER_VERSION), VS2008)
tbell@33 170 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
tbell@33 171 AUTOMATIC_PCH_OPTION =
tbell@33 172 GX_OPTION = -EHsc
tbell@33 173 ifeq ($(ARCH_DATA_MODEL), 32)
tbell@33 174 CC_HIGHEST_OPT = -O2
tbell@33 175 CC_HIGHER_OPT = -O1
tbell@33 176 CC_LOWER_OPT = -O1
tbell@33 177 else
tbell@33 178 CC_HIGHEST_OPT = -O2
tbell@33 179 CC_HIGHER_OPT = -O1
tbell@33 180 CC_LOWER_OPT = -O1
tbell@33 181 endif
tbell@33 182 endif
prr@150 183 ifeq ($(COMPILER_VERSION), VS2010)
prr@150 184 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
prr@150 185 AUTOMATIC_PCH_OPTION =
prr@150 186 GX_OPTION = -EHsc
prr@150 187 ifeq ($(ARCH_DATA_MODEL), 32)
prr@150 188 CC_HIGHEST_OPT = -O2
prr@150 189 CC_HIGHER_OPT = -O1
prr@150 190 CC_LOWER_OPT = -O1
prr@150 191 else
prr@150 192 CC_HIGHEST_OPT = -O2
prr@150 193 CC_HIGHER_OPT = -O1
prr@150 194 CC_LOWER_OPT = -O1
prr@150 195 endif
prr@150 196 endif
duke@1 197 CC_NO_OPT = -Od
duke@1 198 else # CC_VERSION
duke@1 199 # GCC not supported, but left for historical reference...
duke@1 200 CC_HIGHEST_OPT = -O3
duke@1 201 CC_HIGHER_OPT = -O2
duke@1 202 CC_LOWER_OPT = -O2
duke@1 203 CC_NO_OPT =
duke@1 204 endif
duke@1 205
duke@1 206 # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
duke@1 207 ifdef NO_OPTIMIZATIONS
duke@1 208 CC_HIGHEST_OPT = $(CC_NO_OPT)
duke@1 209 CC_HIGHER_OPT = $(CC_NO_OPT)
duke@1 210 CC_LOWER_OPT = $(CC_NO_OPT)
duke@1 211 endif
duke@1 212
duke@1 213 ifeq ($(PRODUCT), java)
duke@1 214 _OPT = $(CC_HIGHER_OPT)
duke@1 215 else
duke@1 216 _OPT = $(CC_LOWER_OPT)
duke@1 217 endif
duke@1 218
duke@1 219 # Select the runtime support library carefully, need to be consistent
duke@1 220 #
duke@1 221 # VS2003 compiler option definitions:
duke@1 222 # -MD Use dynamic multi-threaded runtime library
duke@1 223 # -MDd Use debug version (don't use, doesn't mix with -MD DLL's)
duke@1 224 # -MT Use static multi-threaded runtime library (-ML is going away)
duke@1 225 # -MTd Use static debug version (better than -MDd, no runtime issues)
duke@1 226 # -D_DEBUG Change use of malloc/free/etc to use special debug ones (-MTd)
duke@1 227 #
tbell@33 228 # NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcpnn.dll
duke@1 229 #
duke@1 230 ifeq ($(MS_RUNTIME_STATIC),true)
duke@1 231 MS_RUNTIME_OPTION=-MT
duke@1 232 else
duke@1 233 MS_RUNTIME_OPTION=-MD
duke@1 234 endif
duke@1 235 # The _DEBUG macro option (changes things like malloc to use debug version)
duke@1 236 MS_RUNTIME_DEBUG_OPTION=
duke@1 237 MS_RC_DEBUG_OPTION=
duke@1 238 # Externally set environment variable can force any build to use the debug vers
duke@1 239 ifeq ($(MFC_DEBUG), true)
duke@1 240 ifeq ($(MS_RUNTIME_STATIC),true)
duke@1 241 MS_RUNTIME_OPTION=-MTd
duke@1 242 else
duke@1 243 # This MS debugging flag forces a dependence on the debug
duke@1 244 # version of the runtime library (MSVCRTD.DLL), as does -MDd.
duke@1 245 # We cannot re-distribute this debug runtime.
duke@1 246 MS_RUNTIME_OPTION=-MDd
duke@1 247 endif
duke@1 248 MS_RUNTIME_DEBUG_OPTION= -D_DEBUG
duke@1 249 MS_RC_DEBUG_OPTION= -d _DEBUG
duke@1 250 endif
duke@1 251
duke@1 252 # Always add _STATIC_CPPLIB definition
duke@1 253 STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB
duke@1 254 MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
duke@1 255
duke@1 256 ifeq ($(CC_VERSION),msvc)
duke@1 257 # VS2003 compiler option definitions:
duke@1 258 # -Zi Cause *.pdb file to be created, full debug information
duke@1 259 # -Z7 Full debug inside the .obj, no .pdb
duke@1 260 # -Zd Basic debug, no local variables? In the .obj
duke@1 261 # -Zl Don't add runtime library name to obj file?
duke@1 262 # -Od Turns off optimization and speeds compilation
duke@1 263 # -YX -Fp/.../foobar.pch Use precompiled headers (try someday?)
duke@1 264 # -nologo Don't print out startup message
duke@1 265 # /D _STATIC_CPPLIB
tbell@33 266 # Use static link for the C++ runtime (so msvcpnn.dll not needed)
duke@1 267 #
duke@1 268 CFLAGS_COMMON += -Zi -nologo
duke@1 269 CFLAGS_OPT = $(POPT)
duke@1 270 CFLAGS_DBG = -Od $(MS_RUNTIME_DEBUG_OPTION)
duke@1 271
duke@1 272 # Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
duke@1 273 # by default. However, we expect the wchar_t to be a typedef to the
duke@1 274 # unsigned short data type. The -Zc:wchar_t- option restores the old
duke@1 275 # behavior (as seen in VS2003) to avoid massive code modifications.
duke@1 276 # When/if our code will be "C/C++ Standard"-compliant (at least in the area
duke@1 277 # of handling the wchar_t type), the option won't be necessary.
duke@1 278 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 279 CFLAGS_VS2005 += -Zc:wchar_t-
duke@1 280 else
duke@1 281 # The 64bit Platform SDK we use (April 2005) doesn't like this option
duke@1 282 ifneq ($(CC_VER), 14.00.40310.41)
duke@1 283 CFLAGS_VS2005 += -Zc:wchar_t-
duke@1 284 endif
duke@1 285 endif
duke@1 286
duke@1 287 # All builds get the same runtime setting
duke@1 288 CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
duke@1 289
duke@1 290
duke@1 291 LDEBUG = /debug
duke@1 292
duke@1 293 ifeq ($(VTUNE_SUPPORT), true)
duke@1 294 OTHER_CFLAGS = -Z7 -Ox
duke@1 295 LDEBUG += /pdb:NONE
duke@1 296 endif
duke@1 297
duke@1 298 # The new Platform SDK and VS2005 has /GS as a default and requires
duke@1 299 # bufferoverflowU.lib on the link command line, otherwise
duke@1 300 # we get missing __security_check_cookie externals at link time.
duke@1 301 BUFFEROVERFLOWLIB = bufferoverflowU.lib
duke@1 302 # Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
duke@1 303 LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB)
duke@1 304
duke@1 305 # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
duke@1 306 BASELFLAGS = -nologo /opt:REF /incremental:no
duke@1 307 LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
duke@1 308 LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
duke@1 309
duke@1 310 endif
duke@1 311
duke@1 312 #
duke@1 313 # Preprocessor macro definitions
duke@1 314 #
duke@1 315 CPPFLAGS_COMMON = -DWIN32 -DIAL -D_LITTLE_ENDIAN
duke@1 316 ifeq ($(ARCH), amd64)
duke@1 317 CPPFLAGS_COMMON += -D_AMD64_ -Damd64
duke@1 318 else
duke@1 319 CPPFLAGS_COMMON += -DWIN32 -D_X86_ -Dx86
duke@1 320 endif
duke@1 321 CPPFLAGS_COMMON += -DWIN32_LEAN_AND_MEAN
duke@1 322
duke@1 323 #
duke@1 324 # Output options (use specific filenames to avoid parallel compile errors)
duke@1 325 #
duke@1 326 CFLAGS_COMMON += -Fd$(OBJDIR)/$(basename $(@F)).pdb -Fm$(OBJDIR)/$(basename $(@F)).map
duke@1 327
duke@1 328 #
duke@1 329 # Add warnings and extra on 64bit issues
duke@1 330 #
duke@1 331 ifeq ($(ARCH_DATA_MODEL), 64)
duke@1 332 CFLAGS_COMMON += -Wp64
duke@1 333 endif
duke@1 334 CFLAGS_COMMON += -W$(COMPILER_WARNING_LEVEL)
duke@1 335
duke@1 336 #
duke@1 337 # Treat compiler warnings as errors, if requested
duke@1 338 #
duke@1 339 ifeq ($(COMPILER_WARNINGS_FATAL),true)
duke@1 340 CFLAGS_COMMON += -WX
duke@1 341 endif
duke@1 342
duke@1 343 CPPFLAGS_OPT =
duke@1 344 CPPFLAGS_DBG = -DDEBUG -DLOGGING
duke@1 345
duke@1 346 CXXFLAGS_COMMON = $(CFLAGS_COMMON)
duke@1 347 CXXFLAGS_OPT = $(CFLAGS_OPT)
duke@1 348 CXXFLAGS_DBG = $(CFLAGS_DBG)
duke@1 349
duke@1 350 ifneq ($(LIBRARY),fdlibm)
duke@1 351 EXTRA_LIBS += advapi32.lib
duke@1 352 endif
duke@1 353
duke@1 354 #
duke@1 355 # Path and option to link against the VM, if you have to.
duke@1 356 #
duke@1 357 JVMLIB = $(BOOTDIR)/lib/jvm.lib
duke@1 358 JAVALIB =
duke@1 359
duke@1 360 ifeq ($(CC_VERSION), msvc)
duke@1 361 CC_DEPEND = -FD
duke@1 362 CC_DEPEND_FILTER =
duke@1 363 else # CC_VERSION
duke@1 364 # not supported, but left for historical reference...
duke@1 365 CC_DEPEND = -MM
duke@1 366 CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)&!g'
duke@1 367 endif # CC_VERSION
duke@1 368
duke@1 369 LIBRARY_SUFFIX = dll
duke@1 370 LIB_SUFFIX = lib
duke@1 371
duke@1 372 # Settings for the VERSIONINFO tap on windows.
duke@1 373 VERSIONINFO_RESOURCE = $(TOPDIR)/src/windows/resource/version.rc
duke@1 374
duke@1 375 RC_FLAGS = /l 0x409 /r
duke@1 376
duke@1 377 ifeq ($(VARIANT), OPT)
duke@1 378 RC_FLAGS += -d NDEBUG
duke@1 379 else
duke@1 380 RC_FLAGS += $(MS_RC_DEBUG_OPTION)
duke@1 381 endif
duke@1 382
duke@1 383 ifndef COPYRIGHT_YEAR
duke@1 384 COPYRIGHT_YEAR = 2007
duke@1 385 endif
duke@1 386
herrick@88 387 RC_FLAGS += -d "JDK_BUILD_ID=$(FULL_VERSION)" \
herrick@88 388 -d "JDK_COMPANY=$(COMPANY_NAME)" \
herrick@88 389 -d "JDK_COMPONENT=$(PRODUCT_NAME) Platform SE binary" \
herrick@88 390 -d "JDK_VER=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)" \
herrick@88 391 -d "JDK_COPYRIGHT=Copyright \xA9 $(COPYRIGHT_YEAR)" \
herrick@88 392 -d "JDK_NAME=$(PRODUCT_NAME) Platform SE $(JDK_MINOR_VERSION) $(JDK_UPDATE_META_TAG)" \
herrick@88 393 -d "JDK_FVER=$(JDK_VERSION)"

mercurial