annotate make/linux/makefiles/saproc.make @ 3364:d652a62d6e03

7102323: RFE: enable Full Debug Symbols Phase 1 on Solaris Summary: Add support for ENABLE_FULL_DEBUG_SYMBOLS and ZIP_DEBUGINFO_FILES build flags. Add support for .diz files. Reviewed-by: dholmes, ohair, sspitsyn
author dcubed
date Fri, 23 Mar 2012 11:50:33 -0700
parents 54d3535a6dd3
children a9fed06c01d2
rev   line source
duke@0 1 #
poonam@3208 2 # Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation.
duke@0 8 #
duke@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 # accompanied this code).
duke@0 14 #
duke@0 15 # You should have received a copy of the GNU General Public License version
duke@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 #
trims@1472 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1472 20 # or visit www.oracle.com if you need additional information or have any
trims@1472 21 # questions.
duke@0 22 #
duke@0 23 #
duke@0 24
duke@0 25 # Rules to build serviceability agent library, used by vm.make
duke@0 26
duke@0 27 # libsaproc[_g].so: serviceability agent
phh@1123 28
phh@1123 29 SAPROC = saproc
duke@0 30 LIBSAPROC = lib$(SAPROC).so
duke@0 31
phh@1123 32 SAPROC_G = $(SAPROC)$(G_SUFFIX)
phh@1123 33 LIBSAPROC_G = lib$(SAPROC_G).so
phh@1123 34
dcubed@2790 35 LIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo
dcubed@3364 36 LIBSAPROC_DIZ = lib$(SAPROC).diz
dcubed@2790 37 LIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo
dcubed@3364 38 LIBSAPROC_G_DIZ = lib$(SAPROC_G).diz
dcubed@2790 39
duke@0 40 AGENT_DIR = $(GAMMADIR)/agent
duke@0 41
duke@0 42 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
duke@0 43
duke@0 44 SASRCFILES = $(SASRCDIR)/salibelf.c \
duke@0 45 $(SASRCDIR)/symtab.c \
duke@0 46 $(SASRCDIR)/libproc_impl.c \
duke@0 47 $(SASRCDIR)/ps_proc.c \
duke@0 48 $(SASRCDIR)/ps_core.c \
duke@0 49 $(SASRCDIR)/LinuxDebuggerLocal.c
duke@0 50
duke@0 51 SAMAPFILE = $(SASRCDIR)/mapfile
duke@0 52
dcubed@2790 53 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
dcubed@2790 54 DEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
dcubed@3364 55 DEST_SAPROC_DIZ = $(JDK_LIBDIR)/$(LIBSAPROC_DIZ)
duke@0 56
aph@767 57 # DEBUG_BINARIES overrides everything, use full -g debug information
aph@767 58 ifeq ($(DEBUG_BINARIES), true)
aph@767 59 SA_DEBUG_CFLAGS = -g
aph@767 60 endif
aph@767 61
duke@0 62 # if $(AGENT_DIR) does not exist, we don't build SA
bobv@1601 63 # also, we don't build SA on Itanium, PPC, ARM or zero.
duke@0 64
stefank@1879 65 ifneq ($(wildcard $(AGENT_DIR)),)
stefank@1879 66 ifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
stefank@1879 67 BUILDLIBSAPROC = $(LIBSAPROC)
stefank@1879 68 endif
stefank@1879 69 endif
stefank@1879 70
duke@0 71
never@757 72 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE)
duke@0 73
duke@0 74 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
duke@0 75 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
duke@0 76 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
duke@0 77 exit 1; \
duke@0 78 fi
duke@0 79 @echo Making SA debugger back-end...
duke@0 80 $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
poonam@3208 81 -D_FILE_OFFSET_BITS=64 \
duke@0 82 $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
duke@0 83 -I$(SASRCDIR) \
duke@0 84 -I$(GENERATED) \
duke@0 85 -I$(BOOT_JAVA_HOME)/include \
duke@0 86 -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \
duke@0 87 $(SASRCFILES) \
duke@0 88 $(SA_LFLAGS) \
aph@767 89 $(SA_DEBUG_CFLAGS) \
duke@0 90 -o $@ \
duke@0 91 -lthread_db
phh@1123 92 $(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
dcubed@3364 93 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
dcubed@2790 94 $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
dcubed@2790 95 $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
dcubed@2790 96 ifeq ($(STRIP_POLICY),all_strip)
dcubed@2790 97 $(QUIETLY) $(STRIP) $@
dcubed@2790 98 else
dcubed@2790 99 ifeq ($(STRIP_POLICY),min_strip)
dcubed@2790 100 $(QUIETLY) $(STRIP) -g $@
dcubed@2790 101 # implied else here is no stripping at all
dcubed@2790 102 endif
dcubed@2790 103 endif
dcubed@2790 104 [ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); }
dcubed@3364 105 ifeq ($(ZIP_DEBUGINFO_FILES),1)
dcubed@3364 106 $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
dcubed@3364 107 $(RM) $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO)
dcubed@3364 108 [ -f $(LIBSAPROC_G_DIZ) ] || { ln -s $(LIBSAPROC_DIZ) $(LIBSAPROC_G_DIZ); }
dcubed@3364 109 endif
dcubed@2790 110 endif
duke@0 111
stefank@1879 112 install_saproc: $(BUILDLIBSAPROC)
duke@0 113 $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \
duke@0 114 echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \
dcubed@2790 115 test -f $(LIBSAPROC_DEBUGINFO) && \
dcubed@2790 116 cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
dcubed@3364 117 test -f $(LIBSAPROC_DIZ) && \
dcubed@3364 118 cp -f $(LIBSAPROC_DIZ) $(DEST_SAPROC_DIZ); \
duke@0 119 cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \
duke@0 120 fi
duke@0 121
stefank@1879 122 .PHONY: install_saproc