make/common/Defs-windows.gmk

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

mercurial