blob: 97b6a69e43dbf030c028c5264d3a93c1ee4aae9d [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001#
ohair2283b9d2010-05-25 15:58:33 -07002# Copyright (c) 1995, 2008, 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#
78# Default HPI libraries. Build will build only native unless
79# overriden at the make command line. This makes it convenient for
80# people doing, say, a pthreads port -- they can create a posix
81# directory here, and say "gnumake HPIS=posix" at the top
82# level.
83#
84HPIS = native
85
86#
87# Java default optimization (-x04/-O2) etc. Applies to the VM.
88#
ohair850fb252008-07-30 19:40:57 -070089ifndef OPTIMIZATION_LEVEL
90 ifeq ($(PRODUCT), java)
91 OPTIMIZATION_LEVEL = HIGHER
92 else
93 OPTIMIZATION_LEVEL = LOWER
94 endif
duke6e45e102007-12-01 00:00:00 +000095endif
ohairb99e3e32009-03-31 16:10:31 -070096ifndef FASTDEBUG_OPTIMIZATION_LEVEL
97 FASTDEBUG_OPTIMIZATION_LEVEL = LOWER
98endif
duke6e45e102007-12-01 00:00:00 +000099
100#
ohair850fb252008-07-30 19:40:57 -0700101# If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the
duke6e45e102007-12-01 00:00:00 +0000102# optimized build, and that ordering of the flags completely freaks
103# out cc. Hence, -Xa is instead in each CFLAGS variant.
104#
105# The more unusual options to the Sun C compiler:
106# -v Stricter type checking, more error checking
107# (To turn ALL warnings into fatals, use -errwarn=%all)
108# -xstrconst Place string literals and constants in read-only area
109# (means you can't write on your string literals)
110# -xs Force debug information (stabs) into the .so or a.out
111# (makes the library/executable debuggable without the
112# .o files needing to be around, but at a space cost)
113# -g & -O If you add the -g option to the optimized compiles
114# you will get better stack retraces, the code is
115# still optimized. This includes a space cost too.
116# -xc99=%none Do NOT allow for c99 extensions to be used.
117# e.g. declarations must precede statements
118# -xCC Allow the C++ style of comments in C: //
119# Required with many of the source files.
120# -mt Assume multi-threaded (important)
121#
ohairab4f1212008-07-27 18:42:57 -0700122# The more unusual options to the Sun C compiler:
123# +w Print more warnings
124# +w2 Maximum warnings
125#
duke6e45e102007-12-01 00:00:00 +0000126
127#
128# Debug flag for C and C++ compiler
129#
ohair850fb252008-07-30 19:40:57 -0700130CFLAGS_DEBUG_OPTION = -g $(CC_OPT/NONE)
131CXXFLAGS_DEBUG_OPTION = -g $(CXX_OPT/NONE)
duke6e45e102007-12-01 00:00:00 +0000132
133# Turn off -g if we are doing tcov build
134ifdef TCOV_BUILD
135 CFLAGS_DEBUG_OPTION=
136 CXXFLAGS_DEBUG_OPTION=
137endif
138
139# FASTDEBUG: Optimize the -g builds, gives us a faster debug java
140# If true adds -O to the debug compiles. This allows for any assert
141# tests to remain and debug checking. The resulting code is faster
142# but less debuggable. Stack traces are still valid, although only
143# approximate line numbers are given. Printing of local variables
144# during a debugging session is not possible, but stepping and
145# printing of global or static variables should be possible.
146# Performance/size of files should be about the same, maybe smaller.
147#
148ifeq ($(FASTDEBUG), true)
ohairb99e3e32009-03-31 16:10:31 -0700149 CFLAGS_DEBUG_OPTION = -g $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
150 CXXFLAGS_DEBUG_OPTION = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
duke6e45e102007-12-01 00:00:00 +0000151endif
152
ohairab4f1212008-07-27 18:42:57 -0700153CFLAGS_COMMON = -L$(OBJDIR)
154
155# Do not allow C99 language features like declarations in code etc.
156CFLAGS_COMMON += -xc99=%none
157
158# Allow C++ comments in C code
duke6e45e102007-12-01 00:00:00 +0000159CFLAGS_COMMON += -xCC
ohairab4f1212008-07-27 18:42:57 -0700160
161# Show error message tags on errors
162CFLAGS_COMMON += -errshort=tags
163CXXFLAGS_COMMON += -errtags=yes
164
165# Optimization flags
ohair850fb252008-07-30 19:40:57 -0700166CFLAGS_OPT = $(CC_OPT)
ohairab4f1212008-07-27 18:42:57 -0700167
168# Debug version flags
duke6e45e102007-12-01 00:00:00 +0000169CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION)
ohairab4f1212008-07-27 18:42:57 -0700170
171# Required C compiler flags
172CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED)
173
174# Maximum warnings all the time
175CXXFLAGS_COMMON += +w
176CFLAGS_COMMON += -v
duke6e45e102007-12-01 00:00:00 +0000177
178# Assume MT behavior all the time (important)
ohairab4f1212008-07-27 18:42:57 -0700179CXXFLAGS_COMMON += -mt
180CFLAGS_COMMON += -mt
duke6e45e102007-12-01 00:00:00 +0000181
182# Assume no C++ exceptions are used
183CXXFLAGS_COMMON += -features=no%except -DCC_NOEX
184
185# For C++, these options tell it to assume nothing about locating libraries
186# either at compile time, or at runtime. Use of these options will likely
187# require the use of -L and -R options to indicate where libraries will
188# be found at compile time (-L) and at runtime (-R).
189# The /usr/lib location comes for free, so no need to specify that one.
190# Note: C is much simplier and there is no need for these options. This
191# is mostly needed to avoid dependencies on libraries in the
192# Compiler install area, also see LIBCXX and LIBM.
193CXXFLAGS_COMMON += -norunpath -xnolib
194
195#
196# Treat compiler warnings as errors, if requested
197#
198ifeq ($(COMPILER_WARNINGS_FATAL),true)
199 CFLAGS_COMMON += -errwarn=%all
200 CXXFLAGS_COMMON += -errwarn=%all
201endif
202
ohair850fb252008-07-30 19:40:57 -0700203CXXFLAGS_OPT = $(CXX_OPT)
duke6e45e102007-12-01 00:00:00 +0000204CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION)
205CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
206
207# Add -xstrconst to the library compiles. This forces all string
208# literals into the read-only data section, which prevents them from
209# being written to and increases the runtime pages shared on the system.
210#
211ifdef LIBRARY
212 CFLAGS_COMMON +=-xstrconst
213endif
214
215# Source browser database
216#
217# COMPILE_WITH_SB
218# If defined adds -xsb to compiles and creates a
219# source browsing database during compilation.
220#
221ifdef COMPILE_WITH_SB
222 ifeq ($(LIBRARY), java)
223 CFLAGS_DBG += -xsb
224 endif
225endif
226
227# Lint Flags:
228# -Xa ANSI C plus K&R, favor ANSI rules
duke6e45e102007-12-01 00:00:00 +0000229# -fd report on old style func defs
230# -errchk=structarg report on 64bit struct args by value
231# -errchk=longptr64 report on 64bit to 32bit issues (ignores casts)
232# -errchk=parentheses report on suggested use of extra parens
233# -v suppress unused args
234# -x suppress unused externs
235# -u suppress extern func/vars used/defined
236# -errfmt=simple use one line errors with position info
ohair3f083862008-06-04 09:38:18 -0700237# $(LINT_XARCH_OPTION) See Compiler-sun.gwk
duke6e45e102007-12-01 00:00:00 +0000238
239LINTFLAGS_COMMON = -Xa
240LINTFLAGS_COMMON += -fd
241LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses
242LINTFLAGS_COMMON += -v
243LINTFLAGS_COMMON += -x
244LINTFLAGS_COMMON += -u
245LINTFLAGS_COMMON += -errfmt=simple
246LINTFLAGS_OPT =
247LINTFLAGS_DBG =
248
249# The -W0,-noglobal tells the compiler to NOT generate mangled global
250# ELF data symbols for file local static data.
251# This can break fix&continue, but we'd rather do the same compilations
252# for deliverable bits as we do for non-deliverable bits
253# Tell the compilers to never generate globalized names, all the time.
254CFLAGS_COMMON += -W0,-noglobal
255
ohair3f083862008-06-04 09:38:18 -0700256# If we have a specific arch value to use, add it
257CFLAGS_COMMON += $(XARCH_OPTION)
258CXXFLAGS_COMMON += $(XARCH_OPTION)
259ASFLAGS_COMMON += $(AS_XARCH_OPTION)
260EXTRA_LIBS += $(XARCH_OPTION)
261LINTFLAGS_COMMON += $(LINT_XARCH_OPTION)
duke6e45e102007-12-01 00:00:00 +0000262
263#
264# uncomment the following to build with PERTURBALOT set
265#
266# OTHER_CFLAGS += -DPERTURBALOT
267#
268
ohairab4f1212008-07-27 18:42:57 -0700269CPPFLAGS_COMMON = -D__solaris__ -D$(ARCH_FAMILY)
270CPPFLAGS_OPT = -DNDEBUG
duke6e45e102007-12-01 00:00:00 +0000271CPPFLAGS_DBG = -DDEBUG
272
ohair850fb252008-07-30 19:40:57 -0700273ifneq ($(PRODUCT), java)
274 CPPFLAGS_DBG += -DLOGGING -DDBINFO
275endif
276
duke6e45e102007-12-01 00:00:00 +0000277ifeq ($(ARCH_FAMILY), i586)
278 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
279 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
280 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
281 # Note: -Dmacro is the same as #define macro 1
282 # -Dmacro= is the same as #define macro
283 #
284 CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH)
285 # Turn off a superfluous compiler error message on Intel
286 CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE
287endif
288
289# Java memory management is based on memory mapping by default, but a
290# system only assuming malloc/free can be built by adding -DUSE_MALLOC
291
292CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS
293CPPFLAGS_OPT += -DTRIMMED
294
295LDFLAGS_DEFS_OPTION = -z defs
296LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
297
298#
299# -L paths for finding and -ljava
300#
301LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
302LDFLAGS_OPT =
303LDFLAGS_DBG =
304
305#
306# We never really want the incremental linker, ever
307# The -xildoff option tells Sun's compilers to NOT use incremental linker
308#
309LDFLAGS_COMMON += -xildoff
310
311ifdef LIBRARY
312 # Libraries need to locate other libraries at runtime, and you can tell
313 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
314 # buried inside the .so. The $ORIGIN says to look relative to where
315 # the library itself is and it can be followed with relative paths from
316 # that. By default we always look in $ORIGIN, optionally we add relative
317 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
318 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
319 # Try: 'dump -Lv lib*.so' to see these settings in a library.
320 #
321 LDFLAGS_COMMON += -R\$$ORIGIN
322 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%)
323endif
324
325EXTRA_LIBS += -lc
326
327# Postprocessing is done on the images directories only
328#
329ifeq ($(VARIANT), OPT)
330 ifeq ($(PARTIAL_GPROF), true)
331 NO_STRIP = true
332 endif
333 ifeq ($(GPROF), true)
334 NO_STRIP = true
335 endif
336 ifneq ($(NO_STRIP), true)
337 # Debug 'strip -x' leaves local function Elf symbols (better stack traces)
338 POST_STRIP_PROCESS = $(STRIP) -x
339 endif
340endif
341POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)"
342
343#
344# Sun C compiler will take -M and pass it on to ld.
345# Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o
346#
347ifeq ($(CC_VERSION),gcc)
348LD_MAPFILE_FLAG = -Xlinker -M -Xlinker
349else
350LD_MAPFILE_FLAG = -M
351endif
352
353#
354# Variables globally settable from the make command line (default
355# values in brackets):
356# GPROF (false)
357# Eg: % gnumake GPROF=true
358GPROF = false
359ifeq ($(GPROF), true)
360 CFLAGS_COMMON += -DGPROF -xpg
361 EXTRA_LIBS += -xpg
362endif
363
364# PARTIAL_GPROF is to be used ONLY during compilation - it should not
365# appear during linking of libraries or programs. It also should
366# prevent linking with -z defs to allow a symbol to remain undefined.
367#
368PARTIAL_GPROF = false
369ifeq ($(PARTIAL_GPROF), true)
370 CFLAGS_GPROF += -xpg
371 LDFLAGS_DEFS_OPTION = -z nodefs
372endif
373
374#
375# For a TCOV build we add in the TCOV_OPTION
376#
377ifdef TCOV_BUILD
378 TCOV_OPTION = -xprofile=tcov
379 LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic
380 CFLAGS_COMMON += $(TCOV_OPTION)
381 CXXFLAGS_COMMON += $(TCOV_OPTION)
382 EXTRA_LIBS += $(TCOV_OPTION)
383 LDNOMAP=true
384endif
385
386#
387# Solaris only uses native threads.
388#
389THREADS_FLAG= native
390THREADS_DIR= threads
391
392#
393# Support for Quantify.
394#
395ifdef QUANTIFY
396 QUANTIFY_CMD = quantify
397 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
398 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
399 ifdef LIBRARY
400 CFLAGS_COMMON += -K PIC
401 endif
402endif
403
404#
405# Support for Purify.
406#
407ifdef PURIFY
408 PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify
409 PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
410 LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS)
411 ifdef LIBRARY
412 CFLAGS_COMMON += -K PIC
413 endif
414endif
415
416#
417# Different "levels" of optimization.
418#
419ifeq ($(CC_VERSION),gcc)
ohair850fb252008-07-30 19:40:57 -0700420
421 CC_OPT/NONE =
422 CC_OPT/LOWER = -O2
423 CC_OPT/HIGHER = -O3
424 CC_OPT/HIGHEST = -O3
425
426 CXX_OPT/NONE =
427 CXX_OPT/LOWER = -O2
428 CXX_OPT/HIGHER = -O3
429 CXX_OPT/HIGHEST = -O3
430
duke6e45e102007-12-01 00:00:00 +0000431 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer
432 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer
ohair850fb252008-07-30 19:40:57 -0700433
duke6e45e102007-12-01 00:00:00 +0000434 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
435 # (See Rules.gmk) May need to wait for gcc 5?
436 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700437
duke6e45e102007-12-01 00:00:00 +0000438else
ohair850fb252008-07-30 19:40:57 -0700439
duke6e45e102007-12-01 00:00:00 +0000440 # Highest could be -xO5, but indications are that -xO5 should be reserved
441 # for a per-file use, on sources with known performance impacts.
ohair850fb252008-07-30 19:40:57 -0700442 OPT_LEVEL/LOWER = 2
443 OPT_LEVEL/HIGHER = 4
444 OPT_LEVEL/HIGHEST = 4
445
446 CC_OPT/NONE =
447 CC_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
448 CC_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
449 CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
450
451 CXX_OPT/NONE =
452 CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
453 CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
454 CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
455
456 # We need stack frames at all times
457 USE_XKEEPFRAME_OPTION = false
458 ifeq ($(USE_XKEEPFRAME_OPTION),true)
459
460 # Unknown spelling on this option at this time (Maybe in SS13?)
461 CC_XKEEPFRAME_OPTIONS = -xkeepframe
462 CXX_XKEEPFRAME_OPTIONS = -xkeepframe
463
464 else
465
466 # On X86, make sure tail call optimization is off
467 # The z and y are the tail call optimizations.
468 ifeq ($(ARCH_FAMILY), i586)
469 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.8), 1)
470 # Somehow, tail call optimization is creeping in.
471 # Make sure it is off.
472 # WARNING: These may cause compiler warnings about duplicate -O options
473 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
474 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
475 endif
476 endif
477
478 # On i586 we need to tell the code generator to ALWAYS use a
479 # frame pointer.
480 ifeq ($(ARCH_FAMILY), i586)
481 # Note that in 5.7, this is done with -xregs=no%frameptr
482 ifeq ($(CC_VER), 5.5)
483 # It's not exactly clear when this optimization kicks in, the
484 # current assumption is -xO4 or greater and for C++ with
485 # the -features=no%except option and -xO4 and greater.
486 # Bottom line is, we ALWAYS want a frame pointer!
487 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B
488 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B
489 endif
490 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1)
491 # Do NOT use frame pointer register as a general purpose opt register
492 CC_OPT/NONE += -xregs=no%frameptr
493 CXX_OPT/NONE += -xregs=no%frameptr
494 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
495 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
496 endif
497 endif
498
499 # Optimizer for sparc needs to be told not to do certain things
500 # related to frames or save instructions.
501 ifeq ($(ARCH_FAMILY), sparc)
502 # Do not use save instructions instead of add instructions
503 # This was an optimization starting in SC5.0 that made it hard for us to
504 # find the "save" instruction (which got turned into an "add")
505 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s
506 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s
507 # Don't allow tail call code optimization. Started in SC5.0.
508 # We don't like code of this form:
509 # save
510 # <code>
511 # call foo
512 # restore
513 # because we can't tell if the method will have a stack frame
514 # and register windows or not.
515 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0
516 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0
517 endif
518
519 endif
520
521 # Extra options used with HIGHEST
duke6e45e102007-12-01 00:00:00 +0000522 #
ohair850fb252008-07-30 19:40:57 -0700523 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
duke6e45e102007-12-01 00:00:00 +0000524 # done with care, there are some assumptions below that need to
525 # be understood about the use of pointers, and IEEE behavior.
526 #
527 # Use non-standard floating point mode (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700528 CC_HIGHEST_EXTRAS += -fns
duke6e45e102007-12-01 00:00:00 +0000529 # Do some simplification of floating point arithmetic (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700530 CC_HIGHEST_EXTRAS += -fsimple
duke6e45e102007-12-01 00:00:00 +0000531 # Use single precision floating point with 'float'
ohair850fb252008-07-30 19:40:57 -0700532 CC_HIGHEST_EXTRAS += -fsingle
duke6e45e102007-12-01 00:00:00 +0000533 # Assume memory references via basic pointer types do not alias
534 # (Source with excessing pointer casting and data access with mixed
535 # pointer types are not recommended)
ohair850fb252008-07-30 19:40:57 -0700536 CC_HIGHEST_EXTRAS += -xalias_level=basic
duke6e45e102007-12-01 00:00:00 +0000537 # Use intrinsic or inline versions for math/std functions
538 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700539 CC_HIGHEST_EXTRAS += -xbuiltin=%all
duke6e45e102007-12-01 00:00:00 +0000540 # Loop data dependency optimizations (need -xO3 or higher)
ohair850fb252008-07-30 19:40:57 -0700541 CC_HIGHEST_EXTRAS += -xdepend
duke6e45e102007-12-01 00:00:00 +0000542 # Pointer parameters to functions do not overlap
543 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
544 # If you pass in multiple pointers to the same data, do not use this)
ohair850fb252008-07-30 19:40:57 -0700545 CC_HIGHEST_EXTRAS += -xrestrict
duke6e45e102007-12-01 00:00:00 +0000546 # Inline some library routines
547 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700548 CC_HIGHEST_EXTRAS += -xlibmil
duke6e45e102007-12-01 00:00:00 +0000549 # Use optimized math routines
550 # (If you expect perfect errno behavior, do not use this)
551 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
ohair850fb252008-07-30 19:40:57 -0700552 # CC_HIGHEST_EXTRAS += -xlibmopt
duke6e45e102007-12-01 00:00:00 +0000553 ifeq ($(ARCH_FAMILY), sparc)
554 # Assume at most 8byte alignment, raise SIGBUS on error
555 ### Presents an ABI issue with customer JNI libs?
ohair850fb252008-07-30 19:40:57 -0700556 ####CC_HIGHEST_EXTRAS += -xmemalign=8s
duke6e45e102007-12-01 00:00:00 +0000557 # Automatic prefetch instructions, explicit prefetch macros
ohair850fb252008-07-30 19:40:57 -0700558 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit
duke6e45e102007-12-01 00:00:00 +0000559 # Pick ultra as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700560 CC_HIGHEST_EXTRAS += -xchip=ultra
duke6e45e102007-12-01 00:00:00 +0000561 endif
562 ifeq ($(ARCH), i586)
563 # Pick pentium as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700564 CC_HIGHEST_EXTRAS += -xchip=pentium
duke6e45e102007-12-01 00:00:00 +0000565 endif
566 ifdef LIBRARY
567 # The Solaris CBE (Common Build Environment) requires that the use
568 # of appl registers be disabled when compiling a public library (or
569 # a library that's loaded by a public library) on sparc.
570 CFLAGS_REQUIRED_sparc += -xregs=no%appl
571 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl
572 endif
573 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1)
duke6e45e102007-12-01 00:00:00 +0000574 # We MUST allow data alignment of 4 for sparc V8 (32bit)
575 # Presents an ABI issue with customer JNI libs? We must be able to
576 # to handle 4byte aligned objects? (rare occurance, but possible?)
577 CFLAGS_REQUIRED_sparc += -xmemalign=4s
578 endif
579 # Just incase someone trys to use the SOS9 compilers
580 ifeq ($(CC_VER), 5.6)
581 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
582 CFLAGS_REQUIRED_sparc += -xmemalign=4s
583 endif
584 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
585 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken.
586 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700587
588 # Add in keep frame options
589 CC_OPT/LOWER += $(CC_XKEEPFRAME_OPTIONS)
590 CC_OPT/HIGHER += $(CC_XKEEPFRAME_OPTIONS)
591 CC_OPT/HIGHEST += $(CC_XKEEPFRAME_OPTIONS)
592 CXX_OPT/LOWER += $(CXX_XKEEPFRAME_OPTIONS)
593 CXX_OPT/HIGHER += $(CXX_XKEEPFRAME_OPTIONS)
594 CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS)
595
596 # Add in highest optimization settings
597 CC_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
598 CXX_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
599
duke6e45e102007-12-01 00:00:00 +0000600endif
duke6e45e102007-12-01 00:00:00 +0000601
ohair850fb252008-07-30 19:40:57 -0700602# Default optimization settings based on level.
603CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
604CXX_OPT = $(CXX_OPT/$(OPTIMIZATION_LEVEL))
duke6e45e102007-12-01 00:00:00 +0000605
606# Flags required all the time
607CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
608
duke6e45e102007-12-01 00:00:00 +0000609#
610# Path and option to link against the VM, if you have to. Note that
611# there are libraries that link against only -ljava, but they do get
612# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
613# the library itself should not.
614#
615VM_NAME = server
616JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
617JAVALIB = -ljava $(JVMLIB)
618
619# Part of INCREMENTAL_BUILD mechanism.
620# Compiler emits things like: path/file.o: file.h
621# We want something like: relative_path/file.o relative_path/file.d: file.h
622# In addition on Solaris, any include file starting with / is deleted,
623# this gets rid of things like /usr/include files, which never change.
624CC_DEPEND = -xM1
625CC_DEPEND_FILTER = $(SED) -e '/:[ ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u
626
627# Location of openwin libraries (do we really need this anymore?)
628OPENWIN_HOME = /usr/openwin
629OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR)
630
631# Runtime graphics library search paths...
632OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR)
633AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB)
634
635# C++ Runtime library (libCrun.so), use instead of -lCrun.
636# Originally used instead of -lCrun to guarantee use of the system
637# .so version and not the .a or .so that came with the compilers.
638# With the newer compilers this could probably change back to -lCrun but
639# in general this is ok to continue to do.
640LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1
641
ceisserer93956ca2010-05-28 11:37:44 -0700642# JDK now requires Solaris 10, so pick up libm.so.2
643LIBM = /usr/lib$(ISA_DIR)/libm.so.2
duke6e45e102007-12-01 00:00:00 +0000644
645# Socket library
646LIBSOCKET = -lsocket
647
martind5089e02010-06-10 15:54:25 -0700648# Network Services library
649LIBNSL = -lnsl
650
duke6e45e102007-12-01 00:00:00 +0000651# GLOBAL_KPIC: If set means all libraries are PIC, position independent code
652# EXCEPT for select compiles
653# If a .o file is compiled non-PIC then it should be forced
654# into the RW data segment with a mapfile option. This is done
655# with object files which generated from .s files.
656# The -ztext enforces that no relocations remain in the text segment
657# so that it remains purely read-only for optimum system performance.
658# Some libraries may use a smaller size (13bit -Kpic) on sparc instead of
659# (32 bit -KPIC) and will override GLOBAL_KPIC appropriately.
660#
661PIC_CODE_LARGE = -KPIC
662PIC_CODE_SMALL = -Kpic
663ifndef TCOV_BUILD
664 GLOBAL_KPIC = $(PIC_CODE_LARGE)
665 CXXFLAGS_COMMON += $(GLOBAL_KPIC)
666 CFLAGS_COMMON += $(GLOBAL_KPIC)
667 LDFLAGS_COMMON += -ztext
668endif # TCOV_BUILD
669
670# If your platform has DPS, it will have Type1 fonts too, in which case
671# it is best to enable DPS support until such time as 2D's rasteriser
672# can fully handle Type1 fonts in all cases. Default is "yes".
673# HAVE_DPS should only be "no" if the platform has no DPS headers or libs
674# DPS (Displayable PostScript) is available on Solaris machines
675
676HAVE_DPS = yes
677
678#
679# Japanese manpages
680#
681JA_SOURCE_ENCODING = eucJP
682JA_TARGET_ENCODINGS = eucJP UTF-8 PCK
683
684# Settings for the JDI - Serviceability Agent binding.
685HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
686SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX)
687INCLUDE_SA=true
688