duke@435: # duke@435: # Copyright 1998-2007 Sun Microsystems, Inc. All Rights Reserved. duke@435: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: # duke@435: # This code is free software; you can redistribute it and/or modify it duke@435: # under the terms of the GNU General Public License version 2 only, as duke@435: # published by the Free Software Foundation. duke@435: # duke@435: # This code is distributed in the hope that it will be useful, but WITHOUT duke@435: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: # version 2 for more details (a copy is included in the LICENSE file that duke@435: # accompanied this code). duke@435: # duke@435: # You should have received a copy of the GNU General Public License version duke@435: # 2 along with this work; if not, write to the Free Software Foundation, duke@435: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: # duke@435: # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: # CA 95054 USA or visit www.sun.com if you need additional information or duke@435: # have any questions. duke@435: # duke@435: # duke@435: duke@435: # Rules to build JVM and related libraries, included from vm.make in the build duke@435: # directory. duke@435: duke@435: # Common build rules. kamg@526: MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles duke@435: include $(MAKEFILES_DIR)/rules.make duke@435: duke@435: default: build duke@435: duke@435: #---------------------------------------------------------------------- duke@435: # Defs duke@435: duke@435: GENERATED = ../generated duke@435: duke@435: # read a generated file defining the set of .o's and the .o .h dependencies duke@435: include $(GENERATED)/Dependencies duke@435: duke@435: # read machine-specific adjustments (%%% should do this via buildtree.make?) duke@435: include $(MAKEFILES_DIR)/$(BUILDARCH).make duke@435: duke@435: # set VPATH so make knows where to look for source files duke@435: # Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm duke@435: # The incls directory contains generated header file lists for inclusion. duke@435: # The adfiles directory contains ad_.[ch]pp. duke@435: # The jvmtifiles directory contains jvmti*.[ch]pp duke@435: Src_Dirs_V = $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED)/incls duke@435: VPATH += $(Src_Dirs_V:%=%:) duke@435: duke@435: # set INCLUDES for C preprocessor duke@435: Src_Dirs_I = $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED) duke@435: INCLUDES += $(Src_Dirs_I:%=-I%) duke@435: duke@435: ifeq (${VERSION}, debug) duke@435: SYMFLAG = -g duke@435: else duke@435: SYMFLAG = duke@435: endif duke@435: duke@435: # The following variables are defined in the generated flags.make file. duke@435: BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" duke@435: JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" jrose@535: HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" duke@435: BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\"" duke@435: BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" duke@435: VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\"" duke@435: duke@435: CPPFLAGS = \ duke@435: ${SYSDEFS} \ duke@435: ${INCLUDES} \ duke@435: ${BUILD_VERSION} \ duke@435: ${BUILD_TARGET} \ duke@435: ${BUILD_USER} \ jrose@535: ${HS_LIB_ARCH} \ duke@435: ${JRE_VERSION} \ duke@435: ${VM_DISTRO} duke@435: duke@435: # CFLAGS_WARN holds compiler options to suppress/enable warnings. duke@435: CFLAGS += $(CFLAGS_WARN) duke@435: duke@435: # Do not use C++ exception handling duke@435: CFLAGS += $(CFLAGS/NOEX) duke@435: duke@435: # Extra flags from gnumake's invocation or environment duke@435: CFLAGS += $(EXTRA_CFLAGS) duke@435: duke@435: # Math Library (libm.so), do not use -lm. duke@435: # There might be two versions of libm.so on the build system: duke@435: # libm.so.1 and libm.so.2, and we want libm.so.1. duke@435: # Depending on the Solaris release being used to build with, duke@435: # /usr/lib/libm.so could point at a libm.so.2, so we are duke@435: # explicit here so that the libjvm.so you have built will work on an duke@435: # older Solaris release that might not have libm.so.2. duke@435: # This is a critical factor in allowing builds on Solaris 10 or newer duke@435: # to run on Solaris 8 or 9. duke@435: # duke@435: LIBM=/usr/lib$(ISA_DIR)/libm.so.1 duke@435: duke@435: ifeq ("${Platform_compiler}", "sparcWorks") duke@435: # The whole megilla: duke@435: ifeq ($(shell expr $(COMPILER_REV) \>= 5.5), 1) duke@435: # Old Comment: List the libraries in the order the compiler was designed for duke@435: # Not sure what the 'designed for' comment is referring too above. duke@435: # The order may not be too significant anymore, but I have placed this duke@435: # older libm before libCrun, just to make sure it's found and used first. duke@435: LIBS += -lsocket -lsched -ldl $(LIBM) -lCrun -lthread -ldoor -lc duke@435: else duke@435: LIBS += -ldl -lthread -lsocket $(LIBM) -lsched -ldoor duke@435: endif duke@435: else duke@435: LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc duke@435: endif duke@435: duke@435: # By default, link the *.o into the library, not the executable. duke@435: LINK_INTO$(LINK_INTO) = LIBJVM duke@435: duke@435: JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH) duke@435: duke@435: #---------------------------------------------------------------------- duke@435: # jvm_db & dtrace duke@435: include $(MAKEFILES_DIR)/dtrace.make duke@435: duke@435: #---------------------------------------------------------------------- duke@435: # JVM duke@435: duke@435: JVM = jvm$(G_SUFFIX) duke@435: LIBJVM = lib$(JVM).so duke@435: duke@435: JVM_OBJ_FILES = $(Obj_Files) $(DTRACE_OBJS) duke@435: duke@435: vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES)) duke@435: duke@435: mapfile : $(MAPFILE) $(MAPFILE_DTRACE_OPT) duke@435: rm -f $@ duke@435: cat $^ > $@ duke@435: duke@435: mapfile_reorder : mapfile $(MAPFILE_DTRACE_OPT) $(REORDERFILE) duke@435: rm -f $@ duke@435: cat $^ > $@ duke@435: duke@435: ifeq ($(LINK_INTO),AOUT) duke@435: LIBJVM.o = duke@435: LIBJVM_MAPFILE = duke@435: LIBS_VM = $(LIBS) duke@435: else duke@435: LIBJVM.o = $(JVM_OBJ_FILES) duke@435: LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder duke@435: LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE)) duke@435: LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM)) duke@435: ifndef USE_GCC duke@435: LIBS_VM = $(LIBS) duke@435: else duke@435: # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to duke@435: # get around library dependency and compatibility issues. Must use gcc not duke@435: # g++ to link. duke@435: LFLAGS_VM += $(STATIC_LIBGCC) duke@435: LIBS_VM += $(STATIC_STDCXX) $(LIBS) duke@435: endif duke@435: endif duke@435: duke@435: ifdef USE_GCC duke@435: LINK_VM = $(LINK_LIB.c) duke@435: else duke@435: LINK_VM = $(LINK_LIB.CC) duke@435: endif duke@435: # making the library: duke@435: $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) duke@435: $(QUIETLY) \ duke@435: case "$(CFLAGS_BROWSE)" in \ duke@435: -sbfast|-xsbfast) \ duke@435: ;; \ duke@435: *) \ duke@435: echo Linking vm...; \ duke@435: $(LINK_LIB.CC/PRE_HOOK) \ duke@435: $(LINK_VM) $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM); \ duke@435: $(LINK_LIB.CC/POST_HOOK) \ duke@435: rm -f $@.1; ln -s $@ $@.1; \ duke@435: ;; \ duke@435: esac duke@435: duke@435: DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM) duke@435: duke@435: install_jvm: $(LIBJVM) duke@435: @echo "Copying $(LIBJVM) to $(DEST_JVM)" duke@435: $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" duke@435: duke@435: #---------------------------------------------------------------------- duke@435: # Other files duke@435: duke@435: # Gamma launcher duke@435: include $(MAKEFILES_DIR)/launcher.make duke@435: duke@435: # Signal interposition library duke@435: include $(MAKEFILES_DIR)/jsig.make duke@435: duke@435: # Serviceability agent duke@435: include $(MAKEFILES_DIR)/saproc.make duke@435: duke@435: #---------------------------------------------------------------------- duke@435: duke@435: build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) checkAndBuildSA dtraceCheck duke@435: duke@435: install: install_jvm install_jsig install_saproc duke@435: duke@435: .PHONY: default build install install_jvm