blob: c062f275c25564f3d140c8db391a5e096eccf901 [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)
ohaire74b8592011-04-21 18:26:04 -0700460 CC_NEWER_THAN_58 := \
461 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
462 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 8 \) )
463 ifeq ($(CC_NEWER_THAN_58),1)
464 # Somehow, tail call optimization is creeping in.
465 # Make sure it is off.
466 # WARNING: These may cause compiler warnings about duplicate -O options
467 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
468 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
ohair850fb252008-07-30 19:40:57 -0700469 endif
470 endif
471
472 # On i586 we need to tell the code generator to ALWAYS use a
473 # frame pointer.
474 ifeq ($(ARCH_FAMILY), i586)
475 # Note that in 5.7, this is done with -xregs=no%frameptr
476 ifeq ($(CC_VER), 5.5)
477 # It's not exactly clear when this optimization kicks in, the
478 # current assumption is -xO4 or greater and for C++ with
479 # the -features=no%except option and -xO4 and greater.
480 # Bottom line is, we ALWAYS want a frame pointer!
481 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B
482 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B
483 endif
bae39abd752010-12-05 15:51:31 +0300484
ohaire74b8592011-04-21 18:26:04 -0700485 CC_NEWER_THAN_56 := \
486 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
487 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
488 ifeq ($(CC_NEWER_THAN_56),1)
489 # Do NOT use frame pointer register as a general purpose opt register
490 CC_OPT/NONE += -xregs=no%frameptr
491 CXX_OPT/NONE += -xregs=no%frameptr
492 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
493 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
ohair850fb252008-07-30 19:40:57 -0700494 endif
495 endif
496
497 # Optimizer for sparc needs to be told not to do certain things
498 # related to frames or save instructions.
499 ifeq ($(ARCH_FAMILY), sparc)
500 # Do not use save instructions instead of add instructions
501 # This was an optimization starting in SC5.0 that made it hard for us to
502 # find the "save" instruction (which got turned into an "add")
503 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s
504 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s
505 # Don't allow tail call code optimization. Started in SC5.0.
506 # We don't like code of this form:
507 # save
508 # <code>
509 # call foo
510 # restore
511 # because we can't tell if the method will have a stack frame
512 # and register windows or not.
513 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0
514 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0
515 endif
516
517 endif
518
519 # Extra options used with HIGHEST
duke6e45e102007-12-01 00:00:00 +0000520 #
ohair850fb252008-07-30 19:40:57 -0700521 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
duke6e45e102007-12-01 00:00:00 +0000522 # done with care, there are some assumptions below that need to
523 # be understood about the use of pointers, and IEEE behavior.
524 #
525 # Use non-standard floating point mode (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700526 CC_HIGHEST_EXTRAS += -fns
duke6e45e102007-12-01 00:00:00 +0000527 # Do some simplification of floating point arithmetic (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700528 CC_HIGHEST_EXTRAS += -fsimple
duke6e45e102007-12-01 00:00:00 +0000529 # Use single precision floating point with 'float'
ohair850fb252008-07-30 19:40:57 -0700530 CC_HIGHEST_EXTRAS += -fsingle
duke6e45e102007-12-01 00:00:00 +0000531 # Assume memory references via basic pointer types do not alias
532 # (Source with excessing pointer casting and data access with mixed
533 # pointer types are not recommended)
ohair850fb252008-07-30 19:40:57 -0700534 CC_HIGHEST_EXTRAS += -xalias_level=basic
duke6e45e102007-12-01 00:00:00 +0000535 # Use intrinsic or inline versions for math/std functions
536 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700537 CC_HIGHEST_EXTRAS += -xbuiltin=%all
duke6e45e102007-12-01 00:00:00 +0000538 # Loop data dependency optimizations (need -xO3 or higher)
ohair850fb252008-07-30 19:40:57 -0700539 CC_HIGHEST_EXTRAS += -xdepend
duke6e45e102007-12-01 00:00:00 +0000540 # Pointer parameters to functions do not overlap
541 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
542 # If you pass in multiple pointers to the same data, do not use this)
ohair850fb252008-07-30 19:40:57 -0700543 CC_HIGHEST_EXTRAS += -xrestrict
duke6e45e102007-12-01 00:00:00 +0000544 # Inline some library routines
545 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700546 CC_HIGHEST_EXTRAS += -xlibmil
duke6e45e102007-12-01 00:00:00 +0000547 # Use optimized math routines
548 # (If you expect perfect errno behavior, do not use this)
549 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
ohair850fb252008-07-30 19:40:57 -0700550 # CC_HIGHEST_EXTRAS += -xlibmopt
duke6e45e102007-12-01 00:00:00 +0000551 ifeq ($(ARCH_FAMILY), sparc)
552 # Assume at most 8byte alignment, raise SIGBUS on error
553 ### Presents an ABI issue with customer JNI libs?
ohair850fb252008-07-30 19:40:57 -0700554 ####CC_HIGHEST_EXTRAS += -xmemalign=8s
duke6e45e102007-12-01 00:00:00 +0000555 # Automatic prefetch instructions, explicit prefetch macros
ohair850fb252008-07-30 19:40:57 -0700556 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit
duke6e45e102007-12-01 00:00:00 +0000557 # Pick ultra as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700558 CC_HIGHEST_EXTRAS += -xchip=ultra
duke6e45e102007-12-01 00:00:00 +0000559 endif
560 ifeq ($(ARCH), i586)
561 # Pick pentium as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700562 CC_HIGHEST_EXTRAS += -xchip=pentium
duke6e45e102007-12-01 00:00:00 +0000563 endif
564 ifdef LIBRARY
565 # The Solaris CBE (Common Build Environment) requires that the use
566 # of appl registers be disabled when compiling a public library (or
567 # a library that's loaded by a public library) on sparc.
568 CFLAGS_REQUIRED_sparc += -xregs=no%appl
569 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl
570 endif
ohaire74b8592011-04-21 18:26:04 -0700571 CC_NEWER_THAN_56 := \
572 $(shell $(EXPR) $(CC_MAJORVER) \> 5 \| \
573 \( $(CC_MAJORVER) = 5 \& $(CC_MINORVER) \> 6 \) )
574 ifeq ($(CC_NEWER_THAN_56),1)
duke6e45e102007-12-01 00:00:00 +0000575 # 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