make/linux/makefiles/vm.make

Print this page


   1 #
   2 # Copyright (c) 1999, 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #  


  44 # read machine-specific adjustments (%%% should do this via buildtree.make?)
  45 ifeq ($(ZERO_BUILD), true)
  46   include $(MAKEFILES_DIR)/zeroshark.make
  47 else
  48   include $(MAKEFILES_DIR)/$(BUILDARCH).make
  49 endif
  50 
  51 # set VPATH so make knows where to look for source files
  52 # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
  53 # The adfiles directory contains ad_<arch>.[ch]pp.
  54 # The jvmtifiles directory contains jvmti*.[ch]pp
  55 Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles
  56 VPATH += $(Src_Dirs_V:%=%:)
  57 
  58 # set INCLUDES for C preprocessor.
  59 Src_Dirs_I += $(GENERATED)
  60 # The order is important for the precompiled headers to work.
  61 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
  62 
  63 # SYMFLAG is used by {jsig,saproc}.make
  64 ifneq ($(OBJCOPY),)
  65   # always build with debug info when we can create .debuginfo files
  66   SYMFLAG = -g
  67 else
  68   ifeq (${VERSION}, debug)
  69     SYMFLAG = -g
  70   else
  71     SYMFLAG =
  72   endif
  73 endif
  74 
  75 # HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined 
  76 # in $(GAMMADIR)/make/defs.make
  77 ifeq ($(HOTSPOT_BUILD_VERSION),)
  78   BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
  79 else
  80   BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
  81 endif
  82 
  83 # The following variables are defined in the generated flags.make file.
  84 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""


 122 
 123 LIBS += -lm -ldl -lpthread
 124 
 125 # By default, link the *.o into the library, not the executable.
 126 LINK_INTO$(LINK_INTO) = LIBJVM
 127 
 128 JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
 129 
 130 #----------------------------------------------------------------------
 131 # jvm_db & dtrace
 132 include $(MAKEFILES_DIR)/dtrace.make
 133 
 134 #----------------------------------------------------------------------
 135 # JVM
 136 
 137 JVM      = jvm
 138 LIBJVM   = lib$(JVM).so
 139 LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 140 
 141 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo

 142 LIBJVM_G_DEBUGINFO = lib$(JVM)$(G_SUFFIX).debuginfo

 143 
 144 SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt
 145 
 146 SOURCE_PATHS=\
 147   $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
 148       \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \))
 149 SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
 150 SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
 151 SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
 152 SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
 153 
 154 ifndef JAVASE_EMBEDDED
 155 SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
 156   find $(HS_ALT_SRC)/share/vm/jfr -type d; \
 157   fi)
 158 endif
 159 
 160 CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
 161 CORE_PATHS+=$(GENERATED)/jvmtifiles
 162 


 314             echo Linking vm...;                                         \
 315             $(LINK_LIB.CXX/PRE_HOOK)                                     \
 316             $(LINK_VM) $(LD_SCRIPT_FLAG)                                \
 317                        $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM);       \
 318             $(LINK_LIB.CXX/POST_HOOK)                                    \
 319             rm -f $@.1; ln -s $@ $@.1;                                  \
 320             [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
 321             if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then                    \
 322               if [ -x /usr/sbin/selinuxenabled ] ; then                 \
 323                 /usr/sbin/selinuxenabled;                               \
 324                 if [ $$? = 0 ] ; then                                   \
 325                   /usr/bin/chcon -t textrel_shlib_t $@;                 \
 326                   if [ $$? != 0 ]; then                                 \
 327                     echo "ERROR: Cannot chcon $@";                      \
 328                   fi                                                    \
 329                 fi                                                      \
 330               fi                                                        \
 331             fi                                                          \
 332         }
 333 ifeq ($(CROSS_COMPILE_ARCH),)
 334   ifneq ($(OBJCOPY),)
 335         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
 336         $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
 337     ifeq ($(STRIP_POLICY),all_strip)
 338         $(QUIETLY) $(STRIP) $@
 339     else
 340       ifeq ($(STRIP_POLICY),min_strip)
 341         $(QUIETLY) $(STRIP) -g $@
 342       # implied else here is no stripping at all
 343       endif
 344     endif
 345         $(QUIETLY) [ -f $(LIBJVM_G_DEBUGINFO) ] || ln -s $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)




 346   endif

 347 endif
 348 
 349 DEST_SUBDIR        = $(JDK_LIBDIR)/$(VM_SUBDIR)
 350 DEST_JVM           = $(DEST_SUBDIR)/$(LIBJVM)
 351 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)

 352 
 353 install_jvm: $(LIBJVM)
 354         @echo "Copying $(LIBJVM) to $(DEST_JVM)"
 355         $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \
 356             cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)


 357         $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
 358 
 359 #----------------------------------------------------------------------
 360 # Other files
 361 
 362 # Gamma launcher
 363 include $(MAKEFILES_DIR)/launcher.make
 364 
 365 # Signal interposition library
 366 include $(MAKEFILES_DIR)/jsig.make
 367 
 368 # Serviceability agent
 369 include $(MAKEFILES_DIR)/saproc.make
 370 
 371 #----------------------------------------------------------------------
 372 
 373 build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
 374 
 375 install: install_jvm install_jsig install_saproc
 376 
   1 #
   2 # Copyright (c) 1999, 2012, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20 # or visit www.oracle.com if you need additional information or have any
  21 # questions.
  22 #  


  44 # read machine-specific adjustments (%%% should do this via buildtree.make?)
  45 ifeq ($(ZERO_BUILD), true)
  46   include $(MAKEFILES_DIR)/zeroshark.make
  47 else
  48   include $(MAKEFILES_DIR)/$(BUILDARCH).make
  49 endif
  50 
  51 # set VPATH so make knows where to look for source files
  52 # Src_Dirs_V is everything in src/share/vm/*, plus the right os/*/vm and cpu/*/vm
  53 # The adfiles directory contains ad_<arch>.[ch]pp.
  54 # The jvmtifiles directory contains jvmti*.[ch]pp
  55 Src_Dirs_V += $(GENERATED)/adfiles $(GENERATED)/jvmtifiles
  56 VPATH += $(Src_Dirs_V:%=%:)
  57 
  58 # set INCLUDES for C preprocessor.
  59 Src_Dirs_I += $(GENERATED)
  60 # The order is important for the precompiled headers to work.
  61 INCLUDES += $(PRECOMPILED_HEADER_DIR:%=-I%) $(Src_Dirs_I:%=-I%)
  62 
  63 # SYMFLAG is used by {jsig,saproc}.make
  64 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
  65   # always build with debug info when we can create .debuginfo files
  66   SYMFLAG = -g
  67 else
  68   ifeq (${VERSION}, debug)
  69     SYMFLAG = -g
  70   else
  71     SYMFLAG =
  72   endif
  73 endif
  74 
  75 # HOTSPOT_RELEASE_VERSION and HOTSPOT_BUILD_VERSION are defined 
  76 # in $(GAMMADIR)/make/defs.make
  77 ifeq ($(HOTSPOT_BUILD_VERSION),)
  78   BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)\""
  79 else
  80   BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HOTSPOT_RELEASE_VERSION)-$(HOTSPOT_BUILD_VERSION)\""
  81 endif
  82 
  83 # The following variables are defined in the generated flags.make file.
  84 BUILD_VERSION = -DHOTSPOT_RELEASE_VERSION="\"$(HS_BUILD_VER)\""


 122 
 123 LIBS += -lm -ldl -lpthread
 124 
 125 # By default, link the *.o into the library, not the executable.
 126 LINK_INTO$(LINK_INTO) = LIBJVM
 127 
 128 JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
 129 
 130 #----------------------------------------------------------------------
 131 # jvm_db & dtrace
 132 include $(MAKEFILES_DIR)/dtrace.make
 133 
 134 #----------------------------------------------------------------------
 135 # JVM
 136 
 137 JVM      = jvm
 138 LIBJVM   = lib$(JVM).so
 139 LIBJVM_G = lib$(JVM)$(G_SUFFIX).so
 140 
 141 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 142 LIBJVM_DIZ         = lib$(JVM).diz
 143 LIBJVM_G_DEBUGINFO = lib$(JVM)$(G_SUFFIX).debuginfo
 144 LIBJVM_G_DIZ       = lib$(JVM)$(G_SUFFIX).diz
 145 
 146 SPECIAL_PATHS:=adlc c1 gc_implementation opto shark libadt
 147 
 148 SOURCE_PATHS=\
 149   $(shell find $(HS_COMMON_SRC)/share/vm/* -type d \! \
 150       \( -name DUMMY $(foreach dir,$(SPECIAL_PATHS),-o -name $(dir)) \))
 151 SOURCE_PATHS+=$(HS_COMMON_SRC)/os/$(Platform_os_family)/vm
 152 SOURCE_PATHS+=$(HS_COMMON_SRC)/os/posix/vm
 153 SOURCE_PATHS+=$(HS_COMMON_SRC)/cpu/$(Platform_arch)/vm
 154 SOURCE_PATHS+=$(HS_COMMON_SRC)/os_cpu/$(Platform_os_arch)/vm
 155 
 156 ifndef JAVASE_EMBEDDED
 157 SOURCE_PATHS+=$(shell if [ -d $(HS_ALT_SRC)/share/vm/jfr ]; then \
 158   find $(HS_ALT_SRC)/share/vm/jfr -type d; \
 159   fi)
 160 endif
 161 
 162 CORE_PATHS=$(foreach path,$(SOURCE_PATHS),$(call altsrc,$(path)) $(path))
 163 CORE_PATHS+=$(GENERATED)/jvmtifiles
 164 


 316             echo Linking vm...;                                         \
 317             $(LINK_LIB.CXX/PRE_HOOK)                                     \
 318             $(LINK_VM) $(LD_SCRIPT_FLAG)                                \
 319                        $(LFLAGS_VM) -o $@ $(LIBJVM.o) $(LIBS_VM);       \
 320             $(LINK_LIB.CXX/POST_HOOK)                                    \
 321             rm -f $@.1; ln -s $@ $@.1;                                  \
 322             [ -f $(LIBJVM_G) ] || { ln -s $@ $(LIBJVM_G); ln -s $@.1 $(LIBJVM_G).1; }; \
 323             if [ \"$(CROSS_COMPILE_ARCH)\" = \"\" ] ; then                    \
 324               if [ -x /usr/sbin/selinuxenabled ] ; then                 \
 325                 /usr/sbin/selinuxenabled;                               \
 326                 if [ $$? = 0 ] ; then                                   \
 327                   /usr/bin/chcon -t textrel_shlib_t $@;                 \
 328                   if [ $$? != 0 ]; then                                 \
 329                     echo "ERROR: Cannot chcon $@";                      \
 330                   fi                                                    \
 331                 fi                                                      \
 332               fi                                                        \
 333             fi                                                          \
 334         }
 335 ifeq ($(CROSS_COMPILE_ARCH),)
 336   ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
 337         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
 338         $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
 339     ifeq ($(STRIP_POLICY),all_strip)
 340         $(QUIETLY) $(STRIP) $@
 341     else
 342       ifeq ($(STRIP_POLICY),min_strip)
 343         $(QUIETLY) $(STRIP) -g $@
 344       # implied else here is no stripping at all
 345       endif
 346     endif
 347         $(QUIETLY) [ -f $(LIBJVM_G_DEBUGINFO) ] || ln -s $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
 348     ifeq ($(ZIP_DEBUGINFO_FILES),1)
 349         $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
 350         $(RM) $(LIBJVM_DEBUGINFO) $(LIBJVM_G_DEBUGINFO)
 351         [ -f $(LIBJVM_G_DIZ) ] || { ln -s $(LIBJVM_DIZ) $(LIBJVM_G_DIZ); }
 352     endif
 353   endif
 354 endif
 355 
 356 DEST_SUBDIR        = $(JDK_LIBDIR)/$(VM_SUBDIR)
 357 DEST_JVM           = $(DEST_SUBDIR)/$(LIBJVM)
 358 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
 359 DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
 360 
 361 install_jvm: $(LIBJVM)
 362         @echo "Copying $(LIBJVM) to $(DEST_JVM)"
 363         $(QUIETLY) test -f $(LIBJVM_DEBUGINFO) && \
 364             cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
 365         $(QUIETLY) test -f $(LIBJVM_DIZ) && \
 366             cp -f $(LIBJVM_DIZ) $(DEST_JVM_DIZ)
 367         $(QUIETLY) cp -f $(LIBJVM) $(DEST_JVM) && echo "Done"
 368 
 369 #----------------------------------------------------------------------
 370 # Other files
 371 
 372 # Gamma launcher
 373 include $(MAKEFILES_DIR)/launcher.make
 374 
 375 # Signal interposition library
 376 include $(MAKEFILES_DIR)/jsig.make
 377 
 378 # Serviceability agent
 379 include $(MAKEFILES_DIR)/saproc.make
 380 
 381 #----------------------------------------------------------------------
 382 
 383 build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC)
 384 
 385 install: install_jvm install_jsig install_saproc
 386