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