duke@1: # ohair@158: # Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. duke@1: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: # duke@1: # This code is free software; you can redistribute it and/or modify it duke@1: # under the terms of the GNU General Public License version 2 only, as ohair@158: # published by the Free Software Foundation. Oracle designates this duke@1: # particular file as subject to the "Classpath" exception as provided ohair@158: # by Oracle in the LICENSE file that accompanied this code. duke@1: # duke@1: # This code is distributed in the hope that it will be useful, but WITHOUT duke@1: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: # version 2 for more details (a copy is included in the LICENSE file that duke@1: # accompanied this code). duke@1: # duke@1: # You should have received a copy of the GNU General Public License version duke@1: # 2 along with this work; if not, write to the Free Software Foundation, duke@1: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: # ohair@158: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@158: # or visit www.oracle.com if you need additional information or have any ohair@158: # questions. duke@1: # duke@1: duke@1: # duke@1: # Makefile to specify compiler flags for programs and libraries duke@1: # targeted to Linux. Should not contain any rules. duke@1: # duke@1: duke@1: # Warning: the following variables are overriden by Defs.gmk. Set duke@1: # values will be silently ignored: duke@1: # CFLAGS (set $(OTHER_CFLAGS) instead) duke@1: # CPPFLAGS (set $(OTHER_CPPFLAGS) instead) duke@1: # CXXFLAGS (set $(OTHER_CXXFLAGS) instead) duke@1: # LDFLAGS (set $(OTHER_LDFAGS) instead) duke@1: # LDLIBS (set $(EXTRA_LIBS) instead) duke@1: # LDLIBS_COMMON (set $(EXTRA_LIBS) instead) duke@1: duke@1: # Get shared JDK settings duke@1: include $(BUILDDIR)/common/shared/Defs.gmk duke@1: duke@1: # Part of INCREMENTAL_BUILD mechanism. duke@1: # Compiler emits things like: path/file.o: file.h duke@1: # We want something like: relative_path/file.o relative_path/file.d: file.h duke@1: CC_DEPEND = -MM duke@1: CC_DEPEND_FILTER = $(SED) -e 's!$*\.$(OBJECT_SUFFIX)!$(dir $@)& $(dir $@)$*.$(DEPEND_SUFFIX)!g' duke@1: duke@1: ifndef PLATFORM_SRC duke@1: PLATFORM_SRC = $(TOPDIR)/src/solaris duke@1: endif # PLATFORM_SRC duke@1: duke@1: # platform specific include files duke@1: PLATFORM_INCLUDE_NAME = $(PLATFORM) duke@1: PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) duke@1: duke@1: # suffix used for make dependencies files. duke@1: DEPEND_SUFFIX = d duke@1: # The suffix applied to the library name for FDLIBM duke@1: FDDLIBM_SUFFIX = a duke@1: # The suffix applied to scripts (.bat for windows, nothing for unix) duke@1: SCRIPT_SUFFIX = duke@1: # CC compiler object code output directive flag value duke@1: CC_OBJECT_OUTPUT_FLAG = -o #trailing blank required! duke@1: CC_PROGRAM_OUTPUT_FLAG = -o #trailing blank required! duke@1: duke@1: # duke@1: # Default HPI libraries. Build will build only native, unless duke@1: # overriden at the make command line. This makes it convenient for duke@1: # people doing, say, a pthreads port -- they can create a posix duke@1: # directory here, and say "gnumake HPIS=posix" at the top duke@1: # level. duke@1: # duke@1: HPIS = native duke@1: duke@1: # duke@1: # Default optimization duke@1: # duke@1: CC_HIGHEST_OPT = -O3 duke@1: CC_HIGHER_OPT = -O3 duke@1: CC_LOWER_OPT = -O2 duke@1: CC_NO_OPT = duke@1: duke@1: ifeq ($(PRODUCT), java) duke@1: _OPT = $(CC_HIGHER_OPT) duke@1: else duke@1: _OPT = $(CC_LOWER_OPT) duke@1: CPPFLAGS_DBG += -DLOGGING duke@1: endif duke@1: duke@1: # For all platforms, do not omit the frame pointer register usage. duke@1: # We need this frame pointer to make it easy to walk the stacks. duke@1: # This should be the default on X86, but ia64 and amd64 may not have this duke@1: # as the default. duke@1: CFLAGS_REQUIRED_amd64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN duke@1: CFLAGS_REQUIRED_i586 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN duke@1: CFLAGS_REQUIRED_ia64 += -fno-omit-frame-pointer -D_LITTLE_ENDIAN duke@1: CFLAGS_REQUIRED_sparcv9 += -m64 -mcpu=v9 duke@1: LDFLAGS_COMMON_sparcv9 += -m64 -mcpu=v9 duke@1: CFLAGS_REQUIRED_sparc += -m32 -mcpu=v9 duke@1: LDFLAGS_COMMON_sparc += -m32 -mcpu=v9 gbenson@123: ifeq ($(ZERO_BUILD), true) gbenson@123: CFLAGS_REQUIRED = $(ZERO_ARCHFLAG) gbenson@123: ifeq ($(ZERO_ENDIANNESS), little) gbenson@123: CFLAGS_REQUIRED += -D_LITTLE_ENDIAN gbenson@123: endif gbenson@123: LDFLAGS_COMMON += $(ZERO_ARCHFLAG) gbenson@123: else gbenson@123: CFLAGS_REQUIRED = $(CFLAGS_REQUIRED_$(ARCH)) gbenson@123: LDFLAGS_COMMON += $(LDFLAGS_COMMON_$(ARCH)) gbenson@123: endif duke@1: duke@1: # Add in platform specific optimizations for all opt levels duke@1: CC_HIGHEST_OPT += $(_OPT_$(ARCH)) duke@1: CC_HIGHER_OPT += $(_OPT_$(ARCH)) duke@1: CC_LOWER_OPT += $(_OPT_$(ARCH)) duke@1: duke@1: # If NO_OPTIMIZATIONS is defined in the environment, turn all optimzations off duke@1: ifdef NO_OPTIMIZATIONS duke@1: CC_HIGHEST_OPT = $(CC_NO_OPT) duke@1: CC_HIGHER_OPT = $(CC_NO_OPT) duke@1: CC_LOWER_OPT = $(CC_NO_OPT) duke@1: endif duke@1: duke@1: # duke@1: # Selection of warning messages duke@1: # duke@1: GCC_INHIBIT = -Wno-unused -Wno-parentheses duke@1: GCC_STYLE = duke@1: GCC_WARNINGS = -W -Wall $(GCC_STYLE) $(GCC_INHIBIT) duke@1: duke@1: # duke@1: # Treat compiler warnings as errors, if warnings not allowed duke@1: # duke@1: ifeq ($(COMPILER_WARNINGS_FATAL),true) duke@1: GCC_WARNINGS += -Werror duke@1: endif duke@1: duke@1: # duke@1: # Misc compiler options duke@1: # duke@1: ifeq ($(ARCH),ppc) duke@1: CFLAGS_COMMON = -fsigned-char duke@1: else # ARCH duke@1: CFLAGS_COMMON = -fno-strict-aliasing duke@1: endif # ARCH duke@1: PIC_CODE_LARGE = -fPIC duke@1: PIC_CODE_SMALL = -fpic duke@1: GLOBAL_KPIC = $(PIC_CODE_LARGE) duke@1: ifeq ($(ARCH), amd64) duke@1: CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) -pipe duke@1: else duke@1: CFLAGS_COMMON += $(GLOBAL_KPIC) $(GCC_WARNINGS) duke@1: endif duke@1: duke@1: # Linux 64bit machines use Dwarf2, which can be HUGE, have fastdebug use -g1 duke@1: DEBUG_FLAG = -g duke@1: ifeq ($(FASTDEBUG), true) duke@1: ifeq ($(ARCH_DATA_MODEL), 64) duke@1: DEBUG_FLAG = -g1 duke@1: endif duke@1: endif duke@1: duke@1: CFLAGS_OPT = $(POPT) duke@1: CFLAGS_DBG = $(DEBUG_FLAG) duke@1: CFLAGS_COMMON += $(CFLAGS_REQUIRED) duke@1: duke@1: CXXFLAGS_COMMON = $(GLOBAL_KPIC) -DCC_NOEX $(GCC_WARNINGS) duke@1: CXXFLAGS_OPT = $(POPT) duke@1: CXXFLAGS_DBG = $(DEBUG_FLAG) duke@1: CXXFLAGS_COMMON += $(CFLAGS_REQUIRED) duke@1: duke@1: # FASTDEBUG: Optimize the code in the -g versions, gives us a faster debug java duke@1: ifeq ($(FASTDEBUG), true) duke@1: CFLAGS_DBG += $(CC_LOWER_OPT) duke@1: CXXFLAGS_DBG += $(CC_LOWER_OPT) duke@1: endif duke@1: andrew@168: CPP_ARCH_FLAGS = -DARCH='"$(ARCH)"' andrew@168: andrew@168: # Alpha arch does not like "alpha" defined (potential general arch cleanup issue here) andrew@168: ifneq ($(ARCH),alpha) andrew@168: CPP_ARCH_FLAGS += -D$(ARCH) andrew@168: else andrew@168: CPP_ARCH_FLAGS += -D_$(ARCH)_ andrew@168: endif andrew@168: andrew@168: CPPFLAGS_COMMON = $(CPP_ARCH_FLAGS) -DLINUX $(VERSION_DEFINES) \ duke@1: -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_REENTRANT duke@1: duke@1: ifeq ($(ARCH_DATA_MODEL), 64) duke@1: CPPFLAGS_COMMON += -D_LP64=1 duke@1: endif duke@1: duke@1: CPPFLAGS_OPT = duke@1: CPPFLAGS_DBG = -DDEBUG duke@1: duke@1: ifdef LIBRARY duke@1: # Libraries need to locate other libraries at runtime, and you can tell duke@1: # a library where to look by way of the dynamic runpaths (RPATH or RUNPATH) duke@1: # buried inside the .so. The $ORIGIN says to look relative to where duke@1: # the library itself is and it can be followed with relative paths from duke@1: # that. By default we always look in $ORIGIN, optionally we add relative duke@1: # paths if the Makefile sets LD_RUNPATH_EXTRAS to those relative paths. duke@1: # On Linux we add a flag -z origin, not sure if this is necessary, but duke@1: # doesn't seem to hurt. duke@1: # The environment variable LD_LIBRARY_PATH will over-ride these runpaths. duke@1: # Try: 'readelf -d lib*.so' to see these settings in a library. duke@1: # duke@1: LDFLAGS_COMMON += -Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN duke@1: LDFLAGS_COMMON += $(LD_RUNPATH_EXTRAS:%=-Xlinker -z -Xlinker origin -Xlinker -rpath -Xlinker \$$ORIGIN/%) duke@1: endif duke@1: duke@1: EXTRA_LIBS += -lc duke@1: gbenson@123: LDFLAGS_DEFS_OPTION = -Xlinker -z -Xlinker defs duke@1: LDFLAGS_COMMON += $(LDFLAGS_DEFS_OPTION) duke@1: duke@1: # duke@1: # -L paths for finding and -ljava duke@1: # duke@1: LDFLAGS_OPT = -Xlinker -O1 duke@1: LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) duke@1: LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) duke@1: duke@1: # duke@1: # -static-libgcc is a gcc-3 flag to statically link libgcc, gcc-2.9x always duke@1: # statically link libgcc but will print a warning with the flag. We don't duke@1: # want the warning, so check gcc version first. duke@1: # duke@1: CC_VER_MAJOR := $(shell $(CC) -dumpversion | $(SED) 's/egcs-//' | $(CUT) -d'.' -f1) duke@1: ifeq ("$(CC_VER_MAJOR)", "3") duke@1: OTHER_LDFLAGS += -static-libgcc duke@1: endif duke@1: duke@1: # Automatic precompiled header option to use (if COMPILE_APPROACH=batch) duke@1: # (See Rules.gmk) The gcc 5 compiler might have an option for this? duke@1: AUTOMATIC_PCH_OPTION = duke@1: duke@1: # duke@1: # Post Processing of libraries/executables duke@1: # duke@1: ifeq ($(VARIANT), OPT) duke@1: ifneq ($(NO_STRIP), true) duke@1: # Debug 'strip -g' leaves local function Elf symbols (better stack traces) duke@1: POST_STRIP_PROCESS = $(STRIP) -g duke@1: endif duke@1: endif duke@1: duke@1: # duke@1: # Use: ld $(LD_MAPFILE_FLAG) mapfile *.o duke@1: # duke@1: LD_MAPFILE_FLAG = -Xlinker --version-script -Xlinker duke@1: duke@1: # duke@1: # Support for Quantify. duke@1: # duke@1: ifdef QUANTIFY duke@1: QUANTIFY_CMD = quantify duke@1: QUANTIFY_OPTIONS = -cache-dir=/tmp/quantify -always-use-cache-dir=yes duke@1: LINK_PRE_CMD = $(QUANTIFY_CMD) $(QUANTIFY_OPTIONS) duke@1: endif duke@1: duke@1: # duke@1: # Path and option to link against the VM, if you have to. Note that duke@1: # there are libraries that link against only -ljava, but they do get duke@1: # -L to the -ljvm, this is because -ljava depends on -ljvm, whereas duke@1: # the library itself should not. duke@1: # duke@1: VM_NAME = server duke@1: JVMLIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH)/$(VM_NAME) -ljvm duke@1: JAVALIB = -L$(BOOTDIR)/jre/lib/$(LIBARCH) -ljava $(JVMLIB) duke@1: duke@1: # duke@1: # We want to privatize JVM symbols on Solaris. This is so the user can duke@1: # write a function called FindClass and this should not override the duke@1: # FindClass that is inside the JVM. At this point in time we are not duke@1: # concerned with other JNI libraries because we hope that there will duke@1: # not be as many clashes there. duke@1: # duke@1: PRIVATIZE_JVM_SYMBOLS = false duke@1: duke@1: USE_PTHREADS = true duke@1: override ALT_CODESET_KEY = _NL_CTYPE_CODESET_NAME duke@1: override AWT_RUNPATH = duke@1: override HAVE_ALTZONE = false duke@1: override HAVE_FILIOH = false duke@1: override HAVE_GETHRTIME = false duke@1: override HAVE_GETHRVTIME = false duke@1: override HAVE_SIGIGNORE = true duke@1: override LEX_LIBRARY = -lfl duke@1: ifeq ($(STATIC_CXX),true) duke@1: override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic duke@1: else duke@1: override LIBCXX = -lstdc++ duke@1: endif duke@1: override LIBPOSIX4 = duke@1: override LIBSOCKET = duke@1: override LIBTHREAD = duke@1: override MOOT_PRIORITIES = true duke@1: override NO_INTERRUPTIBLE_IO = true duke@1: override OPENWIN_HOME = /usr/X11R6 duke@1: ifeq ($(ARCH), amd64) duke@1: override OPENWIN_LIB = $(OPENWIN_HOME)/lib64 duke@1: else duke@1: override OPENWIN_LIB = $(OPENWIN_HOME)/lib duke@1: endif duke@1: override OTHER_M4FLAGS = -D__GLIBC__ -DGNU_ASSEMBLER duke@1: override SUN_CMM_SUBDIR = duke@1: override THREADS_FLAG = native duke@1: override USE_GNU_M4 = true duke@1: override USING_GNU_TAR = true duke@1: override WRITE_LIBVERSION = false duke@1: duke@1: # USE_EXECNAME forces the launcher to look up argv[0] on $PATH, and put the duke@1: # resulting resolved absolute name of the executable in the environment duke@1: # variable EXECNAME. That executable name is then used that to locate the duke@1: # installation area. duke@1: override USE_EXECNAME = true duke@1: duke@1: # If your platform has DPS, it will have Type1 fonts too, in which case duke@1: # it is best to enable DPS support until such time as 2D's rasteriser duke@1: # can fully handle Type1 fonts in all cases. Default is "yes". duke@1: # HAVE_DPS should only be "no" if the platform has no DPS headers or libs duke@1: # DPS (Displayable PostScript) is available on Solaris machines duke@1: HAVE_DPS = no duke@1: duke@1: # duke@1: # Japanese manpages duke@1: # duke@1: JA_SOURCE_ENCODING = eucJP duke@1: JA_TARGET_ENCODINGS = eucJP duke@1: