## Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.## This code is free software; you can redistribute it and/or modify it# under the terms of the GNU General Public License version 2 only, as# published by the Free Software Foundation. Sun designates this# particular file as subject to the "Classpath" exception as provided# by Sun in the LICENSE file that accompanied this code.## This code is distributed in the hope that it will be useful, but WITHOUT# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License# version 2 for more details (a copy is included in the LICENSE file that# accompanied this code).## You should have received a copy of the GNU General Public License version# 2 along with this work; if not, write to the Free Software Foundation,# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.## Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,# CA 95054 USA or visit www.sun.com if you need additional information or# have any questions.### Makefile to specify compiler flags for programs and libraries# targeted to Linux. Should not contain any rules.## Warning: the following variables are overriden by Defs.gmk. Set# values will be silently ignored:# CFLAGS (set $(OTHER_CFLAGS) instead)# CPPFLAGS (set $(OTHER_CPPFLAGS) instead)# CXXFLAGS (set $(OTHER_CXXFLAGS) instead)# LDFLAGS (set $(OTHER_LDFAGS) instead)# LDLIBS (set $(EXTRA_LIBS) instead)# LDLIBS_COMMON (set $(EXTRA_LIBS) instead)# Get shared JDK settingsinclude $(BUILDDIR)/common/shared/Defs.gmk# Part of INCREMENTAL_BUILD mechanism.# Compiler emits things like: path/file.o: file.h# We want something like: relative_path/file.o relative_path/file.d: file.hCC_DEPEND = -MMCC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g'ifndef PLATFORM_SRC PLATFORM_SRC = $(TOPDIR)/src/solarisendif # PLATFORM_SRC# platform specific include filesPLATFORM_INCLUDE_NAME = $(PLATFORM)PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)# suffix used for make dependencies files.DEPEND_SUFFIX = d# The suffix applied to the library name for FDLIBMFDDLIBM_SUFFIX = a# The suffix applied to scripts (.bat for windows, nothing for unix)SCRIPT_SUFFIX =# CC compiler object code output directive flag valueCC_OBJECT_OUTPUT_FLAG = -o #trailing blank required!CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required!## Default HPI libraries. Build will build only native, unless# overriden at the make command line. This makes it convenient for# people doing, say, a pthreads port -- they can create a posix# directory here, and say "gnumake HPIS=posix" at the top# level.#HPIS = native## Default optimization#CC_HIGHEST_OPT = -O3CC_HIGHER_OPT = -O3CC_LOWER_OPT = -O2CC_NO_OPT =ifeq ($(PRODUCT), java) _OPT = $(CC_HIGHER_OPT)else _OPT = $(CC_LOWER_OPT) CPPFLAGS_DBG += -DLOGGING endif# For all platforms, do not omit the frame pointer register usage. # We need this frame pointer to make it easy to walk the stacks.# This should be the default on X86, but ia64 and amd64 may not have this# as the default.CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIANCFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIANCFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIANCFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9LDFLAGS_COMMON_sparc += -m32 -mcpu=v9CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH))LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH))# Add in platform specific optimizations for all opt levelsCC_HIGHEST_OPT += $(_OPT_$(ARCH))CC_HIGHER_OPT += $(_OPT_$(ARCH))CC_LOWER_OPT += $(_OPT_$(ARCH))# If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations offifdef NO_OPTIMIZATIONS CC_HIGHEST_OPT = $(CC_NO_OPT) CC_HIGHER_OPT = $(CC_NO_OPT) CC_LOWER_OPT = $(CC_NO_OPT)endif## Selection of warning messages#GCC_INHIBIT = -Wno-unused -Wno-parenthesesGCC_STYLE = GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT)## Treat compiler warnings as errors, if warnings not allowed#ifeq ($(COMPILER_WARNINGS_FATAL),true) GCC_WARNINGS += -Werrorendif## Misc compiler options#ifeq ($(ARCH),ppc) CFLAGS_COMMON = -fsigned-charelse # ARCH CFLAGS_COMMON = -fno-strict-aliasingendif # ARCHPIC_CODE_LARGE = -fPICPIC_CODE_SMALL = -fpicGLOBAL_KPIC = $(PIC_CODE_LARGE)ifeq ($(ARCH), amd64) CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipeelse CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS)endif# Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1DEBUG_FLAG = -gifeq ($(FASTDEBUG), true) ifeq ($(ARCH_DATA_MODEL), 64) DEBUG_FLAG = -g1 endifendifCFLAGS_OPT = $(POPT)CFLAGS_DBG = $(DEBUG_FLAG)CFLAGS_COMMON += $(CFLAGS_REQUIRED)CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS)CXXFLAGS_OPT = $(POPT)CXXFLAGS_DBG = $(DEBUG_FLAG)CXXFLAGS_COMMON += $(CFLAGS_REQUIRED)# FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug javaifeq ($(FASTDEBUG), true) CFLAGS_DBG += $(CC_LOWER_OPT) CXXFLAGS_DBG += $(CC_LOWER_OPT)endifCPPFLAGS_COMMON = -D$(ARCH) -DARCH='"$(ARCH)"' -DLINUX $(VERSION_DEFINES) \ -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANTifeq ($(ARCH_DATA_MODEL), 64)CPPFLAGS_COMMON += -D_LP64=1endifCPPFLAGS_OPT = CPPFLAGS_DBG = -DDEBUGifdef LIBRARY # Libraries need to locate other libraries at runtime, and you can tell # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) # buried inside the .so. The $ORIGIN says to look relative to where # the library itself is and it can be followed with relative paths from # that. By default we always look in $ORIGIN, optionally we add relative # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. # On Linux we add a flag -z origin, not sure if this is necessary, but # doesn't seem to hurt. # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. # Try: 'readelf -d lib*.so' to see these settings in a library. # LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%)endifEXTRA_LIBS += -lcLDFLAGS_DEFS_OPTION = -z defsLDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION)## -L paths for finding and -ljava#LDFLAGS_OPT = -Xlinker -O1LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH)LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX)## -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always# statically link libgcc but will print a warning with the flag. We don't # want the warning, so check gcc version first.#CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1)ifeq ("$(CC_VER_MAJOR)", "3")OTHER_LDFLAGS += -static-libgccendif# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)# (See Rules.gmk) The gcc 5 compiler might have an option for this?AUTOMATIC_PCH_OPTION = ## Post Processing of libraries/executables#ifeq ($(VARIANT), OPT) ifneq ($(NO_STRIP), true) # Debug 'strip -g' leaves local function Elf symbols (better stack traces) POST_STRIP_PROCESS = $(STRIP) -g endifendif## Use: ld $(LD_MAPFILE_FLAG) mapfile *.o#LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker## Support for Quantify.#ifdef QUANTIFYQUANTIFY_CMD = quantifyQUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yesLINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS)endif## Path and option to link against the VM, if you have to. Note that# there are libraries that link against only -ljava, but they do get# -L to the -ljvm, this is because -ljava depends on -ljvm, whereas# the library itself should not.#VM_NAME = serverJVMLIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/$(VM_NAME) -ljvmJAVALIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH) -ljava $(JVMLIB)## We want to privatize JVM symbols on Solaris. This is so the user can# write a function called FindClass and this should not override the # FindClass that is inside the JVM. At this point in time we are not# concerned with other JNI libraries because we hope that there will# not be as many clashes there.#PRIVATIZE_JVM_SYMBOLS = falseUSE_PTHREADS = trueoverride ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAMEoverride AWT_RUNPATH =override HAVE_ALTZONE = falseoverride HAVE_FILIOH = falseoverride HAVE_GETHRTIME = falseoverride HAVE_GETHRVTIME = falseoverride HAVE_SIGIGNORE = trueoverride LEX_LIBRARY = -lflifeq ($(STATIC_CXX),true)override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamicelseoverride LIBCXX = -lstdc++endifoverride LIBPOSIX4 =override LIBSOCKET =override LIBTHREAD =override MOOT_PRIORITIES = trueoverride NO_INTERRUPTIBLE_IO = trueoverride OPENWIN_HOME = /usr/X11R6ifeq ($(ARCH), amd64)override OPENWIN_LIB = $(OPENWIN_HOME)/lib64elseoverride OPENWIN_LIB = $(OPENWIN_HOME)/libendifoverride OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLERoverride SUN_CMM_SUBDIR =override THREADS_FLAG = nativeoverride USE_GNU_M4 = trueoverride USING_GNU_TAR = trueoverride WRITE_LIBVERSION = false# USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the# resulting resolved absolute name of the executable in the environment# variable EXECNAME. That executable name is then used that to locate the# installation area.override USE_EXECNAME = true# If your platform has DPS, it will have Type1 fonts too, in which case# it is best to enable DPS support until such time as 2D's rasteriser# can fully handle Type1 fonts in all cases. Default is "yes".# HAVE_DPS should only be "no" if the platform has no DPS headers or libs# DPS (Displayable PostScript) is available on Solaris machinesHAVE_DPS = no## Japanese manpages#JA_SOURCE_ENCODING = eucJPJA_TARGET_ENCODINGS = eucJP