J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | # |
| 2 | # Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | # 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 |
| 45 | include $(JDK_MAKE_SHARED_DIR)/Defs.gmk |
| 46 | |
| 47 | ifndef PLATFORM_SRC |
| 48 | PLATFORM_SRC = $(JDK_TOPDIR)/src/solaris |
| 49 | endif # PLATFORM_SRC |
| 50 | |
| 51 | # Platform specific closed sources |
| 52 | ifndef OPENJDK |
| 53 | ifndef CLOSED_PLATFORM_SRC |
| 54 | CLOSED_PLATFORM_SRC = $(JDK_TOPDIR)/src/closed/solaris |
| 55 | endif |
| 56 | endif |
| 57 | |
| 58 | # platform specific include files |
| 59 | PLATFORM_INCLUDE_NAME = $(PLATFORM) |
| 60 | PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) |
| 61 | |
| 62 | # suffix used for make dependencies files |
| 63 | DEPEND_SUFFIX = d |
| 64 | # suffix used for lint files |
| 65 | LINT_SUFFIX = ln |
| 66 | # The suffix applied to the library name for FDLIBM |
| 67 | FDDLIBM_SUFFIX = a |
| 68 | # The suffix applied to scripts (.bat for windows, nothing for unix) |
| 69 | SCRIPT_SUFFIX = |
| 70 | # CC compiler object code output directive flag value |
| 71 | CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! |
| 72 | CC_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 | # |
| 81 | HPIS = native |
| 82 | |
| 83 | # |
| 84 | # Java default optimization (-x04/-O2) etc. Applies to the VM. |
| 85 | # |
| 86 | ifeq ($(PRODUCT), java) |
| 87 | _OPT = $(CC_HIGHER_OPT) |
| 88 | else |
| 89 | _OPT = $(CC_LOWER_OPT) |
| 90 | CPPFLAGS_DBG += -DLOGGING -DDBINFO |
| 91 | endif |
| 92 | |
| 93 | # |
| 94 | # If -Xa is in CFLAGS_COMMON it will end up ahead of $(POPT) for the |
| 95 | # optimized build, and that ordering of the flags completely freaks |
| 96 | # out cc. Hence, -Xa is instead in each CFLAGS variant. |
| 97 | # |
| 98 | # The more unusual options to the Sun C compiler: |
| 99 | # -v Stricter type checking, more error checking |
| 100 | # (To turn ALL warnings into fatals, use -errwarn=%all) |
| 101 | # -xstrconst Place string literals and constants in read-only area |
| 102 | # (means you can't write on your string literals) |
| 103 | # -xs Force debug information (stabs) into the .so or a.out |
| 104 | # (makes the library/executable debuggable without the |
| 105 | # .o files needing to be around, but at a space cost) |
| 106 | # -g & -O If you add the -g option to the optimized compiles |
| 107 | # you will get better stack retraces, the code is |
| 108 | # still optimized. This includes a space cost too. |
| 109 | # -xc99=%none Do NOT allow for c99 extensions to be used. |
| 110 | # e.g. declarations must precede statements |
| 111 | # -xCC Allow the C++ style of comments in C: // |
| 112 | # Required with many of the source files. |
| 113 | # -mt Assume multi-threaded (important) |
| 114 | # |
| 115 | |
| 116 | # |
| 117 | # Debug flag for C and C++ compiler |
| 118 | # |
| 119 | CFLAGS_DEBUG_OPTION=-g |
| 120 | CXXFLAGS_DEBUG_OPTION=-g |
| 121 | |
| 122 | # Turn off -g if we are doing tcov build |
| 123 | ifdef TCOV_BUILD |
| 124 | CFLAGS_DEBUG_OPTION= |
| 125 | CXXFLAGS_DEBUG_OPTION= |
| 126 | endif |
| 127 | |
| 128 | # FASTDEBUG: Optimize the -g builds, gives us a faster debug java |
| 129 | # If true adds -O to the debug compiles. This allows for any assert |
| 130 | # tests to remain and debug checking. The resulting code is faster |
| 131 | # but less debuggable. Stack traces are still valid, although only |
| 132 | # approximate line numbers are given. Printing of local variables |
| 133 | # during a debugging session is not possible, but stepping and |
| 134 | # printing of global or static variables should be possible. |
| 135 | # Performance/size of files should be about the same, maybe smaller. |
| 136 | # |
| 137 | ifeq ($(FASTDEBUG), true) |
| 138 | CC_FASTDEBUG_OPT = $(CC_LOWER_OPT) |
| 139 | CFLAGS_DEBUG_OPTION = -g $(CC_FASTDEBUG_OPT) |
| 140 | CXXFLAGS_DEBUG_OPTION = -g0 $(CC_FASTDEBUG_OPT) |
| 141 | endif |
| 142 | |
| 143 | CFLAGS_COMMON = -v -mt -L$(OBJDIR) -xc99=%none |
| 144 | CFLAGS_COMMON += -xCC |
| 145 | CFLAGS_COMMON += -errshort=tags |
| 146 | CFLAGS_OPT = $(POPT) |
| 147 | CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION) |
| 148 | CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED) |
| 149 | |
| 150 | # Assume MT behavior all the time (important) |
| 151 | CXXFLAGS_COMMON = -mt |
| 152 | |
| 153 | # Assume no C++ exceptions are used |
| 154 | CXXFLAGS_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. |
| 164 | CXXFLAGS_COMMON += -norunpath -xnolib |
| 165 | |
| 166 | # |
| 167 | # Treat compiler warnings as errors, if requested |
| 168 | # |
| 169 | ifeq ($(COMPILER_WARNINGS_FATAL),true) |
| 170 | CFLAGS_COMMON += -errwarn=%all |
| 171 | CXXFLAGS_COMMON += -errwarn=%all |
| 172 | endif |
| 173 | |
| 174 | CXXFLAGS_OPT = $(POPT) |
| 175 | CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION) |
| 176 | CXXFLAGS_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 | # |
| 182 | ifdef LIBRARY |
| 183 | CFLAGS_COMMON +=-xstrconst |
| 184 | endif |
| 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 | # |
| 192 | ifdef COMPILE_WITH_SB |
| 193 | ifeq ($(LIBRARY), java) |
| 194 | CFLAGS_DBG += -xsb |
| 195 | endif |
| 196 | endif |
| 197 | |
| 198 | # Lint Flags: |
| 199 | # -Xa ANSI C plus K&R, favor ANSI rules |
| 200 | # -Xarch=XXX Same as 'cc -xarch=XXX' |
| 201 | # -fd report on old style func defs |
| 202 | # -errchk=structarg report on 64bit struct args by value |
| 203 | # -errchk=longptr64 report on 64bit to 32bit issues (ignores casts) |
| 204 | # -errchk=parentheses report on suggested use of extra parens |
| 205 | # -v suppress unused args |
| 206 | # -x suppress unused externs |
| 207 | # -u suppress extern func/vars used/defined |
| 208 | # -errfmt=simple use one line errors with position info |
| 209 | |
| 210 | LINTFLAGS_COMMON = -Xa |
| 211 | LINTFLAGS_COMMON += -fd |
| 212 | LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses |
| 213 | LINTFLAGS_COMMON += -v |
| 214 | LINTFLAGS_COMMON += -x |
| 215 | LINTFLAGS_COMMON += -u |
| 216 | LINTFLAGS_COMMON += -errfmt=simple |
| 217 | LINTFLAGS_OPT = |
| 218 | LINTFLAGS_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. |
| 225 | CFLAGS_COMMON += -W0,-noglobal |
| 226 | |
| 227 | # Arch specific settings (determines type of .o files and instruction set) |
| 228 | ifeq ($(ARCH_FAMILY), sparc) |
| 229 | ifdef VIS_NEEDED |
| 230 | XARCH_VALUE/32=v8plusa |
| 231 | XARCH_VALUE/64=v9a |
| 232 | else |
| 233 | # Someday this should change to improve optimization on UltraSPARC |
| 234 | # and abandon the old v8-only machines like the SPARCstation 10. |
| 235 | # Indications with Mustang is that alacrity runs do not show a |
| 236 | # big improvement using v8plus over v8, but other benchmarks might. |
| 237 | XARCH_VALUE/32=v8 |
| 238 | XARCH_VALUE/64=v9 |
| 239 | endif |
| 240 | endif |
| 241 | ifeq ($(ARCH_FAMILY), i586) |
| 242 | XARCH_VALUE/64=amd64 |
| 243 | XARCH_VALUE/32= |
| 244 | endif |
| 245 | |
| 246 | # Arch value based on current data model being built |
| 247 | XARCH_VALUE=$(XARCH_VALUE/$(ARCH_DATA_MODEL)) |
| 248 | ifneq ($(XARCH_VALUE), ) |
| 249 | # The actual compiler -xarch options to use |
| 250 | XARCH_OPTION/32 = -xarch=$(XARCH_VALUE/32) |
| 251 | XARCH_OPTION/64 = -xarch=$(XARCH_VALUE/64) |
| 252 | XARCH_OPTION = $(XARCH_OPTION/$(ARCH_DATA_MODEL)) |
| 253 | endif |
| 254 | |
| 255 | # If we have a specific -xarch value to use, add it |
| 256 | ifdef XARCH_OPTION |
| 257 | CFLAGS_COMMON += $(XARCH_OPTION) |
| 258 | CXXFLAGS_COMMON += $(XARCH_OPTION) |
| 259 | ASFLAGS_COMMON += $(XARCH_OPTION) |
| 260 | EXTRA_LIBS += $(XARCH_OPTION) |
| 261 | LINTFLAGS_COMMON += -Xarch=$(XARCH_VALUE) |
| 262 | endif |
| 263 | |
| 264 | # |
| 265 | # uncomment the following to build with PERTURBALOT set |
| 266 | # |
| 267 | # OTHER_CFLAGS += -DPERTURBALOT |
| 268 | # |
| 269 | |
| 270 | CPPFLAGS_COMMON = -D$(ARCH_FAMILY) -D__solaris__ -D_REENTRANT |
| 271 | CPPFLAGS_OPT = |
| 272 | CPPFLAGS_DBG = -DDEBUG |
| 273 | |
| 274 | ifeq ($(ARCH_FAMILY), i586) |
| 275 | # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
| 276 | # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
| 277 | # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). |
| 278 | # Note: -Dmacro is the same as #define macro 1 |
| 279 | # -Dmacro= is the same as #define macro |
| 280 | # |
| 281 | CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH) |
| 282 | # Turn off a superfluous compiler error message on Intel |
| 283 | CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE |
| 284 | endif |
| 285 | |
| 286 | # Java memory management is based on memory mapping by default, but a |
| 287 | # system only assuming malloc/free can be built by adding -DUSE_MALLOC |
| 288 | |
| 289 | CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS |
| 290 | CPPFLAGS_OPT += -DTRIMMED |
| 291 | |
| 292 | LDFLAGS_DEFS_OPTION = -z defs |
| 293 | LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) |
| 294 | |
| 295 | # |
| 296 | # -L paths for finding and -ljava |
| 297 | # |
| 298 | LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) |
| 299 | LDFLAGS_OPT = |
| 300 | LDFLAGS_DBG = |
| 301 | |
| 302 | # |
| 303 | # We never really want the incremental linker, ever |
| 304 | # The -xildoff option tells Sun's compilers to NOT use incremental linker |
| 305 | # |
| 306 | LDFLAGS_COMMON += -xildoff |
| 307 | |
| 308 | ifdef LIBRARY |
| 309 | # Libraries need to locate other libraries at runtime, and you can tell |
| 310 | # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
| 311 | # buried inside the .so. The $ORIGIN says to look relative to where |
| 312 | # the library itself is and it can be followed with relative paths from |
| 313 | # that. By default we always look in $ORIGIN, optionally we add relative |
| 314 | # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. |
| 315 | # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
| 316 | # Try: 'dump -Lv lib*.so' to see these settings in a library. |
| 317 | # |
| 318 | LDFLAGS_COMMON += -R\$$ORIGIN |
| 319 | LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%) |
| 320 | endif |
| 321 | |
| 322 | EXTRA_LIBS += -lc |
| 323 | |
| 324 | # Postprocessing is done on the images directories only |
| 325 | # |
| 326 | ifeq ($(VARIANT), OPT) |
| 327 | ifeq ($(PARTIAL_GPROF), true) |
| 328 | NO_STRIP = true |
| 329 | endif |
| 330 | ifeq ($(GPROF), true) |
| 331 | NO_STRIP = true |
| 332 | endif |
| 333 | ifneq ($(NO_STRIP), true) |
| 334 | # Debug 'strip -x' leaves local function Elf symbols (better stack traces) |
| 335 | POST_STRIP_PROCESS = $(STRIP) -x |
| 336 | endif |
| 337 | endif |
| 338 | POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)" |
| 339 | |
| 340 | # |
| 341 | # Sun C compiler will take -M and pass it on to ld. |
| 342 | # Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o |
| 343 | # |
| 344 | ifeq ($(CC_VERSION),gcc) |
| 345 | LD_MAPFILE_FLAG = -Xlinker -M -Xlinker |
| 346 | else |
| 347 | LD_MAPFILE_FLAG = -M |
| 348 | endif |
| 349 | |
| 350 | # |
| 351 | # Variables globally settable from the make command line (default |
| 352 | # values in brackets): |
| 353 | # GPROF (false) |
| 354 | # Eg: % gnumake GPROF=true |
| 355 | GPROF = false |
| 356 | ifeq ($(GPROF), true) |
| 357 | CFLAGS_COMMON += -DGPROF -xpg |
| 358 | EXTRA_LIBS += -xpg |
| 359 | endif |
| 360 | |
| 361 | # PARTIAL_GPROF is to be used ONLY during compilation - it should not |
| 362 | # appear during linking of libraries or programs. It also should |
| 363 | # prevent linking with -z defs to allow a symbol to remain undefined. |
| 364 | # |
| 365 | PARTIAL_GPROF = false |
| 366 | ifeq ($(PARTIAL_GPROF), true) |
| 367 | CFLAGS_GPROF += -xpg |
| 368 | LDFLAGS_DEFS_OPTION = -z nodefs |
| 369 | endif |
| 370 | |
| 371 | # |
| 372 | # For a TCOV build we add in the TCOV_OPTION |
| 373 | # |
| 374 | ifdef TCOV_BUILD |
| 375 | TCOV_OPTION = -xprofile=tcov |
| 376 | LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic |
| 377 | CFLAGS_COMMON += $(TCOV_OPTION) |
| 378 | CXXFLAGS_COMMON += $(TCOV_OPTION) |
| 379 | EXTRA_LIBS += $(TCOV_OPTION) |
| 380 | LDNOMAP=true |
| 381 | endif |
| 382 | |
| 383 | # |
| 384 | # Solaris only uses native threads. |
| 385 | # |
| 386 | THREADS_FLAG= native |
| 387 | THREADS_DIR= threads |
| 388 | |
| 389 | # |
| 390 | # Support for Quantify. |
| 391 | # |
| 392 | ifdef QUANTIFY |
| 393 | QUANTIFY_CMD = quantify |
| 394 | QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
| 395 | LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
| 396 | ifdef LIBRARY |
| 397 | CFLAGS_COMMON += -K PIC |
| 398 | endif |
| 399 | endif |
| 400 | |
| 401 | # |
| 402 | # Support for Purify. |
| 403 | # |
| 404 | ifdef PURIFY |
| 405 | PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify |
| 406 | PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
| 407 | LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS) |
| 408 | ifdef LIBRARY |
| 409 | CFLAGS_COMMON += -K PIC |
| 410 | endif |
| 411 | endif |
| 412 | |
| 413 | # |
| 414 | # Different "levels" of optimization. |
| 415 | # |
| 416 | ifeq ($(CC_VERSION),gcc) |
| 417 | CC_HIGHEST_OPT = -O3 |
| 418 | CC_HIGHER_OPT = -O3 |
| 419 | CC_LOWER_OPT = -O2 |
| 420 | CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer |
| 421 | CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer |
| 422 | # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
| 423 | # (See Rules.gmk) May need to wait for gcc 5? |
| 424 | AUTOMATIC_PCH_OPTION = |
| 425 | else |
| 426 | # Highest could be -xO5, but indications are that -xO5 should be reserved |
| 427 | # for a per-file use, on sources with known performance impacts. |
| 428 | CC_HIGHEST_OPT = -xO4 |
| 429 | CC_HIGHER_OPT = -xO4 |
| 430 | CC_LOWER_OPT = -xO2 |
| 431 | # |
| 432 | # WARNING: Use of _OPT=$(CC_HIGHEST_OPT) in your Makefile needs to be |
| 433 | # done with care, there are some assumptions below that need to |
| 434 | # be understood about the use of pointers, and IEEE behavior. |
| 435 | # |
| 436 | # Use non-standard floating point mode (not IEEE 754) |
| 437 | CC_HIGHEST_OPT += -fns |
| 438 | # Do some simplification of floating point arithmetic (not IEEE 754) |
| 439 | CC_HIGHEST_OPT += -fsimple |
| 440 | # Use single precision floating point with 'float' |
| 441 | CC_HIGHEST_OPT += -fsingle |
| 442 | # Assume memory references via basic pointer types do not alias |
| 443 | # (Source with excessing pointer casting and data access with mixed |
| 444 | # pointer types are not recommended) |
| 445 | CC_HIGHEST_OPT += -xalias_level=basic |
| 446 | # Use intrinsic or inline versions for math/std functions |
| 447 | # (If you expect perfect errno behavior, do not use this) |
| 448 | CC_HIGHEST_OPT += -xbuiltin=%all |
| 449 | # Loop data dependency optimizations (need -xO3 or higher) |
| 450 | CC_HIGHEST_OPT += -xdepend |
| 451 | # Pointer parameters to functions do not overlap |
| 452 | # (Similar to -xalias_level=basic usage, but less obvious sometimes. |
| 453 | # If you pass in multiple pointers to the same data, do not use this) |
| 454 | CC_HIGHEST_OPT += -xrestrict |
| 455 | # Inline some library routines |
| 456 | # (If you expect perfect errno behavior, do not use this) |
| 457 | CC_HIGHEST_OPT += -xlibmil |
| 458 | # Use optimized math routines |
| 459 | # (If you expect perfect errno behavior, do not use this) |
| 460 | # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now |
| 461 | # CC_HIGHEST_OPT += -xlibmopt |
| 462 | ifeq ($(ARCH_FAMILY), sparc) |
| 463 | # Assume at most 8byte alignment, raise SIGBUS on error |
| 464 | ### Presents an ABI issue with customer JNI libs? |
| 465 | ####CC_HIGHEST_OPT += -xmemalign=8s |
| 466 | # Automatic prefetch instructions, explicit prefetch macros |
| 467 | CC_HIGHEST_OPT += -xprefetch=auto,explicit |
| 468 | # Pick ultra as the chip to optimize to |
| 469 | CC_HIGHEST_OPT += -xchip=ultra |
| 470 | endif |
| 471 | ifeq ($(ARCH), i586) |
| 472 | # Pick pentium as the chip to optimize to |
| 473 | CC_HIGHEST_OPT += -xchip=pentium |
| 474 | endif |
| 475 | ifdef LIBRARY |
| 476 | # The Solaris CBE (Common Build Environment) requires that the use |
| 477 | # of appl registers be disabled when compiling a public library (or |
| 478 | # a library that's loaded by a public library) on sparc. |
| 479 | CFLAGS_REQUIRED_sparc += -xregs=no%appl |
| 480 | CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl |
| 481 | endif |
| 482 | ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1) |
| 483 | # Do NOT use the frame pointer register as a general purpose opt register |
| 484 | CFLAGS_REQUIRED_i586 += -xregs=no%frameptr |
| 485 | CFLAGS_REQUIRED_amd64 += -xregs=no%frameptr |
| 486 | # We MUST allow data alignment of 4 for sparc V8 (32bit) |
| 487 | # Presents an ABI issue with customer JNI libs? We must be able to |
| 488 | # to handle 4byte aligned objects? (rare occurance, but possible?) |
| 489 | CFLAGS_REQUIRED_sparc += -xmemalign=4s |
| 490 | endif |
| 491 | # Just incase someone trys to use the SOS9 compilers |
| 492 | ifeq ($(CC_VER), 5.6) |
| 493 | # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) |
| 494 | CFLAGS_REQUIRED_sparc += -xmemalign=4s |
| 495 | endif |
| 496 | # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
| 497 | # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken. |
| 498 | AUTOMATIC_PCH_OPTION = |
| 499 | endif |
| 500 | CC_NO_OPT = |
| 501 | |
| 502 | # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off |
| 503 | ifdef NO_OPTIMIZATIONS |
| 504 | CC_HIGHEST_OPT = $(CC_NO_OPT) |
| 505 | CC_HIGHER_OPT = $(CC_NO_OPT) |
| 506 | CC_LOWER_OPT = $(CC_NO_OPT) |
| 507 | endif |
| 508 | |
| 509 | # Flags required all the time |
| 510 | CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
| 511 | |
| 512 | # Add processor specific options for optimizations |
| 513 | CC_HIGHEST_OPT += $(_OPT_$(ARCH)) |
| 514 | CC_HIGHER_OPT += $(_OPT_$(ARCH)) |
| 515 | CC_LOWER_OPT += $(_OPT_$(ARCH)) |
| 516 | |
| 517 | # Secret compiler optimization options that should be in the above macros |
| 518 | # but since they differ in format from C to C++, are added into the C or |
| 519 | # C++ specific macros for compiler flags. |
| 520 | # |
| 521 | # On i586 we need to tell the code generator to ALWAYS use a |
| 522 | # frame pointer. |
| 523 | ifeq ($(ARCH_FAMILY), i586) |
| 524 | # Note that in 5.7, this is done with -xregs=no%frameptr |
| 525 | ifeq ($(CC_VER), 5.5) |
| 526 | # It's not exactly clear when this optimization kicks in, the |
| 527 | # current assumption is -xO4 or greater and for C++ with |
| 528 | # the -features=no%except option and -xO4 and greater. |
| 529 | # Bottom line is, we ALWAYS want a frame pointer! |
| 530 | CXXFLAGS_OPT += -Qoption ube -Z~B |
| 531 | CFLAGS_OPT += -Wu,-Z~B |
| 532 | ifeq ($(FASTDEBUG), true) |
| 533 | CXXFLAGS_DBG += -Qoption ube -Z~B |
| 534 | CFLAGS_DBG += -Wu,-Z~B |
| 535 | endif |
| 536 | endif |
| 537 | endif |
| 538 | # |
| 539 | # Optimizer for sparc needs to be told not to do certain things |
| 540 | # related to frames or save instructions. |
| 541 | ifeq ($(ARCH_FAMILY), sparc) |
| 542 | # NOTE: Someday the compilers will provide a high-level option for this. |
| 543 | # Use save instructions instead of add instructions |
| 544 | # This was an optimization starting in SC5.0 that made it hard for us to |
| 545 | # find the "save" instruction (which got turned into an "add") |
| 546 | CXXFLAGS_OPT += -Qoption cg -Qrm-s |
| 547 | CFLAGS_OPT += -Wc,-Qrm-s |
| 548 | ifeq ($(FASTDEBUG), true) |
| 549 | CXXFLAGS_DBG += -Qoption cg -Qrm-s |
| 550 | CFLAGS_DBG += -Wc,-Qrm-s |
| 551 | endif |
| 552 | # |
| 553 | # NOTE: Someday the compilers will provide a high-level option for this. |
| 554 | # Don't allow tail call code optimization. Started in SC5.0. |
| 555 | # We don't like code of this form: |
| 556 | # save |
| 557 | # <code> |
| 558 | # call foo |
| 559 | # restore |
| 560 | # because we can't tell if the method will have a stack frame |
| 561 | # and register windows or not. |
| 562 | CXXFLAGS_OPT += -Qoption cg -Qiselect-T0 |
| 563 | CFLAGS_OPT += -Wc,-Qiselect-T0 |
| 564 | ifeq ($(FASTDEBUG), true) |
| 565 | CXXFLAGS_DBG += -Qoption cg -Qiselect-T0 |
| 566 | CFLAGS_DBG += -Wc,-Qiselect-T0 |
| 567 | endif |
| 568 | endif |
| 569 | |
| 570 | # |
| 571 | # Path and option to link against the VM, if you have to. Note that |
| 572 | # there are libraries that link against only -ljava, but they do get |
| 573 | # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas |
| 574 | # the library itself should not. |
| 575 | # |
| 576 | VM_NAME = server |
| 577 | JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm |
| 578 | JAVALIB = -ljava $(JVMLIB) |
| 579 | |
| 580 | # Part of INCREMENTAL_BUILD mechanism. |
| 581 | # Compiler emits things like: path/file.o: file.h |
| 582 | # We want something like: relative_path/file.o relative_path/file.d: file.h |
| 583 | # In addition on Solaris, any include file starting with / is deleted, |
| 584 | # this gets rid of things like /usr/include files, which never change. |
| 585 | CC_DEPEND = -xM1 |
| 586 | CC_DEPEND_FILTER = $(SED) -e '/:[ ]*[/]/d' -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' | $(SORT) -u |
| 587 | |
| 588 | # Location of openwin libraries (do we really need this anymore?) |
| 589 | OPENWIN_HOME = /usr/openwin |
| 590 | OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR) |
| 591 | |
| 592 | # Runtime graphics library search paths... |
| 593 | OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR) |
| 594 | AWT_RUNPATH = -R/usr/dt/lib$(ISA_DIR) -R$(OPENWIN_RUNTIME_LIB) |
| 595 | |
| 596 | # C++ Runtime library (libCrun.so), use instead of -lCrun. |
| 597 | # Originally used instead of -lCrun to guarantee use of the system |
| 598 | # .so version and not the .a or .so that came with the compilers. |
| 599 | # With the newer compilers this could probably change back to -lCrun but |
| 600 | # in general this is ok to continue to do. |
| 601 | LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1 |
| 602 | |
| 603 | # Math Library (libm.so), do not use -lm. |
| 604 | # There might be two versions of libm.so on the build system: |
| 605 | # libm.so.1 and libm.so.2, and we want libm.so.1. |
| 606 | # Depending on the Solaris release being used to build with, |
| 607 | # /usr/lib/libm.so could point at a libm.so.2, so we are |
| 608 | # explicit here so that the libjvm.so you have built will work on an |
| 609 | # older Solaris release that might not have libm.so.2. |
| 610 | # This is a critical factor in allowing builds on Solaris 10 or newer |
| 611 | # to run on Solaris 8 or 9. |
| 612 | # |
| 613 | # Note: Historically there was also a problem picking up a static version |
| 614 | # of libm.a from the compiler area, but that problem has gone away |
| 615 | # with the newer compilers. Use of libm.a would cause .so bloat. |
| 616 | # |
| 617 | LIBM = /usr/lib$(ISA_DIR)/libm.so.1 |
| 618 | |
| 619 | # Socket library |
| 620 | LIBSOCKET = -lsocket |
| 621 | |
| 622 | # GLOBAL_KPIC: If set means all libraries are PIC, position independent code |
| 623 | # EXCEPT for select compiles |
| 624 | # If a .o file is compiled non-PIC then it should be forced |
| 625 | # into the RW data segment with a mapfile option. This is done |
| 626 | # with object files which generated from .s files. |
| 627 | # The -ztext enforces that no relocations remain in the text segment |
| 628 | # so that it remains purely read-only for optimum system performance. |
| 629 | # Some libraries may use a smaller size (13bit -Kpic) on sparc instead of |
| 630 | # (32 bit -KPIC) and will override GLOBAL_KPIC appropriately. |
| 631 | # |
| 632 | PIC_CODE_LARGE = -KPIC |
| 633 | PIC_CODE_SMALL = -Kpic |
| 634 | ifndef TCOV_BUILD |
| 635 | GLOBAL_KPIC = $(PIC_CODE_LARGE) |
| 636 | CXXFLAGS_COMMON += $(GLOBAL_KPIC) |
| 637 | CFLAGS_COMMON += $(GLOBAL_KPIC) |
| 638 | LDFLAGS_COMMON += -ztext |
| 639 | endif # TCOV_BUILD |
| 640 | |
| 641 | # If your platform has DPS, it will have Type1 fonts too, in which case |
| 642 | # it is best to enable DPS support until such time as 2D's rasteriser |
| 643 | # can fully handle Type1 fonts in all cases. Default is "yes". |
| 644 | # HAVE_DPS should only be "no" if the platform has no DPS headers or libs |
| 645 | # DPS (Displayable PostScript) is available on Solaris machines |
| 646 | |
| 647 | HAVE_DPS = yes |
| 648 | |
| 649 | # |
| 650 | # Japanese manpages |
| 651 | # |
| 652 | JA_SOURCE_ENCODING = eucJP |
| 653 | JA_TARGET_ENCODINGS = eucJP UTF-8 PCK |
| 654 | |
| 655 | # Settings for the JDI - Serviceability Agent binding. |
| 656 | HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH) |
| 657 | SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX) |
| 658 | INCLUDE_SA=true |
| 659 | |