make/linux/makefiles/saproc.make

Print this page




  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 #  
  23 #
  24 
  25 # Rules to build serviceability agent library, used by vm.make
  26 
  27 # libsaproc[_g].so: serviceability agent
  28 
  29 SAPROC = saproc
  30 LIBSAPROC = lib$(SAPROC).so
  31 
  32 SAPROC_G = $(SAPROC)$(G_SUFFIX)
  33 LIBSAPROC_G = lib$(SAPROC_G).so
  34 
  35 LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo

  36 LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo

  37 
  38 AGENT_DIR = $(GAMMADIR)/agent
  39 
  40 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
  41 
  42 SASRCFILES = $(SASRCDIR)/salibelf.c                   \
  43              $(SASRCDIR)/symtab.c                     \
  44              $(SASRCDIR)/libproc_impl.c               \
  45              $(SASRCDIR)/ps_proc.c                    \
  46              $(SASRCDIR)/ps_core.c                    \
  47              $(SASRCDIR)/LinuxDebuggerLocal.c
  48 
  49 SAMAPFILE = $(SASRCDIR)/mapfile
  50 
  51 DEST_SAPROC           = $(JDK_LIBDIR)/$(LIBSAPROC)
  52 DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)

  53 
  54 # DEBUG_BINARIES overrides everything, use full -g debug information
  55 ifeq ($(DEBUG_BINARIES), true)
  56   SA_DEBUG_CFLAGS = -g
  57 endif
  58 
  59 # if $(AGENT_DIR) does not exist, we don't build SA
  60 # also, we don't build SA on Itanium, PPC, ARM or zero.
  61 
  62 ifneq ($(wildcard $(AGENT_DIR)),)
  63 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
  64   BUILDLIBSAPROC = $(LIBSAPROC)
  65 endif
  66 endif
  67 
  68 
  69 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
  70 
  71 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
  72         $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
  73           echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
  74           exit 1; \
  75         fi
  76         @echo Making SA debugger back-end...
  77         $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE                   \
  78                    -D_FILE_OFFSET_BITS=64                               \
  79                    $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG)     \
  80                    -I$(SASRCDIR)                                        \
  81                    -I$(GENERATED)                                       \
  82                    -I$(BOOT_JAVA_HOME)/include                          \
  83                    -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family)    \
  84                    $(SASRCFILES)                                        \
  85                    $(SA_LFLAGS)                                         \
  86                    $(SA_DEBUG_CFLAGS)                                   \
  87                    -o $@                                                \
  88                    -lthread_db
  89         $(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
  90 ifneq ($(OBJCOPY),)
  91         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
  92         $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
  93   ifeq ($(STRIP_POLICY),all_strip)
  94         $(QUIETLY) $(STRIP) $@
  95   else
  96     ifeq ($(STRIP_POLICY),min_strip)
  97         $(QUIETLY) $(STRIP) -g $@
  98     # implied else here is no stripping at all
  99     endif
 100   endif
 101         [ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); }





 102 endif
 103 
 104 install_saproc: $(BUILDLIBSAPROC)
 105         $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
 106           echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";     \
 107           test -f $(LIBSAPROC_DEBUGINFO) &&                  \
 108             cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \


 109           cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
 110         fi
 111 
 112 .PHONY: install_saproc


  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 #  
  23 #
  24 
  25 # Rules to build serviceability agent library, used by vm.make
  26 
  27 # libsaproc[_g].so: serviceability agent
  28 
  29 SAPROC = saproc
  30 LIBSAPROC = lib$(SAPROC).so
  31 
  32 SAPROC_G = $(SAPROC)$(G_SUFFIX)
  33 LIBSAPROC_G = lib$(SAPROC_G).so
  34 
  35 LIBSAPROC_DEBUGINFO   = lib$(SAPROC).debuginfo
  36 LIBSAPROC_DIZ         = lib$(SAPROC).diz
  37 LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo
  38 LIBSAPROC_G_DIZ       = lib$(SAPROC_G).diz
  39 
  40 AGENT_DIR = $(GAMMADIR)/agent
  41 
  42 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
  43 
  44 SASRCFILES = $(SASRCDIR)/salibelf.c                   \
  45              $(SASRCDIR)/symtab.c                     \
  46              $(SASRCDIR)/libproc_impl.c               \
  47              $(SASRCDIR)/ps_proc.c                    \
  48              $(SASRCDIR)/ps_core.c                    \
  49              $(SASRCDIR)/LinuxDebuggerLocal.c
  50 
  51 SAMAPFILE = $(SASRCDIR)/mapfile
  52 
  53 DEST_SAPROC           = $(JDK_LIBDIR)/$(LIBSAPROC)
  54 DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
  55 DEST_SAPROC_DIZ       = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
  56 
  57 # DEBUG_BINARIES overrides everything, use full -g debug information
  58 ifeq ($(DEBUG_BINARIES), true)
  59   SA_DEBUG_CFLAGS = -g
  60 endif
  61 
  62 # if $(AGENT_DIR) does not exist, we don't build SA
  63 # also, we don't build SA on Itanium, PPC, ARM or zero.
  64 
  65 ifneq ($(wildcard $(AGENT_DIR)),)
  66 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
  67   BUILDLIBSAPROC = $(LIBSAPROC)
  68 endif
  69 endif
  70 
  71 
  72 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
  73 
  74 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
  75         $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
  76           echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
  77           exit 1; \
  78         fi
  79         @echo Making SA debugger back-end...
  80         $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE                   \
  81                    -D_FILE_OFFSET_BITS=64                               \
  82                    $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG)     \
  83                    -I$(SASRCDIR)                                        \
  84                    -I$(GENERATED)                                       \
  85                    -I$(BOOT_JAVA_HOME)/include                          \
  86                    -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family)    \
  87                    $(SASRCFILES)                                        \
  88                    $(SA_LFLAGS)                                         \
  89                    $(SA_DEBUG_CFLAGS)                                   \
  90                    -o $@                                                \
  91                    -lthread_db
  92         $(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
  93 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
  94         $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
  95         $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
  96   ifeq ($(STRIP_POLICY),all_strip)
  97         $(QUIETLY) $(STRIP) $@
  98   else
  99     ifeq ($(STRIP_POLICY),min_strip)
 100         $(QUIETLY) $(STRIP) -g $@
 101     # implied else here is no stripping at all
 102     endif
 103   endif
 104         [ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); }
 105   ifeq ($(ZIP_DEBUGINFO_FILES),1)
 106         $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
 107         $(RM) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
 108         [ -f $(LIBSAPROC_G_DIZ) ] || { ln -s $(LIBSAPROC_DIZ) $(LIBSAPROC_G_DIZ); }
 109   endif
 110 endif
 111 
 112 install_saproc: $(BUILDLIBSAPROC)
 113         $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then             \
 114           echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)";     \
 115           test -f $(LIBSAPROC_DEBUGINFO) &&                  \
 116             cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
 117           test -f $(LIBSAPROC_DIZ) &&                  \
 118             cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \
 119           cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done";  \
 120         fi
 121 
 122 .PHONY: install_saproc