1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/make/linux/makefiles/vm.make Wed Apr 09 14:22:48 2008 -0400 1.3 @@ -0,0 +1,226 @@ 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. 1.11 +# 1.12 +# This code is distributed in the hope that it will be useful, but WITHOUT 1.13 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 +# version 2 for more details (a copy is included in the LICENSE file that 1.16 +# accompanied this code). 1.17 +# 1.18 +# You should have received a copy of the GNU General Public License version 1.19 +# 2 along with this work; if not, write to the Free Software Foundation, 1.20 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 +# 1.22 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.23 +# CA 95054 USA or visit www.sun.com if you need additional information or 1.24 +# have any questions. 1.25 +# 1.26 +# 1.27 + 1.28 +# Rules to build JVM and related libraries, included from vm.make in the build 1.29 +# directory. 1.30 + 1.31 +# Common build rules. 1.32 +MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles 1.33 +include $(MAKEFILES_DIR)/rules.make 1.34 + 1.35 +default: build 1.36 + 1.37 +#---------------------------------------------------------------------- 1.38 +# Defs 1.39 + 1.40 +GENERATED = ../generated 1.41 + 1.42 +# read a generated file defining the set of .o's and the .o .h dependencies 1.43 +include $(GENERATED)/Dependencies 1.44 + 1.45 +# read machine-specific adjustments (%%% should do this via buildtree.make?) 1.46 +include $(MAKEFILES_DIR)/$(BUILDARCH).make 1.47 + 1.48 +# set VPATH so make knows where to look for source files 1.49 +# Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm 1.50 +# The incls directory contains generated header file lists for inclusion. 1.51 +# The adfiles directory contains ad_<arch>.[ch]pp. 1.52 +# The jvmtifiles directory contains jvmti*.[ch]pp 1.53 +Src_Dirs_V = $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED)/incls 1.54 +VPATH += $(Src_Dirs_V:%=%:) 1.55 + 1.56 +# set INCLUDES for C preprocessor 1.57 +Src_Dirs_I = $(PRECOMPILED_HEADER_DIR) $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED) 1.58 +INCLUDES += $(Src_Dirs_I:%=-I%) 1.59 + 1.60 +ifeq (${VERSION}, debug) 1.61 + SYMFLAG = -g 1.62 +else 1.63 + SYMFLAG = 1.64 +endif 1.65 + 1.66 +# HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined 1.67 +# in $(GAMMADIR)/make/defs.make 1.68 +ifeq ($(HOTSPOT_BUILD_VERSION),) 1.69 + BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\"" 1.70 +else 1.71 + BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\"" 1.72 +endif 1.73 + 1.74 +# The following variables are defined in the generated flags.make file. 1.75 +BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\"" 1.76 +JRE_VERSION = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\"" 1.77 +BUILD_TARGET = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\"" 1.78 +BUILD_USER = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\"" 1.79 +VM_DISTRO = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\"" 1.80 + 1.81 +CPPFLAGS = \ 1.82 + ${SYSDEFS} \ 1.83 + ${INCLUDES} \ 1.84 + ${BUILD_VERSION} \ 1.85 + ${BUILD_TARGET} \ 1.86 + ${BUILD_USER} \ 1.87 + ${JRE_VERSION} \ 1.88 + ${VM_DISTRO} 1.89 + 1.90 +# CFLAGS_WARN holds compiler options to suppress/enable warnings. 1.91 +CFLAGS += $(CFLAGS_WARN/BYFILE) 1.92 + 1.93 +# Do not use C++ exception handling 1.94 +CFLAGS += $(CFLAGS/NOEX) 1.95 + 1.96 +# Extra flags from gnumake's invocation or environment 1.97 +CFLAGS += $(EXTRA_CFLAGS) 1.98 + 1.99 +LIBS += -lm -ldl -lpthread 1.100 + 1.101 +# By default, link the *.o into the library, not the executable. 1.102 +LINK_INTO$(LINK_INTO) = LIBJVM 1.103 + 1.104 +JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH) 1.105 + 1.106 +#---------------------------------------------------------------------- 1.107 +# jvm_db & dtrace 1.108 +include $(MAKEFILES_DIR)/dtrace.make 1.109 + 1.110 +#---------------------------------------------------------------------- 1.111 +# JVM 1.112 + 1.113 +JVM = jvm$(G_SUFFIX) 1.114 +LIBJVM = lib$(JVM).so 1.115 + 1.116 +JVM_OBJ_FILES = $(Obj_Files) 1.117 + 1.118 +vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES)) 1.119 + 1.120 +mapfile : $(MAPFILE) 1.121 + rm -f $@ 1.122 + cat $^ > $@ 1.123 + 1.124 +mapfile_reorder : mapfile $(REORDERFILE) 1.125 + rm -f $@ 1.126 + cat $^ > $@ 1.127 + 1.128 +STATIC_CXX = true 1.129 + 1.130 +ifeq ($(LINK_INTO),AOUT) 1.131 + LIBJVM.o = 1.132 + LIBJVM_MAPFILE = 1.133 + LIBS_VM = $(LIBS) 1.134 +else 1.135 + LIBJVM.o = $(JVM_OBJ_FILES) 1.136 + LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder 1.137 + LFLAGS_VM$(LDNOMAP) += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE)) 1.138 + LFLAGS_VM += $(SONAMEFLAG:SONAME=$(LIBJVM)) 1.139 + 1.140 + # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to 1.141 + # get around library dependency and compatibility issues. Must use gcc not 1.142 + # g++ to link. 1.143 + ifeq ($(STATIC_CXX), true) 1.144 + LFLAGS_VM += $(STATIC_LIBGCC) 1.145 + LIBS_VM += $(STATIC_STDCXX) 1.146 + else 1.147 + LIBS_VM += -lstdc++ 1.148 + endif 1.149 + 1.150 + LIBS_VM += $(LIBS) 1.151 +endif 1.152 + 1.153 +LINK_VM = $(LINK_LIB.c) 1.154 + 1.155 +# rule for building precompiled header 1.156 +$(PRECOMPILED_HEADER): $(Precompiled_Files) 1.157 + $(QUIETLY) echo Generating precompiled header $@ 1.158 + $(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)/incls 1.159 + $(QUIETLY) $(COMPILE.CC) -x c++-header -c $(GENERATED)/incls/_precompiled.incl -o $@ $(COMPILE_DONE) 1.160 + 1.161 +# making the library: 1.162 + 1.163 +ifneq ($(JVM_BASE_ADDR),) 1.164 +# By default shared library is linked at base address == 0. Modify the 1.165 +# linker script if JVM prefers a different base location. It can also be 1.166 +# implemented with 'prelink -r'. But 'prelink' is not (yet) available on 1.167 +# our build platform (AS-2.1). 1.168 +LD_SCRIPT = libjvm.so.lds 1.169 +$(LD_SCRIPT): $(LIBJVM_MAPFILE) 1.170 + $(QUIETLY) { \ 1.171 + rm -rf $@; \ 1.172 + $(LINK_VM) -Wl,--verbose $(LFLAGS_VM) 2>&1 | \ 1.173 + sed -e '/^======/,/^======/!d' \ 1.174 + -e '/^======/d' \ 1.175 + -e 's/0\( + SIZEOF_HEADERS\)/$(JVM_BASE_ADDR)\1/' \ 1.176 + > $@; \ 1.177 + } 1.178 +LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT) 1.179 +endif 1.180 + 1.181 +# With more recent Redhat releases (or the cutting edge version Fedora), if 1.182 +# SELinux is configured to be enabled, the runtime linker will fail to apply 1.183 +# the text relocation to libjvm.so considering that it is built as a non-PIC 1.184 +# DSO. To workaround that, we run chcon to libjvm.so after it is built. See 1.185 +# details in bug 6538311. 1.186 +$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT) 1.187 + $(QUIETLY) { \ 1.188 + echo Linking vm...; \ 1.189 + $(LINK_LIB.CC/PRE_HOOK) \ 1.190 + $(LINK_VM) $(LD_SCRIPT_FLAG) \ 1.191 + $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM); \ 1.192 + $(LINK_LIB.CC/POST_HOOK) \ 1.193 + rm -f $@.1; ln -s $@ $@.1; \ 1.194 + if [ -x /usr/sbin/selinuxenabled ] ; then \ 1.195 + /usr/sbin/selinuxenabled; \ 1.196 + if [ $$? = 0 ] ; then \ 1.197 + /usr/bin/chcon -t textrel_shlib_t $@; \ 1.198 + if [ $$? != 0 ]; then \ 1.199 + echo "ERROR: Cannot chcon $@"; exit 1; \ 1.200 + fi \ 1.201 + fi \ 1.202 + fi \ 1.203 + } 1.204 + 1.205 +DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM) 1.206 + 1.207 +install_jvm: $(LIBJVM) 1.208 + @echo "Copying $(LIBJVM) to $(DEST_JVM)" 1.209 + $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done" 1.210 + 1.211 +#---------------------------------------------------------------------- 1.212 +# Other files 1.213 + 1.214 +# Gamma launcher 1.215 +include $(MAKEFILES_DIR)/launcher.make 1.216 + 1.217 +# Signal interposition library 1.218 +include $(MAKEFILES_DIR)/jsig.make 1.219 + 1.220 +# Serviceability agent 1.221 +include $(MAKEFILES_DIR)/saproc.make 1.222 + 1.223 +#---------------------------------------------------------------------- 1.224 + 1.225 +build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) checkAndBuildSA 1.226 + 1.227 +install: install_jvm install_jsig install_saproc 1.228 + 1.229 +.PHONY: default build install install_jvm