make/linux/makefiles/vm.make

Tue, 13 Oct 2009 12:04:21 -0700

author
never
date
Tue, 13 Oct 2009 12:04:21 -0700
changeset 1445
354d3184f6b2
parent 722
6e76352f1f62
child 1558
167c2986d91b
permissions
-rw-r--r--

6890308: integrate zero assembler hotspot changes
Reviewed-by: never
Contributed-by: gbenson@redhat.com

     1 #
     2 # Copyright 1999-2008 Sun Microsystems, Inc.  All Rights Reserved.
     3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4 #
     5 # This code is free software; you can redistribute it and/or modify it
     6 # under the terms of the GNU General Public License version 2 only, as
     7 # published by the Free Software Foundation.
     8 #
     9 # This code is distributed in the hope that it will be useful, but WITHOUT
    10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12 # version 2 for more details (a copy is included in the LICENSE file that
    13 # accompanied this code).
    14 #
    15 # You should have received a copy of the GNU General Public License version
    16 # 2 along with this work; if not, write to the Free Software Foundation,
    17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18 #
    19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20 # CA 95054 USA or visit www.sun.com if you need additional information or
    21 # have any questions.
    22 #  
    23 #
    25 # Rules to build JVM and related libraries, included from vm.make in the build
    26 # directory.
    28 # Common build rules.
    29 MAKEFILES_DIR=$(GAMMADIR)/make/$(Platform_os_family)/makefiles
    30 include $(MAKEFILES_DIR)/rules.make
    32 default: build
    34 #----------------------------------------------------------------------
    35 # Defs
    37 GENERATED     = ../generated
    39 # read a generated file defining the set of .o's and the .o .h dependencies
    40 include $(GENERATED)/Dependencies
    42 # read machine-specific adjustments (%%% should do this via buildtree.make?)
    43 ifeq ($(ZERO_BUILD), true)
    44   include $(MAKEFILES_DIR)/zeroshark.make
    45 else
    46   include $(MAKEFILES_DIR)/$(BUILDARCH).make
    47 endif
    49 # set VPATH so make knows where to look for source files
    50 # Src_Dirs is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
    51 # The incls directory contains generated header file lists for inclusion.
    52 # The adfiles directory contains ad_<arch>.[ch]pp.
    53 # The jvmtifiles directory contains jvmti*.[ch]pp
    54 Src_Dirs_V = $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED)/incls
    55 VPATH    += $(Src_Dirs_V:%=%:)
    57 # set INCLUDES for C preprocessor
    58 Src_Dirs_I = $(PRECOMPILED_HEADER_DIR) $(GENERATED)/adfiles $(GENERATED)/jvmtifiles ${Src_Dirs} $(GENERATED)
    59 INCLUDES += $(Src_Dirs_I:%=-I%)
    61 ifeq (${VERSION}, debug)
    62   SYMFLAG = -g
    63 else
    64   SYMFLAG =
    65 endif
    67 # HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined 
    68 # in $(GAMMADIR)/make/defs.make
    69 ifeq ($(HOTSPOT_BUILD_VERSION),)
    70   BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
    71 else
    72   BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
    73 endif
    75 # The following variables are defined in the generated flags.make file.
    76 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""
    77 JRE_VERSION   = -DJRE_RELEASE_VERSION="\"$(JRE_RELEASE_VER)\""
    78 HS_LIB_ARCH   = -DHOTSPOT_LIB_ARCH=\"$(LIBARCH)\"
    79 BUILD_TARGET  = -DHOTSPOT_BUILD_TARGET="\"$(TARGET)\""
    80 BUILD_USER    = -DHOTSPOT_BUILD_USER="\"$(HOTSPOT_BUILD_USER)\""
    81 VM_DISTRO     = -DHOTSPOT_VM_DISTRO="\"$(HOTSPOT_VM_DISTRO)\""
    83 CPPFLAGS =           \
    84   ${SYSDEFS}         \
    85   ${INCLUDES}        \
    86   ${BUILD_VERSION}   \
    87   ${BUILD_TARGET}    \
    88   ${BUILD_USER}      \
    89   ${HS_LIB_ARCH}     \
    90   ${JRE_VERSION}     \
    91   ${VM_DISTRO}
    93 # CFLAGS_WARN holds compiler options to suppress/enable warnings.
    94 CFLAGS += $(CFLAGS_WARN/BYFILE)
    96 # Do not use C++ exception handling
    97 CFLAGS += $(CFLAGS/NOEX)
    99 # Extra flags from gnumake's invocation or environment
   100 CFLAGS += $(EXTRA_CFLAGS)
   102 LIBS += -lm -ldl -lpthread
   104 # By default, link the *.o into the library, not the executable.
   105 LINK_INTO$(LINK_INTO) = LIBJVM
   107 JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
   109 #----------------------------------------------------------------------
   110 # jvm_db & dtrace
   111 include $(MAKEFILES_DIR)/dtrace.make
   113 #----------------------------------------------------------------------
   114 # JVM
   116 JVM    = jvm$(G_SUFFIX)
   117 LIBJVM = lib$(JVM).so
   119 JVM_OBJ_FILES = $(Obj_Files)
   121 vm_version.o: $(filter-out vm_version.o,$(JVM_OBJ_FILES))
   123 mapfile : $(MAPFILE)
   124 	rm -f $@
   125 	cat $^ > $@
   127 mapfile_reorder : mapfile $(REORDERFILE)
   128 	rm -f $@
   129 	cat $^ > $@
   131 ifeq ($(ZERO_LIBARCH), ppc64)
   132   STATIC_CXX = false
   133 else
   134   STATIC_CXX = true
   135 endif
   137 ifeq ($(LINK_INTO),AOUT)
   138   LIBJVM.o                 =
   139   LIBJVM_MAPFILE           =
   140   LIBS_VM                  = $(LIBS)
   141 else
   142   LIBJVM.o                 = $(JVM_OBJ_FILES)
   143   LIBJVM_MAPFILE$(LDNOMAP) = mapfile_reorder
   144   LFLAGS_VM$(LDNOMAP)      += $(MAPFLAG:FILENAME=$(LIBJVM_MAPFILE))
   145   LFLAGS_VM                += $(SONAMEFLAG:SONAME=$(LIBJVM))
   147   # JVM is statically linked with libgcc[_s] and libstdc++; this is needed to
   148   # get around library dependency and compatibility issues. Must use gcc not
   149   # g++ to link.
   150   ifeq ($(STATIC_CXX), true)
   151     LFLAGS_VM              += $(STATIC_LIBGCC)
   152     LIBS_VM                += $(STATIC_STDCXX)
   153   else
   154     LIBS_VM                += -lstdc++
   155   endif
   157   LIBS_VM                  += $(LIBS)
   158 endif
   159 ifeq ($(ZERO_BUILD), true)
   160   LIBS_VM += $(LIBFFI_LIBS)
   161 endif
   163 LINK_VM = $(LINK_LIB.c)
   165 # rule for building precompiled header
   166 $(PRECOMPILED_HEADER): $(Precompiled_Files)
   167 	$(QUIETLY) echo Generating precompiled header $@
   168 	$(QUIETLY) mkdir -p $(PRECOMPILED_HEADER_DIR)/incls
   169 	$(QUIETLY) $(COMPILE.CC) -x c++-header -c $(GENERATED)/incls/_precompiled.incl -o $@ $(COMPILE_DONE)
   171 # making the library:
   173 ifneq ($(JVM_BASE_ADDR),)
   174 # By default shared library is linked at base address == 0. Modify the
   175 # linker script if JVM prefers a different base location. It can also be
   176 # implemented with 'prelink -r'. But 'prelink' is not (yet) available on
   177 # our build platform (AS-2.1).
   178 LD_SCRIPT = libjvm.so.lds
   179 $(LD_SCRIPT): $(LIBJVM_MAPFILE)
   180 	$(QUIETLY) {                                                \
   181 	  rm -rf $@;                                                \
   182 	  $(LINK_VM) -Wl,--verbose $(LFLAGS_VM) 2>&1             |  \
   183 	    sed -e '/^======/,/^======/!d'                          \
   184 		-e '/^======/d'                                     \
   185 		-e 's/0\( + SIZEOF_HEADERS\)/$(JVM_BASE_ADDR)\1/'   \
   186 		> $@;                                               \
   187 	}
   188 LD_SCRIPT_FLAG = -Wl,-T,$(LD_SCRIPT)
   189 endif
   191 # With more recent Redhat releases (or the cutting edge version Fedora), if
   192 # SELinux is configured to be enabled, the runtime linker will fail to apply
   193 # the text relocation to libjvm.so considering that it is built as a non-PIC
   194 # DSO. To workaround that, we run chcon to libjvm.so after it is built. See 
   195 # details in bug 6538311.
   196 $(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE) $(LD_SCRIPT)
   197 	$(QUIETLY) {                                                    \
   198 	    echo Linking vm...;                                         \
   199 	    $(LINK_LIB.CC/PRE_HOOK)                                     \
   200 	    $(LINK_VM) $(LD_SCRIPT_FLAG)                                \
   201 		       $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM);       \
   202 	    $(LINK_LIB.CC/POST_HOOK)                                    \
   203 	    rm -f $@.1; ln -s $@ $@.1;                                  \
   204 	    if [ -x /usr/sbin/selinuxenabled ] ; then                   \
   205 	      /usr/sbin/selinuxenabled;                                 \
   206               if [ $$? = 0 ] ; then					\
   207 		/usr/bin/chcon -t textrel_shlib_t $@;                   \
   208 		if [ $$? != 0 ]; then                                   \
   209 		  echo "ERROR: Cannot chcon $@";			\
   210 		fi							\
   211 	      fi							\
   212 	    fi                                                          \
   213 	}
   215 DEST_JVM = $(JDK_LIBDIR)/$(VM_SUBDIR)/$(LIBJVM)
   217 install_jvm: $(LIBJVM)
   218 	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
   219 	$(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
   221 #----------------------------------------------------------------------
   222 # Other files
   224 # Gamma launcher
   225 include $(MAKEFILES_DIR)/launcher.make
   227 # Signal interposition library
   228 include $(MAKEFILES_DIR)/jsig.make
   230 # Serviceability agent
   231 include $(MAKEFILES_DIR)/saproc.make
   233 #----------------------------------------------------------------------
   235 build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) checkAndBuildSA
   237 install: install_jvm install_jsig install_saproc
   239 .PHONY: default build install install_jvm

mercurial