make/common/Defs-linux.gmk

Thu, 17 Jun 2010 16:27:56 -0700

author
mikejwre
date
Thu, 17 Jun 2010 16:27:56 -0700
changeset 171
95db968660e7
parent 168
2657ee0d2d14
child 194
0f60cf26c5b5
permissions
-rw-r--r--

Added tag jdk7-b98 for changeset 3b99409057e4

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

mercurial