duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 1 | # |
ohair | 2283b9d | 2010-05-25 15:58:33 -0700 | [diff] [blame] | 2 | # Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 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 |
ohair | 2283b9d | 2010-05-25 15:58:33 -0700 | [diff] [blame] | 7 | # published by the Free Software Foundation. Oracle designates this |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 8 | # particular file as subject to the "Classpath" exception as provided |
ohair | 2283b9d | 2010-05-25 15:58:33 -0700 | [diff] [blame] | 9 | # by Oracle in the LICENSE file that accompanied this code. |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 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 | # |
ohair | 2283b9d | 2010-05-25 15:58:33 -0700 | [diff] [blame] | 21 | # 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. |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 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) |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 43 | # |
| 44 | # Note: CPPFLAGS are used in C and C++ compiles. |
| 45 | # |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 46 | |
| 47 | # Get shared JDK settings |
| 48 | include $(JDK_MAKE_SHARED_DIR)/Defs.gmk |
| 49 | |
| 50 | ifndef PLATFORM_SRC |
ohair | 26e0af6 | 2008-03-04 09:52:54 -0800 | [diff] [blame] | 51 | PLATFORM_SRC = $(BUILDDIR)/../src/solaris |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 52 | endif # PLATFORM_SRC |
| 53 | |
| 54 | # Platform specific closed sources |
| 55 | ifndef OPENJDK |
| 56 | ifndef CLOSED_PLATFORM_SRC |
ohair | 26e0af6 | 2008-03-04 09:52:54 -0800 | [diff] [blame] | 57 | CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 58 | endif |
| 59 | endif |
| 60 | |
| 61 | # platform specific include files |
| 62 | PLATFORM_INCLUDE_NAME = $(PLATFORM) |
| 63 | PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) |
| 64 | |
| 65 | # suffix used for make dependencies files |
| 66 | DEPEND_SUFFIX = d |
| 67 | # suffix used for lint files |
| 68 | LINT_SUFFIX = ln |
| 69 | # The suffix applied to the library name for FDLIBM |
| 70 | FDDLIBM_SUFFIX = a |
| 71 | # The suffix applied to scripts (.bat for windows, nothing for unix) |
| 72 | SCRIPT_SUFFIX = |
| 73 | # CC compiler object code output directive flag value |
| 74 | CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! |
| 75 | CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! |
| 76 | |
| 77 | # |
| 78 | # Default HPI libraries. Build will build only native unless |
| 79 | # overriden at the make command line. This makes it convenient for |
| 80 | # people doing, say, a pthreads port -- they can create a posix |
| 81 | # directory here, and say "gnumake HPIS=posix" at the top |
| 82 | # level. |
| 83 | # |
| 84 | HPIS = native |
| 85 | |
| 86 | # |
| 87 | # Java default optimization (-x04/-O2) etc. Applies to the VM. |
| 88 | # |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 89 | ifndef OPTIMIZATION_LEVEL |
| 90 | ifeq ($(PRODUCT), java) |
| 91 | OPTIMIZATION_LEVEL = HIGHER |
| 92 | else |
| 93 | OPTIMIZATION_LEVEL = LOWER |
| 94 | endif |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 95 | endif |
ohair | b99e3e3 | 2009-03-31 16:10:31 -0700 | [diff] [blame] | 96 | ifndef FASTDEBUG_OPTIMIZATION_LEVEL |
| 97 | FASTDEBUG_OPTIMIZATION_LEVEL = LOWER |
| 98 | endif |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 99 | |
| 100 | # |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 101 | # If -Xa is in CFLAGS_COMMON it will end up ahead of $(CC_OPT) for the |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 102 | # optimized build, and that ordering of the flags completely freaks |
| 103 | # out cc. Hence, -Xa is instead in each CFLAGS variant. |
| 104 | # |
| 105 | # The more unusual options to the Sun C compiler: |
| 106 | # -v Stricter type checking, more error checking |
| 107 | # (To turn ALL warnings into fatals, use -errwarn=%all) |
| 108 | # -xstrconst Place string literals and constants in read-only area |
| 109 | # (means you can't write on your string literals) |
| 110 | # -xs Force debug information (stabs) into the .so or a.out |
| 111 | # (makes the library/executable debuggable without the |
| 112 | # .o files needing to be around, but at a space cost) |
| 113 | # -g & -O If you add the -g option to the optimized compiles |
| 114 | # you will get better stack retraces, the code is |
| 115 | # still optimized. This includes a space cost too. |
| 116 | # -xc99=%none Do NOT allow for c99 extensions to be used. |
| 117 | # e.g. declarations must precede statements |
| 118 | # -xCC Allow the C++ style of comments in C: // |
| 119 | # Required with many of the source files. |
| 120 | # -mt Assume multi-threaded (important) |
| 121 | # |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 122 | # The more unusual options to the Sun C compiler: |
| 123 | # +w Print more warnings |
| 124 | # +w2 Maximum warnings |
| 125 | # |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 126 | |
| 127 | # |
| 128 | # Debug flag for C and C++ compiler |
| 129 | # |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 130 | CFLAGS_DEBUG_OPTION = -g $(CC_OPT/NONE) |
| 131 | CXXFLAGS_DEBUG_OPTION = -g $(CXX_OPT/NONE) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 132 | |
| 133 | # Turn off -g if we are doing tcov build |
| 134 | ifdef TCOV_BUILD |
| 135 | CFLAGS_DEBUG_OPTION= |
| 136 | CXXFLAGS_DEBUG_OPTION= |
| 137 | endif |
| 138 | |
| 139 | # FASTDEBUG: Optimize the -g builds, gives us a faster debug java |
| 140 | # If true adds -O to the debug compiles. This allows for any assert |
| 141 | # tests to remain and debug checking. The resulting code is faster |
| 142 | # but less debuggable. Stack traces are still valid, although only |
| 143 | # approximate line numbers are given. Printing of local variables |
| 144 | # during a debugging session is not possible, but stepping and |
| 145 | # printing of global or static variables should be possible. |
| 146 | # Performance/size of files should be about the same, maybe smaller. |
| 147 | # |
| 148 | ifeq ($(FASTDEBUG), true) |
ohair | b99e3e3 | 2009-03-31 16:10:31 -0700 | [diff] [blame] | 149 | CFLAGS_DEBUG_OPTION = -g $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) |
| 150 | CXXFLAGS_DEBUG_OPTION = -g0 $(CXX_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 151 | endif |
| 152 | |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 153 | CFLAGS_COMMON = -L$(OBJDIR) |
| 154 | |
| 155 | # Do not allow C99 language features like declarations in code etc. |
| 156 | CFLAGS_COMMON += -xc99=%none |
| 157 | |
| 158 | # Allow C++ comments in C code |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 159 | CFLAGS_COMMON += -xCC |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 160 | |
| 161 | # Show error message tags on errors |
| 162 | CFLAGS_COMMON += -errshort=tags |
| 163 | CXXFLAGS_COMMON += -errtags=yes |
| 164 | |
| 165 | # Optimization flags |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 166 | CFLAGS_OPT = $(CC_OPT) |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 167 | |
| 168 | # Debug version flags |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 169 | CFLAGS_DBG = $(CFLAGS_DEBUG_OPTION) |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 170 | |
| 171 | # Required C compiler flags |
| 172 | CFLAGS_COMMON += -Xa $(CFLAGS_REQUIRED) |
| 173 | |
| 174 | # Maximum warnings all the time |
| 175 | CXXFLAGS_COMMON += +w |
| 176 | CFLAGS_COMMON += -v |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 177 | |
| 178 | # Assume MT behavior all the time (important) |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 179 | CXXFLAGS_COMMON += -mt |
| 180 | CFLAGS_COMMON += -mt |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 181 | |
| 182 | # Assume no C++ exceptions are used |
| 183 | CXXFLAGS_COMMON += -features=no%except -DCC_NOEX |
| 184 | |
| 185 | # For C++, these options tell it to assume nothing about locating libraries |
| 186 | # either at compile time, or at runtime. Use of these options will likely |
| 187 | # require the use of -L and -R options to indicate where libraries will |
| 188 | # be found at compile time (-L) and at runtime (-R). |
| 189 | # The /usr/lib location comes for free, so no need to specify that one. |
| 190 | # Note: C is much simplier and there is no need for these options. This |
| 191 | # is mostly needed to avoid dependencies on libraries in the |
| 192 | # Compiler install area, also see LIBCXX and LIBM. |
| 193 | CXXFLAGS_COMMON += -norunpath -xnolib |
| 194 | |
| 195 | # |
| 196 | # Treat compiler warnings as errors, if requested |
| 197 | # |
| 198 | ifeq ($(COMPILER_WARNINGS_FATAL),true) |
| 199 | CFLAGS_COMMON += -errwarn=%all |
| 200 | CXXFLAGS_COMMON += -errwarn=%all |
| 201 | endif |
| 202 | |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 203 | CXXFLAGS_OPT = $(CXX_OPT) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 204 | CXXFLAGS_DBG = $(CXXFLAGS_DEBUG_OPTION) |
| 205 | CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) |
| 206 | |
| 207 | # Add -xstrconst to the library compiles. This forces all string |
| 208 | # literals into the read-only data section, which prevents them from |
| 209 | # being written to and increases the runtime pages shared on the system. |
| 210 | # |
| 211 | ifdef LIBRARY |
| 212 | CFLAGS_COMMON +=-xstrconst |
| 213 | endif |
| 214 | |
| 215 | # Source browser database |
| 216 | # |
| 217 | # COMPILE_WITH_SB |
| 218 | # If defined adds -xsb to compiles and creates a |
| 219 | # source browsing database during compilation. |
| 220 | # |
| 221 | ifdef COMPILE_WITH_SB |
| 222 | ifeq ($(LIBRARY), java) |
| 223 | CFLAGS_DBG += -xsb |
| 224 | endif |
| 225 | endif |
| 226 | |
| 227 | # Lint Flags: |
| 228 | # -Xa ANSI C plus K&R, favor ANSI rules |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 229 | # -fd report on old style func defs |
| 230 | # -errchk=structarg report on 64bit struct args by value |
| 231 | # -errchk=longptr64 report on 64bit to 32bit issues (ignores casts) |
| 232 | # -errchk=parentheses report on suggested use of extra parens |
| 233 | # -v suppress unused args |
| 234 | # -x suppress unused externs |
| 235 | # -u suppress extern func/vars used/defined |
| 236 | # -errfmt=simple use one line errors with position info |
ohair | 3f08386 | 2008-06-04 09:38:18 -0700 | [diff] [blame] | 237 | # $(LINT_XARCH_OPTION) See Compiler-sun.gwk |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 238 | |
| 239 | LINTFLAGS_COMMON = -Xa |
| 240 | LINTFLAGS_COMMON += -fd |
| 241 | LINTFLAGS_COMMON += -errchk=structarg,longptr64,parentheses |
| 242 | LINTFLAGS_COMMON += -v |
| 243 | LINTFLAGS_COMMON += -x |
| 244 | LINTFLAGS_COMMON += -u |
| 245 | LINTFLAGS_COMMON += -errfmt=simple |
| 246 | LINTFLAGS_OPT = |
| 247 | LINTFLAGS_DBG = |
| 248 | |
| 249 | # The -W0,-noglobal tells the compiler to NOT generate mangled global |
| 250 | # ELF data symbols for file local static data. |
| 251 | # This can break fix&continue, but we'd rather do the same compilations |
| 252 | # for deliverable bits as we do for non-deliverable bits |
| 253 | # Tell the compilers to never generate globalized names, all the time. |
| 254 | CFLAGS_COMMON += -W0,-noglobal |
| 255 | |
ohair | 3f08386 | 2008-06-04 09:38:18 -0700 | [diff] [blame] | 256 | # If we have a specific arch value to use, add it |
| 257 | CFLAGS_COMMON += $(XARCH_OPTION) |
| 258 | CXXFLAGS_COMMON += $(XARCH_OPTION) |
| 259 | ASFLAGS_COMMON += $(AS_XARCH_OPTION) |
| 260 | EXTRA_LIBS += $(XARCH_OPTION) |
| 261 | LINTFLAGS_COMMON += $(LINT_XARCH_OPTION) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 262 | |
| 263 | # |
| 264 | # uncomment the following to build with PERTURBALOT set |
| 265 | # |
| 266 | # OTHER_CFLAGS += -DPERTURBALOT |
| 267 | # |
| 268 | |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 269 | CPPFLAGS_COMMON = -D__solaris__ -D$(ARCH_FAMILY) |
| 270 | CPPFLAGS_OPT = -DNDEBUG |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 271 | CPPFLAGS_DBG = -DDEBUG |
| 272 | |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 273 | ifneq ($(PRODUCT), java) |
| 274 | CPPFLAGS_DBG += -DLOGGING -DDBINFO |
| 275 | endif |
| 276 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 277 | ifeq ($(ARCH_FAMILY), i586) |
| 278 | # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the |
| 279 | # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN |
| 280 | # (The Solaris X86 system defines this in file /usr/include/sys/isa_defs.h). |
| 281 | # Note: -Dmacro is the same as #define macro 1 |
| 282 | # -Dmacro= is the same as #define macro |
| 283 | # |
| 284 | CPPFLAGS_COMMON += -DcpuIntel -D_LITTLE_ENDIAN= -D$(LIBARCH) |
| 285 | # Turn off a superfluous compiler error message on Intel |
| 286 | CFLAGS_COMMON += -erroff=E_BAD_PRAGMA_PACK_VALUE |
| 287 | endif |
| 288 | |
| 289 | # Java memory management is based on memory mapping by default, but a |
| 290 | # system only assuming malloc/free can be built by adding -DUSE_MALLOC |
| 291 | |
| 292 | CPPFLAGS_COMMON += -DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS |
| 293 | CPPFLAGS_OPT += -DTRIMMED |
| 294 | |
| 295 | LDFLAGS_DEFS_OPTION = -z defs |
| 296 | LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) |
| 297 | |
| 298 | # |
| 299 | # -L paths for finding and -ljava |
| 300 | # |
| 301 | LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) |
| 302 | LDFLAGS_OPT = |
| 303 | LDFLAGS_DBG = |
| 304 | |
| 305 | # |
| 306 | # We never really want the incremental linker, ever |
| 307 | # The -xildoff option tells Sun's compilers to NOT use incremental linker |
| 308 | # |
| 309 | LDFLAGS_COMMON += -xildoff |
| 310 | |
| 311 | ifdef LIBRARY |
| 312 | # Libraries need to locate other libraries at runtime, and you can tell |
| 313 | # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
| 314 | # buried inside the .so. The $ORIGIN says to look relative to where |
| 315 | # the library itself is and it can be followed with relative paths from |
| 316 | # that. By default we always look in $ORIGIN, optionally we add relative |
| 317 | # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. |
| 318 | # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
| 319 | # Try: 'dump -Lv lib*.so' to see these settings in a library. |
| 320 | # |
| 321 | LDFLAGS_COMMON += -R\$$ORIGIN |
| 322 | LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-R\$$ORIGIN/%) |
| 323 | endif |
| 324 | |
| 325 | EXTRA_LIBS += -lc |
| 326 | |
| 327 | # Postprocessing is done on the images directories only |
| 328 | # |
| 329 | ifeq ($(VARIANT), OPT) |
| 330 | ifeq ($(PARTIAL_GPROF), true) |
| 331 | NO_STRIP = true |
| 332 | endif |
| 333 | ifeq ($(GPROF), true) |
| 334 | NO_STRIP = true |
| 335 | endif |
| 336 | ifneq ($(NO_STRIP), true) |
| 337 | # Debug 'strip -x' leaves local function Elf symbols (better stack traces) |
| 338 | POST_STRIP_PROCESS = $(STRIP) -x |
| 339 | endif |
| 340 | endif |
| 341 | POST_MCS_PROCESS=$(MCS) -d -a "JDK $(FULL_VERSION)" |
| 342 | |
| 343 | # |
| 344 | # Sun C compiler will take -M and pass it on to ld. |
| 345 | # Usage: ld $(LD_MAPFILE_FLAG) mapfile *.o |
| 346 | # |
| 347 | ifeq ($(CC_VERSION),gcc) |
| 348 | LD_MAPFILE_FLAG = -Xlinker -M -Xlinker |
| 349 | else |
| 350 | LD_MAPFILE_FLAG = -M |
| 351 | endif |
| 352 | |
| 353 | # |
| 354 | # Variables globally settable from the make command line (default |
| 355 | # values in brackets): |
| 356 | # GPROF (false) |
| 357 | # Eg: % gnumake GPROF=true |
| 358 | GPROF = false |
| 359 | ifeq ($(GPROF), true) |
| 360 | CFLAGS_COMMON += -DGPROF -xpg |
| 361 | EXTRA_LIBS += -xpg |
| 362 | endif |
| 363 | |
| 364 | # PARTIAL_GPROF is to be used ONLY during compilation - it should not |
| 365 | # appear during linking of libraries or programs. It also should |
| 366 | # prevent linking with -z defs to allow a symbol to remain undefined. |
| 367 | # |
| 368 | PARTIAL_GPROF = false |
| 369 | ifeq ($(PARTIAL_GPROF), true) |
| 370 | CFLAGS_GPROF += -xpg |
| 371 | LDFLAGS_DEFS_OPTION = -z nodefs |
| 372 | endif |
| 373 | |
| 374 | # |
| 375 | # For a TCOV build we add in the TCOV_OPTION |
| 376 | # |
| 377 | ifdef TCOV_BUILD |
| 378 | TCOV_OPTION = -xprofile=tcov |
| 379 | LDFLAGS_COMMON += $(TCOV_OPTION) -Kpic |
| 380 | CFLAGS_COMMON += $(TCOV_OPTION) |
| 381 | CXXFLAGS_COMMON += $(TCOV_OPTION) |
| 382 | EXTRA_LIBS += $(TCOV_OPTION) |
| 383 | LDNOMAP=true |
| 384 | endif |
| 385 | |
| 386 | # |
| 387 | # Solaris only uses native threads. |
| 388 | # |
| 389 | THREADS_FLAG= native |
| 390 | THREADS_DIR= threads |
| 391 | |
| 392 | # |
| 393 | # Support for Quantify. |
| 394 | # |
| 395 | ifdef QUANTIFY |
| 396 | QUANTIFY_CMD = quantify |
| 397 | QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
| 398 | LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
| 399 | ifdef LIBRARY |
| 400 | CFLAGS_COMMON += -K PIC |
| 401 | endif |
| 402 | endif |
| 403 | |
| 404 | # |
| 405 | # Support for Purify. |
| 406 | # |
| 407 | ifdef PURIFY |
| 408 | PURIFY_CMD = /net/suntools.eng/export/tools/sparc/bin/purify |
| 409 | PURIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
| 410 | LINK_PRE_CMD = $(PURIFY_CMD) $(PURIFY_OPTIONS) |
| 411 | ifdef LIBRARY |
| 412 | CFLAGS_COMMON += -K PIC |
| 413 | endif |
| 414 | endif |
| 415 | |
| 416 | # |
| 417 | # Different "levels" of optimization. |
| 418 | # |
| 419 | ifeq ($(CC_VERSION),gcc) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 420 | |
| 421 | CC_OPT/NONE = |
| 422 | CC_OPT/LOWER = -O2 |
| 423 | CC_OPT/HIGHER = -O3 |
| 424 | CC_OPT/HIGHEST = -O3 |
| 425 | |
| 426 | CXX_OPT/NONE = |
| 427 | CXX_OPT/LOWER = -O2 |
| 428 | CXX_OPT/HIGHER = -O3 |
| 429 | CXX_OPT/HIGHEST = -O3 |
| 430 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 431 | CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer |
| 432 | CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 433 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 434 | # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
| 435 | # (See Rules.gmk) May need to wait for gcc 5? |
| 436 | AUTOMATIC_PCH_OPTION = |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 437 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 438 | else |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 439 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 440 | # Highest could be -xO5, but indications are that -xO5 should be reserved |
| 441 | # for a per-file use, on sources with known performance impacts. |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 442 | OPT_LEVEL/LOWER = 2 |
| 443 | OPT_LEVEL/HIGHER = 4 |
| 444 | OPT_LEVEL/HIGHEST = 4 |
| 445 | |
| 446 | CC_OPT/NONE = |
| 447 | CC_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%) |
| 448 | CC_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%) |
| 449 | CC_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) |
| 450 | |
| 451 | CXX_OPT/NONE = |
| 452 | CXX_OPT/LOWER = $(OPT_LEVEL/LOWER:%=-xO%) |
| 453 | CXX_OPT/HIGHER = $(OPT_LEVEL/HIGHER:%=-xO%) |
| 454 | CXX_OPT/HIGHEST = $(OPT_LEVEL/HIGHEST:%=-xO%) |
| 455 | |
| 456 | # We need stack frames at all times |
| 457 | USE_XKEEPFRAME_OPTION = false |
| 458 | ifeq ($(USE_XKEEPFRAME_OPTION),true) |
| 459 | |
| 460 | # Unknown spelling on this option at this time (Maybe in SS13?) |
| 461 | CC_XKEEPFRAME_OPTIONS = -xkeepframe |
| 462 | CXX_XKEEPFRAME_OPTIONS = -xkeepframe |
| 463 | |
| 464 | else |
| 465 | |
| 466 | # On X86, make sure tail call optimization is off |
| 467 | # The z and y are the tail call optimizations. |
| 468 | ifeq ($(ARCH_FAMILY), i586) |
| 469 | ifeq ($(shell $(EXPR) $(CC_VER) \> 5.8), 1) |
| 470 | # Somehow, tail call optimization is creeping in. |
| 471 | # Make sure it is off. |
| 472 | # WARNING: These may cause compiler warnings about duplicate -O options |
| 473 | CC_XKEEPFRAME_OPTIONS += -Wu,-O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz |
| 474 | CXX_XKEEPFRAME_OPTIONS += -Qoption ube -O$(OPT_LEVEL/$(OPTIMIZATION_LEVEL))~yz |
| 475 | endif |
| 476 | endif |
| 477 | |
| 478 | # On i586 we need to tell the code generator to ALWAYS use a |
| 479 | # frame pointer. |
| 480 | ifeq ($(ARCH_FAMILY), i586) |
| 481 | # Note that in 5.7, this is done with -xregs=no%frameptr |
| 482 | ifeq ($(CC_VER), 5.5) |
| 483 | # It's not exactly clear when this optimization kicks in, the |
| 484 | # current assumption is -xO4 or greater and for C++ with |
| 485 | # the -features=no%except option and -xO4 and greater. |
| 486 | # Bottom line is, we ALWAYS want a frame pointer! |
| 487 | CC_XKEEPFRAME_OPTIONS += -Wu,-Z~B |
| 488 | CXX_XKEEPFRAME_OPTIONS += -Qoption ube -Z~B |
| 489 | endif |
| 490 | ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1) |
| 491 | # Do NOT use frame pointer register as a general purpose opt register |
| 492 | CC_OPT/NONE += -xregs=no%frameptr |
| 493 | CXX_OPT/NONE += -xregs=no%frameptr |
| 494 | CC_XKEEPFRAME_OPTIONS += -xregs=no%frameptr |
| 495 | CXX_XKEEPFRAME_OPTIONS += -xregs=no%frameptr |
| 496 | endif |
| 497 | endif |
| 498 | |
| 499 | # Optimizer for sparc needs to be told not to do certain things |
| 500 | # related to frames or save instructions. |
| 501 | ifeq ($(ARCH_FAMILY), sparc) |
| 502 | # Do not use save instructions instead of add instructions |
| 503 | # This was an optimization starting in SC5.0 that made it hard for us to |
| 504 | # find the "save" instruction (which got turned into an "add") |
| 505 | CC_XKEEPFRAME_OPTIONS += -Wc,-Qrm-s |
| 506 | CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qrm-s |
| 507 | # Don't allow tail call code optimization. Started in SC5.0. |
| 508 | # We don't like code of this form: |
| 509 | # save |
| 510 | # <code> |
| 511 | # call foo |
| 512 | # restore |
| 513 | # because we can't tell if the method will have a stack frame |
| 514 | # and register windows or not. |
| 515 | CC_XKEEPFRAME_OPTIONS += -Wc,-Qiselect-T0 |
| 516 | CXX_XKEEPFRAME_OPTIONS += -Qoption cg -Qiselect-T0 |
| 517 | endif |
| 518 | |
| 519 | endif |
| 520 | |
| 521 | # Extra options used with HIGHEST |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 522 | # |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 523 | # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 524 | # done with care, there are some assumptions below that need to |
| 525 | # be understood about the use of pointers, and IEEE behavior. |
| 526 | # |
| 527 | # Use non-standard floating point mode (not IEEE 754) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 528 | CC_HIGHEST_EXTRAS += -fns |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 529 | # Do some simplification of floating point arithmetic (not IEEE 754) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 530 | CC_HIGHEST_EXTRAS += -fsimple |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 531 | # Use single precision floating point with 'float' |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 532 | CC_HIGHEST_EXTRAS += -fsingle |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 533 | # Assume memory references via basic pointer types do not alias |
| 534 | # (Source with excessing pointer casting and data access with mixed |
| 535 | # pointer types are not recommended) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 536 | CC_HIGHEST_EXTRAS += -xalias_level=basic |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 537 | # Use intrinsic or inline versions for math/std functions |
| 538 | # (If you expect perfect errno behavior, do not use this) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 539 | CC_HIGHEST_EXTRAS += -xbuiltin=%all |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 540 | # Loop data dependency optimizations (need -xO3 or higher) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 541 | CC_HIGHEST_EXTRAS += -xdepend |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 542 | # Pointer parameters to functions do not overlap |
| 543 | # (Similar to -xalias_level=basic usage, but less obvious sometimes. |
| 544 | # If you pass in multiple pointers to the same data, do not use this) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 545 | CC_HIGHEST_EXTRAS += -xrestrict |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 546 | # Inline some library routines |
| 547 | # (If you expect perfect errno behavior, do not use this) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 548 | CC_HIGHEST_EXTRAS += -xlibmil |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 549 | # Use optimized math routines |
| 550 | # (If you expect perfect errno behavior, do not use this) |
| 551 | # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 552 | # CC_HIGHEST_EXTRAS += -xlibmopt |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 553 | ifeq ($(ARCH_FAMILY), sparc) |
| 554 | # Assume at most 8byte alignment, raise SIGBUS on error |
| 555 | ### Presents an ABI issue with customer JNI libs? |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 556 | ####CC_HIGHEST_EXTRAS += -xmemalign=8s |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 557 | # Automatic prefetch instructions, explicit prefetch macros |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 558 | CC_HIGHEST_EXTRAS += -xprefetch=auto,explicit |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 559 | # Pick ultra as the chip to optimize to |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 560 | CC_HIGHEST_EXTRAS += -xchip=ultra |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 561 | endif |
| 562 | ifeq ($(ARCH), i586) |
| 563 | # Pick pentium as the chip to optimize to |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 564 | CC_HIGHEST_EXTRAS += -xchip=pentium |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 565 | endif |
| 566 | ifdef LIBRARY |
| 567 | # The Solaris CBE (Common Build Environment) requires that the use |
| 568 | # of appl registers be disabled when compiling a public library (or |
| 569 | # a library that's loaded by a public library) on sparc. |
| 570 | CFLAGS_REQUIRED_sparc += -xregs=no%appl |
| 571 | CFLAGS_REQUIRED_sparcv9 += -xregs=no%appl |
| 572 | endif |
| 573 | ifeq ($(shell $(EXPR) $(CC_VER) \> 5.6), 1) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 574 | # We MUST allow data alignment of 4 for sparc V8 (32bit) |
| 575 | # Presents an ABI issue with customer JNI libs? We must be able to |
| 576 | # to handle 4byte aligned objects? (rare occurance, but possible?) |
| 577 | CFLAGS_REQUIRED_sparc += -xmemalign=4s |
| 578 | endif |
| 579 | # Just incase someone trys to use the SOS9 compilers |
| 580 | ifeq ($(CC_VER), 5.6) |
| 581 | # We MUST allow data alignment of 4 for sparc (sparcv9 is ok at 8s) |
| 582 | CFLAGS_REQUIRED_sparc += -xmemalign=4s |
| 583 | endif |
| 584 | # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
| 585 | # (See Rules.gmk) The SS11 -xpch=auto* options appear to be broken. |
| 586 | AUTOMATIC_PCH_OPTION = |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 587 | |
| 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 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 600 | endif |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 601 | |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 602 | # Default optimization settings based on level. |
| 603 | CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) |
| 604 | CXX_OPT = $(CXX_OPT/$(OPTIMIZATION_LEVEL)) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 605 | |
| 606 | # Flags required all the time |
| 607 | CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
| 608 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 609 | # |
| 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 | # |
| 615 | VM_NAME = server |
| 616 | JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm |
| 617 | JAVALIB = -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. |
| 624 | CC_DEPEND = -xM1 |
| 625 | CC_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?) |
| 628 | OPENWIN_HOME = /usr/openwin |
| 629 | OPENWIN_LIB = $(OPENWIN_HOME)/lib$(ISA_DIR) |
| 630 | |
| 631 | # Runtime graphics library search paths... |
| 632 | OPENWIN_RUNTIME_LIB = /usr/openwin/lib$(ISA_DIR) |
| 633 | AWT_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. |
| 640 | LIBCXX = /usr/lib$(ISA_DIR)/libCrun.so.1 |
| 641 | |
ceisserer | 93956ca | 2010-05-28 11:37:44 -0700 | [diff] [blame] | 642 | # JDK now requires Solaris 10, so pick up libm.so.2 |
| 643 | LIBM = /usr/lib$(ISA_DIR)/libm.so.2 |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 644 | |
| 645 | # Socket library |
| 646 | LIBSOCKET = -lsocket |
| 647 | |
martin | d5089e0 | 2010-06-10 15:54:25 -0700 | [diff] [blame] | 648 | # Network Services library |
| 649 | LIBNSL = -lnsl |
| 650 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 651 | # 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 | # |
| 661 | PIC_CODE_LARGE = -KPIC |
| 662 | PIC_CODE_SMALL = -Kpic |
| 663 | ifndef TCOV_BUILD |
| 664 | GLOBAL_KPIC = $(PIC_CODE_LARGE) |
| 665 | CXXFLAGS_COMMON += $(GLOBAL_KPIC) |
| 666 | CFLAGS_COMMON += $(GLOBAL_KPIC) |
| 667 | LDFLAGS_COMMON += -ztext |
| 668 | endif # 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 | |
| 676 | HAVE_DPS = yes |
| 677 | |
| 678 | # |
| 679 | # Japanese manpages |
| 680 | # |
| 681 | JA_SOURCE_ENCODING = eucJP |
| 682 | JA_TARGET_ENCODINGS = eucJP UTF-8 PCK |
| 683 | |
| 684 | # Settings for the JDI - Serviceability Agent binding. |
| 685 | HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH) |
| 686 | SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX) |
| 687 | INCLUDE_SA=true |
| 688 | |