blob: 71e56d4c0b46a2df59cd33e90f82af4e313b28b1 [file] [log] [blame]
duke6e45e102007-12-01 00:00:00 +00001#
xdonod10b8cf2008-07-02 12:55:45 -07002# Copyright 1995-2008 Sun Microsystems, Inc. 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
7# published by the Free Software Foundation. Sun designates this
8# particular file as subject to the "Classpath" exception as provided
9# by Sun in the LICENSE file that accompanied this code.
10#
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#
21# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22# CA 95054 USA or visit www.sun.com if you need additional information or
23# have any questions.
24#
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)
43
44# Get shared JDK settings
45include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
46
47ifndef PLATFORM_SRC
ohair26e0af62008-03-04 09:52:54 -080048PLATFORM_SRC = $(BUILDDIR)/../src/solaris
duke6e45e102007-12-01 00:00:00 +000049endif # PLATFORM_SRC
50
51# Platform specific closed sources
52ifndef OPENJDK
53 ifndef CLOSED_PLATFORM_SRC
ohair26e0af62008-03-04 09:52:54 -080054 CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
duke6e45e102007-12-01 00:00:00 +000055 endif
56endif
57
58# platform specific include files
59PLATFORM_INCLUDE_NAME = $(PLATFORM)
60PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
61
62# suffix used for make dependencies files
63DEPEND_SUFFIX = d
64# suffix used for lint files
65LINT_SUFFIX = ln
66# The suffix applied to the library name for FDLIBM
67FDDLIBM_SUFFIX = a
68# The suffix applied to scripts (.bat for windows, nothing for unix)
69SCRIPT_SUFFIX =
70# CC compiler object code output directive flag value
71CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
72CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
73
74#
75# Default HPI libraries. Build will build only native unless
76# overriden at the make command line. This makes it convenient for
77# people doing, say, a pthreads port -- they can create a posix
78# directory here, and say "gnumake HPIS=posix" at the top
79# level.
80#
81HPIS = native
82
83#
84# Java default optimization (-x04/-O2) etc. Applies to the VM.
85#
ohair850fb252008-07-30 19:40:57 -070086ifndef OPTIMIZATION_LEVEL
87 ifeq ($(PRODUCT), java)
88 OPTIMIZATION_LEVEL = HIGHER
89 else
90 OPTIMIZATION_LEVEL = LOWER
91 endif
duke6e45e102007-12-01 00:00:00 +000092endif
93
94#
ohair850fb252008-07-30 19:40:57 -070095# If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the
duke6e45e102007-12-01 00:00:00 +000096# optimized build, and that ordering of the flags completely freaks
97# out cc. Hence, -Xa is instead in each CFLAGS variant.
98#
99# The more unusual options to the Sun C compiler:
100# -v Stricter type checking, more error checking
101# (To turn ALL warnings into fatals, use -errwarn=%all)
102# -xstrconst Place string literals and constants in read-only area
103# (means you can't write on your string literals)
104# -xs Force debug information (stabs) into the .so or a.out
105# (makes the library/executable debuggable without the
106# .o files needing to be around, but at a space cost)
107# -g & -O If you add the -g option to the optimized compiles
108# you will get better stack retraces, the code is
109# still optimized. This includes a space cost too.
110# -xc99=%none Do NOT allow for c99 extensions to be used.
111# e.g. declarations must precede statements
112# -xCC Allow the C++ style of comments in C: //
113# Required with many of the source files.
114# -mt Assume multi-threaded (important)
115#
116
117#
118# Debug flag for C and C++ compiler
119#
ohair850fb252008-07-30 19:40:57 -0700120CFLAGS_DEBUG_OPTION = -g $(CC_OPT/NONE)
121CXXFLAGS_DEBUG_OPTION = -g $(CXX_OPT/NONE)
duke6e45e102007-12-01 00:00:00 +0000122
123# Turn off -g if we are doing tcov build
124ifdef TCOV_BUILD
125 CFLAGS_DEBUG_OPTION=
126 CXXFLAGS_DEBUG_OPTION=
127endif
128
129# FASTDEBUG: Optimize the -g builds, gives us a faster debug java
130# If true adds -O to the debug compiles. This allows for any assert
131# tests to remain and debug checking. The resulting code is faster
132# but less debuggable. Stack traces are still valid, although only
133# approximate line numbers are given. Printing of local variables
134# during a debugging session is not possible, but stepping and
135# printing of global or static variables should be possible.
136# Performance/size of files should be about the same, maybe smaller.
137#
138ifeq ($(FASTDEBUG), true)
ohair850fb252008-07-30 19:40:57 -0700139 CFLAGS_DEBUG_OPTION = -g $(CC_OPT/LOWER)
140 CXXFLAGS_DEBUG_OPTION = -g0 $(CXX_OPT/LOWER)
duke6e45e102007-12-01 00:00:00 +0000141endif
142
143CFLAGS_COMMON = -v -mt -L$(OBJDIR) -xc99=%none
144CFLAGS_COMMON += -xCC
145CFLAGS_COMMON += -errshort=tags
ohair850fb252008-07-30 19:40:57 -0700146CFLAGS_OPT = $(CC_OPT)
duke6e45e102007-12-01 00:00:00 +0000147CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION)
148CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED)
149
150# Assume MT behavior all the time (important)
151CXXFLAGS_COMMON = -mt
152
153# Assume no C++ exceptions are used
154CXXFLAGS_COMMON += -features=no%except -DCC_NOEX
155
156# For C++, these options tell it to assume nothing about locating libraries
157# either at compile time, or at runtime. Use of these options will likely
158# require the use of -L and -R options to indicate where libraries will
159# be found at compile time (-L) and at runtime (-R).
160# The /usr/lib location comes for free, so no need to specify that one.
161# Note: C is much simplier and there is no need for these options. This
162# is mostly needed to avoid dependencies on libraries in the
163# Compiler install area, also see LIBCXX and LIBM.
164CXXFLAGS_COMMON += -norunpath -xnolib
165
166#
167# Treat compiler warnings as errors, if requested
168#
169ifeq ($(COMPILER_WARNINGS_FATAL),true)
170 CFLAGS_COMMON += -errwarn=%all
171 CXXFLAGS_COMMON += -errwarn=%all
172endif
173
ohair850fb252008-07-30 19:40:57 -0700174CXXFLAGS_OPT = $(CXX_OPT)
duke6e45e102007-12-01 00:00:00 +0000175CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION)
176CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
177
178# Add -xstrconst to the library compiles. This forces all string
179# literals into the read-only data section, which prevents them from
180# being written to and increases the runtime pages shared on the system.
181#
182ifdef LIBRARY
183 CFLAGS_COMMON +=-xstrconst
184endif
185
186# Source browser database
187#
188# COMPILE_WITH_SB
189# If defined adds -xsb to compiles and creates a
190# source browsing database during compilation.
191#
192ifdef COMPILE_WITH_SB
193 ifeq ($(LIBRARY), java)
194 CFLAGS_DBG += -xsb
195 endif
196endif
197
198# Lint Flags:
199# -Xa ANSI C plus K&R, favor ANSI rules
duke6e45e102007-12-01 00:00:00 +0000200# -fd report on old style func defs
201# -errchk=structarg report on 64bit struct args by value
202# -errchk=longptr64 report on 64bit to 32bit issues (ignores casts)
203# -errchk=parentheses report on suggested use of extra parens
204# -v suppress unused args
205# -x suppress unused externs
206# -u suppress extern func/vars used/defined
207# -errfmt=simple use one line errors with position info
ohair3f083862008-06-04 09:38:18 -0700208# $(LINT_XARCH_OPTION) See Compiler-sun.gwk
duke6e45e102007-12-01 00:00:00 +0000209
210LINTFLAGS_COMMON = -Xa
211LINTFLAGS_COMMON += -fd
212LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses
213LINTFLAGS_COMMON += -v
214LINTFLAGS_COMMON += -x
215LINTFLAGS_COMMON += -u
216LINTFLAGS_COMMON += -errfmt=simple
217LINTFLAGS_OPT =
218LINTFLAGS_DBG =
219
220# The -W0,-noglobal tells the compiler to NOT generate mangled global
221# ELF data symbols for file local static data.
222# This can break fix&continue, but we'd rather do the same compilations
223# for deliverable bits as we do for non-deliverable bits
224# Tell the compilers to never generate globalized names, all the time.
225CFLAGS_COMMON += -W0,-noglobal
226
ohair3f083862008-06-04 09:38:18 -0700227# If we have a specific arch value to use, add it
228CFLAGS_COMMON += $(XARCH_OPTION)
229CXXFLAGS_COMMON += $(XARCH_OPTION)
230ASFLAGS_COMMON += $(AS_XARCH_OPTION)
231EXTRA_LIBS += $(XARCH_OPTION)
232LINTFLAGS_COMMON += $(LINT_XARCH_OPTION)
duke6e45e102007-12-01 00:00:00 +0000233
234#
235# uncomment the following to build with PERTURBALOT set
236#
237# OTHER_CFLAGS += -DPERTURBALOT
238#
239
240CPPFLAGS_COMMON = -D$(ARCH_FAMILY) -D__solaris__ -D_REENTRANT
241CPPFLAGS_OPT =
242CPPFLAGS_DBG = -DDEBUG
243
ohair850fb252008-07-30 19:40:57 -0700244ifneq ($(PRODUCT), java)
245 CPPFLAGS_DBG += -DLOGGING -DDBINFO
246endif
247
duke6e45e102007-12-01 00:00:00 +0000248ifeq ($(ARCH_FAMILY), i586)
249 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
250 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
251 # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h).
252 # Note: -Dmacro is the same as #define macro 1
253 # -Dmacro= is the same as #define macro
254 #
255 CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH)
256 # Turn off a superfluous compiler error message on Intel
257 CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE
258endif
259
260# Java memory management is based on memory mapping by default, but a
261# system only assuming malloc/free can be built by adding -DUSE_MALLOC
262
263CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS
264CPPFLAGS_OPT += -DTRIMMED
265
266LDFLAGS_DEFS_OPTION = -z defs
267LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
268
269#
270# -L paths for finding and -ljava
271#
272LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
273LDFLAGS_OPT =
274LDFLAGS_DBG =
275
276#
277# We never really want the incremental linker, ever
278# The -xildoff option tells Sun's compilers to NOT use incremental linker
279#
280LDFLAGS_COMMON += -xildoff
281
282ifdef LIBRARY
283 # Libraries need to locate other libraries at runtime, and you can tell
284 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
285 # buried inside the .so. The $ORIGIN says to look relative to where
286 # the library itself is and it can be followed with relative paths from
287 # that. By default we always look in $ORIGIN, optionally we add relative
288 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
289 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
290 # Try: 'dump -Lv lib*.so' to see these settings in a library.
291 #
292 LDFLAGS_COMMON += -R\$$ORIGIN
293 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%)
294endif
295
296EXTRA_LIBS += -lc
297
298# Postprocessing is done on the images directories only
299#
300ifeq ($(VARIANT), OPT)
301 ifeq ($(PARTIAL_GPROF), true)
302 NO_STRIP = true
303 endif
304 ifeq ($(GPROF), true)
305 NO_STRIP = true
306 endif
307 ifneq ($(NO_STRIP), true)
308 # Debug 'strip -x' leaves local function Elf symbols (better stack traces)
309 POST_STRIP_PROCESS = $(STRIP) -x
310 endif
311endif
312POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)"
313
314#
315# Sun C compiler will take -M and pass it on to ld.
316# Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o
317#
318ifeq ($(CC_VERSION),gcc)
319LD_MAPFILE_FLAG = -Xlinker -M -Xlinker
320else
321LD_MAPFILE_FLAG = -M
322endif
323
324#
325# Variables globally settable from the make command line (default
326# values in brackets):
327# GPROF (false)
328# Eg: % gnumake GPROF=true
329GPROF = false
330ifeq ($(GPROF), true)
331 CFLAGS_COMMON += -DGPROF -xpg
332 EXTRA_LIBS += -xpg
333endif
334
335# PARTIAL_GPROF is to be used ONLY during compilation - it should not
336# appear during linking of libraries or programs. It also should
337# prevent linking with -z defs to allow a symbol to remain undefined.
338#
339PARTIAL_GPROF = false
340ifeq ($(PARTIAL_GPROF), true)
341 CFLAGS_GPROF += -xpg
342 LDFLAGS_DEFS_OPTION = -z nodefs
343endif
344
345#
346# For a TCOV build we add in the TCOV_OPTION
347#
348ifdef TCOV_BUILD
349 TCOV_OPTION = -xprofile=tcov
350 LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic
351 CFLAGS_COMMON += $(TCOV_OPTION)
352 CXXFLAGS_COMMON += $(TCOV_OPTION)
353 EXTRA_LIBS += $(TCOV_OPTION)
354 LDNOMAP=true
355endif
356
357#
358# Solaris only uses native threads.
359#
360THREADS_FLAG= native
361THREADS_DIR= threads
362
363#
364# Support for Quantify.
365#
366ifdef QUANTIFY
367 QUANTIFY_CMD = quantify
368 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
369 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
370 ifdef LIBRARY
371 CFLAGS_COMMON += -K PIC
372 endif
373endif
374
375#
376# Support for Purify.
377#
378ifdef PURIFY
379 PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify
380 PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
381 LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS)
382 ifdef LIBRARY
383 CFLAGS_COMMON += -K PIC
384 endif
385endif
386
387#
388# Different "levels" of optimization.
389#
390ifeq ($(CC_VERSION),gcc)
ohair850fb252008-07-30 19:40:57 -0700391
392 CC_OPT/NONE =
393 CC_OPT/LOWER = -O2
394 CC_OPT/HIGHER = -O3
395 CC_OPT/HIGHEST = -O3
396
397 CXX_OPT/NONE =
398 CXX_OPT/LOWER = -O2
399 CXX_OPT/HIGHER = -O3
400 CXX_OPT/HIGHEST = -O3
401
duke6e45e102007-12-01 00:00:00 +0000402 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer
403 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer
ohair850fb252008-07-30 19:40:57 -0700404
duke6e45e102007-12-01 00:00:00 +0000405 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
406 # (See Rules.gmk) May need to wait for gcc 5?
407 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700408
duke6e45e102007-12-01 00:00:00 +0000409else
ohair850fb252008-07-30 19:40:57 -0700410
duke6e45e102007-12-01 00:00:00 +0000411 # Highest could be -xO5, but indications are that -xO5 should be reserved
412 # for a per-file use, on sources with known performance impacts.
ohair850fb252008-07-30 19:40:57 -0700413 OPT_LEVEL/LOWER = 2
414 OPT_LEVEL/HIGHER = 4
415 OPT_LEVEL/HIGHEST = 4
416
417 CC_OPT/NONE =
418 CC_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
419 CC_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
420 CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
421
422 CXX_OPT/NONE =
423 CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%)
424 CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%)
425 CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%)
426
427 # We need stack frames at all times
428 USE_XKEEPFRAME_OPTION = false
429 ifeq ($(USE_XKEEPFRAME_OPTION),true)
430
431 # Unknown spelling on this option at this time (Maybe in SS13?)
432 CC_XKEEPFRAME_OPTIONS = -xkeepframe
433 CXX_XKEEPFRAME_OPTIONS = -xkeepframe
434
435 else
436
437 # On X86, make sure tail call optimization is off
438 # The z and y are the tail call optimizations.
439 ifeq ($(ARCH_FAMILY), i586)
440 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.8), 1)
441 # Somehow, tail call optimization is creeping in.
442 # Make sure it is off.
443 # WARNING: These may cause compiler warnings about duplicate -O options
444 CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
445 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz
446 endif
447 endif
448
449 # On i586 we need to tell the code generator to ALWAYS use a
450 # frame pointer.
451 ifeq ($(ARCH_FAMILY), i586)
452 # Note that in 5.7, this is done with -xregs=no%frameptr
453 ifeq ($(CC_VER), 5.5)
454 # It's not exactly clear when this optimization kicks in, the
455 # current assumption is -xO4 or greater and for C++ with
456 # the -features=no%except option and -xO4 and greater.
457 # Bottom line is, we ALWAYS want a frame pointer!
458 CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B
459 CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B
460 endif
461 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1)
462 # Do NOT use frame pointer register as a general purpose opt register
463 CC_OPT/NONE += -xregs=no%frameptr
464 CXX_OPT/NONE += -xregs=no%frameptr
465 CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
466 CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr
467 endif
468 endif
469
470 # Optimizer for sparc needs to be told not to do certain things
471 # related to frames or save instructions.
472 ifeq ($(ARCH_FAMILY), sparc)
473 # Do not use save instructions instead of add instructions
474 # This was an optimization starting in SC5.0 that made it hard for us to
475 # find the "save" instruction (which got turned into an "add")
476 CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s
477 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s
478 # Don't allow tail call code optimization. Started in SC5.0.
479 # We don't like code of this form:
480 # save
481 # <code>
482 # call foo
483 # restore
484 # because we can't tell if the method will have a stack frame
485 # and register windows or not.
486 CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0
487 CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0
488 endif
489
490 endif
491
492 # Extra options used with HIGHEST
duke6e45e102007-12-01 00:00:00 +0000493 #
ohair850fb252008-07-30 19:40:57 -0700494 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
duke6e45e102007-12-01 00:00:00 +0000495 # done with care, there are some assumptions below that need to
496 # be understood about the use of pointers, and IEEE behavior.
497 #
498 # Use non-standard floating point mode (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700499 CC_HIGHEST_EXTRAS += -fns
duke6e45e102007-12-01 00:00:00 +0000500 # Do some simplification of floating point arithmetic (not IEEE 754)
ohair850fb252008-07-30 19:40:57 -0700501 CC_HIGHEST_EXTRAS += -fsimple
duke6e45e102007-12-01 00:00:00 +0000502 # Use single precision floating point with 'float'
ohair850fb252008-07-30 19:40:57 -0700503 CC_HIGHEST_EXTRAS += -fsingle
duke6e45e102007-12-01 00:00:00 +0000504 # Assume memory references via basic pointer types do not alias
505 # (Source with excessing pointer casting and data access with mixed
506 # pointer types are not recommended)
ohair850fb252008-07-30 19:40:57 -0700507 CC_HIGHEST_EXTRAS += -xalias_level=basic
duke6e45e102007-12-01 00:00:00 +0000508 # Use intrinsic or inline versions for math/std functions
509 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700510 CC_HIGHEST_EXTRAS += -xbuiltin=%all
duke6e45e102007-12-01 00:00:00 +0000511 # Loop data dependency optimizations (need -xO3 or higher)
ohair850fb252008-07-30 19:40:57 -0700512 CC_HIGHEST_EXTRAS += -xdepend
duke6e45e102007-12-01 00:00:00 +0000513 # Pointer parameters to functions do not overlap
514 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
515 # If you pass in multiple pointers to the same data, do not use this)
ohair850fb252008-07-30 19:40:57 -0700516 CC_HIGHEST_EXTRAS += -xrestrict
duke6e45e102007-12-01 00:00:00 +0000517 # Inline some library routines
518 # (If you expect perfect errno behavior, do not use this)
ohair850fb252008-07-30 19:40:57 -0700519 CC_HIGHEST_EXTRAS += -xlibmil
duke6e45e102007-12-01 00:00:00 +0000520 # Use optimized math routines
521 # (If you expect perfect errno behavior, do not use this)
522 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now
ohair850fb252008-07-30 19:40:57 -0700523 # CC_HIGHEST_EXTRAS += -xlibmopt
duke6e45e102007-12-01 00:00:00 +0000524 ifeq ($(ARCH_FAMILY), sparc)
525 # Assume at most 8byte alignment, raise SIGBUS on error
526 ### Presents an ABI issue with customer JNI libs?
ohair850fb252008-07-30 19:40:57 -0700527 ####CC_HIGHEST_EXTRAS += -xmemalign=8s
duke6e45e102007-12-01 00:00:00 +0000528 # Automatic prefetch instructions, explicit prefetch macros
ohair850fb252008-07-30 19:40:57 -0700529 CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit
duke6e45e102007-12-01 00:00:00 +0000530 # Pick ultra as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700531 CC_HIGHEST_EXTRAS += -xchip=ultra
duke6e45e102007-12-01 00:00:00 +0000532 endif
533 ifeq ($(ARCH), i586)
534 # Pick pentium as the chip to optimize to
ohair850fb252008-07-30 19:40:57 -0700535 CC_HIGHEST_EXTRAS += -xchip=pentium
duke6e45e102007-12-01 00:00:00 +0000536 endif
537 ifdef LIBRARY
538 # The Solaris CBE (Common Build Environment) requires that the use
539 # of appl registers be disabled when compiling a public library (or
540 # a library that's loaded by a public library) on sparc.
541 CFLAGS_REQUIRED_sparc += -xregs=no%appl
542 CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl
543 endif
544 ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1)
duke6e45e102007-12-01 00:00:00 +0000545 # We MUST allow data alignment of 4 for sparc V8 (32bit)
546 # Presents an ABI issue with customer JNI libs? We must be able to
547 # to handle 4byte aligned objects? (rare occurance, but possible?)
548 CFLAGS_REQUIRED_sparc += -xmemalign=4s
549 endif
550 # Just incase someone trys to use the SOS9 compilers
551 ifeq ($(CC_VER), 5.6)
552 # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s)
553 CFLAGS_REQUIRED_sparc += -xmemalign=4s
554 endif
555 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
556 # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken.
557 AUTOMATIC_PCH_OPTION =
ohair850fb252008-07-30 19:40:57 -0700558
559 # Add in keep frame options
560 CC_OPT/LOWER += $(CC_XKEEPFRAME_OPTIONS)
561 CC_OPT/HIGHER += $(CC_XKEEPFRAME_OPTIONS)
562 CC_OPT/HIGHEST += $(CC_XKEEPFRAME_OPTIONS)
563 CXX_OPT/LOWER += $(CXX_XKEEPFRAME_OPTIONS)
564 CXX_OPT/HIGHER += $(CXX_XKEEPFRAME_OPTIONS)
565 CXX_OPT/HIGHEST += $(CXX_XKEEPFRAME_OPTIONS)
566
567 # Add in highest optimization settings
568 CC_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
569 CXX_OPT/HIGHEST += $(CC_HIGHEST_EXTRAS)
570
duke6e45e102007-12-01 00:00:00 +0000571endif
duke6e45e102007-12-01 00:00:00 +0000572
ohair850fb252008-07-30 19:40:57 -0700573# Default optimization settings based on level.
574CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
575CXX_OPT = $(CXX_OPT/$(OPTIMIZATION_LEVEL))
duke6e45e102007-12-01 00:00:00 +0000576
577# Flags required all the time
578CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
579
duke6e45e102007-12-01 00:00:00 +0000580#
581# Path and option to link against the VM, if you have to. Note that
582# there are libraries that link against only -ljava, but they do get
583# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
584# the library itself should not.
585#
586VM_NAME = server
587JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
588JAVALIB = -ljava $(JVMLIB)
589
590# Part of INCREMENTAL_BUILD mechanism.
591# Compiler emits things like: path/file.o: file.h
592# We want something like: relative_path/file.o relative_path/file.d: file.h
593# In addition on Solaris, any include file starting with / is deleted,
594# this gets rid of things like /usr/include files, which never change.
595CC_DEPEND = -xM1
596CC_DEPEND_FILTER = $(SED) -e '/:[ ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u
597
598# Location of openwin libraries (do we really need this anymore?)
599OPENWIN_HOME = /usr/openwin
600OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR)
601
602# Runtime graphics library search paths...
603OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR)
604AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB)
605
606# C++ Runtime library (libCrun.so), use instead of -lCrun.
607# Originally used instead of -lCrun to guarantee use of the system
608# .so version and not the .a or .so that came with the compilers.
609# With the newer compilers this could probably change back to -lCrun but
610# in general this is ok to continue to do.
611LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1
612
613# Math Library (libm.so), do not use -lm.
614# There might be two versions of libm.so on the build system:
615# libm.so.1 and libm.so.2, and we want libm.so.1.
616# Depending on the Solaris release being used to build with,
617# /usr/lib/libm.so could point at a libm.so.2, so we are
618# explicit here so that the libjvm.so you have built will work on an
619# older Solaris release that might not have libm.so.2.
620# This is a critical factor in allowing builds on Solaris 10 or newer
621# to run on Solaris 8 or 9.
622#
623# Note: Historically there was also a problem picking up a static version
624# of libm.a from the compiler area, but that problem has gone away
625# with the newer compilers. Use of libm.a would cause .so bloat.
626#
627LIBM = /usr/lib$(ISA_DIR)/libm.so.1
628
629# Socket library
630LIBSOCKET = -lsocket
631
632# GLOBAL_KPIC: If set means all libraries are PIC, position independent code
633# EXCEPT for select compiles
634# If a .o file is compiled non-PIC then it should be forced
635# into the RW data segment with a mapfile option. This is done
636# with object files which generated from .s files.
637# The -ztext enforces that no relocations remain in the text segment
638# so that it remains purely read-only for optimum system performance.
639# Some libraries may use a smaller size (13bit -Kpic) on sparc instead of
640# (32 bit -KPIC) and will override GLOBAL_KPIC appropriately.
641#
642PIC_CODE_LARGE = -KPIC
643PIC_CODE_SMALL = -Kpic
644ifndef TCOV_BUILD
645 GLOBAL_KPIC = $(PIC_CODE_LARGE)
646 CXXFLAGS_COMMON += $(GLOBAL_KPIC)
647 CFLAGS_COMMON += $(GLOBAL_KPIC)
648 LDFLAGS_COMMON += -ztext
649endif # TCOV_BUILD
650
651# If your platform has DPS, it will have Type1 fonts too, in which case
652# it is best to enable DPS support until such time as 2D's rasteriser
653# can fully handle Type1 fonts in all cases. Default is "yes".
654# HAVE_DPS should only be "no" if the platform has no DPS headers or libs
655# DPS (Displayable PostScript) is available on Solaris machines
656
657HAVE_DPS = yes
658
659#
660# Japanese manpages
661#
662JA_SOURCE_ENCODING = eucJP
663JA_TARGET_ENCODINGS = eucJP UTF-8 PCK
664
665# Settings for the JDI - Serviceability Agent binding.
666HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
667SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX)
668INCLUDE_SA=true
669