annotate make/common/Defs-linux.gmk @ 422:c51121419e30

6727683: Cleanup use of COMPILER_WARNINGS_FATAL in makefiles Reviewed-by: tbell
author ohair
date Sun, 27 Jul 2008 18:42:57 -0700
parents b6d6877c1155
children a418b563ed63
rev   line source
duke@0 1 #
xdono@381 2 # Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation. Sun designates this
duke@0 8 # particular file as subject to the "Classpath" exception as provided
duke@0 9 # by Sun in the LICENSE file that accompanied this code.
duke@0 10 #
duke@0 11 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 14 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 15 # accompanied this code).
duke@0 16 #
duke@0 17 # You should have received a copy of the GNU General Public License version
duke@0 18 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 20 #
duke@0 21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 22 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 23 # have any questions.
duke@0 24 #
duke@0 25
duke@0 26 #
duke@0 27 # Makefile to specify compiler flags for programs and libraries
duke@0 28 # targeted to Linux. Should not contain any rules.
duke@0 29 #
duke@0 30 # WARNING: This file is shared with other workspaces.
duke@0 31 # So when it includes other files, it must use JDK_TOPDIR.
duke@0 32 #
duke@0 33
duke@0 34 # Warning: the following variables are overriden by Defs.gmk. Set
duke@0 35 # values will be silently ignored:
duke@0 36 # CFLAGS (set $(OTHER_CFLAGS) instead)
duke@0 37 # CPPFLAGS (set $(OTHER_CPPFLAGS) instead)
duke@0 38 # CXXFLAGS (set $(OTHER_CXXFLAGS) instead)
duke@0 39 # LDFLAGS (set $(OTHER_LDFAGS) instead)
duke@0 40 # LDLIBS (set $(EXTRA_LIBS) instead)
duke@0 41 # LDLIBS_COMMON (set $(EXTRA_LIBS) instead)
duke@0 42
duke@0 43 # Get shared JDK settings
duke@0 44 include $(JDK_MAKE_SHARED_DIR)/Defs.gmk
duke@0 45
duke@0 46 # Part of INCREMENTAL_BUILD mechanism.
duke@0 47 # Compiler emits things like: path/file.o: file.h
duke@0 48 # We want something like: relative_path/file.o relative_path/file.d: file.h
duke@0 49 CC_DEPEND = -MM
duke@0 50 CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g'
duke@0 51
duke@0 52 ifndef PLATFORM_SRC
ohair@7 53 PLATFORM_SRC = $(BUILDDIR)/../src/solaris
duke@0 54 endif # PLATFORM_SRC
duke@0 55
duke@0 56 # Platform specific closed sources
duke@0 57 ifndef OPENJDK
duke@0 58 ifndef CLOSED_PLATFORM_SRC
ohair@7 59 CLOSED_PLATFORM_SRC = $(BUILDDIR)/../src/closed/solaris
duke@0 60 endif
duke@0 61 endif
duke@0 62
duke@0 63 # platform specific include files
duke@0 64 PLATFORM_INCLUDE_NAME = $(PLATFORM)
duke@0 65 PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
duke@0 66
duke@0 67 # suffix used for make dependencies files.
duke@0 68 DEPEND_SUFFIX = d
duke@0 69 # The suffix applied to the library name for FDLIBM
duke@0 70 FDDLIBM_SUFFIX = a
duke@0 71 # The suffix applied to scripts (.bat for windows, nothing for unix)
duke@0 72 SCRIPT_SUFFIX =
duke@0 73 # CC compiler object code output directive flag value
duke@0 74 CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
duke@0 75 CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
duke@0 76
duke@0 77 #
duke@0 78 # Default HPI libraries. Build will build only native, unless
duke@0 79 # overriden at the make command line. This makes it convenient for
duke@0 80 # people doing, say, a pthreads port -- they can create a posix
duke@0 81 # directory here, and say "gnumake HPIS=posix" at the top
duke@0 82 # level.
duke@0 83 #
duke@0 84 HPIS = native
duke@0 85
duke@0 86 #
duke@0 87 # Default optimization
duke@0 88 #
duke@0 89 CC_HIGHEST_OPT = -O3
duke@0 90 CC_HIGHER_OPT = -O3
duke@0 91 CC_LOWER_OPT = -O2
duke@0 92 CC_NO_OPT =
duke@0 93
duke@0 94 ifeq ($(PRODUCT), java)
duke@0 95 _OPT = $(CC_HIGHER_OPT)
duke@0 96 else
duke@0 97 _OPT = $(CC_LOWER_OPT)
duke@0 98 CPPFLAGS_DBG += -DLOGGING
duke@0 99 endif
duke@0 100
duke@0 101 # For all platforms, do not omit the frame pointer register usage.
duke@0 102 # We need this frame pointer to make it easy to walk the stacks.
duke@0 103 # This should be the default on X86, but ia64 and amd64 may not have this
duke@0 104 # as the default.
duke@0 105 CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
duke@0 106 CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
duke@0 107 CFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
duke@0 108 CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9
duke@0 109 LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9
duke@0 110 CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9
duke@0 111 LDFLAGS_COMMON_sparc += -m32 -mcpu=v9
duke@0 112 CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))
duke@0 113 LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH))
duke@0 114
duke@0 115 # Add in platform specific optimizations for all opt levels
duke@0 116 CC_HIGHEST_OPT += $(_OPT_$(ARCH))
duke@0 117 CC_HIGHER_OPT += $(_OPT_$(ARCH))
duke@0 118 CC_LOWER_OPT += $(_OPT_$(ARCH))
duke@0 119
duke@0 120 # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
duke@0 121 ifdef NO_OPTIMIZATIONS
duke@0 122 CC_HIGHEST_OPT = $(CC_NO_OPT)
duke@0 123 CC_HIGHER_OPT = $(CC_NO_OPT)
duke@0 124 CC_LOWER_OPT = $(CC_NO_OPT)
duke@0 125 endif
duke@0 126
duke@0 127 #
duke@0 128 # Selection of warning messages
duke@0 129 #
duke@0 130 GCC_INHIBIT = -Wno-unused -Wno-parentheses
duke@0 131 GCC_STYLE =
duke@0 132 GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT)
duke@0 133
duke@0 134 #
duke@0 135 # Treat compiler warnings as errors, if warnings not allowed
duke@0 136 #
duke@0 137 ifeq ($(COMPILER_WARNINGS_FATAL),true)
duke@0 138 GCC_WARNINGS += -Werror
duke@0 139 endif
duke@0 140
duke@0 141 #
duke@0 142 # Misc compiler options
duke@0 143 #
duke@0 144 ifeq ($(ARCH),ppc)
duke@0 145 CFLAGS_COMMON = -fsigned-char
duke@0 146 else # ARCH
duke@0 147 CFLAGS_COMMON = -fno-strict-aliasing
duke@0 148 endif # ARCH
duke@0 149 PIC_CODE_LARGE = -fPIC
duke@0 150 PIC_CODE_SMALL = -fpic
duke@0 151 GLOBAL_KPIC = $(PIC_CODE_LARGE)
ohair@422 152 CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS)
duke@0 153 ifeq ($(ARCH), amd64)
ohair@422 154 CFLAGS_COMMON += -pipe
duke@0 155 endif
duke@0 156
duke@0 157 # Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1
duke@0 158 DEBUG_FLAG = -g
duke@0 159 ifeq ($(FASTDEBUG), true)
duke@0 160 ifeq ($(ARCH_DATA_MODEL), 64)
duke@0 161 DEBUG_FLAG = -g1
duke@0 162 endif
duke@0 163 endif
duke@0 164
duke@0 165 CFLAGS_OPT = $(POPT)
duke@0 166 CFLAGS_DBG = $(DEBUG_FLAG)
duke@0 167 CFLAGS_COMMON += $(CFLAGS_REQUIRED)
duke@0 168
duke@0 169 CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS)
duke@0 170 CXXFLAGS_OPT = $(POPT)
duke@0 171 CXXFLAGS_DBG = $(DEBUG_FLAG)
duke@0 172 CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
duke@0 173
duke@0 174 # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java
duke@0 175 ifeq ($(FASTDEBUG), true)
duke@0 176 CFLAGS_DBG += $(CC_LOWER_OPT)
duke@0 177 CXXFLAGS_DBG += $(CC_LOWER_OPT)
duke@0 178 endif
duke@0 179
duke@0 180 CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \
duke@0 181 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT
duke@0 182
duke@0 183 ifeq ($(ARCH_DATA_MODEL), 64)
duke@0 184 CPPFLAGS_COMMON += -D_LP64=1
duke@0 185 endif
duke@0 186
duke@0 187 CPPFLAGS_OPT =
duke@0 188 CPPFLAGS_DBG = -DDEBUG
duke@0 189
duke@0 190 ifdef LIBRARY
duke@0 191 # Libraries need to locate other libraries at runtime, and you can tell
duke@0 192 # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
duke@0 193 # buried inside the .so. The $ORIGIN says to look relative to where
duke@0 194 # the library itself is and it can be followed with relative paths from
duke@0 195 # that. By default we always look in $ORIGIN, optionally we add relative
duke@0 196 # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
duke@0 197 # On Linux we add a flag -z origin, not sure if this is necessary, but
duke@0 198 # doesn't seem to hurt.
duke@0 199 # The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
duke@0 200 # Try: 'readelf -d lib*.so' to see these settings in a library.
duke@0 201 #
duke@0 202 LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN
duke@0 203 LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%)
duke@0 204 endif
duke@0 205
duke@0 206 EXTRA_LIBS += -lc
duke@0 207
duke@0 208 LDFLAGS_DEFS_OPTION = -z defs
duke@0 209 LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)
duke@0 210
duke@0 211 #
duke@0 212 # -L paths for finding and -ljava
duke@0 213 #
duke@0 214 LDFLAGS_OPT = -Xlinker -O1
duke@0 215 LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
duke@0 216 LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)
duke@0 217
duke@0 218 #
duke@0 219 # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always
duke@0 220 # statically link libgcc but will print a warning with the flag. We don't
duke@0 221 # want the warning, so check gcc version first.
duke@0 222 #
duke@0 223 CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1)
duke@0 224 ifeq ("$(CC_VER_MAJOR)", "3")
duke@0 225 OTHER_LDFLAGS += -static-libgcc
duke@0 226 endif
duke@0 227
duke@0 228 # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
duke@0 229 # (See Rules.gmk) The gcc 5 compiler might have an option for this?
duke@0 230 AUTOMATIC_PCH_OPTION =
duke@0 231
duke@0 232 #
duke@0 233 # Post Processing of libraries/executables
duke@0 234 #
duke@0 235 ifeq ($(VARIANT), OPT)
duke@0 236 ifneq ($(NO_STRIP), true)
duke@0 237 # Debug 'strip -g' leaves local function Elf symbols (better stack traces)
duke@0 238 POST_STRIP_PROCESS = $(STRIP) -g
duke@0 239 endif
duke@0 240 endif
duke@0 241
duke@0 242 #
duke@0 243 # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o
duke@0 244 #
duke@0 245 LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker
duke@0 246
duke@0 247 #
duke@0 248 # Support for Quantify.
duke@0 249 #
duke@0 250 ifdef QUANTIFY
duke@0 251 QUANTIFY_CMD = quantify
duke@0 252 QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
duke@0 253 LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
duke@0 254 endif
duke@0 255
duke@0 256 #
duke@0 257 # Path and option to link against the VM, if you have to. Note that
duke@0 258 # there are libraries that link against only -ljava, but they do get
duke@0 259 # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
duke@0 260 # the library itself should not.
duke@0 261 #
duke@0 262 VM_NAME = server
duke@0 263 JVMLIB = -L$(LIBDIR)/$(LIBARCH)/$(VM_NAME) -ljvm
duke@0 264 JAVALIB = -ljava $(JVMLIB)
duke@0 265
duke@0 266 #
duke@0 267 # We want to privatize JVM symbols on Solaris. This is so the user can
duke@0 268 # write a function called FindClass and this should not override the
duke@0 269 # FindClass that is inside the JVM. At this point in time we are not
duke@0 270 # concerned with other JNI libraries because we hope that there will
duke@0 271 # not be as many clashes there.
duke@0 272 #
duke@0 273 PRIVATIZE_JVM_SYMBOLS = false
duke@0 274
duke@0 275 USE_PTHREADS = true
duke@0 276 override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME
duke@0 277 override AWT_RUNPATH =
duke@0 278 override HAVE_ALTZONE = false
duke@0 279 override HAVE_FILIOH = false
duke@0 280 override HAVE_GETHRTIME = false
duke@0 281 override HAVE_GETHRVTIME = false
duke@0 282 override HAVE_SIGIGNORE = true
duke@0 283 override LEX_LIBRARY = -lfl
duke@0 284 ifeq ($(STATIC_CXX),true)
duke@0 285 override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
duke@0 286 else
duke@0 287 override LIBCXX = -lstdc++
duke@0 288 endif
duke@0 289 override LIBPOSIX4 =
duke@0 290 override LIBSOCKET =
duke@0 291 override LIBTHREAD =
duke@0 292 override MOOT_PRIORITIES = true
duke@0 293 override NO_INTERRUPTIBLE_IO = true
duke@0 294 override OPENWIN_HOME = /usr/X11R6
duke@0 295 ifeq ($(ARCH), amd64)
duke@0 296 override OPENWIN_LIB = $(OPENWIN_HOME)/lib64
duke@0 297 else
duke@0 298 override OPENWIN_LIB = $(OPENWIN_HOME)/lib
duke@0 299 endif
duke@0 300 override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER
duke@0 301 override SUN_CMM_SUBDIR =
duke@0 302 override THREADS_FLAG = native
duke@0 303 override USE_GNU_M4 = true
duke@0 304 override USING_GNU_TAR = true
duke@0 305 override WRITE_LIBVERSION = false
duke@0 306
duke@0 307 # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the
duke@0 308 # resulting resolved absolute name of the executable in the environment
duke@0 309 # variable EXECNAME. That executable name is then used that to locate the
duke@0 310 # installation area.
duke@0 311 override USE_EXECNAME = true
duke@0 312
duke@0 313 # If your platform has DPS, it will have Type1 fonts too, in which case
duke@0 314 # it is best to enable DPS support until such time as 2D's rasteriser
duke@0 315 # can fully handle Type1 fonts in all cases. Default is "yes".
duke@0 316 # HAVE_DPS should only be "no" if the platform has no DPS headers or libs
duke@0 317 # DPS (Displayable PostScript) is available on Solaris machines
duke@0 318 HAVE_DPS = no
duke@0 319
duke@0 320 #
duke@0 321 # Japanese manpages
duke@0 322 #
duke@0 323 JA_SOURCE_ENCODING = eucJP
duke@0 324 JA_TARGET_ENCODINGS = eucJP
duke@0 325
duke@0 326 # Settings for the JDI - Serviceability Agent binding.
duke@0 327 HOTSPOT_SALIB_PATH = $(HOTSPOT_IMPORT_PATH)/jre/lib/$(LIBARCH)
duke@0 328 SALIB_NAME = $(LIB_PREFIX)saproc.$(LIBRARY_SUFFIX)
duke@0 329
duke@0 330 # The JDI - Serviceability Agent binding is not currently supported
duke@0 331 # on Linux-ia64.
duke@0 332 ifeq ($(ARCH), ia64)
duke@0 333 INCLUDE_SA = false
duke@0 334 else
duke@0 335 INCLUDE_SA = true
duke@0 336 endif
duke@0 337