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