duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 1 | # |
xdono | d10b8cf | 2008-07-02 12:55:45 -0700 | [diff] [blame] | 2 | # Copyright 1999-2008 Sun Microsystems, Inc. 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 |
| 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 Linux. 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 overriden 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 | |
| 43 | # Get shared JDK settings |
| 44 | include $(JDK_MAKE_SHARED_DIR)/Defs.gmk |
| 45 | |
| 46 | # Part of INCREMENTAL_BUILD mechanism. |
| 47 | # Compiler emits things like: path/file.o: file.h |
| 48 | # We want something like: relative_path/file.o relative_path/file.d: file.h |
| 49 | CC_DEPEND = -MM |
| 50 | CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' |
| 51 | |
| 52 | ifndef PLATFORM_SRC |
ohair | 26e0af6 | 2008-03-04 09:52:54 -0800 | [diff] [blame] | 53 | PLATFORM_SRC = $(BUILDDIR)/../src/solaris |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 54 | endif # PLATFORM_SRC |
| 55 | |
| 56 | # Platform specific closed sources |
| 57 | ifndef OPENJDK |
| 58 | ifndef CLOSED_PLATFORM_SRC |
ohair | 26e0af6 | 2008-03-04 09:52:54 -0800 | [diff] [blame] | 59 | CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 60 | endif |
| 61 | endif |
| 62 | |
| 63 | # platform specific include files |
| 64 | PLATFORM_INCLUDE_NAME = $(PLATFORM) |
| 65 | PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) |
| 66 | |
| 67 | # suffix used for make dependencies files. |
| 68 | DEPEND_SUFFIX = d |
| 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 | # Default optimization |
| 88 | # |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 89 | |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 90 | ifndef OPTIMIZATION_LEVEL |
| 91 | ifeq ($(PRODUCT), java) |
| 92 | OPTIMIZATION_LEVEL = HIGHER |
| 93 | else |
| 94 | OPTIMIZATION_LEVEL = LOWER |
| 95 | endif |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 96 | endif |
ohair | b99e3e3 | 2009-03-31 16:10:31 -0700 | [diff] [blame] | 97 | ifndef FASTDEBUG_OPTIMIZATION_LEVEL |
| 98 | FASTDEBUG_OPTIMIZATION_LEVEL = LOWER |
| 99 | endif |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 100 | |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 101 | CC_OPT/NONE = |
| 102 | CC_OPT/LOWER = -O2 |
| 103 | CC_OPT/HIGHER = -O3 |
| 104 | CC_OPT/HIGHEST = -O3 |
| 105 | |
| 106 | CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) |
| 107 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 108 | # For all platforms, do not omit the frame pointer register usage. |
| 109 | # We need this frame pointer to make it easy to walk the stacks. |
| 110 | # This should be the default on X86, but ia64 and amd64 may not have this |
| 111 | # as the default. |
| 112 | CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
| 113 | CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
| 114 | CFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
| 115 | CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9 |
| 116 | LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9 |
| 117 | CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9 |
| 118 | LDFLAGS_COMMON_sparc += -m32 -mcpu=v9 |
| 119 | CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
| 120 | LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH)) |
| 121 | |
ohair | 8df3929 | 2009-01-31 17:31:21 -0800 | [diff] [blame] | 122 | # If this is a --hash-style=gnu system, use --hash-style=both |
| 123 | # The gnu .hash section won't work on some Linux systems like SuSE 10. |
| 124 | _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | $(GREP) -- '--hash-style=gnu') |
| 125 | ifneq ($(_HAS_HASH_STYLE_GNU),) |
| 126 | LDFLAGS_HASH_STYLE = -Wl,--hash-style=both |
| 127 | endif |
| 128 | LDFLAGS_COMMON += $(LDFLAGS_HASH_STYLE) |
| 129 | |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 130 | # |
| 131 | # Selection of warning messages |
| 132 | # |
| 133 | GCC_INHIBIT = -Wno-unused -Wno-parentheses |
| 134 | GCC_STYLE = |
| 135 | GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT) |
| 136 | |
| 137 | # |
| 138 | # Treat compiler warnings as errors, if warnings not allowed |
| 139 | # |
| 140 | ifeq ($(COMPILER_WARNINGS_FATAL),true) |
| 141 | GCC_WARNINGS += -Werror |
| 142 | endif |
| 143 | |
| 144 | # |
| 145 | # Misc compiler options |
| 146 | # |
| 147 | ifeq ($(ARCH),ppc) |
| 148 | CFLAGS_COMMON = -fsigned-char |
| 149 | else # ARCH |
| 150 | CFLAGS_COMMON = -fno-strict-aliasing |
| 151 | endif # ARCH |
| 152 | PIC_CODE_LARGE = -fPIC |
| 153 | PIC_CODE_SMALL = -fpic |
| 154 | GLOBAL_KPIC = $(PIC_CODE_LARGE) |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 155 | CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 156 | ifeq ($(ARCH), amd64) |
ohair | ab4f121 | 2008-07-27 18:42:57 -0700 | [diff] [blame] | 157 | CFLAGS_COMMON += -pipe |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 158 | endif |
| 159 | |
| 160 | # Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1 |
| 161 | DEBUG_FLAG = -g |
| 162 | ifeq ($(FASTDEBUG), true) |
| 163 | ifeq ($(ARCH_DATA_MODEL), 64) |
| 164 | DEBUG_FLAG = -g1 |
| 165 | endif |
| 166 | endif |
| 167 | |
aph | d46bd76 | 2009-04-17 15:56:20 +0100 | [diff] [blame] | 168 | # DEBUG_BINARIES overrides everything, use full -g debug information |
| 169 | ifeq ($(DEBUG_BINARIES), true) |
| 170 | DEBUG_FLAG = -g |
| 171 | CFLAGS_REQUIRED += $(DEBUG_FLAG) |
| 172 | endif |
| 173 | |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 174 | CFLAGS_OPT = $(CC_OPT) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 175 | CFLAGS_DBG = $(DEBUG_FLAG) |
| 176 | CFLAGS_COMMON += $(CFLAGS_REQUIRED) |
| 177 | |
| 178 | CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS) |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 179 | CXXFLAGS_OPT = $(CC_OPT) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 180 | CXXFLAGS_DBG = $(DEBUG_FLAG) |
| 181 | CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) |
| 182 | |
| 183 | # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java |
| 184 | ifeq ($(FASTDEBUG), true) |
ohair | b99e3e3 | 2009-03-31 16:10:31 -0700 | [diff] [blame] | 185 | CFLAGS_DBG += $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) |
| 186 | CXXFLAGS_DBG += $(CC_OPT/$(FASTDEBUG_OPTIMIZATION_LEVEL)) |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 187 | endif |
| 188 | |
| 189 | CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \ |
| 190 | -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT |
| 191 | |
| 192 | ifeq ($(ARCH_DATA_MODEL), 64) |
| 193 | CPPFLAGS_COMMON += -D_LP64=1 |
| 194 | endif |
| 195 | |
| 196 | CPPFLAGS_OPT = |
| 197 | CPPFLAGS_DBG = -DDEBUG |
ohair | 850fb25 | 2008-07-30 19:40:57 -0700 | [diff] [blame] | 198 | ifneq ($(PRODUCT), java) |
| 199 | CPPFLAGS_DBG += -DLOGGING |
| 200 | endif |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 201 | |
| 202 | ifdef LIBRARY |
| 203 | # Libraries need to locate other libraries at runtime, and you can tell |
| 204 | # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
| 205 | # buried inside the .so. The $ORIGIN says to look relative to where |
| 206 | # the library itself is and it can be followed with relative paths from |
| 207 | # that. By default we always look in $ORIGIN, optionally we add relative |
| 208 | # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. |
| 209 | # On Linux we add a flag -z origin, not sure if this is necessary, but |
| 210 | # doesn't seem to hurt. |
| 211 | # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
| 212 | # Try: 'readelf -d lib*.so' to see these settings in a library. |
| 213 | # |
| 214 | LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN |
| 215 | LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%) |
| 216 | endif |
| 217 | |
| 218 | EXTRA_LIBS += -lc |
| 219 | |
| 220 | LDFLAGS_DEFS_OPTION = -z defs |
| 221 | LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) |
| 222 | |
| 223 | # |
| 224 | # -L paths for finding and -ljava |
| 225 | # |
| 226 | LDFLAGS_OPT = -Xlinker -O1 |
| 227 | LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) |
| 228 | LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) |
| 229 | |
| 230 | # |
| 231 | # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always |
| 232 | # statically link libgcc but will print a warning with the flag. We don't |
| 233 | # want the warning, so check gcc version first. |
| 234 | # |
| 235 | CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1) |
| 236 | ifeq ("$(CC_VER_MAJOR)", "3") |
| 237 | OTHER_LDFLAGS += -static-libgcc |
| 238 | endif |
| 239 | |
| 240 | # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
| 241 | # (See Rules.gmk) The gcc 5 compiler might have an option for this? |
| 242 | AUTOMATIC_PCH_OPTION = |
| 243 | |
| 244 | # |
| 245 | # Post Processing of libraries/executables |
| 246 | # |
| 247 | ifeq ($(VARIANT), OPT) |
| 248 | ifneq ($(NO_STRIP), true) |
aph | d46bd76 | 2009-04-17 15:56:20 +0100 | [diff] [blame] | 249 | ifneq ($(DEBUG_BINARIES), true) |
| 250 | # Debug 'strip -g' leaves local function Elf symbols (better stack |
| 251 | # traces) |
| 252 | POST_STRIP_PROCESS = $(STRIP) -g |
| 253 | endif |
duke | 6e45e10 | 2007-12-01 00:00:00 +0000 | [diff] [blame] | 254 | endif |
| 255 | endif |
| 256 | |
| 257 | # |
| 258 | # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o |
| 259 | # |
| 260 | LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker |
| 261 | |
| 262 | # |
| 263 | # Support for Quantify. |
| 264 | # |
| 265 | ifdef QUANTIFY |
| 266 | QUANTIFY_CMD = quantify |
| 267 | QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
| 268 | LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
| 269 | endif |
| 270 | |
| 271 | # |
| 272 | # Path and option to link against the VM, if you have to. Note that |
| 273 | # there are libraries that link against only -ljava, but they do get |
| 274 | # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas |
| 275 | # the library itself should not. |
| 276 | # |
| 277 | VM_NAME = server |
| 278 | JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm |
| 279 | JAVALIB = -ljava $(JVMLIB) |
| 280 | |
| 281 | # |
| 282 | # We want to privatize JVM symbols on Solaris. This is so the user can |
| 283 | # write a function called FindClass and this should not override the |
| 284 | # FindClass that is inside the JVM. At this point in time we are not |
| 285 | # concerned with other JNI libraries because we hope that there will |
| 286 | # not be as many clashes there. |
| 287 | # |
| 288 | PRIVATIZE_JVM_SYMBOLS = false |
| 289 | |
| 290 | USE_PTHREADS = true |
| 291 | override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME |
| 292 | override AWT_RUNPATH = |
| 293 | override HAVE_ALTZONE = false |
| 294 | override HAVE_FILIOH = false |
| 295 | override HAVE_GETHRTIME = false |
| 296 | override HAVE_GETHRVTIME = false |
| 297 | override HAVE_SIGIGNORE = true |
| 298 | override LEX_LIBRARY = -lfl |
| 299 | ifeq ($(STATIC_CXX),true) |
| 300 | override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic |
| 301 | else |
| 302 | override LIBCXX = -lstdc++ |
| 303 | endif |
| 304 | override LIBPOSIX4 = |
| 305 | override LIBSOCKET = |
| 306 | override LIBTHREAD = |
| 307 | override MOOT_PRIORITIES = true |
| 308 | override NO_INTERRUPTIBLE_IO = true |
| 309 | override OPENWIN_HOME = /usr/X11R6 |
| 310 | ifeq ($(ARCH), amd64) |
| 311 | override OPENWIN_LIB = $(OPENWIN_HOME)/lib64 |
| 312 | else |
| 313 | override OPENWIN_LIB = $(OPENWIN_HOME)/lib |
| 314 | endif |
| 315 | override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER |
| 316 | override SUN_CMM_SUBDIR = |
| 317 | override THREADS_FLAG = native |
| 318 | override USE_GNU_M4 = true |
| 319 | override USING_GNU_TAR = true |
| 320 | override WRITE_LIBVERSION = false |
| 321 | |
| 322 | # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the |
| 323 | # resulting resolved absolute name of the executable in the environment |
| 324 | # variable EXECNAME. That executable name is then used that to locate the |
| 325 | # installation area. |
| 326 | override USE_EXECNAME = true |
| 327 | |
| 328 | # If your platform has DPS, it will have Type1 fonts too, in which case |
| 329 | # it is best to enable DPS support until such time as 2D's rasteriser |
| 330 | # can fully handle Type1 fonts in all cases. Default is "yes". |
| 331 | # HAVE_DPS should only be "no" if the platform has no DPS headers or libs |
| 332 | # DPS (Displayable PostScript) is available on Solaris machines |
| 333 | HAVE_DPS = no |
| 334 | |
| 335 | # |
| 336 | # Japanese manpages |
| 337 | # |
| 338 | JA_SOURCE_ENCODING = eucJP |
| 339 | JA_TARGET_ENCODINGS = eucJP |
| 340 | |
| 341 | # Settings for the JDI - Serviceability Agent binding. |
| 342 | HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH) |
| 343 | SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX) |
| 344 | |
| 345 | # The JDI - Serviceability Agent binding is not currently supported |
| 346 | # on Linux-ia64. |
| 347 | ifeq ($(ARCH), ia64) |
| 348 | INCLUDE_SA = false |
| 349 | else |
| 350 | INCLUDE_SA = true |
| 351 | endif |
| 352 | |