Defs-windows.gmk revision 157
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# This code is free software; you can redistribute it and/or modify it
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# under the terms of the GNU General Public License version 2 only, as
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# published by the Free Software Foundation. Oracle designates this
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# particular file as subject to the "Classpath" exception as provided
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# by Oracle in the LICENSE file that accompanied this code.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# This code is distributed in the hope that it will be useful, but WITHOUT
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# version 2 for more details (a copy is included in the LICENSE file that
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# accompanied this code).
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# You should have received a copy of the GNU General Public License version
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# 2 along with this work; if not, write to the Free Software Foundation,
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# or visit www.oracle.com if you need additional information or have any
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# questions.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Makefile to specify compiler flags for programs and libraries
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# targeted to Windows builds. Should not contain any rules.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy#
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# Get shared JDK settings
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyinclude $(BUILDDIR)/common/shared/Defs.gmk
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# CC compiler object code output directive flag value
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyCC_OBJECT_OUTPUT_FLAG = -Fo
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyCC_PROGRAM_OUTPUT_FLAG = -Fe
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# The suffix applied to the library name for FDLIBM
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyFDDLIBM_SUFFIX = lib
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# The suffix applied to scripts (.bat for windows, nothing for unix)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedySCRIPT_SUFFIX = .bat
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyHPIS = windows
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# LIB_LOCATION, which for windows identifies where .exe files go, may be
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# set by each GNUmakefile. The default is BINDIR.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyifndef LIB_LOCATION
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy LIB_LOCATION = $(BINDIR)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyendif # LIB_LOCATION
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyifndef PLATFORM_SRC
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy PLATFORM_SRC = $(TOPDIR)/src/windows
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedyendif # PLATFORM_SRC
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# for backwards compatability, the old "win32" is used here instead of
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# the more proper "windows"
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyPLATFORM_INCLUDE_NAME = win32
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyPLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# The following DLL's are considered MS runtime libraries and should
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy# not to be REBASEd, see deploy/make/common/Release.gmk.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy# msvcrt.dll, msvcrnn.dll [msvcr71 or msvcr80 or msvcr90] : Microsoft runtimes
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyMS_RUNTIME_LIBRARIES = msvcrt.dll
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren KennedyMSVCRNN_DLL =
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedyifeq ($(ARCH_DATA_MODEL), 32)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy ifeq ($(COMPILER_VERSION), VS2003)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy MSVCRNN_DLL = msvcr71.dll
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy MSVCPNN_DLL = msvcp71.dll
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy endif
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy ifeq ($(COMPILER_VERSION), VS2005)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy MSVCRNN_DLL = msvcr80.dll
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy MSVCPNN_DLL = msvcp80.dll
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy endif
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy ifeq ($(COMPILER_VERSION), VS2008)
MSVCRNN_DLL = msvcr90.dll
MSVCPNN_DLL = msvcp90.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
endif
ifeq ($(COMPILER_VERSION), VS2010)
MSVCRNN_DLL = msvcr100.dll
MSVCPNN_DLL = msvcp100.dll
MS_RUNTIME_LIBRARIES += $(MSVCRNN_DLL)
endif
endif
# C Compiler flag definitions
#
# Default optimization
#
ifeq ($(CC_VERSION),msvc)
# Visual Studio .NET 2003 or VS2003 compiler option definitions:
# -O1 Favors reduced size over speed (-Og -Os -Oy -Ob2 -Gs -GF -Gy)
# -O2 Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
# -Ox Full optimization (use -O2) (-Og -Oi -Ot -Oy -Ob2)
# (Removed in Visual Studio 2005 or VS2005)
# -Ob2 More aggressive inlining
# -Og Global optimizations
# -Oi Replace some functions with intrinsic or special forms
# -Op Improve floating point calculations (disables some optimizations)
# (Replaced with -fp:precise in VS2005, /Op is default now)
# -Os Favor small code
# -Ot Favor faster code
# -Oy Frame pointer omission
# -GB Optimize for pentium (old VC6 option?)
# -G6 VS2003 version of -GB?
# -GF Pool strings in read-only memory
# -Gf Pool strings in read-write memory (the default)
# -Gs Controls stack probess
# -GS Adds buffer overflow checks on stacks
# (Default in VS2005)
# -GX Enables exception handling
# (Replaced with /EHsc in VS2005)
# -Gy Function level linking only
#
# NOTE: With VC6, -Ox included -Gs.
# NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
# NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
#
ifeq ($(COMPILER_VERSION), VC6)
# VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION =
GX_OPTION = -GX
ifeq ($(ARCH_DATA_MODEL), 32)
CC_HIGHEST_OPT = -Ox -Gy -Os -GB
CC_HIGHER_OPT = -Ox -Gy -Os -GB
CC_LOWER_OPT = -Ox -Gy -Os -GB
else
CC_HIGHEST_OPT = -Ox -Gy -Op
CC_HIGHER_OPT = -Ox -Gy -Op
CC_LOWER_OPT = -Ox -Gy -Op
endif
endif
ifeq ($(COMPILER_VERSION), VS2003)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION = -YX
# Also known as VC7 compiler
GX_OPTION = -GX
ifeq ($(ARCH_DATA_MODEL), 32)
# Lowered opt level to try and reduce footprint, dll size especially.
# Was: CC_HIGHEST_OPT = -O2 -G6
# Was: CC_HIGHER_OPT = -O2
CC_HIGHEST_OPT = -O2
CC_HIGHER_OPT = -O1
CC_LOWER_OPT = -O1
else
CC_HIGHEST_OPT = -O2 -Op
CC_HIGHER_OPT = -O2 -Op
CC_LOWER_OPT = -O1 -Op
endif
endif
ifeq ($(COMPILER_VERSION), VS2005)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION =
# VS2005 compiler, only with Platform SDK right now?
GX_OPTION = -EHsc
ifeq ($(ARCH_DATA_MODEL), 32)
CC_HIGHEST_OPT = -O2
CC_HIGHER_OPT = -O1
CC_LOWER_OPT = -O1
else
CC_HIGHEST_OPT = -O2
CC_HIGHER_OPT = -O1
CC_LOWER_OPT = -O1
endif
endif
ifeq ($(COMPILER_VERSION), VS2008)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION =
GX_OPTION = -EHsc
ifeq ($(ARCH_DATA_MODEL), 32)
CC_HIGHEST_OPT = -O2
CC_HIGHER_OPT = -O1
CC_LOWER_OPT = -O1
else
CC_HIGHEST_OPT = -O2
CC_HIGHER_OPT = -O1
CC_LOWER_OPT = -O1
endif
endif
ifeq ($(COMPILER_VERSION), VS2010)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION =
GX_OPTION = -EHsc
ifeq ($(ARCH_DATA_MODEL), 32)
CC_HIGHEST_OPT = -O2
CC_HIGHER_OPT = -O1
CC_LOWER_OPT = -O1
else
CC_HIGHEST_OPT = -O2
CC_HIGHER_OPT = -O1
CC_LOWER_OPT = -O1
endif
endif
CC_NO_OPT = -Od
else # CC_VERSION
# GCC not supported, but left for historical reference...
CC_HIGHEST_OPT = -O3
CC_HIGHER_OPT = -O2
CC_LOWER_OPT = -O2
CC_NO_OPT =
endif
# If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
ifdef NO_OPTIMIZATIONS
CC_HIGHEST_OPT = $(CC_NO_OPT)
CC_HIGHER_OPT = $(CC_NO_OPT)
CC_LOWER_OPT = $(CC_NO_OPT)
endif
ifeq ($(PRODUCT), java)
_OPT = $(CC_HIGHER_OPT)
else
_OPT = $(CC_LOWER_OPT)
endif
# Select the runtime support library carefully, need to be consistent
#
# VS2003 compiler option definitions:
# -MD Use dynamic multi-threaded runtime library
# -MDd Use debug version (don't use, doesn't mix with -MD DLL's)
# -MT Use static multi-threaded runtime library (-ML is going away)
# -MTd Use static debug version (better than -MDd, no runtime issues)
# -D_DEBUG Change use of malloc/free/etc to use special debug ones (-MTd)
#
# NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcpnn.dll
#
ifeq ($(MS_RUNTIME_STATIC),true)
MS_RUNTIME_OPTION=-MT
else
MS_RUNTIME_OPTION=-MD
endif
# The _DEBUG macro option (changes things like malloc to use debug version)
MS_RUNTIME_DEBUG_OPTION=
MS_RC_DEBUG_OPTION=
# Externally set environment variable can force any build to use the debug vers
ifeq ($(MFC_DEBUG), true)
ifeq ($(MS_RUNTIME_STATIC),true)
MS_RUNTIME_OPTION=-MTd
else
# This MS debugging flag forces a dependence on the debug
# version of the runtime library (MSVCRTD.DLL), as does -MDd.
# We cannot re-distribute this debug runtime.
MS_RUNTIME_OPTION=-MDd
endif
MS_RUNTIME_DEBUG_OPTION= -D_DEBUG
MS_RC_DEBUG_OPTION= -d _DEBUG
endif
# Always add _STATIC_CPPLIB definition
STATIC_CPPLIB_OPTION = /D _STATIC_CPPLIB
MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
ifeq ($(CC_VERSION),msvc)
# VS2003 compiler option definitions:
# -Zi Cause *.pdb file to be created, full debug information
# -Z7 Full debug inside the .obj, no .pdb
# -Zd Basic debug, no local variables? In the .obj
# -Zl Don't add runtime library name to obj file?
# -Od Turns off optimization and speeds compilation
# -YX -Fp/.../foobar.pch Use precompiled headers (try someday?)
# -nologo Don't print out startup message
# /D _STATIC_CPPLIB
# Use static link for the C++ runtime (so msvcpnn.dll not needed)
#
CFLAGS_COMMON += -Zi -nologo
CFLAGS_OPT = $(POPT)
CFLAGS_DBG = -Od $(MS_RUNTIME_DEBUG_OPTION)
# Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
# by default. However, we expect the wchar_t to be a typedef to the
# unsigned short data type. The -Zc:wchar_t- option restores the old
# behavior (as seen in VS2003) to avoid massive code modifications.
# When/if our code will be "C/C++ Standard"-compliant (at least in the area
# of handling the wchar_t type), the option won't be necessary.
ifeq ($(ARCH_DATA_MODEL), 32)
CFLAGS_VS2005 += -Zc:wchar_t-
else
# The 64bit Platform SDK we use (April 2005) doesn't like this option
ifneq ($(CC_VER), 14.00.40310.41)
CFLAGS_VS2005 += -Zc:wchar_t-
endif
endif
# All builds get the same runtime setting
CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
LDEBUG = /debug
ifeq ($(VTUNE_SUPPORT), true)
OTHER_CFLAGS = -Z7 -Ox
LDEBUG += /pdb:NONE
endif
# The new Platform SDK and VS2005 has /GS as a default and requires
# bufferoverflowU.lib on the link command line, otherwise
# we get missing __security_check_cookie externals at link time.
BUFFEROVERFLOWLIB = bufferoverflowU.lib
# Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB)
# LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
BASELFLAGS = -nologo /opt:REF /incremental:no
LFLAGS = $(BASELFLAGS) $(LDEBUG) $(EXTRA_LFLAGS) $(LFLAGS_$(COMPILER_VERSION))
LDDFLAGS += $(LFLAGS_$(COMPILER_VERSION))
endif
#
# Preprocessor macro definitions
#
CPPFLAGS_COMMON = -DWIN32 -DIAL -D_LITTLE_ENDIAN
ifeq ($(ARCH), amd64)
CPPFLAGS_COMMON += -D_AMD64_ -Damd64
else
CPPFLAGS_COMMON += -DWIN32 -D_X86_ -Dx86
endif
CPPFLAGS_COMMON += -DWIN32_LEAN_AND_MEAN
#
# Output options (use specific filenames to avoid parallel compile errors)
#
CFLAGS_COMMON += -Fd$(OBJDIR)/$(basename $(@F)).pdb -Fm$(OBJDIR)/$(basename $(@F)).map
#
# Add warnings and extra on 64bit issues
#
ifeq ($(ARCH_DATA_MODEL), 64)
CFLAGS_COMMON += -Wp64
endif
CFLAGS_COMMON += -W$(COMPILER_WARNING_LEVEL)
#
# Treat compiler warnings as errors, if requested
#
ifeq ($(COMPILER_WARNINGS_FATAL),true)
CFLAGS_COMMON += -WX
endif
CPPFLAGS_OPT =
CPPFLAGS_DBG = -DDEBUG -DLOGGING
CXXFLAGS_COMMON = $(CFLAGS_COMMON)
CXXFLAGS_OPT = $(CFLAGS_OPT)
CXXFLAGS_DBG = $(CFLAGS_DBG)
ifneq ($(LIBRARY),fdlibm)
EXTRA_LIBS += advapi32.lib
endif
#
# Path and option to link against the VM, if you have to.
#
JVMLIB = $(BOOTDIR)/lib/jvm.lib
JAVALIB =
ifeq ($(CC_VERSION), msvc)
CC_DEPEND = -FD
CC_DEPEND_FILTER =
else # CC_VERSION
# not supported, but left for historical reference...
CC_DEPEND = -MM
CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)&!g'
endif # CC_VERSION
LIBRARY_SUFFIX = dll
LIB_SUFFIX = lib
# Settings for the VERSIONINFO tap on windows.
VERSIONINFO_RESOURCE = $(TOPDIR)/src/windows/resource/version.rc
RC_FLAGS = /l 0x409 /r
ifeq ($(VARIANT), OPT)
RC_FLAGS += -d NDEBUG
else
RC_FLAGS += $(MS_RC_DEBUG_OPTION)
endif
ifndef COPYRIGHT_YEAR
COPYRIGHT_YEAR = 2007
endif
RC_FLAGS += -d "JDK_BUILD_ID=$(FULL_VERSION)" \
-d "JDK_COMPANY=$(COMPANY_NAME)" \
-d "JDK_COMPONENT=$(PRODUCT_NAME) Platform SE binary" \
-d "JDK_VER=$(JDK_MINOR_VERSION).$(JDK_MICRO_VERSION).$(JDK_UPDATE_VER).$(COOKED_BUILD_NUMBER)" \
-d "JDK_COPYRIGHT=Copyright \xA9 $(COPYRIGHT_YEAR)" \
-d "JDK_NAME=$(PRODUCT_NAME) Platform SE $(JDK_MINOR_VERSION) $(JDK_UPDATE_META_TAG)" \
-d "JDK_FVER=$(JDK_VERSION)"