make/common/Defs-linux.gmk

changeset 1
55540e827aef
child 123
34a68fa0680b
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/common/Defs-linux.gmk	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,316 @@
     1.4 +#
     1.5 +# Copyright 1999-2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 +#
     1.8 +# This code is free software; you can redistribute it and/or modify it
     1.9 +# under the terms of the GNU General Public License version 2 only, as
    1.10 +# published by the Free Software Foundation.  Sun designates this
    1.11 +# particular file as subject to the "Classpath" exception as provided
    1.12 +# by Sun in the LICENSE file that accompanied this code.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 +# have any questions.
    1.27 +#
    1.28 +
    1.29 +#
    1.30 +# Makefile to specify compiler flags for programs and libraries
    1.31 +# targeted to Linux.  Should not contain any rules.
    1.32 +#
    1.33 +
    1.34 +# Warning: the following variables are overriden by Defs.gmk. Set
    1.35 +# values will be silently ignored:
    1.36 +#   CFLAGS        (set $(OTHER_CFLAGS) instead)
    1.37 +#   CPPFLAGS      (set $(OTHER_CPPFLAGS) instead)
    1.38 +#   CXXFLAGS      (set $(OTHER_CXXFLAGS) instead)
    1.39 +#   LDFLAGS       (set $(OTHER_LDFAGS) instead)
    1.40 +#   LDLIBS        (set $(EXTRA_LIBS) instead)
    1.41 +#   LDLIBS_COMMON (set $(EXTRA_LIBS) instead)
    1.42 +
    1.43 +# Get shared JDK settings
    1.44 +include $(BUILDDIR)/common/shared/Defs.gmk
    1.45 +
    1.46 +# Part of INCREMENTAL_BUILD mechanism.
    1.47 +#   Compiler emits things like:  path/file.o: file.h
    1.48 +#   We want something like: relative_path/file.o relative_path/file.d: file.h
    1.49 +CC_DEPEND	 = -MM
    1.50 +CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g'
    1.51 +
    1.52 +ifndef PLATFORM_SRC
    1.53 +  PLATFORM_SRC = $(TOPDIR)/src/solaris
    1.54 +endif # PLATFORM_SRC
    1.55 +
    1.56 +# platform specific include files
    1.57 +PLATFORM_INCLUDE_NAME = $(PLATFORM)
    1.58 +PLATFORM_INCLUDE      = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
    1.59 +
    1.60 +# suffix used for make dependencies files.
    1.61 +DEPEND_SUFFIX = d
    1.62 +# The suffix applied to the library name for FDLIBM
    1.63 +FDDLIBM_SUFFIX = a
    1.64 +# The suffix applied to scripts (.bat for windows, nothing for unix)
    1.65 +SCRIPT_SUFFIX =
    1.66 +# CC compiler object code output directive flag value
    1.67 +CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!
    1.68 +CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!
    1.69 +
    1.70 +#
    1.71 +# Default HPI libraries. Build will build only native, unless
    1.72 +# overriden at the make command line. This makes it convenient for
    1.73 +# people doing, say, a pthreads port -- they can create a posix
    1.74 +# directory here, and say "gnumake HPIS=posix" at the top
    1.75 +# level.
    1.76 +#
    1.77 +HPIS = native
    1.78 +
    1.79 +#
    1.80 +# Default optimization
    1.81 +#
    1.82 +CC_HIGHEST_OPT = -O3
    1.83 +CC_HIGHER_OPT  = -O3
    1.84 +CC_LOWER_OPT   = -O2
    1.85 +CC_NO_OPT      =
    1.86 +
    1.87 +ifeq ($(PRODUCT), java)
    1.88 +    _OPT = $(CC_HIGHER_OPT)
    1.89 +else
    1.90 +    _OPT = $(CC_LOWER_OPT)
    1.91 +    CPPFLAGS_DBG    += -DLOGGING 
    1.92 +endif
    1.93 +
    1.94 +# For all platforms, do not omit the frame pointer register usage. 
    1.95 +#    We need this frame pointer to make it easy to walk the stacks.
    1.96 +#    This should be the default on X86, but ia64 and amd64 may not have this
    1.97 +#    as the default.
    1.98 +CFLAGS_REQUIRED_amd64   += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
    1.99 +CFLAGS_REQUIRED_i586    += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
   1.100 +CFLAGS_REQUIRED_ia64    += -fno-omit-frame-pointer -D_LITTLE_ENDIAN
   1.101 +CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9
   1.102 +LDFLAGS_COMMON_sparcv9  += -m64 -mcpu=v9
   1.103 +CFLAGS_REQUIRED_sparc   += -m32 -mcpu=v9
   1.104 +LDFLAGS_COMMON_sparc    += -m32 -mcpu=v9
   1.105 +CFLAGS_REQUIRED         =  $(CFLAGS_REQUIRED_$(ARCH))
   1.106 +LDFLAGS_COMMON          += $(LDFLAGS_COMMON_$(ARCH))
   1.107 +
   1.108 +# Add in platform specific optimizations for all opt levels
   1.109 +CC_HIGHEST_OPT += $(_OPT_$(ARCH))
   1.110 +CC_HIGHER_OPT  += $(_OPT_$(ARCH))
   1.111 +CC_LOWER_OPT   += $(_OPT_$(ARCH))
   1.112 +
   1.113 +# If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off
   1.114 +ifdef NO_OPTIMIZATIONS
   1.115 +  CC_HIGHEST_OPT = $(CC_NO_OPT)
   1.116 +  CC_HIGHER_OPT  = $(CC_NO_OPT)
   1.117 +  CC_LOWER_OPT   = $(CC_NO_OPT)
   1.118 +endif
   1.119 +
   1.120 +#
   1.121 +# Selection of warning messages
   1.122 +#
   1.123 +GCC_INHIBIT	= -Wno-unused -Wno-parentheses
   1.124 +GCC_STYLE	= 
   1.125 +GCC_WARNINGS	= -W -Wall $(GCC_STYLE) $(GCC_INHIBIT)
   1.126 +
   1.127 +#
   1.128 +# Treat compiler warnings as errors, if warnings not allowed
   1.129 +#
   1.130 +ifeq ($(COMPILER_WARNINGS_FATAL),true)
   1.131 +  GCC_WARNINGS += -Werror
   1.132 +endif
   1.133 +
   1.134 +#
   1.135 +# Misc compiler options
   1.136 +#
   1.137 +ifeq ($(ARCH),ppc)
   1.138 +  CFLAGS_COMMON   = -fsigned-char
   1.139 +else # ARCH
   1.140 +  CFLAGS_COMMON   = -fno-strict-aliasing
   1.141 +endif # ARCH
   1.142 +PIC_CODE_LARGE = -fPIC
   1.143 +PIC_CODE_SMALL = -fpic
   1.144 +GLOBAL_KPIC = $(PIC_CODE_LARGE)
   1.145 +ifeq ($(ARCH), amd64)
   1.146 +   CFLAGS_COMMON   += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipe
   1.147 +else
   1.148 +   CFLAGS_COMMON   += $(GLOBAL_KPIC) $(GCC_WARNINGS)
   1.149 +endif
   1.150 +
   1.151 +# Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1
   1.152 +DEBUG_FLAG = -g
   1.153 +ifeq ($(FASTDEBUG), true)
   1.154 +  ifeq ($(ARCH_DATA_MODEL), 64)
   1.155 +    DEBUG_FLAG = -g1
   1.156 +  endif
   1.157 +endif
   1.158 +
   1.159 +CFLAGS_OPT      = $(POPT)
   1.160 +CFLAGS_DBG      = $(DEBUG_FLAG)
   1.161 +CFLAGS_COMMON += $(CFLAGS_REQUIRED)
   1.162 +
   1.163 +CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS)
   1.164 +CXXFLAGS_OPT	= $(POPT)
   1.165 +CXXFLAGS_DBG	= $(DEBUG_FLAG)
   1.166 +CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)
   1.167 +
   1.168 +# FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java
   1.169 +ifeq ($(FASTDEBUG), true)
   1.170 +  CFLAGS_DBG    += $(CC_LOWER_OPT)
   1.171 +  CXXFLAGS_DBG	+= $(CC_LOWER_OPT)
   1.172 +endif
   1.173 +
   1.174 +CPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \
   1.175 +		  -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT
   1.176 +
   1.177 +ifeq ($(ARCH_DATA_MODEL), 64)
   1.178 +CPPFLAGS_COMMON += -D_LP64=1
   1.179 +endif
   1.180 +
   1.181 +CPPFLAGS_OPT    = 
   1.182 +CPPFLAGS_DBG    = -DDEBUG
   1.183 +
   1.184 +ifdef LIBRARY
   1.185 +  # Libraries need to locate other libraries at runtime, and you can tell
   1.186 +  #   a library where to look by way of the dynamic runpaths (RPATH or RUNPATH)
   1.187 +  #   buried inside the .so. The $ORIGIN says to look relative to where
   1.188 +  #   the library itself is and it can be followed with relative paths from
   1.189 +  #   that. By default we always look in $ORIGIN, optionally we add relative
   1.190 +  #   paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths.
   1.191 +  #   On Linux we add a flag -z origin, not sure if this is necessary, but 
   1.192 +  #   doesn't seem to hurt.
   1.193 +  #   The environment variable LD_LIBRARY_PATH will over-ride these runpaths.
   1.194 +  #   Try: 'readelf -d lib*.so' to see these settings in a library.
   1.195 +  #
   1.196 +  LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN
   1.197 +  LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%)
   1.198 +endif
   1.199 +
   1.200 +EXTRA_LIBS += -lc
   1.201 +
   1.202 +LDFLAGS_DEFS_OPTION  = -z defs
   1.203 +LDFLAGS_COMMON  += $(LDFLAGS_DEFS_OPTION)
   1.204 +
   1.205 +#
   1.206 +# -L paths for finding and -ljava
   1.207 +#
   1.208 +LDFLAGS_OPT     = -Xlinker -O1
   1.209 +LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)
   1.210 +LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)
   1.211 +
   1.212 +#
   1.213 +# -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always
   1.214 +# statically link libgcc but will print a warning with the flag. We don't 
   1.215 +# want the warning, so check gcc version first.
   1.216 +#
   1.217 +CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1)
   1.218 +ifeq ("$(CC_VER_MAJOR)", "3")
   1.219 +OTHER_LDFLAGS  += -static-libgcc
   1.220 +endif
   1.221 +
   1.222 +# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
   1.223 +#   (See Rules.gmk) The gcc 5 compiler might have an option for this?
   1.224 +AUTOMATIC_PCH_OPTION = 
   1.225 +
   1.226 +#
   1.227 +# Post Processing of libraries/executables
   1.228 +#
   1.229 +ifeq ($(VARIANT), OPT)
   1.230 +  ifneq ($(NO_STRIP), true)
   1.231 +    # Debug 'strip -g' leaves local function Elf symbols (better stack traces)
   1.232 +    POST_STRIP_PROCESS = $(STRIP) -g
   1.233 +  endif
   1.234 +endif
   1.235 +
   1.236 +#
   1.237 +# Use: ld $(LD_MAPFILE_FLAG) mapfile *.o
   1.238 +#
   1.239 +LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker
   1.240 +
   1.241 +#
   1.242 +# Support for Quantify.
   1.243 +#
   1.244 +ifdef QUANTIFY
   1.245 +QUANTIFY_CMD = quantify
   1.246 +QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes
   1.247 +LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)
   1.248 +endif
   1.249 +
   1.250 +#
   1.251 +# Path and option to link against the VM, if you have to.  Note that
   1.252 +# there are libraries that link against only -ljava, but they do get
   1.253 +# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas
   1.254 +# the library itself should not.
   1.255 +#
   1.256 +VM_NAME         = server
   1.257 +JVMLIB          = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/$(VM_NAME) -ljvm
   1.258 +JAVALIB         = -L$(BOOTDIR)/jre/lib/$(LIBARCH) -ljava $(JVMLIB)
   1.259 +
   1.260 +#
   1.261 +# We want to privatize JVM symbols on Solaris. This is so the user can
   1.262 +# write a function called FindClass and this should not override the 
   1.263 +# FindClass that is inside the JVM. At this point in time we are not
   1.264 +# concerned with other JNI libraries because we hope that there will
   1.265 +# not be as many clashes there.
   1.266 +#
   1.267 +PRIVATIZE_JVM_SYMBOLS = false
   1.268 +
   1.269 +USE_PTHREADS = true
   1.270 +override ALT_CODESET_KEY         = _NL_CTYPE_CODESET_NAME
   1.271 +override AWT_RUNPATH             =
   1.272 +override HAVE_ALTZONE            = false
   1.273 +override HAVE_FILIOH             = false
   1.274 +override HAVE_GETHRTIME          = false
   1.275 +override HAVE_GETHRVTIME         = false
   1.276 +override HAVE_SIGIGNORE          = true
   1.277 +override LEX_LIBRARY             = -lfl
   1.278 +ifeq ($(STATIC_CXX),true)
   1.279 +override LIBCXX                  = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic
   1.280 +else
   1.281 +override LIBCXX                  = -lstdc++
   1.282 +endif
   1.283 +override LIBPOSIX4               =
   1.284 +override LIBSOCKET               =
   1.285 +override LIBTHREAD               =
   1.286 +override MOOT_PRIORITIES         = true
   1.287 +override NO_INTERRUPTIBLE_IO     = true
   1.288 +override OPENWIN_HOME            = /usr/X11R6
   1.289 +ifeq ($(ARCH), amd64)
   1.290 +override OPENWIN_LIB             = $(OPENWIN_HOME)/lib64
   1.291 +else
   1.292 +override OPENWIN_LIB             = $(OPENWIN_HOME)/lib
   1.293 +endif
   1.294 +override OTHER_M4FLAGS           = -D__GLIBC__ -DGNU_ASSEMBLER
   1.295 +override SUN_CMM_SUBDIR          =
   1.296 +override THREADS_FLAG            = native
   1.297 +override USE_GNU_M4              = true
   1.298 +override USING_GNU_TAR           = true
   1.299 +override WRITE_LIBVERSION        = false
   1.300 +
   1.301 +# USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the
   1.302 +# resulting resolved absolute name of the executable in the environment
   1.303 +# variable EXECNAME.  That executable name is then used that to locate the
   1.304 +# installation area.
   1.305 +override USE_EXECNAME            = true
   1.306 +
   1.307 +# If your platform has DPS, it will have Type1 fonts too, in which case
   1.308 +# it is best to enable DPS support until such time as 2D's rasteriser
   1.309 +# can fully handle Type1 fonts in all cases. Default is "yes".
   1.310 +# HAVE_DPS should only be "no" if the platform has no DPS headers or libs
   1.311 +# DPS (Displayable PostScript) is available on Solaris machines
   1.312 +HAVE_DPS = no
   1.313 +
   1.314 +#
   1.315 +# Japanese manpages
   1.316 +#
   1.317 +JA_SOURCE_ENCODING = eucJP
   1.318 +JA_TARGET_ENCODINGS = eucJP
   1.319 +

mercurial