blob: 1442959756ffbe8958118db551d5f3455604ed01 [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001#
ohairbf91ea12011-04-06 22:06:11 -07002# Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
duke6e45e102007-12-01 00:00:00 +00003# 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
ohair2283b9d2010-05-25 15:58:33 -07007# published by the Free Software Foundation. Oracle designates this
duke6e45e102007-12-01 00:00:00 +00008# particular file as subject to the "Classpath" exception as provided
ohair2283b9d2010-05-25 15:58:33 -07009# by Oracle in the LICENSE file that accompanied this code.
duke6e45e102007-12-01 00:00:00 +000010#
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#
ohair2283b9d2010-05-25 15:58:33 -070021# 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.
duke6e45e102007-12-01 00:00:00 +000024#
25
26#
27# Makefile to specify compiler flags for programs and libraries
28# targeted to Solaris. 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# Warning: the following variables are overridden by Defs.gmk. Set
35# values will be silently ignored:
36# CFLAGS (set $(OTHER_CFLAGS) instead)
37# CPPFLAGS (set $(OTHER_CPPFLAGS) instead)
38# CXXFLAGS (set $(OTHER_CXXFLAGS) instead)
39# LDFLAGS (set $(OTHER_LDFAGS) instead)
40# LDLIBS (set $(EXTRA_LIBS) instead)
41# LDLIBS_COMMON (set $(EXTRA_LIBS) instead)
42# LINTFLAGS (set $(OTHER_LINTFLAGS) instead)
ohairab4f1212008-07-27 18:42:57 -070043#
44# Note: CPPFLAGS are used in C and C++ compiles.
45#
duke6e45e102007-12-01 00:00:00 +000046
47# Get shared JDK settings
48include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
49
50ifndef PLATFORM_SRC
ohair26e0af62008-03-04 09:52:54 -080051PLATFORM_SRC = $(BUILDDIR)/../src/solaris
duke6e45e102007-12-01 00:00:00 +000052endif # PLATFORM_SRC
53
54# Platform specific closed sources
55ifndef OPENJDK
56 ifndef CLOSED_PLATFORM_SRC
ohair26e0af62008-03-04 09:52:54 -080057 CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
duke6e45e102007-12-01 00:00:00 +000058 endif
59endif
60
61# platform specific include files
62PLATFORM_INCLUDE_NAME = $(PLATFORM)
63PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
64
65# suffix used for make dependencies files
66DEPEND_SUFFIX = d
67# suffix used for lint files
68LINT_SUFFIX = ln
69# The suffix applied to the library name for FDLIBM
70FDDLIBM_SUFFIX = a
71# The suffix applied to scripts (.bat for windows, nothing for unix)
72SCRIPT_SUFFIX =
73# CC compiler object code output directive flag value
74CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
75CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
76
77#
duke6e45e102007-12-01 00:00:00 +000078# Java default optimization (-x04/-O2) etc. Applies to the VM.
79#
ohair850fb252008-07-30 19:40:57 -070080ifndef OPTIMIZATION_LEVEL
81 ifeq ($(PRODUCT), java)
82 OPTIMIZATION_LEVEL = HIGHER
83 else
84 OPTIMIZATION_LEVEL = LOWER
85 endif
duke6e45e102007-12-01 00:00:00 +000086endif
ohairb99e3e32009-03-31 16:10:31 -070087ifndef FASTDEBUG_OPTIMIZATION_LEVEL
88 FASTDEBUG_OPTIMIZATION_LEVEL = LOWER
89endif
duke6e45e102007-12-01 00:00:00 +000090
91#
ohair850fb252008-07-30 19:40:57 -070092# If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the
duke6e45e102007-12-01 00:00:00 +000093# optimized build, and that ordering of the flags completely freaks
94# out cc. Hence, -Xa is instead in each CFLAGS variant.
95#
96# The more unusual options to the Sun C compiler:
97# -v Stricter type checking, more error checking
98# (To turn ALL warnings into fatals, use -errwarn=%all)
99# -xstrconst Place string literals and constants in read-only area
100# (means you can't write on your string literals)
101# -xs Force debug information (stabs) into the .so or a.out
102# (makes the library/executable debuggable without the
103# .o files needing to be around, but at a space cost)
104# -g & -O If you add the -g option to the optimized compiles
105# you will get better stack retraces, the code is
106# still optimized. This includes a space cost too.
107# -xc99=%none Do NOT allow for c99 extensions to be used.
108# e.g. declarations must precede statements
109# -xCC Allow the C++ style of comments in C: //
110# Required with many of the source files.
111# -mt Assume multi-threaded (important)
112#
ohairab4f1212008-07-27 18:42:57 -0700113# The more unusual options to the Sun C compiler:
114# +w Print more warnings
115# +w2 Maximum warnings
116#
duke6e45e102007-12-01 00:00:00 +0000117
118#
119# Debug flag for C and C++ compiler
120#
ohair850fb252008-07-30 19:40:57 -0700121CFLAGS_DEBUG_OPTION = -g $(CC_OPT/NONE)
122CXXFLAGS_DEBUG_OPTION = -g $(CXX_OPT/NONE)
duke6e45e102007-12-01 00:00:00 +0000123
124# Turn off -g if we are doing tcov build
125ifdef TCOV_BUILD
126 CFLAGS_DEBUG_OPTION=
127 CXXFLAGS_DEBUG_OPTION=
128endif
129
130# FASTDEBUG: Optimize the -g builds, gives us a faster debug java
131# If true adds -O to the debug compiles. This allows for any assert
132# tests to remain and debug checking. The resulting code is faster
133# but less debuggable. Stack traces are still valid, although only
134# approximate line numbers are given. Printing of local variables
135# during a debugging session is not possible, but stepping and
136# printing of global or static variables should be possible.
137# Performance/size of files should be about the same, maybe smaller.
138#
139ifeq ($(FASTDEBUG), true)
ohairb99e3e32009-03-31 16:10:31 -0700140 CFLAGS_DEBUG_OPTION = -g $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
141 CXXFLAGS_DEBUG_OPTION = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
duke6e45e102007-12-01 00:00:00 +0000142endif
143
ohairab4f1212008-07-27 18:42:57 -0700144CFLAGS_COMMON = -L$(OBJDIR)
145
146# Do not allow C99 language features like declarations in code etc.
147CFLAGS_COMMON += -xc99=%none
148
149# Allow C++ comments in C code
duke6e45e102007-12-01 00:00:00 +0000150CFLAGS_COMMON += -xCC
ohairab4f1212008-07-27 18:42:57 -0700151
152# Show error message tags on errors
153CFLAGS_COMMON += -errshort=tags
154CXXFLAGS_COMMON += -errtags=yes
155
156# Optimization flags
ohair850fb252008-07-30 19:40:57 -0700157CFLAGS_OPT = $(CC_OPT)
ohairab4f1212008-07-27 18:42:57 -0700158
159# Debug version flags
duke6e45e102007-12-01 00:00:00 +0000160CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION)
ohairab4f1212008-07-27 18:42:57 -0700161
162# Required C compiler flags
163CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED)
164
165# Maximum warnings all the time
166CXXFLAGS_COMMON += +w
167CFLAGS_COMMON += -v
duke6e45e102007-12-01 00:00:00 +0000168
169# Assume MT behavior all the time (important)
ohairab4f1212008-07-27 18:42:57 -0700170CXXFLAGS_COMMON += -mt
171CFLAGS_COMMON += -mt
duke6e45e102007-12-01 00:00:00 +0000172
173# Assume no C++ exceptions are used
174CXXFLAGS_COMMON += -features=no%except -DCC_NOEX
175
176# For C++, these options tell it to assume nothing about locating libraries
177# either at compile time, or at runtime. Use of these options will likely
178# require the use of -L and -R options to indicate where libraries will
179# be found at compile time (-L) and at runtime (-R).
180# The /usr/lib location comes for free, so no need to specify that one.
181# Note: C is much simplier and there is no need for these options. This
182# is mostly needed to avoid dependencies on libraries in the
183# Compiler install area, also see LIBCXX and LIBM.
184CXXFLAGS_COMMON += -norunpath -xnolib
185
186#
187# Treat compiler warnings as errors, if requested
188#
189ifeq ($(COMPILER_WARNINGS_FATAL),true)
190 CFLAGS_COMMON += -errwarn=%all
191 CXXFLAGS_COMMON += -errwarn=%all
192endif
193
ohair850fb252008-07-30 19:40:57 -0700194CXXFLAGS_OPT = $(CXX_OPT)
duke6e45e102007-12-01 00:00:00 +0000195CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION)
196CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
197
198# Add -xstrconst to the library compiles. This forces all string
199# literals into the read-only data section, which prevents them from
200# being written to and increases the runtime pages shared on the system.
201#
202ifdef LIBRARY
203 CFLAGS_COMMON +=-xstrconst
204endif
205
206# Source browser database
207#
208# COMPILE_WITH_SB
209# If defined adds -xsb to compiles and creates a
210# source browsing database during compilation.
211#
212ifdef COMPILE_WITH_SB
213 ifeq ($(LIBRARY), java)
214 CFLAGS_DBG += -xsb
215 endif
216endif
217
218# Lint Flags:
219# -Xa ANSI C plus K&R, favor ANSI rules
duke6e45e102007-12-01 00:00:00 +0000220# -fd report on old style func defs
221# -errchk=structarg report on 64bit struct args by value
222# -errchk=longptr64 report on 64bit to 32bit issues (ignores casts)
223# -errchk=parentheses report on suggested use of extra parens
224# -v suppress unused args
225# -x suppress unused externs
226# -u suppress extern func/vars used/defined
227# -errfmt=simple use one line errors with position info
ohair3f083862008-06-04 09:38:18 -0700228# $(LINT_XARCH_OPTION) See Compiler-sun.gwk
duke6e45e102007-12-01 00:00:00 +0000229
230LINTFLAGS_COMMON = -Xa
231LINTFLAGS_COMMON += -fd
232LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses
233LINTFLAGS_COMMON += -v
234LINTFLAGS_COMMON += -x
235LINTFLAGS_COMMON += -u
236LINTFLAGS_COMMON += -errfmt=simple
237LINTFLAGS_OPT =
238LINTFLAGS_DBG =
239
240# The -W0,-noglobal tells the compiler to NOT generate mangled global
241# ELF data symbols for file local static data.
242# This can break fix&continue, but we'd rather do the same compilations
243# for deliverable bits as we do for non-deliverable bits
244# Tell the compilers to never generate globalized names, all the time.
245CFLAGS_COMMON += -W0,-noglobal
246
ohair3f083862008-06-04 09:38:18 -0700247# If we have a specific arch value to use, add it
248CFLAGS_COMMON += $(XARCH_OPTION)
249CXXFLAGS_COMMON += $(XARCH_OPTION)
250ASFLAGS_COMMON += $(AS_XARCH_OPTION)
251EXTRA_LIBS += $(XARCH_OPTION)
252LINTFLAGS_COMMON += $(LINT_XARCH_OPTION)
duke6e45e102007-12-01 00:00:00 +0000253
254#
255# uncomment the following to build with PERTURBALOT set
256#
257# OTHER_CFLAGS += -DPERTURBALOT
258#
259
ohairab4f1212008-07-27 18:42:57 -0700260CPPFLAGS_COMMON = -D__solaris__ -D$(ARCH_FAMILY)
261CPPFLAGS_OPT = -DNDEBUG
duke6e45e102007-12-01 00:00:00 +0000262CPPFLAGS_DBG = -DDEBUG
263
ohair850fb252008-07-30 19:40:57 -0700264ifneq ($(PRODUCT), java)
265 CPPFLAGS_DBG += -DLOGGING -DDBINFO
266endif
267
duke6e45e102007-12-01 00:00:00 +0000268ifeq ($(ARCH_FAMILY), i586)
269 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
270 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
271 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
272 # Note: -Dmacro is the same as #define macro 1
273 # -Dmacro= is the same as #define macro
274 #
275 CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH)
276 # Turn off a superfluous compiler error message on Intel
277 CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE
278endif
279
280# Java memory management is based on memory mapping by default, but a
281# system only assuming malloc/free can be built by adding -DUSE_MALLOC
282
283CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS
284CPPFLAGS_OPT += -DTRIMMED
285
286LDFLAGS_DEFS_OPTION = -z defs
287LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
288
289#
290# -L paths for finding and -ljava
291#
292LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
293LDFLAGS_OPT =
294LDFLAGS_DBG =
295
296#
297# We never really want the incremental linker, ever
298# The -xildoff option tells Sun's compilers to NOT use incremental linker
299#
300LDFLAGS_COMMON += -xildoff
301
302ifdef LIBRARY
303 # Libraries need to locate other libraries at runtime, and you can tell
304 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
305 # buried inside the .so. The $ORIGIN says to look relative to where
306 # the library itself is and it can be followed with relative paths from
307 # that. By default we always look in $ORIGIN, optionally we add relative
308 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
309 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
310 # Try: 'dump -Lv lib*.so' to see these settings in a library.
311 #
312 LDFLAGS_COMMON += -R\$$ORIGIN
313 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%)
314endif
315
316EXTRA_LIBS += -lc
317
318# Postprocessing is done on the images directories only
319#
320ifeq ($(VARIANT), OPT)
321 ifeq ($(PARTIAL_GPROF), true)
322 NO_STRIP = true
323 endif
324 ifeq ($(GPROF), true)
325 NO_STRIP = true
326 endif
327 ifneq ($(NO_STRIP), true)
328 # Debug 'strip -x' leaves local function Elf symbols (better stack traces)
329 POST_STRIP_PROCESS = $(STRIP) -x
330 endif
331endif
332POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)"
333
334#
335# Sun C compiler will take -M and pass it on to ld.
336# Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o
337#
338ifeq ($(CC_VERSION),gcc)
339LD_MAPFILE_FLAG = -Xlinker -M -Xlinker
340else
341LD_MAPFILE_FLAG = -M
342endif
343
344#
345# Variables globally settable from the make command line (default
346# values in brackets):
347# GPROF (false)
348# Eg: % gnumake GPROF=true
349GPROF = false
350ifeq ($(GPROF), true)
351 CFLAGS_COMMON += -DGPROF -xpg
352 EXTRA_LIBS += -xpg
353endif
354
355# PARTIAL_GPROF is to be used ONLY during compilation - it should not
356# appear during linking of libraries or programs. It also should
357# prevent linking with -z defs to allow a symbol to remain undefined.
358#
359PARTIAL_GPROF = false
360ifeq ($(PARTIAL_GPROF), true)
361 CFLAGS_GPROF += -xpg
362 LDFLAGS_DEFS_OPTION = -z nodefs
363endif
364
365#
366# For a TCOV build we add in the TCOV_OPTION
367#
368ifdef TCOV_BUILD
369 TCOV_OPTION = -xprofile=tcov
370 LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic
371 CFLAGS_COMMON += $(TCOV_OPTION)
372 CXXFLAGS_COMMON += $(TCOV_OPTION)
373 EXTRA_LIBS += $(TCOV_OPTION)
374 LDNOMAP=true
375endif
376
377#
378# Solaris only uses native threads.
379#
380THREADS_FLAG= native
381THREADS_DIR= threads
382
383#
384# Support for Quantify.
385#
386ifdef QUANTIFY
387 QUANTIFY_CMD = quantify
388 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
389 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
390 ifdef LIBRARY
391 CFLAGS_COMMON += -K PIC
392 endif
393endif
394
395#
396# Support for Purify.
397#
398ifdef PURIFY
399 PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify
400 PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
401 LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS)
402 ifdef LIBRARY
403 CFLAGS_COMMON += -K PIC
404 endif
405endif
406
407#
408# Different "levels" of optimization.
409#
410ifeq ($(CC_VERSION),gcc)
ohair850fb252008-07-30 19:40:57 -0700411
412 CC_OPT/NONE =
413 CC_OPT/LOWER = -O2
414 CC_OPT/HIGHER = -O3
415 CC_OPT/HIGHEST = -O3
416
417 CXX_OPT/NONE =
418 CXX_OPT/LOWER = -O2
419 CXX_OPT/HIGHER = -O3
420 CXX_OPT/HIGHEST = -O3
421
duke6e45e102007-12-01 00:00:00 +0000422 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer
423 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer
ohair850fb252008-07-30 19:40:57 -0700424
duke6e45e102007-12-01 00:00:00 +0000425 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
426 # (See Rules.gmk) May need to wait for gcc 5?
427 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700428
duke6e45e102007-12-01 00:00:00 +0000429else
ohair850fb252008-07-30 19:40:57 -0700430
duke6e45e102007-12-01 00:00:00 +0000431 # Highest could be -xO5, but indications are that -xO5 should be reserved
432 # for a per-file use, on sources with known performance impacts.
ohair850fb252008-07-30 19:40:57 -0700433 OPT_LEVEL/LOWER = 2
434 OPT_LEVEL/HIGHER = 4
435 OPT_LEVEL/HIGHEST = 4
436
437 CC_OPT/NONE =
438 CC_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
439 CC_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
440 CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
441
442 CXX_OPT/NONE =
443 CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
444 CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
445 CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
446
447 # We need stack frames at all times
448 USE_XKEEPFRAME_OPTION = false
449 ifeq ($(USE_XKEEPFRAME_OPTION),true)
450
451 # Unknown spelling on this option at this time (Maybe in SS13?)
452 CC_XKEEPFRAME_OPTIONS = -xkeepframe
453 CXX_XKEEPFRAME_OPTIONS = -xkeepframe
454
455 else
456
457 # On X86, make sure tail call optimization is off
458 # The z and y are the tail call optimizations.
459 ifeq ($(ARCH_FAMILY), i586)
bae39abd752010-12-05 15:51:31 +0300460 ifeq ($(shell $(EXPR) $(CC_MAJORVER) \>= 5), 1)
461 ifeq ($(shell $(EXPR) $(CC_MINORVER) \> 8), 1)
462 # Somehow, tail call optimization is creeping in.
463 # Make sure it is off.
464 # WARNING: These may cause compiler warnings about duplicate -O options
465 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
466 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
467 endif
ohair850fb252008-07-30 19:40:57 -0700468 endif
469 endif
470
471 # On i586 we need to tell the code generator to ALWAYS use a
472 # frame pointer.
473 ifeq ($(ARCH_FAMILY), i586)
474 # Note that in 5.7, this is done with -xregs=no%frameptr
475 ifeq ($(CC_VER), 5.5)
476 # It's not exactly clear when this optimization kicks in, the
477 # current assumption is -xO4 or greater and for C++ with
478 # the -features=no%except option and -xO4 and greater.
479 # Bottom line is, we ALWAYS want a frame pointer!
480 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B
481 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B
482 endif
bae39abd752010-12-05 15:51:31 +0300483
484 ifeq ($(shell $(EXPR) $(CC_MAJORVER) \>= 5), 1)
485 ifeq ($(shell $(EXPR) $(CC_MINORVER) \> 6), 1)
486 # Do NOT use frame pointer register as a general purpose opt register
487 CC_OPT/NONE += -xregs=no%frameptr
488 CXX_OPT/NONE += -xregs=no%frameptr
489 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
490 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
491 endif
ohair850fb252008-07-30 19:40:57 -0700492 endif
493 endif
494
495 # Optimizer for sparc needs to be told not to do certain things
496 # related to frames or save instructions.
497 ifeq ($(ARCH_FAMILY), sparc)
498 # Do not use save instructions instead of add instructions
499 # This was an optimization starting in SC5.0 that made it hard for us to
500 # find the "save" instruction (which got turned into an "add")
501 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s
502 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s
503 # Don't allow tail call code optimization. Started in SC5.0.
504 # We don't like code of this form:
505 # save
506 # <code>
507 # call foo
508 # restore
509 # because we can't tell if the method will have a stack frame
510 # and register windows or not.
511 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0
512 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0
513 endif
514
515 endif
516
517 # Extra options used with HIGHEST
duke6e45e102007-12-01 00:00:00 +0000518 #
ohair850fb252008-07-30 19:40:57 -0700519 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
duke6e45e102007-12-01 00:00:00 +0000520 # done with care, there are some assumptions below that need to
521 # be understood about the use of pointers, and IEEE behavior.
522 #
523 # Use non-standard floating point mode (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700524 CC_HIGHEST_EXTRAS += -fns
duke6e45e102007-12-01 00:00:00 +0000525 # Do some simplification of floating point arithmetic (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700526 CC_HIGHEST_EXTRAS += -fsimple
duke6e45e102007-12-01 00:00:00 +0000527 # Use single precision floating point with 'float'
ohair850fb252008-07-30 19:40:57 -0700528 CC_HIGHEST_EXTRAS += -fsingle
duke6e45e102007-12-01 00:00:00 +0000529 # Assume memory references via basic pointer types do not alias
530 # (Source with excessing pointer casting and data access with mixed
531 # pointer types are not recommended)
ohair850fb252008-07-30 19:40:57 -0700532 CC_HIGHEST_EXTRAS += -xalias_level=basic
duke6e45e102007-12-01 00:00:00 +0000533 # Use intrinsic or inline versions for math/std functions
534 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700535 CC_HIGHEST_EXTRAS += -xbuiltin=%all
duke6e45e102007-12-01 00:00:00 +0000536 # Loop data dependency optimizations (need -xO3 or higher)
ohair850fb252008-07-30 19:40:57 -0700537 CC_HIGHEST_EXTRAS += -xdepend
duke6e45e102007-12-01 00:00:00 +0000538 # Pointer parameters to functions do not overlap
539 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
540 # If you pass in multiple pointers to the same data, do not use this)
ohair850fb252008-07-30 19:40:57 -0700541 CC_HIGHEST_EXTRAS += -xrestrict
duke6e45e102007-12-01 00:00:00 +0000542 # Inline some library routines
543 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700544 CC_HIGHEST_EXTRAS += -xlibmil
duke6e45e102007-12-01 00:00:00 +0000545 # Use optimized math routines
546 # (If you expect perfect errno behavior, do not use this)
547 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
ohair850fb252008-07-30 19:40:57 -0700548 # CC_HIGHEST_EXTRAS += -xlibmopt
duke6e45e102007-12-01 00:00:00 +0000549 ifeq ($(ARCH_FAMILY), sparc)
550 # Assume at most 8byte alignment, raise SIGBUS on error
551 ### Presents an ABI issue with customer JNI libs?
ohair850fb252008-07-30 19:40:57 -0700552 ####CC_HIGHEST_EXTRAS += -xmemalign=8s
duke6e45e102007-12-01 00:00:00 +0000553 # Automatic prefetch instructions, explicit prefetch macros
ohair850fb252008-07-30 19:40:57 -0700554 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit
duke6e45e102007-12-01 00:00:00 +0000555 # Pick ultra as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700556 CC_HIGHEST_EXTRAS += -xchip=ultra
duke6e45e102007-12-01 00:00:00 +0000557 endif
558 ifeq ($(ARCH), i586)
559 # Pick pentium as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700560 CC_HIGHEST_EXTRAS += -xchip=pentium
duke6e45e102007-12-01 00:00:00 +0000561 endif
562 ifdef LIBRARY
563 # The Solaris CBE (Common Build Environment) requires that the use
564 # of appl registers be disabled when compiling a public library (or
565 # a library that's loaded by a public library) on sparc.
566 CFLAGS_REQUIRED_sparc += -xregs=no%appl
567 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl
568 endif
569 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1)
duke6e45e102007-12-01 00:00:00 +0000570 # We MUST allow data alignment of 4 for sparc V8 (32bit)
571 # Presents an ABI issue with customer JNI libs? We must be able to
572 # to handle 4byte aligned objects? (rare occurance, but possible?)
573 CFLAGS_REQUIRED_sparc += -xmemalign=4s
574 endif
575 # Just incase someone trys to use the SOS9 compilers
576 ifeq ($(CC_VER), 5.6)
577 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
578 CFLAGS_REQUIRED_sparc += -xmemalign=4s
579 endif
580 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
581 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken.
582 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700583
584 # Add in keep frame options
585 CC_OPT/LOWER += $(CC_XKEEPFRAME_OPTIONS)
586 CC_OPT/HIGHER += $(CC_XKEEPFRAME_OPTIONS)
587 CC_OPT/HIGHEST += $(CC_XKEEPFRAME_OPTIONS)
588 CXX_OPT/LOWER += $(CXX_XKEEPFRAME_OPTIONS)
589 CXX_OPT/HIGHER += $(CXX_XKEEPFRAME_OPTIONS)
590 CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS)
591
592 # Add in highest optimization settings
593 CC_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
594 CXX_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
595
duke6e45e102007-12-01 00:00:00 +0000596endif
duke6e45e102007-12-01 00:00:00 +0000597
ohair850fb252008-07-30 19:40:57 -0700598# Default optimization settings based on level.
599CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
600CXX_OPT = $(CXX_OPT/$(OPTIMIZATION_LEVEL))
duke6e45e102007-12-01 00:00:00 +0000601
602# Flags required all the time
603CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
604
duke6e45e102007-12-01 00:00:00 +0000605#
606# Path and option to link against the VM, if you have to. Note that
607# there are libraries that link against only -ljava, but they do get
608# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
609# the library itself should not.
610#
611VM_NAME = server
612JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
613JAVALIB = -ljava $(JVMLIB)
614
615# Part of INCREMENTAL_BUILD mechanism.
616# Compiler emits things like: path/file.o: file.h
617# We want something like: relative_path/file.o relative_path/file.d: file.h
618# In addition on Solaris, any include file starting with / is deleted,
619# this gets rid of things like /usr/include files, which never change.
620CC_DEPEND = -xM1
621CC_DEPEND_FILTER = $(SED) -e '/:[ ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u
622
623# Location of openwin libraries (do we really need this anymore?)
624OPENWIN_HOME = /usr/openwin
625OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR)
626
627# Runtime graphics library search paths...
628OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR)
629AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB)
630
631# C++ Runtime library (libCrun.so), use instead of -lCrun.
632# Originally used instead of -lCrun to guarantee use of the system
633# .so version and not the .a or .so that came with the compilers.
634# With the newer compilers this could probably change back to -lCrun but
635# in general this is ok to continue to do.
636LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1
637
ceisserer93956ca2010-05-28 11:37:44 -0700638# JDK now requires Solaris 10, so pick up libm.so.2
639LIBM = /usr/lib$(ISA_DIR)/libm.so.2
duke6e45e102007-12-01 00:00:00 +0000640
641# Socket library
642LIBSOCKET = -lsocket
643
martind5089e02010-06-10 15:54:25 -0700644# Network Services library
645LIBNSL = -lnsl
646
duke6e45e102007-12-01 00:00:00 +0000647# GLOBAL_KPIC: If set means all libraries are PIC, position independent code
648# EXCEPT for select compiles
649# If a .o file is compiled non-PIC then it should be forced
650# into the RW data segment with a mapfile option. This is done
651# with object files which generated from .s files.
652# The -ztext enforces that no relocations remain in the text segment
653# so that it remains purely read-only for optimum system performance.
654# Some libraries may use a smaller size (13bit -Kpic) on sparc instead of
655# (32 bit -KPIC) and will override GLOBAL_KPIC appropriately.
656#
657PIC_CODE_LARGE = -KPIC
658PIC_CODE_SMALL = -Kpic
659ifndef TCOV_BUILD
660 GLOBAL_KPIC = $(PIC_CODE_LARGE)
661 CXXFLAGS_COMMON += $(GLOBAL_KPIC)
662 CFLAGS_COMMON += $(GLOBAL_KPIC)
663 LDFLAGS_COMMON += -ztext
664endif # TCOV_BUILD
665
666# If your platform has DPS, it will have Type1 fonts too, in which case
667# it is best to enable DPS support until such time as 2D's rasteriser
668# can fully handle Type1 fonts in all cases. Default is "yes".
669# HAVE_DPS should only be "no" if the platform has no DPS headers or libs
670# DPS (Displayable PostScript) is available on Solaris machines
671
672HAVE_DPS = yes
673
674#
675# Japanese manpages
676#
677JA_SOURCE_ENCODING = eucJP
678JA_TARGET_ENCODINGS = eucJP UTF-8 PCK
679
680# Settings for the JDI - Serviceability Agent binding.
681HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
682SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX)
683INCLUDE_SA=true
684