make/common/Defs-windows.gmk

Sat, 01 Dec 2007 00:00:00 +0000

author
duke
date
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1
55540e827aef
child 33
a067bf2329ef
permissions
-rw-r--r--

Initial load

duke@1 1 #
duke@1 2 # Copyright 1999-2007 Sun Microsystems, Inc. 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
duke@1 7 # published by the Free Software Foundation. Sun designates this
duke@1 8 # particular file as subject to the "Classpath" exception as provided
duke@1 9 # by Sun 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 #
duke@1 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 23 # have any 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.
duke@1 61 # msvcrt.dll, msvcr71.dll: Microsoft runtimes
duke@1 62 MS_RUNTIME_LIBRARIES = msvcrt.dll
duke@1 63 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 64 ifeq ($(COMPILER_VERSION), VS2003)
duke@1 65 MS_RUNTIME_LIBRARIES += msvcr71.dll
duke@1 66 endif
duke@1 67 endif
duke@1 68
duke@1 69 # C Compiler flag definitions
duke@1 70
duke@1 71 #
duke@1 72 # Default optimization
duke@1 73 #
duke@1 74 ifeq ($(CC_VERSION),msvc)
duke@1 75 # Visual Studio .NET 2003 or VS2003 compiler option definitions:
duke@1 76 # -O1 Favors reduced size over speed (-Og -Os -Oy -Ob2 -Gs -GF -Gy)
duke@1 77 # -O2 Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
duke@1 78 # -Ox Full optimization (use -O2) (-Og -Oi -Ot -Oy -Ob2)
duke@1 79 # (Removed in Visual Studio 2005 or VS2005)
duke@1 80 # -Ob2 More aggressive inlining
duke@1 81 # -Og Global optimizations
duke@1 82 # -Oi Replace some functions with intrinsic or special forms
duke@1 83 # -Op Improve floating point calculations (disables some optimizations)
duke@1 84 # (Replaced with -fp:precise in VS2005, /Op is default now)
duke@1 85 # -Os Favor small code
duke@1 86 # -Ot Favor faster code
duke@1 87 # -Oy Frame pointer omission
duke@1 88 # -GB Optimize for pentium (old VC6 option?)
duke@1 89 # -G6 VS2003 version of -GB?
duke@1 90 # -GF Pool strings in read-only memory
duke@1 91 # -Gf Pool strings in read-write memory (the default)
duke@1 92 # -Gs Controls stack probess
duke@1 93 # -GS Adds buffer overflow checks on stacks
duke@1 94 # (Default in VS2005)
duke@1 95 # -GX Enables exception handling
duke@1 96 # (Replaced with /EHsc in VS2005)
duke@1 97 # -Gy Function level linking only
duke@1 98 #
duke@1 99 # NOTE: With VC6, -Ox included -Gs.
duke@1 100 # NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
duke@1 101 # NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
duke@1 102 #
duke@1 103 ifeq ($(COMPILER_VERSION), VC6)
duke@1 104 # VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
duke@1 105 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
duke@1 106 AUTOMATIC_PCH_OPTION =
duke@1 107 GX_OPTION = -GX
duke@1 108 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 109 CC_HIGHEST_OPT = -Ox -Gy -Os -GB
duke@1 110 CC_HIGHER_OPT = -Ox -Gy -Os -GB
duke@1 111 CC_LOWER_OPT = -Ox -Gy -Os -GB
duke@1 112 else
duke@1 113 CC_HIGHEST_OPT = -Ox -Gy -Op
duke@1 114 CC_HIGHER_OPT = -Ox -Gy -Op
duke@1 115 CC_LOWER_OPT = -Ox -Gy -Op
duke@1 116 endif
duke@1 117 endif
duke@1 118 ifeq ($(COMPILER_VERSION), VS2003)
duke@1 119 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
duke@1 120 AUTOMATIC_PCH_OPTION = -YX
duke@1 121 # Also known as VC7 compiler
duke@1 122 GX_OPTION = -GX
duke@1 123 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 124 # Lowered opt level to try and reduce footprint, dll size especially.
duke@1 125 # Was: CC_HIGHEST_OPT = -O2 -G6
duke@1 126 # Was: CC_HIGHER_OPT = -O2
duke@1 127 CC_HIGHEST_OPT = -O2
duke@1 128 CC_HIGHER_OPT = -O1
duke@1 129 CC_LOWER_OPT = -O1
duke@1 130 else
duke@1 131 CC_HIGHEST_OPT = -O2 -Op
duke@1 132 CC_HIGHER_OPT = -O2 -Op
duke@1 133 CC_LOWER_OPT = -O1 -Op
duke@1 134 endif
duke@1 135 endif
duke@1 136 ifeq ($(COMPILER_VERSION), VS2005)
duke@1 137 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
duke@1 138 AUTOMATIC_PCH_OPTION =
duke@1 139 # VS2005 compiler, only with Platform SDK right now?
duke@1 140 GX_OPTION = -EHsc
duke@1 141 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 142 CC_HIGHEST_OPT = -O2
duke@1 143 CC_HIGHER_OPT = -O1
duke@1 144 CC_LOWER_OPT = -O1
duke@1 145 else
duke@1 146 CC_HIGHEST_OPT = -O2
duke@1 147 CC_HIGHER_OPT = -O1
duke@1 148 CC_LOWER_OPT = -O1
duke@1 149 endif
duke@1 150 endif
duke@1 151 CC_NO_OPT = -Od
duke@1 152 else # CC_VERSION
duke@1 153 # GCC not supported, but left for historical reference...
duke@1 154 CC_HIGHEST_OPT = -O3
duke@1 155 CC_HIGHER_OPT = -O2
duke@1 156 CC_LOWER_OPT = -O2
duke@1 157 CC_NO_OPT =
duke@1 158 endif
duke@1 159
duke@1 160 # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
duke@1 161 ifdef NO_OPTIMIZATIONS
duke@1 162 CC_HIGHEST_OPT = $(CC_NO_OPT)
duke@1 163 CC_HIGHER_OPT = $(CC_NO_OPT)
duke@1 164 CC_LOWER_OPT = $(CC_NO_OPT)
duke@1 165 endif
duke@1 166
duke@1 167 ifeq ($(PRODUCT), java)
duke@1 168 _OPT = $(CC_HIGHER_OPT)
duke@1 169 else
duke@1 170 _OPT = $(CC_LOWER_OPT)
duke@1 171 endif
duke@1 172
duke@1 173 # Select the runtime support library carefully, need to be consistent
duke@1 174 #
duke@1 175 # VS2003 compiler option definitions:
duke@1 176 # -MD Use dynamic multi-threaded runtime library
duke@1 177 # -MDd Use debug version (don't use, doesn't mix with -MD DLL's)
duke@1 178 # -MT Use static multi-threaded runtime library (-ML is going away)
duke@1 179 # -MTd Use static debug version (better than -MDd, no runtime issues)
duke@1 180 # -D_DEBUG Change use of malloc/free/etc to use special debug ones (-MTd)
duke@1 181 #
duke@1 182 # NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcp71.dll
duke@1 183 #
duke@1 184 ifeq ($(MS_RUNTIME_STATIC),true)
duke@1 185 MS_RUNTIME_OPTION=-MT
duke@1 186 else
duke@1 187 MS_RUNTIME_OPTION=-MD
duke@1 188 endif
duke@1 189 # The _DEBUG macro option (changes things like malloc to use debug version)
duke@1 190 MS_RUNTIME_DEBUG_OPTION=
duke@1 191 MS_RC_DEBUG_OPTION=
duke@1 192 # Externally set environment variable can force any build to use the debug vers
duke@1 193 ifeq ($(MFC_DEBUG), true)
duke@1 194 ifeq ($(MS_RUNTIME_STATIC),true)
duke@1 195 MS_RUNTIME_OPTION=-MTd
duke@1 196 else
duke@1 197 # This MS debugging flag forces a dependence on the debug
duke@1 198 # version of the runtime library (MSVCRTD.DLL), as does -MDd.
duke@1 199 # We cannot re-distribute this debug runtime.
duke@1 200 MS_RUNTIME_OPTION=-MDd
duke@1 201 endif
duke@1 202 MS_RUNTIME_DEBUG_OPTION= -D_DEBUG
duke@1 203 MS_RC_DEBUG_OPTION= -d _DEBUG
duke@1 204 endif
duke@1 205
duke@1 206 # Always add _STATIC_CPPLIB definition
duke@1 207 STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB
duke@1 208 MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
duke@1 209
duke@1 210 ifeq ($(CC_VERSION),msvc)
duke@1 211 # VS2003 compiler option definitions:
duke@1 212 # -Zi Cause *.pdb file to be created, full debug information
duke@1 213 # -Z7 Full debug inside the .obj, no .pdb
duke@1 214 # -Zd Basic debug, no local variables? In the .obj
duke@1 215 # -Zl Don't add runtime library name to obj file?
duke@1 216 # -Od Turns off optimization and speeds compilation
duke@1 217 # -YX -Fp/.../foobar.pch Use precompiled headers (try someday?)
duke@1 218 # -nologo Don't print out startup message
duke@1 219 # /D _STATIC_CPPLIB
duke@1 220 # Use static link for the C++ runtime (so msvcp71.dll not needed)
duke@1 221 #
duke@1 222 CFLAGS_COMMON += -Zi -nologo
duke@1 223 CFLAGS_OPT = $(POPT)
duke@1 224 CFLAGS_DBG = -Od $(MS_RUNTIME_DEBUG_OPTION)
duke@1 225
duke@1 226 # Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
duke@1 227 # by default. However, we expect the wchar_t to be a typedef to the
duke@1 228 # unsigned short data type. The -Zc:wchar_t- option restores the old
duke@1 229 # behavior (as seen in VS2003) to avoid massive code modifications.
duke@1 230 # When/if our code will be "C/C++ Standard"-compliant (at least in the area
duke@1 231 # of handling the wchar_t type), the option won't be necessary.
duke@1 232 ifeq ($(ARCH_DATA_MODEL), 32)
duke@1 233 CFLAGS_VS2005 += -Zc:wchar_t-
duke@1 234 else
duke@1 235 # The 64bit Platform SDK we use (April 2005) doesn't like this option
duke@1 236 ifneq ($(CC_VER), 14.00.40310.41)
duke@1 237 CFLAGS_VS2005 += -Zc:wchar_t-
duke@1 238 endif
duke@1 239 endif
duke@1 240
duke@1 241 # All builds get the same runtime setting
duke@1 242 CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
duke@1 243
duke@1 244
duke@1 245 LDEBUG = /debug
duke@1 246
duke@1 247 ifeq ($(VTUNE_SUPPORT), true)
duke@1 248 OTHER_CFLAGS = -Z7 -Ox
duke@1 249 LDEBUG += /pdb:NONE
duke@1 250 endif
duke@1 251
duke@1 252 # The new Platform SDK and VS2005 has /GS as a default and requires
duke@1 253 # bufferoverflowU.lib on the link command line, otherwise
duke@1 254 # we get missing __security_check_cookie externals at link time.
duke@1 255 BUFFEROVERFLOWLIB = bufferoverflowU.lib
duke@1 256 # Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
duke@1 257 LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB)
duke@1 258
duke@1 259 # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
duke@1 260 BASELFLAGS = -nologo /opt:REF /incremental:no
duke@1 261 LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
duke@1 262 LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
duke@1 263
duke@1 264 endif
duke@1 265
duke@1 266 #
duke@1 267 # Preprocessor macro definitions
duke@1 268 #
duke@1 269 CPPFLAGS_COMMON = -DWIN32 -DIAL -D_LITTLE_ENDIAN
duke@1 270 ifeq ($(ARCH), amd64)
duke@1 271 CPPFLAGS_COMMON += -D_AMD64_ -Damd64
duke@1 272 else
duke@1 273 CPPFLAGS_COMMON += -DWIN32 -D_X86_ -Dx86
duke@1 274 endif
duke@1 275 CPPFLAGS_COMMON += -DWIN32_LEAN_AND_MEAN
duke@1 276
duke@1 277 #
duke@1 278 # Output options (use specific filenames to avoid parallel compile errors)
duke@1 279 #
duke@1 280 CFLAGS_COMMON += -Fd$(OBJDIR)/$(basename $(@F)).pdb -Fm$(OBJDIR)/$(basename $(@F)).map
duke@1 281
duke@1 282 #
duke@1 283 # Add warnings and extra on 64bit issues
duke@1 284 #
duke@1 285 ifeq ($(ARCH_DATA_MODEL), 64)
duke@1 286 CFLAGS_COMMON += -Wp64
duke@1 287 endif
duke@1 288 CFLAGS_COMMON += -W$(COMPILER_WARNING_LEVEL)
duke@1 289
duke@1 290 #
duke@1 291 # Treat compiler warnings as errors, if requested
duke@1 292 #
duke@1 293 ifeq ($(COMPILER_WARNINGS_FATAL),true)
duke@1 294 CFLAGS_COMMON += -WX
duke@1 295 endif
duke@1 296
duke@1 297 CPPFLAGS_OPT =
duke@1 298 CPPFLAGS_DBG = -DDEBUG -DLOGGING
duke@1 299
duke@1 300 CXXFLAGS_COMMON = $(CFLAGS_COMMON)
duke@1 301 CXXFLAGS_OPT = $(CFLAGS_OPT)
duke@1 302 CXXFLAGS_DBG = $(CFLAGS_DBG)
duke@1 303
duke@1 304 ifneq ($(LIBRARY),fdlibm)
duke@1 305 EXTRA_LIBS += advapi32.lib
duke@1 306 endif
duke@1 307
duke@1 308 #
duke@1 309 # Path and option to link against the VM, if you have to.
duke@1 310 #
duke@1 311 JVMLIB = $(BOOTDIR)/lib/jvm.lib
duke@1 312 JAVALIB =
duke@1 313
duke@1 314 ifeq ($(CC_VERSION), msvc)
duke@1 315 CC_DEPEND = -FD
duke@1 316 CC_DEPEND_FILTER =
duke@1 317 else # CC_VERSION
duke@1 318 # not supported, but left for historical reference...
duke@1 319 CC_DEPEND = -MM
duke@1 320 CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)&!g'
duke@1 321 endif # CC_VERSION
duke@1 322
duke@1 323 LIBRARY_SUFFIX = dll
duke@1 324 LIB_SUFFIX = lib
duke@1 325
duke@1 326 # Settings for the VERSIONINFO tap on windows.
duke@1 327 VERSIONINFO_RESOURCE = $(TOPDIR)/src/windows/resource/version.rc
duke@1 328
duke@1 329 RC_FLAGS = /l 0x409 /r
duke@1 330
duke@1 331 ifeq ($(VARIANT), OPT)
duke@1 332 RC_FLAGS += -d NDEBUG
duke@1 333 else
duke@1 334 RC_FLAGS += $(MS_RC_DEBUG_OPTION)
duke@1 335 endif
duke@1 336
duke@1 337 ifndef COPYRIGHT_YEAR
duke@1 338 COPYRIGHT_YEAR = 2007
duke@1 339 endif
duke@1 340
duke@1 341 RC_FLAGS += -d "J2SE_BUILD_ID=$(FULL_VERSION)" \
duke@1 342 -d "J2SE_COMPANY=$(COMPANY_NAME)" \
duke@1 343 -d "J2SE_COMPONENT=$(PRODUCT_NAME) Platform SE binary" \
duke@1 344 -d "J2SE_VER=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(J2SE_UPDATE_VER).$(COOKED_BUILD_NUMBER)" \
duke@1 345 -d "J2SE_COPYRIGHT=Copyright \xA9 $(COPYRIGHT_YEAR)" \
duke@1 346 -d "J2SE_NAME=$(PRODUCT_NAME) Platform SE $(JDK_MINOR_VERSION) $(J2SE_UPDATE_META_TAG)" \
duke@1 347 -d "J2SE_FVER=$(JDK_VERSION)"

mercurial