Mon, 24 May 2010 13:53:38 -0700
6490487: java support on 64 bit solaris x86 machines is broken.
Reviewed-by: kvn, kamg
duke@435 | 1 | # |
xdono@631 | 2 | # Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. |
duke@435 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | # |
duke@435 | 5 | # This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | # under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | # published by the Free Software Foundation. |
duke@435 | 8 | # |
duke@435 | 9 | # This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | # version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | # accompanied this code). |
duke@435 | 14 | # |
duke@435 | 15 | # You should have received a copy of the GNU General Public License version |
duke@435 | 16 | # 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | # |
duke@435 | 19 | # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
duke@435 | 20 | # CA 95054 USA or visit www.sun.com if you need additional information or |
duke@435 | 21 | # have any questions. |
duke@435 | 22 | # |
duke@435 | 23 | # |
duke@435 | 24 | |
duke@435 | 25 | # Rules to build JVM and related libraries, included from vm.make in the build |
duke@435 | 26 | # directory. |
duke@435 | 27 | |
duke@435 | 28 | # Common build rules. |
kamg@526 | 29 | MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles |
duke@435 | 30 | include $(MAKEFILES_DIR)/rules.make |
duke@435 | 31 | |
duke@435 | 32 | default: build |
duke@435 | 33 | |
duke@435 | 34 | #---------------------------------------------------------------------- |
duke@435 | 35 | # Defs |
duke@435 | 36 | |
duke@435 | 37 | GENERATED = ../generated |
duke@435 | 38 | |
duke@435 | 39 | # read a generated file defining the set of .o's and the .o .h dependencies |
duke@435 | 40 | include $(GENERATED)/Dependencies |
duke@435 | 41 | |
duke@435 | 42 | # read machine-specific adjustments (%%% should do this via buildtree.make?) |
duke@435 | 43 | include $(MAKEFILES_DIR)/$(BUILDARCH).make |
duke@435 | 44 | |
duke@435 | 45 | # set VPATH so make knows where to look for source files |
duke@435 | 46 | # Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm |
duke@435 | 47 | # The incls directory contains generated header file lists for inclusion. |
duke@435 | 48 | # The adfiles directory contains ad_<arch>.[ch]pp. |
duke@435 | 49 | # The jvmtifiles directory contains jvmti*.[ch]pp |
duke@435 | 50 | Src_Dirs_V = $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED)/incls |
duke@435 | 51 | VPATH += $(Src_Dirs_V:%=%:) |
duke@435 | 52 | |
duke@435 | 53 | # set INCLUDES for C preprocessor |
duke@435 | 54 | Src_Dirs_I = $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED) |
duke@435 | 55 | INCLUDES += $(Src_Dirs_I:%=-I%) |
duke@435 | 56 | |
duke@435 | 57 | ifeq (${VERSION}, debug) |
duke@435 | 58 | SYMFLAG = -g |
duke@435 | 59 | else |
duke@435 | 60 | SYMFLAG = |
duke@435 | 61 | endif |
duke@435 | 62 | |
duke@435 | 63 | # The following variables are defined in the generated flags.make file. |
duke@435 | 64 | BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" |
duke@435 | 65 | JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" |
jrose@535 | 66 | HS_LIB_ARCH = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\" |
duke@435 | 67 | BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\"" |
duke@435 | 68 | BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" |
duke@435 | 69 | VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\"" |
duke@435 | 70 | |
duke@435 | 71 | CPPFLAGS = \ |
duke@435 | 72 | ${SYSDEFS} \ |
duke@435 | 73 | ${INCLUDES} \ |
duke@435 | 74 | ${BUILD_VERSION} \ |
duke@435 | 75 | ${BUILD_TARGET} \ |
duke@435 | 76 | ${BUILD_USER} \ |
jrose@535 | 77 | ${HS_LIB_ARCH} \ |
duke@435 | 78 | ${JRE_VERSION} \ |
duke@435 | 79 | ${VM_DISTRO} |
duke@435 | 80 | |
duke@435 | 81 | # CFLAGS_WARN holds compiler options to suppress/enable warnings. |
duke@435 | 82 | CFLAGS += $(CFLAGS_WARN) |
duke@435 | 83 | |
duke@435 | 84 | # Do not use C++ exception handling |
duke@435 | 85 | CFLAGS += $(CFLAGS/NOEX) |
duke@435 | 86 | |
duke@435 | 87 | # Extra flags from gnumake's invocation or environment |
duke@435 | 88 | CFLAGS += $(EXTRA_CFLAGS) |
duke@435 | 89 | |
duke@435 | 90 | # Math Library (libm.so), do not use -lm. |
duke@435 | 91 | # There might be two versions of libm.so on the build system: |
duke@435 | 92 | # libm.so.1 and libm.so.2, and we want libm.so.1. |
duke@435 | 93 | # Depending on the Solaris release being used to build with, |
duke@435 | 94 | # /usr/lib/libm.so could point at a libm.so.2, so we are |
duke@435 | 95 | # explicit here so that the libjvm.so you have built will work on an |
duke@435 | 96 | # older Solaris release that might not have libm.so.2. |
duke@435 | 97 | # This is a critical factor in allowing builds on Solaris 10 or newer |
duke@435 | 98 | # to run on Solaris 8 or 9. |
duke@435 | 99 | # |
duke@435 | 100 | LIBM=/usr/lib$(ISA_DIR)/libm.so.1 |
duke@435 | 101 | |
duke@435 | 102 | ifeq ("${Platform_compiler}", "sparcWorks") |
duke@435 | 103 | # The whole megilla: |
kvn@865 | 104 | ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 505), 1) |
duke@435 | 105 | # Old Comment: List the libraries in the order the compiler was designed for |
duke@435 | 106 | # Not sure what the 'designed for' comment is referring too above. |
duke@435 | 107 | # The order may not be too significant anymore, but I have placed this |
duke@435 | 108 | # older libm before libCrun, just to make sure it's found and used first. |
duke@435 | 109 | LIBS += -lsocket -lsched -ldl $(LIBM) -lCrun -lthread -ldoor -lc |
duke@435 | 110 | else |
phh@1558 | 111 | ifeq ($(COMPILER_REV_NUMERIC), 502) |
phh@1558 | 112 | # SC6.1 has it's own libm.so: specifying anything else provokes a name conflict. |
phh@1558 | 113 | LIBS += -ldl -lthread -lsocket -lm -lsched -ldoor |
phh@1558 | 114 | else |
duke@435 | 115 | LIBS += -ldl -lthread -lsocket $(LIBM) -lsched -ldoor |
phh@1558 | 116 | endif # 502 |
phh@1558 | 117 | endif # 505 |
duke@435 | 118 | else |
duke@435 | 119 | LIBS += -lsocket -lsched -ldl $(LIBM) -lthread -lc |
phh@1558 | 120 | endif # sparcWorks |
duke@435 | 121 | |
duke@435 | 122 | # By default, link the *.o into the library, not the executable. |
duke@435 | 123 | LINK_INTO$(LINK_INTO) = LIBJVM |
duke@435 | 124 | |
duke@435 | 125 | JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH) |
duke@435 | 126 | |
duke@435 | 127 | #---------------------------------------------------------------------- |
duke@435 | 128 | # jvm_db & dtrace |
duke@435 | 129 | include $(MAKEFILES_DIR)/dtrace.make |
duke@435 | 130 | |
duke@435 | 131 | #---------------------------------------------------------------------- |
duke@435 | 132 | # JVM |
duke@435 | 133 | |
phh@1558 | 134 | JVM = jvm |
phh@1558 | 135 | LIBJVM = lib$(JVM).so |
phh@1558 | 136 | LIBJVM_G = lib$(JVM)$(G_SUFFIX).so |
duke@435 | 137 | |
duke@435 | 138 | JVM_OBJ_FILES = $(Obj_Files) $(DTRACE_OBJS) |
duke@435 | 139 | |
duke@435 | 140 | vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES)) |
duke@435 | 141 | |
duke@435 | 142 | mapfile : $(MAPFILE) $(MAPFILE_DTRACE_OPT) |
duke@435 | 143 | rm -f $@ |
duke@435 | 144 | cat $^ > $@ |
duke@435 | 145 | |
duke@435 | 146 | mapfile_reorder : mapfile $(MAPFILE_DTRACE_OPT) $(REORDERFILE) |
duke@435 | 147 | rm -f $@ |
duke@435 | 148 | cat $^ > $@ |
duke@435 | 149 | |
duke@435 | 150 | ifeq ($(LINK_INTO),AOUT) |
duke@435 | 151 | LIBJVM.o = |
duke@435 | 152 | LIBJVM_MAPFILE = |
duke@435 | 153 | LIBS_VM = $(LIBS) |
duke@435 | 154 | else |
duke@435 | 155 | LIBJVM.o = $(JVM_OBJ_FILES) |
duke@435 | 156 | LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder |
duke@435 | 157 | LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE)) |
duke@435 | 158 | LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM)) |
duke@435 | 159 | ifndef USE_GCC |
duke@435 | 160 | LIBS_VM = $(LIBS) |
duke@435 | 161 | else |
duke@435 | 162 | # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to |
duke@435 | 163 | # get around library dependency and compatibility issues. Must use gcc not |
duke@435 | 164 | # g++ to link. |
duke@435 | 165 | LFLAGS_VM += $(STATIC_LIBGCC) |
duke@435 | 166 | LIBS_VM += $(STATIC_STDCXX) $(LIBS) |
duke@435 | 167 | endif |
duke@435 | 168 | endif |
duke@435 | 169 | |
duke@435 | 170 | ifdef USE_GCC |
duke@435 | 171 | LINK_VM = $(LINK_LIB.c) |
duke@435 | 172 | else |
duke@435 | 173 | LINK_VM = $(LINK_LIB.CC) |
duke@435 | 174 | endif |
duke@435 | 175 | # making the library: |
duke@435 | 176 | $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) |
duke@435 | 177 | $(QUIETLY) \ |
duke@435 | 178 | case "$(CFLAGS_BROWSE)" in \ |
duke@435 | 179 | -sbfast|-xsbfast) \ |
duke@435 | 180 | ;; \ |
duke@435 | 181 | *) \ |
phh@1558 | 182 | echo Linking vm...; \ |
phh@1558 | 183 | $(LINK_LIB.CC/PRE_HOOK) \ |
phh@1558 | 184 | $(LINK_VM) $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM); \ |
phh@1558 | 185 | $(LINK_LIB.CC/POST_HOOK) \ |
phh@1558 | 186 | rm -f $@.1; ln -s $@ $@.1; \ |
phh@1558 | 187 | [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \ |
duke@435 | 188 | ;; \ |
duke@435 | 189 | esac |
duke@435 | 190 | |
duke@435 | 191 | DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM) |
duke@435 | 192 | |
duke@435 | 193 | install_jvm: $(LIBJVM) |
duke@435 | 194 | @echo "Copying $(LIBJVM) to $(DEST_JVM)" |
duke@435 | 195 | $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" |
duke@435 | 196 | |
duke@435 | 197 | #---------------------------------------------------------------------- |
duke@435 | 198 | # Other files |
duke@435 | 199 | |
duke@435 | 200 | # Gamma launcher |
duke@435 | 201 | include $(MAKEFILES_DIR)/launcher.make |
duke@435 | 202 | |
duke@435 | 203 | # Signal interposition library |
duke@435 | 204 | include $(MAKEFILES_DIR)/jsig.make |
duke@435 | 205 | |
duke@435 | 206 | # Serviceability agent |
duke@435 | 207 | include $(MAKEFILES_DIR)/saproc.make |
duke@435 | 208 | |
duke@435 | 209 | #---------------------------------------------------------------------- |
duke@435 | 210 | |
duke@435 | 211 | build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(LIBJVM_DTRACE) checkAndBuildSA dtraceCheck |
duke@435 | 212 | |
duke@435 | 213 | install: install_jvm install_jsig install_saproc |
duke@435 | 214 | |
duke@435 | 215 | .PHONY: default build install install_jvm |