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