Mon, 23 Mar 2009 17:58:32 -0700
Merge
duke@1 | 1 | # |
duke@1 | 2 | # Copyright 1999-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 Linux. Should not contain any rules. |
duke@1 | 29 | # |
duke@1 | 30 | |
duke@1 | 31 | # Warning: the following variables are overriden 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 | |
duke@1 | 40 | # Get shared JDK settings |
duke@1 | 41 | include $(BUILDDIR)/common/shared/Defs.gmk |
duke@1 | 42 | |
duke@1 | 43 | # Part of INCREMENTAL_BUILD mechanism. |
duke@1 | 44 | # Compiler emits things like: path/file.o: file.h |
duke@1 | 45 | # We want something like: relative_path/file.o relative_path/file.d: file.h |
duke@1 | 46 | CC_DEPEND = -MM |
duke@1 | 47 | CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' |
duke@1 | 48 | |
duke@1 | 49 | ifndef PLATFORM_SRC |
duke@1 | 50 | PLATFORM_SRC = $(TOPDIR)/src/solaris |
duke@1 | 51 | endif # PLATFORM_SRC |
duke@1 | 52 | |
duke@1 | 53 | # platform specific include files |
duke@1 | 54 | PLATFORM_INCLUDE_NAME = $(PLATFORM) |
duke@1 | 55 | PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) |
duke@1 | 56 | |
duke@1 | 57 | # suffix used for make dependencies files. |
duke@1 | 58 | DEPEND_SUFFIX = d |
duke@1 | 59 | # The suffix applied to the library name for FDLIBM |
duke@1 | 60 | FDDLIBM_SUFFIX = a |
duke@1 | 61 | # The suffix applied to scripts (.bat for windows, nothing for unix) |
duke@1 | 62 | SCRIPT_SUFFIX = |
duke@1 | 63 | # CC compiler object code output directive flag value |
duke@1 | 64 | CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! |
duke@1 | 65 | CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! |
duke@1 | 66 | |
duke@1 | 67 | # |
duke@1 | 68 | # Default HPI libraries. Build will build only native, unless |
duke@1 | 69 | # overriden at the make command line. This makes it convenient for |
duke@1 | 70 | # people doing, say, a pthreads port -- they can create a posix |
duke@1 | 71 | # directory here, and say "gnumake HPIS=posix" at the top |
duke@1 | 72 | # level. |
duke@1 | 73 | # |
duke@1 | 74 | HPIS = native |
duke@1 | 75 | |
duke@1 | 76 | # |
duke@1 | 77 | # Default optimization |
duke@1 | 78 | # |
duke@1 | 79 | CC_HIGHEST_OPT = -O3 |
duke@1 | 80 | CC_HIGHER_OPT = -O3 |
duke@1 | 81 | CC_LOWER_OPT = -O2 |
duke@1 | 82 | CC_NO_OPT = |
duke@1 | 83 | |
duke@1 | 84 | ifeq ($(PRODUCT), java) |
duke@1 | 85 | _OPT = $(CC_HIGHER_OPT) |
duke@1 | 86 | else |
duke@1 | 87 | _OPT = $(CC_LOWER_OPT) |
duke@1 | 88 | CPPFLAGS_DBG += -DLOGGING |
duke@1 | 89 | endif |
duke@1 | 90 | |
duke@1 | 91 | # For all platforms, do not omit the frame pointer register usage. |
duke@1 | 92 | # We need this frame pointer to make it easy to walk the stacks. |
duke@1 | 93 | # This should be the default on X86, but ia64 and amd64 may not have this |
duke@1 | 94 | # as the default. |
duke@1 | 95 | CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
duke@1 | 96 | CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
duke@1 | 97 | CFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN |
duke@1 | 98 | CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9 |
duke@1 | 99 | LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9 |
duke@1 | 100 | CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9 |
duke@1 | 101 | LDFLAGS_COMMON_sparc += -m32 -mcpu=v9 |
duke@1 | 102 | CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) |
duke@1 | 103 | LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH)) |
duke@1 | 104 | |
duke@1 | 105 | # Add in platform specific optimizations for all opt levels |
duke@1 | 106 | CC_HIGHEST_OPT += $(_OPT_$(ARCH)) |
duke@1 | 107 | CC_HIGHER_OPT += $(_OPT_$(ARCH)) |
duke@1 | 108 | CC_LOWER_OPT += $(_OPT_$(ARCH)) |
duke@1 | 109 | |
duke@1 | 110 | # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off |
duke@1 | 111 | ifdef NO_OPTIMIZATIONS |
duke@1 | 112 | CC_HIGHEST_OPT = $(CC_NO_OPT) |
duke@1 | 113 | CC_HIGHER_OPT = $(CC_NO_OPT) |
duke@1 | 114 | CC_LOWER_OPT = $(CC_NO_OPT) |
duke@1 | 115 | endif |
duke@1 | 116 | |
duke@1 | 117 | # |
duke@1 | 118 | # Selection of warning messages |
duke@1 | 119 | # |
duke@1 | 120 | GCC_INHIBIT = -Wno-unused -Wno-parentheses |
duke@1 | 121 | GCC_STYLE = |
duke@1 | 122 | GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT) |
duke@1 | 123 | |
duke@1 | 124 | # |
duke@1 | 125 | # Treat compiler warnings as errors, if warnings not allowed |
duke@1 | 126 | # |
duke@1 | 127 | ifeq ($(COMPILER_WARNINGS_FATAL),true) |
duke@1 | 128 | GCC_WARNINGS += -Werror |
duke@1 | 129 | endif |
duke@1 | 130 | |
duke@1 | 131 | # |
duke@1 | 132 | # Misc compiler options |
duke@1 | 133 | # |
duke@1 | 134 | ifeq ($(ARCH),ppc) |
duke@1 | 135 | CFLAGS_COMMON = -fsigned-char |
duke@1 | 136 | else # ARCH |
duke@1 | 137 | CFLAGS_COMMON = -fno-strict-aliasing |
duke@1 | 138 | endif # ARCH |
duke@1 | 139 | PIC_CODE_LARGE = -fPIC |
duke@1 | 140 | PIC_CODE_SMALL = -fpic |
duke@1 | 141 | GLOBAL_KPIC = $(PIC_CODE_LARGE) |
duke@1 | 142 | ifeq ($(ARCH), amd64) |
duke@1 | 143 | CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipe |
duke@1 | 144 | else |
duke@1 | 145 | CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) |
duke@1 | 146 | endif |
duke@1 | 147 | |
duke@1 | 148 | # Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1 |
duke@1 | 149 | DEBUG_FLAG = -g |
duke@1 | 150 | ifeq ($(FASTDEBUG), true) |
duke@1 | 151 | ifeq ($(ARCH_DATA_MODEL), 64) |
duke@1 | 152 | DEBUG_FLAG = -g1 |
duke@1 | 153 | endif |
duke@1 | 154 | endif |
duke@1 | 155 | |
duke@1 | 156 | CFLAGS_OPT = $(POPT) |
duke@1 | 157 | CFLAGS_DBG = $(DEBUG_FLAG) |
duke@1 | 158 | CFLAGS_COMMON += $(CFLAGS_REQUIRED) |
duke@1 | 159 | |
duke@1 | 160 | CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS) |
duke@1 | 161 | CXXFLAGS_OPT = $(POPT) |
duke@1 | 162 | CXXFLAGS_DBG = $(DEBUG_FLAG) |
duke@1 | 163 | CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) |
duke@1 | 164 | |
duke@1 | 165 | # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java |
duke@1 | 166 | ifeq ($(FASTDEBUG), true) |
duke@1 | 167 | CFLAGS_DBG += $(CC_LOWER_OPT) |
duke@1 | 168 | CXXFLAGS_DBG += $(CC_LOWER_OPT) |
duke@1 | 169 | endif |
duke@1 | 170 | |
duke@1 | 171 | CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \ |
duke@1 | 172 | -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT |
duke@1 | 173 | |
duke@1 | 174 | ifeq ($(ARCH_DATA_MODEL), 64) |
duke@1 | 175 | CPPFLAGS_COMMON += -D_LP64=1 |
duke@1 | 176 | endif |
duke@1 | 177 | |
duke@1 | 178 | CPPFLAGS_OPT = |
duke@1 | 179 | CPPFLAGS_DBG = -DDEBUG |
duke@1 | 180 | |
duke@1 | 181 | ifdef LIBRARY |
duke@1 | 182 | # Libraries need to locate other libraries at runtime, and you can tell |
duke@1 | 183 | # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) |
duke@1 | 184 | # buried inside the .so. The $ORIGIN says to look relative to where |
duke@1 | 185 | # the library itself is and it can be followed with relative paths from |
duke@1 | 186 | # that. By default we always look in $ORIGIN, optionally we add relative |
duke@1 | 187 | # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. |
duke@1 | 188 | # On Linux we add a flag -z origin, not sure if this is necessary, but |
duke@1 | 189 | # doesn't seem to hurt. |
duke@1 | 190 | # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. |
duke@1 | 191 | # Try: 'readelf -d lib*.so' to see these settings in a library. |
duke@1 | 192 | # |
duke@1 | 193 | LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN |
duke@1 | 194 | LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%) |
duke@1 | 195 | endif |
duke@1 | 196 | |
duke@1 | 197 | EXTRA_LIBS += -lc |
duke@1 | 198 | |
duke@1 | 199 | LDFLAGS_DEFS_OPTION = -z defs |
duke@1 | 200 | LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) |
duke@1 | 201 | |
duke@1 | 202 | # |
duke@1 | 203 | # -L paths for finding and -ljava |
duke@1 | 204 | # |
duke@1 | 205 | LDFLAGS_OPT = -Xlinker -O1 |
duke@1 | 206 | LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) |
duke@1 | 207 | LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) |
duke@1 | 208 | |
duke@1 | 209 | # |
duke@1 | 210 | # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always |
duke@1 | 211 | # statically link libgcc but will print a warning with the flag. We don't |
duke@1 | 212 | # want the warning, so check gcc version first. |
duke@1 | 213 | # |
duke@1 | 214 | CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1) |
duke@1 | 215 | ifeq ("$(CC_VER_MAJOR)", "3") |
duke@1 | 216 | OTHER_LDFLAGS += -static-libgcc |
duke@1 | 217 | endif |
duke@1 | 218 | |
duke@1 | 219 | # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) |
duke@1 | 220 | # (See Rules.gmk) The gcc 5 compiler might have an option for this? |
duke@1 | 221 | AUTOMATIC_PCH_OPTION = |
duke@1 | 222 | |
duke@1 | 223 | # |
duke@1 | 224 | # Post Processing of libraries/executables |
duke@1 | 225 | # |
duke@1 | 226 | ifeq ($(VARIANT), OPT) |
duke@1 | 227 | ifneq ($(NO_STRIP), true) |
duke@1 | 228 | # Debug 'strip -g' leaves local function Elf symbols (better stack traces) |
duke@1 | 229 | POST_STRIP_PROCESS = $(STRIP) -g |
duke@1 | 230 | endif |
duke@1 | 231 | endif |
duke@1 | 232 | |
duke@1 | 233 | # |
duke@1 | 234 | # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o |
duke@1 | 235 | # |
duke@1 | 236 | LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker |
duke@1 | 237 | |
duke@1 | 238 | # |
duke@1 | 239 | # Support for Quantify. |
duke@1 | 240 | # |
duke@1 | 241 | ifdef QUANTIFY |
duke@1 | 242 | QUANTIFY_CMD = quantify |
duke@1 | 243 | QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes |
duke@1 | 244 | LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) |
duke@1 | 245 | endif |
duke@1 | 246 | |
duke@1 | 247 | # |
duke@1 | 248 | # Path and option to link against the VM, if you have to. Note that |
duke@1 | 249 | # there are libraries that link against only -ljava, but they do get |
duke@1 | 250 | # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas |
duke@1 | 251 | # the library itself should not. |
duke@1 | 252 | # |
duke@1 | 253 | VM_NAME = server |
duke@1 | 254 | JVMLIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/$(VM_NAME) -ljvm |
duke@1 | 255 | JAVALIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH) -ljava $(JVMLIB) |
duke@1 | 256 | |
duke@1 | 257 | # |
duke@1 | 258 | # We want to privatize JVM symbols on Solaris. This is so the user can |
duke@1 | 259 | # write a function called FindClass and this should not override the |
duke@1 | 260 | # FindClass that is inside the JVM. At this point in time we are not |
duke@1 | 261 | # concerned with other JNI libraries because we hope that there will |
duke@1 | 262 | # not be as many clashes there. |
duke@1 | 263 | # |
duke@1 | 264 | PRIVATIZE_JVM_SYMBOLS = false |
duke@1 | 265 | |
duke@1 | 266 | USE_PTHREADS = true |
duke@1 | 267 | override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME |
duke@1 | 268 | override AWT_RUNPATH = |
duke@1 | 269 | override HAVE_ALTZONE = false |
duke@1 | 270 | override HAVE_FILIOH = false |
duke@1 | 271 | override HAVE_GETHRTIME = false |
duke@1 | 272 | override HAVE_GETHRVTIME = false |
duke@1 | 273 | override HAVE_SIGIGNORE = true |
duke@1 | 274 | override LEX_LIBRARY = -lfl |
duke@1 | 275 | ifeq ($(STATIC_CXX),true) |
duke@1 | 276 | override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic |
duke@1 | 277 | else |
duke@1 | 278 | override LIBCXX = -lstdc++ |
duke@1 | 279 | endif |
duke@1 | 280 | override LIBPOSIX4 = |
duke@1 | 281 | override LIBSOCKET = |
duke@1 | 282 | override LIBTHREAD = |
duke@1 | 283 | override MOOT_PRIORITIES = true |
duke@1 | 284 | override NO_INTERRUPTIBLE_IO = true |
duke@1 | 285 | override OPENWIN_HOME = /usr/X11R6 |
duke@1 | 286 | ifeq ($(ARCH), amd64) |
duke@1 | 287 | override OPENWIN_LIB = $(OPENWIN_HOME)/lib64 |
duke@1 | 288 | else |
duke@1 | 289 | override OPENWIN_LIB = $(OPENWIN_HOME)/lib |
duke@1 | 290 | endif |
duke@1 | 291 | override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER |
duke@1 | 292 | override SUN_CMM_SUBDIR = |
duke@1 | 293 | override THREADS_FLAG = native |
duke@1 | 294 | override USE_GNU_M4 = true |
duke@1 | 295 | override USING_GNU_TAR = true |
duke@1 | 296 | override WRITE_LIBVERSION = false |
duke@1 | 297 | |
duke@1 | 298 | # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the |
duke@1 | 299 | # resulting resolved absolute name of the executable in the environment |
duke@1 | 300 | # variable EXECNAME. That executable name is then used that to locate the |
duke@1 | 301 | # installation area. |
duke@1 | 302 | override USE_EXECNAME = true |
duke@1 | 303 | |
duke@1 | 304 | # If your platform has DPS, it will have Type1 fonts too, in which case |
duke@1 | 305 | # it is best to enable DPS support until such time as 2D's rasteriser |
duke@1 | 306 | # can fully handle Type1 fonts in all cases. Default is "yes". |
duke@1 | 307 | # HAVE_DPS should only be "no" if the platform has no DPS headers or libs |
duke@1 | 308 | # DPS (Displayable PostScript) is available on Solaris machines |
duke@1 | 309 | HAVE_DPS = no |
duke@1 | 310 | |
duke@1 | 311 | # |
duke@1 | 312 | # Japanese manpages |
duke@1 | 313 | # |
duke@1 | 314 | JA_SOURCE_ENCODING = eucJP |
duke@1 | 315 | JA_TARGET_ENCODINGS = eucJP |
duke@1 | 316 |