Defs-windows.gmk revision 795
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# This code is free software; you can redistribute it and/or modify it
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# under the terms of the GNU General Public License version 2 only, as
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# published by the Free Software Foundation. Sun designates this
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# particular file as subject to the "Classpath" exception as provided
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# by Sun in the LICENSE file that accompanied this code.
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# This code is distributed in the hope that it will be useful, but WITHOUT
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# version 2 for more details (a copy is included in the LICENSE file that
90929d4c6b284dd318f4a78c2aa407afb7423747oliver.bradley# accompanied this code).
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# You should have received a copy of the GNU General Public License version
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# 2 along with this work; if not, write to the Free Software Foundation,
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22715efe327ebff20a080126afbf434886fe124cjason.browne# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22715efe327ebff20a080126afbf434886fe124cjason.browne# CA 95054 USA or visit www.sun.com if you need additional information or
22715efe327ebff20a080126afbf434886fe124cjason.browne# have any questions.
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# Makefile to specify compiler flags for programs and libraries
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# targeted to Windows builds. Should not contain any rules.
22715efe327ebff20a080126afbf434886fe124cjason.browne# WARNING: This file is shared with other workspaces.
22715efe327ebff20a080126afbf434886fe124cjason.browne# So when it includes other files, it must use JDK_TOPDIR.
22715efe327ebff20a080126afbf434886fe124cjason.browne# Get shared JDK settings
dd6f7acd9f8b4ac201528617b8cea0a8b518d4cejason.browne# CC compiler object code output directive flag value
dd6f7acd9f8b4ac201528617b8cea0a8b518d4cejason.browne# The suffix applied to the library name for FDLIBM
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# The suffix applied to scripts (.bat for windows, nothing for unix)
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# LIB_LOCATION, which for windows identifies where .exe files go, may be
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# set by each GNUmakefile. The default is BINDIR.
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# Platform specific closed sources
9f4ef34f046eeedd0734fe9aaa227b84caa6a6e7Elizabeth Browne CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/windows
9f4ef34f046eeedd0734fe9aaa227b84caa6a6e7Elizabeth Browne# for backwards compatability, the old "win32" is used here instead of
9f4ef34f046eeedd0734fe9aaa227b84caa6a6e7Elizabeth Browne# the more proper "windows"
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.brownePLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne# The following DLL's are considered MS runtime libraries and should
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# not to be REBASEd, see deploy/make/common/Release.gmk.
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# msvcrt.dll, msvcrnn.dll [msvcr71 or msvcr80 or msvcr90] : Microsoft runtimes
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne# C Compiler flag definitions
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# Default optimization
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # Visual Studio .NET 2003 or VS2003 compiler option definitions:
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -O1 Favors reduced size over speed (-Og -Os -Oy -Ob2 -Gs -GF -Gy)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -O2 Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
397a6f6248290aed0c80b6314796178a18efe9bcJason Browne # -Ox Full optimization (use -O2) (-Og -Oi -Ot -Oy -Ob2)
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne # (Removed in Visual Studio 2005 or VS2005)
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne # -Ob2 More aggressive inlining
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne # -Og Global optimizations
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne # -Oi Replace some functions with intrinsic or special forms
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -Op Improve floating point calculations (disables some optimizations)
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne # (Replaced with -fp:precise in VS2005, /Op is default now)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -Os Favor small code
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -Ot Favor faster code
397a6f6248290aed0c80b6314796178a18efe9bcJason Browne # -Oy Frame pointer omission
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -GB Optimize for pentium (old VC6 option?)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -G6 VS2003 version of -GB?
3d2f8976854bd9256c853f21c3a3c2fa9891b37ejason.browne # -GF Pool strings in read-only memory
33b843c6297041e8c1a73b737821958ed0883366Jason Browne # -Gf Pool strings in read-write memory (the default)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -Gs Controls stack probess
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -GS Adds buffer overflow checks on stacks
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # (Default in VS2005)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -GX Enables exception handling
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # (Replaced with /EHsc in VS2005)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # -Gy Function level linking only
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # NOTE: With VC6, -Ox included -Gs.
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # Also known as VC7 compiler
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # Lowered opt level to try and reduce footprint, dll size especially.
3265d87127479b58587813601a6b05315248a146Jason Browne # Was: CC_OPT/HIGHEST = -O2 -G6
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
33b843c6297041e8c1a73b737821958ed0883366Jason Browne # VS2005 compiler, only with Platform SDK right now?
22715efe327ebff20a080126afbf434886fe124cjason.browne # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
22715efe327ebff20a080126afbf434886fe124cjason.browneelse # CC_VERSION
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # GCC not supported, but left for historical reference...
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# Select the runtime support library carefully, need to be consistent
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# VS2003 compiler option definitions:
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# -MD Use dynamic multi-threaded runtime library
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# -MDd Use debug version (don't use, doesn't mix with -MD DLL's)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# -MT Use static multi-threaded runtime library (-ML is going away)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# -MTd Use static debug version (better than -MDd, no runtime issues)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# -D_DEBUG Change use of malloc/free/etc to use special debug ones (-MTd)
33b843c6297041e8c1a73b737821958ed0883366Jason Browne# NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcpnn.dll
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# If MS_RUNTIME_STATIC is requested, use -MT only with VS2003.
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# The _DEBUG macro option (changes things like malloc to use debug version)
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne# Externally set environment variable can force any build to use the debug vers
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # This MS debugging flag forces a dependence on the debug
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # version of the runtime library (MSVCRTD.DLL), as does -MDd.
9e90d9b80268528a6f6b3144a429849a75681f47Elizabeth Browne # We cannot re-distribute this debug runtime.
33b843c6297041e8c1a73b737821958ed0883366Jason Browne# Always add _STATIC_CPPLIB definition
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne # VS2003 compiler option definitions:
22715efe327ebff20a080126afbf434886fe124cjason.browne # -Zi Cause *.pdb file to be created, full debug information
22715efe327ebff20a080126afbf434886fe124cjason.browne # -Z7 Full debug inside the .obj, no .pdb
22715efe327ebff20a080126afbf434886fe124cjason.browne # -Zd Basic debug, no local variables? In the .obj
22715efe327ebff20a080126afbf434886fe124cjason.browne # -Zl Don't add runtime library name to obj file?
22715efe327ebff20a080126afbf434886fe124cjason.browne # -Od Turns off optimization and speeds compilation
22715efe327ebff20a080126afbf434886fe124cjason.browne # -YX -Fp/.../foobar.pch Use precompiled headers (try someday?)
22715efe327ebff20a080126afbf434886fe124cjason.browne # -nologo Don't print out startup message
33b843c6297041e8c1a73b737821958ed0883366Jason Browne # /D _STATIC_CPPLIB
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # Use static link for the C++ runtime (so msvcpnn.dll not needed)
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
a95affcf61989573b6cd080e5bd2416bf5af4b4bElizabeth # by default. However, we expect the wchar_t to be a typedef to the
22715efe327ebff20a080126afbf434886fe124cjason.browne # unsigned short data type. The -Zc:wchar_t- option restores the old
f6d886370a7cd712288f760f2ee2edbdc834503djason.browne # behavior (as seen in VS2003) to avoid massive code modifications.
397a6f6248290aed0c80b6314796178a18efe9bcJason Browne # When/if our code will be "C/C++ Standard"-compliant (at least in the area
12e51f2d3d5bbab9a7d831998eb852567223a8a9jason.browne # of handling the wchar_t type), the option won't be necessary.
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne # The 64bit Platform SDK we use (April 2005) doesn't like this option
475f923f502d2590d1fabb3662bf46758fd7f16aElizabeth Browne # All builds get the same runtime setting
22715efe327ebff20a080126afbf434886fe124cjason.browne CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # The new Platform SDK and VS2005 has /GS as a default and requires
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # bufferoverflowU.lib on the link command line, otherwise
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # we get missing __security_check_cookie externals at link time.
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # VS2008 has bufferoverflow baked in:
9849ba3450fd40c5f351b6a968888a7d1582eb80jason.browne # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
475f923f502d2590d1fabb3662bf46758fd7f16aElizabeth Browne # VS2005, VS2008, and beyond: ask LINK to generate manifests for .dll & .exe
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# Preprocessor macro definitions
22715efe327ebff20a080126afbf434886fe124cjason.browneCPPFLAGS_COMMON = -DWIN32 -DIAL -D_LITTLE_ENDIAN
22715efe327ebff20a080126afbf434886fe124cjason.browne# Output options (use specific filenames to avoid parallel compile errors)
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browneCFLAGS_COMMON += -Fd$(OBJDIR)/$(basename $(@F)).pdb -Fm$(OBJDIR)/$(basename $(@F)).map
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# Use -wdNNNN to disable warning NNNN.
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# C4800 is a warning about bool performance casts (can't make go away)
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browneCFLAGS_COMMON += $(COMPILER_WARNINGS_TO_IGNORE:%=-wd%)
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# Add warnings and extra on 64bit issues
ee3c8b0cc03a9031a3564d90aaa94ea4d0019e4cjason.browne# Treat compiler warnings as errors, if requested
22715efe327ebff20a080126afbf434886fe124cjason.browne# Path and option to link against the VM, if you have to.
22715efe327ebff20a080126afbf434886fe124cjason.browneelse # CC_VERSION
22715efe327ebff20a080126afbf434886fe124cjason.browne# not supported, but left for historical reference...
12e51f2d3d5bbab9a7d831998eb852567223a8a9jason.browne CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)&!g'
22715efe327ebff20a080126afbf434886fe124cjason.browne# Settings for the JDI - Serviceability Agent binding.
22715efe327ebff20a080126afbf434886fe124cjason.browneHOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/bin
22715efe327ebff20a080126afbf434886fe124cjason.browneSALIB_NAME = $(LIB_PREFIX)sawindbg.$(LIBRARY_SUFFIX)
22715efe327ebff20a080126afbf434886fe124cjason.browne # SA will never be supported here.
22715efe327ebff20a080126afbf434886fe124cjason.browne # Hopefully, SA will be supported here one of these days,
22715efe327ebff20a080126afbf434886fe124cjason.browne # and these will be changed to true. Until then,
22715efe327ebff20a080126afbf434886fe124cjason.browne # to build SA on windows, do a control build with
22715efe327ebff20a080126afbf434886fe124cjason.browne # BUILD_WIN_SA=1
22715efe327ebff20a080126afbf434886fe124cjason.browne # on the make command.
22715efe327ebff20a080126afbf434886fe124cjason.browne# Settings for the VERSIONINFO tap on windows.
22715efe327ebff20a080126afbf434886fe124cjason.browneVERSIONINFO_RESOURCE = $(BUILDDIR)/../src/windows/resource/version.rc
22715efe327ebff20a080126afbf434886fe124cjason.browne COOKED_BUILD_NUMBER = $(shell $(ECHO) $(JDK_BUILD_NUMBER) | $(SED) -e 's/^b//' -e 's/^0//')
22715efe327ebff20a080126afbf434886fe124cjason.browne# If the update version contains non-numeric characters, we need
22715efe327ebff20a080126afbf434886fe124cjason.browne# to massage it into a numeric format.
22715efe327ebff20a080126afbf434886fe124cjason.browne# We use the following formula:
22715efe327ebff20a080126afbf434886fe124cjason.browne# JDK_UPDATE_VER = JDK_UPDATE_VERSION * 10 + EXCEPTION_VERSION
22715efe327ebff20a080126afbf434886fe124cjason.browne# Here are some examples:
22715efe327ebff20a080126afbf434886fe124cjason.browne# 1.5.0 b01 -> 5,0,0,1
22715efe327ebff20a080126afbf434886fe124cjason.browne# 1.5.0_10 b01 -> 5,0,100,1
22715efe327ebff20a080126afbf434886fe124cjason.browne# 1.4.2 b01 -> 4,2,0,1
22715efe327ebff20a080126afbf434886fe124cjason.browne# 1.4.2_02 b01 -> 4,2,20,1
22715efe327ebff20a080126afbf434886fe124cjason.browne# 1.4.2_02a b01 -> 4,2,21,1
22715efe327ebff20a080126afbf434886fe124cjason.browne# 1.4.2_02b b01 -> 4,2,22,1
22715efe327ebff20a080126afbf434886fe124cjason.browne VTMP := $(shell $(ECHO) $(JDK_UPDATE_VERSION) | $(TR) "abcde" "12345")
22715efe327ebff20a080126afbf434886fe124cjason.browne CAB_CHAR1 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 1, 1);}')
22715efe327ebff20a080126afbf434886fe124cjason.browne CAB_CHAR2 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 2, 1);}')
22715efe327ebff20a080126afbf434886fe124cjason.browne CAB_CHAR3 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 3, 1);}')
22715efe327ebff20a080126afbf434886fe124cjason.browne JDK_UPDATE_VER := $(CAB_CHAR1)$(CAB_CHAR2)$(CAB_CHAR3)
22715efe327ebff20a080126afbf434886fe124cjason.browne# Values for the RC variables defined in RC_FLAGS
22715efe327ebff20a080126afbf434886fe124cjason.browneJDK_RC_COMPONENT = $(PRODUCT_NAME) $(JDK_RC_PLATFORM_NAME) binary
22715efe327ebff20a080126afbf434886fe124cjason.browne $(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)
22715efe327ebff20a080126afbf434886fe124cjason.browneJDK_RC_COPYRIGHT = Copyright \xA9 $(COPYRIGHT_YEAR)
22715efe327ebff20a080126afbf434886fe124cjason.browne $(PRODUCT_NAME) $(JDK_RC_PLATFORM_NAME) $(JDK_MINOR_VERSION) $(JDK_UPDATE_META_TAG)
22715efe327ebff20a080126afbf434886fe124cjason.browne $(JDK_MINOR_VERSION),$(JDK_MICRO_VERSION),$(JDK_UPDATE_VER),$(COOKED_BUILD_NUMBER)
22715efe327ebff20a080126afbf434886fe124cjason.browne# J2SE name required here
22715efe327ebff20a080126afbf434886fe124cjason.browneRC_FLAGS += -d "J2SE_BUILD_ID=$(JDK_RC_BUILD_ID)" \