blob: aae69291a5ffd81ce9cc296048d834f0852c45a8 [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!
duke6e45e102007-12-01 00:00:00 +000075
dcubed46b99222011-09-20 19:16:21 -070076ifdef ENABLE_FULL_DEBUG_SYMBOLS
77# Only check for Full Debug Symbols support on Solaris if it is
78# specifically enabled. Hopefully, it can be enabled by default
79# once the .debuginfo size issues are worked out.
80
81# Default OBJCOPY comes from the SUNWbinutils package:
82DEF_OBJCOPY=/usr/sfw/bin/gobjcopy
83ifeq ($(PLATFORM)-$(LIBARCH), solaris-amd64)
84 # On Solaris AMD64/X64, gobjcopy is not happy and fails:
85 #
86 # usr/sfw/bin/gobjcopy --add-gnu-debuglink=<lib>.debuginfo <lib>.so
87 # BFD: stKPaiop: Not enough room for program headers, try linking with -N
88 # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
89 # BFD: stKPaiop: Not enough room for program headers, try linking with -N
90 # /usr/sfw/bin/gobjcopy: libsaproc.debuginfo: Bad value
91 # BFD: stKPaiop: Not enough room for program headers, try linking with -N
92 # /usr/sfw/bin/gobjcopy: stKPaiop: Bad value
93 _JUNK_ := $(shell \
94 echo >&2 "INFO: $(DEF_OBJCOPY) is not working on Solaris AMD64/X64")
95 OBJCOPY=
96else
97 OBJCOPY=$(shell test -x $(DEF_OBJCOPY) && echo $(DEF_OBJCOPY))
98 ifneq ($(ALT_OBJCOPY),)
99 _JUNK_ := $(shell echo >&2 "INFO: ALT_OBJCOPY=$(ALT_OBJCOPY)")
100 # disable .debuginfo support by setting ALT_OBJCOPY to a non-existent path
101 OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
102 endif
103endif
104
105ifdef LIBRARY_SUPPORTS_FULL_DEBUG_SYMBOLS
106# The setting of OBJCOPY above enables the JDK build to import
107# .debuginfo files from the HotSpot build. However, adding FDS
108# support to the JDK build will occur in phases so a different
109# make variable is used to indicate that a particular library
110# supports FDS.
111
112ifeq ($(OBJCOPY),)
113 _JUNK_ := $(shell \
114 echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files.")
115else
116 _JUNK_ := $(shell \
117 echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.")
118
119 # Library stripping policies for .debuginfo configs:
120 # all_strip - strips everything from the library
121 # min_strip - strips most stuff from the library; leaves minimum symbols
122 # no_strip - does not strip the library at all
123 #
124 # Oracle security policy requires "all_strip". A waiver was granted on
125 # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE.
126 #
127 DEF_STRIP_POLICY="min_strip"
128 ifeq ($(ALT_STRIP_POLICY),)
129 STRIP_POLICY=$(DEF_STRIP_POLICY)
130 else
131 STRIP_POLICY=$(ALT_STRIP_POLICY)
132 endif
133 _JUNK_ := $(shell \
134 echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)")
135endif
136endif
137endif
138
duke6e45e102007-12-01 00:00:00 +0000139#
duke6e45e102007-12-01 00:00:00 +0000140# Java default optimization (-x04/-O2) etc. Applies to the VM.
141#
ohair850fb252008-07-30 19:40:57 -0700142ifndef OPTIMIZATION_LEVEL
143 ifeq ($(PRODUCT), java)
144 OPTIMIZATION_LEVEL = HIGHER
145 else
146 OPTIMIZATION_LEVEL = LOWER
147 endif
duke6e45e102007-12-01 00:00:00 +0000148endif
ohairb99e3e32009-03-31 16:10:31 -0700149ifndef FASTDEBUG_OPTIMIZATION_LEVEL
150 FASTDEBUG_OPTIMIZATION_LEVEL = LOWER
151endif
duke6e45e102007-12-01 00:00:00 +0000152
153#
ohair850fb252008-07-30 19:40:57 -0700154# If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the
duke6e45e102007-12-01 00:00:00 +0000155# optimized build, and that ordering of the flags completely freaks
156# out cc. Hence, -Xa is instead in each CFLAGS variant.
157#
158# The more unusual options to the Sun C compiler:
159# -v Stricter type checking, more error checking
160# (To turn ALL warnings into fatals, use -errwarn=%all)
161# -xstrconst Place string literals and constants in read-only area
162# (means you can't write on your string literals)
163# -xs Force debug information (stabs) into the .so or a.out
164# (makes the library/executable debuggable without the
165# .o files needing to be around, but at a space cost)
166# -g & -O If you add the -g option to the optimized compiles
167# you will get better stack retraces, the code is
168# still optimized. This includes a space cost too.
169# -xc99=%none Do NOT allow for c99 extensions to be used.
170# e.g. declarations must precede statements
171# -xCC Allow the C++ style of comments in C: //
172# Required with many of the source files.
173# -mt Assume multi-threaded (important)
174#
ohairab4f1212008-07-27 18:42:57 -0700175# The more unusual options to the Sun C compiler:
176# +w Print more warnings
177# +w2 Maximum warnings
178#
duke6e45e102007-12-01 00:00:00 +0000179
180#
181# Debug flag for C and C++ compiler
182#
ohair850fb252008-07-30 19:40:57 -0700183CFLAGS_DEBUG_OPTION = -g $(CC_OPT/NONE)
184CXXFLAGS_DEBUG_OPTION = -g $(CXX_OPT/NONE)
duke6e45e102007-12-01 00:00:00 +0000185
186# Turn off -g if we are doing tcov build
187ifdef TCOV_BUILD
188 CFLAGS_DEBUG_OPTION=
189 CXXFLAGS_DEBUG_OPTION=
190endif
191
192# FASTDEBUG: Optimize the -g builds, gives us a faster debug java
193# If true adds -O to the debug compiles. This allows for any assert
194# tests to remain and debug checking. The resulting code is faster
195# but less debuggable. Stack traces are still valid, although only
196# approximate line numbers are given. Printing of local variables
197# during a debugging session is not possible, but stepping and
198# printing of global or static variables should be possible.
199# Performance/size of files should be about the same, maybe smaller.
200#
201ifeq ($(FASTDEBUG), true)
ohairb99e3e32009-03-31 16:10:31 -0700202 CFLAGS_DEBUG_OPTION = -g $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
203 CXXFLAGS_DEBUG_OPTION = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL))
duke6e45e102007-12-01 00:00:00 +0000204endif
205
ohairab4f1212008-07-27 18:42:57 -0700206CFLAGS_COMMON = -L$(OBJDIR)
207
208# Do not allow C99 language features like declarations in code etc.
209CFLAGS_COMMON += -xc99=%none
210
211# Allow C++ comments in C code
duke6e45e102007-12-01 00:00:00 +0000212CFLAGS_COMMON += -xCC
ohairab4f1212008-07-27 18:42:57 -0700213
214# Show error message tags on errors
215CFLAGS_COMMON += -errshort=tags
216CXXFLAGS_COMMON += -errtags=yes
217
218# Optimization flags
ohair850fb252008-07-30 19:40:57 -0700219CFLAGS_OPT = $(CC_OPT)
ohairab4f1212008-07-27 18:42:57 -0700220
221# Debug version flags
duke6e45e102007-12-01 00:00:00 +0000222CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION)
ohairab4f1212008-07-27 18:42:57 -0700223
224# Required C compiler flags
225CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED)
226
227# Maximum warnings all the time
228CXXFLAGS_COMMON += +w
229CFLAGS_COMMON += -v
duke6e45e102007-12-01 00:00:00 +0000230
231# Assume MT behavior all the time (important)
ohairab4f1212008-07-27 18:42:57 -0700232CXXFLAGS_COMMON += -mt
233CFLAGS_COMMON += -mt
duke6e45e102007-12-01 00:00:00 +0000234
235# Assume no C++ exceptions are used
236CXXFLAGS_COMMON += -features=no%except -DCC_NOEX
237
238# For C++, these options tell it to assume nothing about locating libraries
239# either at compile time, or at runtime. Use of these options will likely
240# require the use of -L and -R options to indicate where libraries will
241# be found at compile time (-L) and at runtime (-R).
242# The /usr/lib location comes for free, so no need to specify that one.
243# Note: C is much simplier and there is no need for these options. This
244# is mostly needed to avoid dependencies on libraries in the
245# Compiler install area, also see LIBCXX and LIBM.
246CXXFLAGS_COMMON += -norunpath -xnolib
247
248#
249# Treat compiler warnings as errors, if requested
250#
251ifeq ($(COMPILER_WARNINGS_FATAL),true)
252 CFLAGS_COMMON += -errwarn=%all
253 CXXFLAGS_COMMON += -errwarn=%all
254endif
255
ohair850fb252008-07-30 19:40:57 -0700256CXXFLAGS_OPT = $(CXX_OPT)
duke6e45e102007-12-01 00:00:00 +0000257CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION)
258CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
259
260# Add -xstrconst to the library compiles. This forces all string
261# literals into the read-only data section, which prevents them from
262# being written to and increases the runtime pages shared on the system.
263#
264ifdef LIBRARY
265 CFLAGS_COMMON +=-xstrconst
266endif
267
268# Source browser database
269#
270# COMPILE_WITH_SB
271# If defined adds -xsb to compiles and creates a
272# source browsing database during compilation.
273#
274ifdef COMPILE_WITH_SB
275 ifeq ($(LIBRARY), java)
276 CFLAGS_DBG += -xsb
277 endif
278endif
279
280# Lint Flags:
281# -Xa ANSI C plus K&R, favor ANSI rules
duke6e45e102007-12-01 00:00:00 +0000282# -fd report on old style func defs
283# -errchk=structarg report on 64bit struct args by value
284# -errchk=longptr64 report on 64bit to 32bit issues (ignores casts)
285# -errchk=parentheses report on suggested use of extra parens
286# -v suppress unused args
287# -x suppress unused externs
288# -u suppress extern func/vars used/defined
289# -errfmt=simple use one line errors with position info
ohair3f083862008-06-04 09:38:18 -0700290# $(LINT_XARCH_OPTION) See Compiler-sun.gwk
duke6e45e102007-12-01 00:00:00 +0000291
292LINTFLAGS_COMMON = -Xa
293LINTFLAGS_COMMON += -fd
294LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses
295LINTFLAGS_COMMON += -v
296LINTFLAGS_COMMON += -x
297LINTFLAGS_COMMON += -u
298LINTFLAGS_COMMON += -errfmt=simple
299LINTFLAGS_OPT =
300LINTFLAGS_DBG =
301
302# The -W0,-noglobal tells the compiler to NOT generate mangled global
303# ELF data symbols for file local static data.
304# This can break fix&continue, but we'd rather do the same compilations
305# for deliverable bits as we do for non-deliverable bits
306# Tell the compilers to never generate globalized names, all the time.
307CFLAGS_COMMON += -W0,-noglobal
308
ohair3f083862008-06-04 09:38:18 -0700309# If we have a specific arch value to use, add it
310CFLAGS_COMMON += $(XARCH_OPTION)
311CXXFLAGS_COMMON += $(XARCH_OPTION)
312ASFLAGS_COMMON += $(AS_XARCH_OPTION)
313EXTRA_LIBS += $(XARCH_OPTION)
314LINTFLAGS_COMMON += $(LINT_XARCH_OPTION)
duke6e45e102007-12-01 00:00:00 +0000315
316#
317# uncomment the following to build with PERTURBALOT set
318#
319# OTHER_CFLAGS += -DPERTURBALOT
320#
321
ohairab4f1212008-07-27 18:42:57 -0700322CPPFLAGS_COMMON = -D__solaris__ -D$(ARCH_FAMILY)
323CPPFLAGS_OPT = -DNDEBUG
duke6e45e102007-12-01 00:00:00 +0000324CPPFLAGS_DBG = -DDEBUG
325
ohair850fb252008-07-30 19:40:57 -0700326ifneq ($(PRODUCT), java)
327 CPPFLAGS_DBG += -DLOGGING -DDBINFO
328endif
329
duke6e45e102007-12-01 00:00:00 +0000330ifeq ($(ARCH_FAMILY), i586)
331 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
332 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
333 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
334 # Note: -Dmacro is the same as #define macro 1
335 # -Dmacro= is the same as #define macro
336 #
337 CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH)
338 # Turn off a superfluous compiler error message on Intel
339 CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE
340endif
341
342# Java memory management is based on memory mapping by default, but a
343# system only assuming malloc/free can be built by adding -DUSE_MALLOC
344
345CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS
346CPPFLAGS_OPT += -DTRIMMED
347
348LDFLAGS_DEFS_OPTION = -z defs
349LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
350
351#
352# -L paths for finding and -ljava
353#
354LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
355LDFLAGS_OPT =
356LDFLAGS_DBG =
357
358#
359# We never really want the incremental linker, ever
360# The -xildoff option tells Sun's compilers to NOT use incremental linker
361#
362LDFLAGS_COMMON += -xildoff
363
364ifdef LIBRARY
365 # Libraries need to locate other libraries at runtime, and you can tell
366 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
367 # buried inside the .so. The $ORIGIN says to look relative to where
368 # the library itself is and it can be followed with relative paths from
369 # that. By default we always look in $ORIGIN, optionally we add relative
370 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
371 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
372 # Try: 'dump -Lv lib*.so' to see these settings in a library.
373 #
374 LDFLAGS_COMMON += -R\$$ORIGIN
375 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%)
376endif
377
378EXTRA_LIBS += -lc
379
380# Postprocessing is done on the images directories only
381#
382ifeq ($(VARIANT), OPT)
383 ifeq ($(PARTIAL_GPROF), true)
384 NO_STRIP = true
385 endif
386 ifeq ($(GPROF), true)
387 NO_STRIP = true
388 endif
389 ifneq ($(NO_STRIP), true)
390 # Debug 'strip -x' leaves local function Elf symbols (better stack traces)
391 POST_STRIP_PROCESS = $(STRIP) -x
392 endif
393endif
394POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)"
395
396#
397# Sun C compiler will take -M and pass it on to ld.
398# Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o
399#
400ifeq ($(CC_VERSION),gcc)
401LD_MAPFILE_FLAG = -Xlinker -M -Xlinker
402else
403LD_MAPFILE_FLAG = -M
404endif
405
406#
407# Variables globally settable from the make command line (default
408# values in brackets):
409# GPROF (false)
410# Eg: % gnumake GPROF=true
411GPROF = false
412ifeq ($(GPROF), true)
413 CFLAGS_COMMON += -DGPROF -xpg
414 EXTRA_LIBS += -xpg
415endif
416
417# PARTIAL_GPROF is to be used ONLY during compilation - it should not
418# appear during linking of libraries or programs. It also should
419# prevent linking with -z defs to allow a symbol to remain undefined.
420#
421PARTIAL_GPROF = false
422ifeq ($(PARTIAL_GPROF), true)
423 CFLAGS_GPROF += -xpg
424 LDFLAGS_DEFS_OPTION = -z nodefs
425endif
426
427#
428# For a TCOV build we add in the TCOV_OPTION
429#
430ifdef TCOV_BUILD
431 TCOV_OPTION = -xprofile=tcov
432 LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic
433 CFLAGS_COMMON += $(TCOV_OPTION)
434 CXXFLAGS_COMMON += $(TCOV_OPTION)
435 EXTRA_LIBS += $(TCOV_OPTION)
436 LDNOMAP=true
437endif
438
439#
440# Solaris only uses native threads.
441#
442THREADS_FLAG= native
443THREADS_DIR= threads
444
445#
446# Support for Quantify.
447#
448ifdef QUANTIFY
449 QUANTIFY_CMD = quantify
450 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
451 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
452 ifdef LIBRARY
453 CFLAGS_COMMON += -K PIC
454 endif
455endif
456
457#
458# Support for Purify.
459#
460ifdef PURIFY
461 PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify
462 PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
463 LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS)
464 ifdef LIBRARY
465 CFLAGS_COMMON += -K PIC
466 endif
467endif
468
469#
470# Different "levels" of optimization.
471#
472ifeq ($(CC_VERSION),gcc)
ohair850fb252008-07-30 19:40:57 -0700473
474 CC_OPT/NONE =
475 CC_OPT/LOWER = -O2
476 CC_OPT/HIGHER = -O3
477 CC_OPT/HIGHEST = -O3
478
479 CXX_OPT/NONE =
480 CXX_OPT/LOWER = -O2
481 CXX_OPT/HIGHER = -O3
482 CXX_OPT/HIGHEST = -O3
483
duke6e45e102007-12-01 00:00:00 +0000484 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer
485 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer
ohair850fb252008-07-30 19:40:57 -0700486
duke6e45e102007-12-01 00:00:00 +0000487 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
488 # (See Rules.gmk) May need to wait for gcc 5?
489 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700490
duke6e45e102007-12-01 00:00:00 +0000491else
ohair850fb252008-07-30 19:40:57 -0700492
duke6e45e102007-12-01 00:00:00 +0000493 # Highest could be -xO5, but indications are that -xO5 should be reserved
494 # for a per-file use, on sources with known performance impacts.
ohair850fb252008-07-30 19:40:57 -0700495 OPT_LEVEL/LOWER = 2
496 OPT_LEVEL/HIGHER = 4
497 OPT_LEVEL/HIGHEST = 4
498
499 CC_OPT/NONE =
500 CC_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
501 CC_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
502 CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
503
504 CXX_OPT/NONE =
505 CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
506 CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
507 CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
508
509 # We need stack frames at all times
510 USE_XKEEPFRAME_OPTION = false
511 ifeq ($(USE_XKEEPFRAME_OPTION),true)
512
513 # Unknown spelling on this option at this time (Maybe in SS13?)
514 CC_XKEEPFRAME_OPTIONS = -xkeepframe
515 CXX_XKEEPFRAME_OPTIONS = -xkeepframe
516
517 else
518
519 # On X86, make sure tail call optimization is off
520 # The z and y are the tail call optimizations.
521 ifeq ($(ARCH_FAMILY), i586)
ohaire74b8592011-04-21 18:26:04 -0700522 CC_NEWER_THAN_58 := \
523 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
524 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 8 \) )
525 ifeq ($(CC_NEWER_THAN_58),1)
526 # Somehow, tail call optimization is creeping in.
527 # Make sure it is off.
528 # WARNING: These may cause compiler warnings about duplicate -O options
529 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
530 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
ohair850fb252008-07-30 19:40:57 -0700531 endif
532 endif
533
534 # On i586 we need to tell the code generator to ALWAYS use a
535 # frame pointer.
536 ifeq ($(ARCH_FAMILY), i586)
537 # Note that in 5.7, this is done with -xregs=no%frameptr
538 ifeq ($(CC_VER), 5.5)
539 # It's not exactly clear when this optimization kicks in, the
540 # current assumption is -xO4 or greater and for C++ with
541 # the -features=no%except option and -xO4 and greater.
542 # Bottom line is, we ALWAYS want a frame pointer!
543 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B
544 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B
545 endif
bae39abd752010-12-05 15:51:31 +0300546
ohaire74b8592011-04-21 18:26:04 -0700547 CC_NEWER_THAN_56 := \
548 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
549 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
550 ifeq ($(CC_NEWER_THAN_56),1)
551 # Do NOT use frame pointer register as a general purpose opt register
552 CC_OPT/NONE += -xregs=no%frameptr
553 CXX_OPT/NONE += -xregs=no%frameptr
554 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
555 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
ohair850fb252008-07-30 19:40:57 -0700556 endif
557 endif
558
559 # Optimizer for sparc needs to be told not to do certain things
560 # related to frames or save instructions.
561 ifeq ($(ARCH_FAMILY), sparc)
562 # Do not use save instructions instead of add instructions
563 # This was an optimization starting in SC5.0 that made it hard for us to
564 # find the "save" instruction (which got turned into an "add")
565 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s
566 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s
567 # Don't allow tail call code optimization. Started in SC5.0.
568 # We don't like code of this form:
569 # save
570 # <code>
571 # call foo
572 # restore
573 # because we can't tell if the method will have a stack frame
574 # and register windows or not.
575 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0
576 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0
577 endif
578
579 endif
580
581 # Extra options used with HIGHEST
duke6e45e102007-12-01 00:00:00 +0000582 #
ohair850fb252008-07-30 19:40:57 -0700583 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
duke6e45e102007-12-01 00:00:00 +0000584 # done with care, there are some assumptions below that need to
585 # be understood about the use of pointers, and IEEE behavior.
586 #
587 # Use non-standard floating point mode (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700588 CC_HIGHEST_EXTRAS += -fns
duke6e45e102007-12-01 00:00:00 +0000589 # Do some simplification of floating point arithmetic (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700590 CC_HIGHEST_EXTRAS += -fsimple
duke6e45e102007-12-01 00:00:00 +0000591 # Use single precision floating point with 'float'
ohair850fb252008-07-30 19:40:57 -0700592 CC_HIGHEST_EXTRAS += -fsingle
duke6e45e102007-12-01 00:00:00 +0000593 # Assume memory references via basic pointer types do not alias
594 # (Source with excessing pointer casting and data access with mixed
595 # pointer types are not recommended)
ohair850fb252008-07-30 19:40:57 -0700596 CC_HIGHEST_EXTRAS += -xalias_level=basic
duke6e45e102007-12-01 00:00:00 +0000597 # Use intrinsic or inline versions for math/std functions
598 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700599 CC_HIGHEST_EXTRAS += -xbuiltin=%all
duke6e45e102007-12-01 00:00:00 +0000600 # Loop data dependency optimizations (need -xO3 or higher)
ohair850fb252008-07-30 19:40:57 -0700601 CC_HIGHEST_EXTRAS += -xdepend
duke6e45e102007-12-01 00:00:00 +0000602 # Pointer parameters to functions do not overlap
603 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
604 # If you pass in multiple pointers to the same data, do not use this)
ohair850fb252008-07-30 19:40:57 -0700605 CC_HIGHEST_EXTRAS += -xrestrict
duke6e45e102007-12-01 00:00:00 +0000606 # Inline some library routines
607 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700608 CC_HIGHEST_EXTRAS += -xlibmil
duke6e45e102007-12-01 00:00:00 +0000609 # Use optimized math routines
610 # (If you expect perfect errno behavior, do not use this)
611 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
ohair850fb252008-07-30 19:40:57 -0700612 # CC_HIGHEST_EXTRAS += -xlibmopt
duke6e45e102007-12-01 00:00:00 +0000613 ifeq ($(ARCH_FAMILY), sparc)
614 # Assume at most 8byte alignment, raise SIGBUS on error
615 ### Presents an ABI issue with customer JNI libs?
ohair850fb252008-07-30 19:40:57 -0700616 ####CC_HIGHEST_EXTRAS += -xmemalign=8s
duke6e45e102007-12-01 00:00:00 +0000617 # Automatic prefetch instructions, explicit prefetch macros
ohair850fb252008-07-30 19:40:57 -0700618 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit
duke6e45e102007-12-01 00:00:00 +0000619 # Pick ultra as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700620 CC_HIGHEST_EXTRAS += -xchip=ultra
duke6e45e102007-12-01 00:00:00 +0000621 endif
622 ifeq ($(ARCH), i586)
623 # Pick pentium as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700624 CC_HIGHEST_EXTRAS += -xchip=pentium
duke6e45e102007-12-01 00:00:00 +0000625 endif
626 ifdef LIBRARY
627 # The Solaris CBE (Common Build Environment) requires that the use
628 # of appl registers be disabled when compiling a public library (or
629 # a library that's loaded by a public library) on sparc.
630 CFLAGS_REQUIRED_sparc += -xregs=no%appl
631 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl
632 endif
ohaire74b8592011-04-21 18:26:04 -0700633 CC_NEWER_THAN_56 := \
634 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
635 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
636 ifeq ($(CC_NEWER_THAN_56),1)
duke6e45e102007-12-01 00:00:00 +0000637 # Presents an ABI issue with customer JNI libs? We must be able to
638 # to handle 4byte aligned objects? (rare occurance, but possible?)
639 CFLAGS_REQUIRED_sparc += -xmemalign=4s
640 endif
641 # Just incase someone trys to use the SOS9 compilers
642 ifeq ($(CC_VER), 5.6)
643 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
644 CFLAGS_REQUIRED_sparc += -xmemalign=4s
645 endif
646 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
647 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken.
648 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700649
650 # Add in keep frame options
651 CC_OPT/LOWER += $(CC_XKEEPFRAME_OPTIONS)
652 CC_OPT/HIGHER += $(CC_XKEEPFRAME_OPTIONS)
653 CC_OPT/HIGHEST += $(CC_XKEEPFRAME_OPTIONS)
654 CXX_OPT/LOWER += $(CXX_XKEEPFRAME_OPTIONS)
655 CXX_OPT/HIGHER += $(CXX_XKEEPFRAME_OPTIONS)
656 CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS)
657
658 # Add in highest optimization settings
659 CC_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
660 CXX_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
661
duke6e45e102007-12-01 00:00:00 +0000662endif
duke6e45e102007-12-01 00:00:00 +0000663
ohair850fb252008-07-30 19:40:57 -0700664# Default optimization settings based on level.
665CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
666CXX_OPT = $(CXX_OPT/$(OPTIMIZATION_LEVEL))
duke6e45e102007-12-01 00:00:00 +0000667
668# Flags required all the time
669CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
670
duke6e45e102007-12-01 00:00:00 +0000671#
672# Path and option to link against the VM, if you have to. Note that
673# there are libraries that link against only -ljava, but they do get
674# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
675# the library itself should not.
676#
677VM_NAME = server
678JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
679JAVALIB = -ljava $(JVMLIB)
680
681# Part of INCREMENTAL_BUILD mechanism.
682# Compiler emits things like: path/file.o: file.h
683# We want something like: relative_path/file.o relative_path/file.d: file.h
684# In addition on Solaris, any include file starting with / is deleted,
685# this gets rid of things like /usr/include files, which never change.
686CC_DEPEND = -xM1
687CC_DEPEND_FILTER = $(SED) -e '/:[ ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u
688
689# Location of openwin libraries (do we really need this anymore?)
690OPENWIN_HOME = /usr/openwin
691OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR)
692
693# Runtime graphics library search paths...
694OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR)
695AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB)
696
697# C++ Runtime library (libCrun.so), use instead of -lCrun.
698# Originally used instead of -lCrun to guarantee use of the system
699# .so version and not the .a or .so that came with the compilers.
700# With the newer compilers this could probably change back to -lCrun but
701# in general this is ok to continue to do.
702LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1
703
ceisserer93956ca2010-05-28 11:37:44 -0700704# JDK now requires Solaris 10, so pick up libm.so.2
705LIBM = /usr/lib$(ISA_DIR)/libm.so.2
duke6e45e102007-12-01 00:00:00 +0000706
707# Socket library
708LIBSOCKET = -lsocket
709
martind5089e02010-06-10 15:54:25 -0700710# Network Services library
711LIBNSL = -lnsl
712
okutsu953b5b22011-10-05 15:13:40 +0900713# service configuration facility library
714LIBSCF = -lscf
715
duke6e45e102007-12-01 00:00:00 +0000716# GLOBAL_KPIC: If set means all libraries are PIC, position independent code
717# EXCEPT for select compiles
718# If a .o file is compiled non-PIC then it should be forced
719# into the RW data segment with a mapfile option. This is done
720# with object files which generated from .s files.
721# The -ztext enforces that no relocations remain in the text segment
722# so that it remains purely read-only for optimum system performance.
723# Some libraries may use a smaller size (13bit -Kpic) on sparc instead of
724# (32 bit -KPIC) and will override GLOBAL_KPIC appropriately.
725#
726PIC_CODE_LARGE = -KPIC
727PIC_CODE_SMALL = -Kpic
728ifndef TCOV_BUILD
729 GLOBAL_KPIC = $(PIC_CODE_LARGE)
730 CXXFLAGS_COMMON += $(GLOBAL_KPIC)
731 CFLAGS_COMMON += $(GLOBAL_KPIC)
732 LDFLAGS_COMMON += -ztext
733endif # TCOV_BUILD
734
735# If your platform has DPS, it will have Type1 fonts too, in which case
736# it is best to enable DPS support until such time as 2D's rasteriser
737# can fully handle Type1 fonts in all cases. Default is "yes".
738# HAVE_DPS should only be "no" if the platform has no DPS headers or libs
739# DPS (Displayable PostScript) is available on Solaris machines
740
741HAVE_DPS = yes
742
743#
744# Japanese manpages
745#
746JA_SOURCE_ENCODING = eucJP
747JA_TARGET_ENCODINGS = eucJP UTF-8 PCK
748
749# Settings for the JDI - Serviceability Agent binding.
750HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
751SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX)
dcubed46b99222011-09-20 19:16:21 -0700752SA_DEBUGINFO_NAME = $(LIB_PREFIX)saproc.debuginfo
duke6e45e102007-12-01 00:00:00 +0000753INCLUDE_SA=true
754