Defs-windows.gmk revision 460
0N/A#
381N/A# Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation. Sun designates this
0N/A# particular file as subject to the "Classpath" exception as provided
0N/A# by Sun in the LICENSE file that accompanied this code.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
0N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A# CA 95054 USA or visit www.sun.com if you need additional information or
0N/A# have any questions.
0N/A#
0N/A
0N/A#
0N/A# Makefile to specify compiler flags for programs and libraries
0N/A# targeted to Windows builds. Should not contain any rules.
0N/A#
0N/A# WARNING: This file is shared with other workspaces.
0N/A# So when it includes other files, it must use JDK_TOPDIR.
0N/A#
0N/A
0N/A# Get shared JDK settings
0N/Ainclude $(JDK_MAKE_SHARED_DIR)/Defs.gmk
0N/A
0N/A# CC compiler object code output directive flag value
0N/ACC_OBJECT_OUTPUT_FLAG = -Fo
0N/ACC_PROGRAM_OUTPUT_FLAG = -Fe
0N/A
0N/A# The suffix applied to the library name for FDLIBM
0N/AFDDLIBM_SUFFIX = lib
0N/A# The suffix applied to scripts (.bat for windows, nothing for unix)
0N/ASCRIPT_SUFFIX = .bat
0N/A
0N/AHPIS = windows
0N/A# LIB_LOCATION, which for windows identifies where .exe files go, may be
0N/A# set by each GNUmakefile. The default is BINDIR.
0N/Aifndef LIB_LOCATION
0N/A LIB_LOCATION = $(BINDIR)
0N/Aendif # LIB_LOCATION
0N/A
0N/Aifndef PLATFORM_SRC
7N/A PLATFORM_SRC = $(BUILDDIR)/../src/windows
0N/Aendif # PLATFORM_SRC
0N/A
0N/A# Platform specific closed sources
0N/Aifndef OPENJDK
0N/A ifndef CLOSED_PLATFORM_SRC
7N/A CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/windows
0N/A endif
0N/Aendif
0N/A
0N/A# for backwards compatability, the old "win32" is used here instead of
0N/A# the more proper "windows"
0N/APLATFORM_INCLUDE_NAME = win32
0N/APLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
0N/A
0N/A# The following DLL's are considered MS runtime libraries and should
0N/A# not to be REBASEd, see deploy/make/common/Release.gmk.
0N/A# msvcrt.dll, msvcr71.dll: Microsoft runtimes
0N/AMS_RUNTIME_LIBRARIES = msvcrt.dll
0N/Aifeq ($(ARCH_DATA_MODEL), 32)
0N/A ifeq ($(COMPILER_VERSION), VS2003)
0N/A MS_RUNTIME_LIBRARIES += msvcr71.dll
0N/A endif
0N/Aendif
0N/A
0N/A
0N/AEXTRA_LFLAGS += /LIBPATH:$(DXSDK_LIB_PATH)
0N/A
0N/A# C Compiler flag definitions
0N/A
0N/A#
0N/A# Default optimization
0N/A#
460N/A
460N/Aifndef OPTIMIZATION_LEVEL
460N/A ifeq ($(PRODUCT), java)
460N/A OPTIMIZATION_LEVEL = HIGHER
460N/A else
460N/A OPTIMIZATION_LEVEL = LOWER
460N/A endif
460N/Aendif
460N/A
0N/Aifeq ($(CC_VERSION),msvc)
0N/A # Visual Studio .NET 2003 or VS2003 compiler option definitions:
0N/A # -O1 Favors reduced size over speed (-Og -Os -Oy -Ob2 -Gs -GF -Gy)
0N/A # -O2 Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
0N/A # -Ox Full optimization (use -O2) (-Og -Oi -Ot -Oy -Ob2)
0N/A # (Removed in Visual Studio 2005 or VS2005)
0N/A # -Ob2 More aggressive inlining
0N/A # -Og Global optimizations
0N/A # -Oi Replace some functions with intrinsic or special forms
0N/A # -Op Improve floating point calculations (disables some optimizations)
0N/A # (Replaced with -fp:precise in VS2005, /Op is default now)
0N/A # -Os Favor small code
0N/A # -Ot Favor faster code
0N/A # -Oy Frame pointer omission
0N/A # -GB Optimize for pentium (old VC6 option?)
0N/A # -G6 VS2003 version of -GB?
0N/A # -GF Pool strings in read-only memory
0N/A # -Gf Pool strings in read-write memory (the default)
0N/A # -Gs Controls stack probess
0N/A # -GS Adds buffer overflow checks on stacks
0N/A # (Default in VS2005)
0N/A # -GX Enables exception handling
0N/A # (Replaced with /EHsc in VS2005)
0N/A # -Gy Function level linking only
0N/A #
0N/A # NOTE: With VC6, -Ox included -Gs.
0N/A # NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
0N/A # NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
0N/A #
460N/A
460N/A CC_OPT/NONE = -Od
460N/A CC_OPT/LOWER = -O2
460N/A CC_OPT/HIGHER = -O3
460N/A CC_OPT/HIGHEST = -O3
460N/A
0N/A ifeq ($(COMPILER_VERSION), VC6)
0N/A # VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
0N/A # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
0N/A AUTOMATIC_PCH_OPTION =
0N/A GX_OPTION = -GX
0N/A ifeq ($(ARCH_DATA_MODEL), 32)
460N/A CC_OPT/HIGHEST = -Ox -Gy -Os -GB
460N/A CC_OPT/HIGHER = -Ox -Gy -Os -GB
460N/A CC_OPT/LOWER = -Ox -Gy -Os -GB
0N/A else
460N/A CC_OPT/HIGHEST = -Ox -Gy -Op
460N/A CC_OPT/HIGHER = -Ox -Gy -Op
460N/A CC_OPT/LOWER = -Ox -Gy -Op
0N/A endif
0N/A endif
460N/A
0N/A ifeq ($(COMPILER_VERSION), VS2003)
0N/A # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
0N/A AUTOMATIC_PCH_OPTION = -YX
0N/A # Also known as VC7 compiler
0N/A GX_OPTION = -GX
0N/A ifeq ($(ARCH_DATA_MODEL), 32)
0N/A # Lowered opt level to try and reduce footprint, dll size especially.
460N/A # Was: CC_OPT/HIGHEST = -O2 -G6
460N/A # Was: CC_OPT/HIGHER = -O2
460N/A CC_OPT/HIGHEST = -O2
460N/A CC_OPT/HIGHER = -O1
460N/A CC_OPT/LOWER = -O1
0N/A else
460N/A CC_OPT/HIGHEST = -O2 -Op
460N/A CC_OPT/HIGHER = -O2 -Op
460N/A CC_OPT/LOWER = -O1 -Op
0N/A endif
0N/A endif
460N/A
0N/A ifeq ($(COMPILER_VERSION), VS2005)
0N/A # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
0N/A AUTOMATIC_PCH_OPTION =
0N/A # VS2005 compiler, only with Platform SDK right now?
0N/A GX_OPTION = -EHsc
0N/A ifeq ($(ARCH_DATA_MODEL), 32)
460N/A CC_OPT/HIGHEST = -O2
460N/A CC_OPT/HIGHER = -O1
460N/A CC_OPT/LOWER = -O1
0N/A else
460N/A CC_OPT/HIGHEST = -O2
460N/A CC_OPT/HIGHER = -O1
460N/A CC_OPT/LOWER = -O1
0N/A endif
0N/A endif
460N/A
0N/Aelse # CC_VERSION
460N/A
0N/A # GCC not supported, but left for historical reference...
460N/A CC_OPT/NONE =
460N/A CC_OPT/LOWER = -O2
460N/A CC_OPT/HIGHER = -O2
460N/A CC_OPT/HIGHEST = -O3
460N/A
0N/Aendif
0N/A
460N/ACC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
0N/A
0N/A# Select the runtime support library carefully, need to be consistent
0N/A#
0N/A# VS2003 compiler option definitions:
0N/A# -MD Use dynamic multi-threaded runtime library
0N/A# -MDd Use debug version (don't use, doesn't mix with -MD DLL's)
0N/A# -MT Use static multi-threaded runtime library (-ML is going away)
0N/A# -MTd Use static debug version (better than -MDd, no runtime issues)
0N/A# -D_DEBUG Change use of malloc/free/etc to use special debug ones (-MTd)
0N/A#
0N/A# NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcp71.dll
0N/A#
0N/Aifeq ($(MS_RUNTIME_STATIC),true)
0N/A MS_RUNTIME_OPTION=-MT
0N/Aelse
0N/A MS_RUNTIME_OPTION=-MD
0N/Aendif
0N/A# The _DEBUG macro option (changes things like malloc to use debug version)
0N/AMS_RUNTIME_DEBUG_OPTION=
0N/AMS_RC_DEBUG_OPTION=
0N/A# Externally set environment variable can force any build to use the debug vers
0N/Aifeq ($(MFC_DEBUG), true)
0N/A ifeq ($(MS_RUNTIME_STATIC),true)
0N/A MS_RUNTIME_OPTION=-MTd
0N/A else
0N/A # This MS debugging flag forces a dependence on the debug
0N/A # version of the runtime library (MSVCRTD.DLL), as does -MDd.
0N/A # We cannot re-distribute this debug runtime.
0N/A MS_RUNTIME_OPTION=-MDd
0N/A endif
0N/A MS_RUNTIME_DEBUG_OPTION= -D_DEBUG
0N/A MS_RC_DEBUG_OPTION= -d _DEBUG
0N/Aendif
0N/A
0N/A# Always add _STATIC_CPPLIB definition
0N/ASTATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB
0N/AMS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
0N/A
0N/Aifeq ($(CC_VERSION),msvc)
0N/A # VS2003 compiler option definitions:
0N/A # -Zi Cause *.pdb file to be created, full debug information
0N/A # -Z7 Full debug inside the .obj, no .pdb
0N/A # -Zd Basic debug, no local variables? In the .obj
0N/A # -Zl Don't add runtime library name to obj file?
0N/A # -Od Turns off optimization and speeds compilation
0N/A # -YX -Fp/.../foobar.pch Use precompiled headers (try someday?)
0N/A # -nologo Don't print out startup message
0N/A # /D _STATIC_CPPLIB
0N/A # Use static link for the C++ runtime (so msvcp71.dll not needed)
0N/A #
0N/A CFLAGS_COMMON += -Zi -nologo
460N/A CFLAGS_OPT = $(CC_OPT)
0N/A CFLAGS_DBG = -Od $(MS_RUNTIME_DEBUG_OPTION)
0N/A
0N/A # Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
0N/A # by default. However, we expect the wchar_t to be a typedef to the
0N/A # unsigned short data type. The -Zc:wchar_t- option restores the old
0N/A # behavior (as seen in VS2003) to avoid massive code modifications.
0N/A # When/if our code will be "C/C++ Standard"-compliant (at least in the area
0N/A # of handling the wchar_t type), the option won't be necessary.
0N/A ifeq ($(ARCH_DATA_MODEL), 32)
0N/A CFLAGS_VS2005 += -Zc:wchar_t-
0N/A else
0N/A # The 64bit Platform SDK we use (April 2005) doesn't like this option
0N/A ifneq ($(CC_VER), 14.00.40310.41)
0N/A CFLAGS_VS2005 += -Zc:wchar_t-
0N/A endif
0N/A endif
0N/A
0N/A # All builds get the same runtime setting
0N/A CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
0N/A
0N/A
0N/A LDEBUG = /debug
0N/A
0N/A ifeq ($(VTUNE_SUPPORT), true)
0N/A OTHER_CFLAGS = -Z7 -Ox
0N/A LDEBUG += /pdb:NONE
0N/A endif
0N/A
0N/A # The new Platform SDK and VS2005 has /GS as a default and requires
0N/A # bufferoverflowU.lib on the link command line, otherwise
0N/A # we get missing __security_check_cookie externals at link time.
0N/A BUFFEROVERFLOWLIB = bufferoverflowU.lib
0N/A # Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
0N/A LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB)
0N/A
0N/A # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
0N/A BASELFLAGS = -nologo /opt:REF /incremental:no
0N/A LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
0N/A LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
0N/A
0N/Aendif
0N/A
0N/A#
0N/A# Preprocessor macro definitions
0N/A#
0N/ACPPFLAGS_COMMON = -DWIN32 -DIAL -D_LITTLE_ENDIAN
0N/Aifeq ($(ARCH), amd64)
0N/A CPPFLAGS_COMMON += -D_AMD64_ -Damd64
0N/Aelse
0N/A CPPFLAGS_COMMON += -DWIN32 -D_X86_ -Dx86
0N/Aendif
0N/ACPPFLAGS_COMMON += -DWIN32_LEAN_AND_MEAN
0N/A
0N/A#
0N/A# Output options (use specific filenames to avoid parallel compile errors)
0N/A#
0N/ACFLAGS_COMMON += -Fd$(OBJDIR)/$(basename $(@F)).pdb -Fm$(OBJDIR)/$(basename $(@F)).map
0N/A
0N/A#
0N/A# Add warnings and extra on 64bit issues
0N/A#
0N/Aifeq ($(ARCH_DATA_MODEL), 64)
0N/A CFLAGS_COMMON += -Wp64
0N/Aendif
0N/ACFLAGS_COMMON += -W$(COMPILER_WARNING_LEVEL)
0N/A
0N/A#
0N/A# Treat compiler warnings as errors, if requested
0N/A#
0N/Aifeq ($(COMPILER_WARNINGS_FATAL),true)
0N/A CFLAGS_COMMON += -WX
0N/Aendif
0N/A
0N/ACPPFLAGS_OPT =
0N/ACPPFLAGS_DBG = -DDEBUG -DLOGGING
0N/A
0N/ACXXFLAGS_COMMON = $(CFLAGS_COMMON)
0N/ACXXFLAGS_OPT = $(CFLAGS_OPT)
0N/ACXXFLAGS_DBG = $(CFLAGS_DBG)
0N/A
0N/Aifneq ($(LIBRARY),fdlibm)
0N/A EXTRA_LIBS += advapi32.lib
0N/Aendif
0N/A
0N/A#
0N/A# Path and option to link against the VM, if you have to.
0N/A#
0N/AJVMLIB = $(LIBDIR)/jvm.lib
0N/AJAVALIB = $(LIBDIR)/java.lib
0N/A
0N/Aifeq ($(CC_VERSION), msvc)
0N/A CC_DEPEND = -FD
0N/A CC_DEPEND_FILTER =
0N/Aelse # CC_VERSION
0N/A# not supported, but left for historical reference...
0N/A CC_DEPEND = -MM
0N/A CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)&!g'
0N/Aendif # CC_VERSION
0N/A
0N/ALIBRARY_SUFFIX = dll
0N/ALIB_SUFFIX = lib
0N/A
0N/A# Settings for the JDI - Serviceability Agent binding.
0N/AHOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/bin
0N/ASALIB_NAME = $(LIB_PREFIX)sawindbg.$(LIBRARY_SUFFIX)
0N/ASAMAP_NAME = $(LIB_PREFIX)sawindbg.map
0N/ASAPDB_NAME = $(LIB_PREFIX)sawindbg.pdb
0N/A
0N/Aifeq ($(ARCH), ia64)
0N/A # SA will never be supported here.
0N/A INCLUDE_SA = false
0N/Aelse
0N/A # Hopefully, SA will be supported here one of these days,
0N/A # and these will be changed to true. Until then,
0N/A # to build SA on windows, do a control build with
0N/A # BUILD_WIN_SA=1
0N/A # on the make command.
0N/A ifdef BUILD_WIN_SA
0N/A ifeq ($(ARCH), amd64)
0N/A INCLUDE_SA = true
0N/A else
0N/A INCLUDE_SA = true
0N/A endif
0N/A else
0N/A ifeq ($(ARCH), amd64)
0N/A INCLUDE_SA = false
0N/A else
0N/A INCLUDE_SA = false
0N/A endif
0N/A endif
0N/Aendif
0N/A
0N/A# Settings for the VERSIONINFO tap on windows.
7N/AVERSIONINFO_RESOURCE = $(BUILDDIR)/../src/windows/resource/version.rc
0N/A
0N/Aifneq ($(JDK_BUILD_NUMBER),)
0N/A COOKED_BUILD_NUMBER = $(shell $(ECHO) $(JDK_BUILD_NUMBER) | $(SED) -e 's/^b//' -e 's/^0//')
0N/Aelse
0N/A COOKED_BUILD_NUMBER = 0
0N/Aendif
0N/A
0N/A# If the update version contains non-numeric characters, we need
0N/A# to massage it into a numeric format.
0N/A# We use the following formula:
0N/A# JDK_UPDATE_VER = JDK_UPDATE_VERSION * 10 + EXCEPTION_VERSION
0N/A#
0N/A# Here are some examples:
0N/A# 1.5.0 b01 -> 5,0,0,1
0N/A# 1.5.0_10 b01 -> 5,0,100,1
0N/A# 1.4.2 b01 -> 4,2,0,1
0N/A# 1.4.2_02 b01 -> 4,2,20,1
0N/A# 1.4.2_02a b01 -> 4,2,21,1
0N/A# 1.4.2_02b b01 -> 4,2,22,1
0N/Aifdef JDK_UPDATE_VERSION
0N/A VTMP := $(shell $(ECHO) $(JDK_UPDATE_VERSION) | $(TR) "abcde" "12345")
0N/A CAB_CHAR1 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 1, 1);}')
0N/A CAB_CHAR2 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 2, 1);}')
0N/A CAB_CHAR3 := $(shell $(ECHO) $(VTMP) | $(NAWK) '{print substr($$1, 3, 1);}')
0N/A JDK_UPDATE_META_TAG := U$(MARKETING_NUMBER)
0N/A ifeq ($(CAB_CHAR3),)
0N/A CAB_CHAR3 := 0
0N/A endif
0N/A ifeq ($(CAB_CHAR1), 0)
0N/A JDK_UPDATE_VER := $(CAB_CHAR2)$(CAB_CHAR3)
0N/A else
0N/A JDK_UPDATE_VER := $(CAB_CHAR1)$(CAB_CHAR2)$(CAB_CHAR3)
0N/A endif
0N/Aelse
0N/A JDK_UPDATE_VER := 0
0N/Aendif
0N/AJDK_VER = $(JDK_MINOR_VERSION),$(JDK_MICRO_VERSION),$(JDK_UPDATE_VER),$(COOKED_BUILD_NUMBER)
0N/A
0N/ARC_FLAGS = /l 0x409 /r
0N/A
0N/Aifeq ($(VARIANT), OPT)
0N/A RC_FLAGS += -d NDEBUG
0N/Aelse
0N/A RC_FLAGS += $(MS_RC_DEBUG_OPTION)
0N/Aendif
0N/A
0N/Aifndef COPYRIGHT_YEAR
0N/A COPYRIGHT_YEAR = 2007
0N/Aendif
0N/A
0N/A# J2SE name required here
0N/ARC_FLAGS += -d "J2SE_BUILD_ID=$(FULL_VERSION)" \
0N/A -d "J2SE_COMPANY=$(COMPANY_NAME)" \
0N/A -d "J2SE_COMPONENT=$(PRODUCT_NAME) Platform SE binary" \
0N/A -d "J2SE_VER=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)" \
0N/A -d "J2SE_COPYRIGHT=Copyright \xA9 $(COPYRIGHT_YEAR)" \
0N/A -d "J2SE_NAME=$(PRODUCT_NAME) Platform SE $(JDK_MINOR_VERSION) $(JDK_UPDATE_META_TAG)" \
0N/A -d "J2SE_FVER=$(JDK_VER)"