source: trunk/openjdk/jdk/make/common/Defs-windows.gmk

Last change on this file was 278, checked in by dmik, 14 years ago

trunk: Merged in openjdk6 b22 from branches/vendor/oracle.

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