saproc.make revision 2790
2509N/A#
1178N/A# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
1178N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1178N/A#
1178N/A# This code is free software; you can redistribute it and/or modify it
1178N/A# under the terms of the GNU General Public License version 2 only, as
1178N/A# published by the Free Software Foundation.
1178N/A#
1178N/A# This code is distributed in the hope that it will be useful, but WITHOUT
1178N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1178N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1178N/A# version 2 for more details (a copy is included in the LICENSE file that
1178N/A# accompanied this code).
1178N/A#
1178N/A# You should have received a copy of the GNU General Public License version
1178N/A# 2 along with this work; if not, write to the Free Software Foundation,
1178N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A#
2362N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A# or visit www.oracle.com if you need additional information or have any
1178N/A# questions.
2509N/A#
1178N/A#
1178N/A
1178N/A# Rules to build serviceability agent library, used by vm.make
1178N/A
0N/A# libsaproc[_g].so: serviceability agent
0N/A
1178N/ASAPROC = saproc
1178N/ALIBSAPROC = lib$(SAPROC).so
1178N/A
1178N/ASAPROC_G = $(SAPROC)$(G_SUFFIX)
1178N/ALIBSAPROC_G = lib$(SAPROC_G).so
1178N/A
1178N/ALIBSAPROC_DEBUGINFO = lib$(SAPROC).debuginfo
1178N/ALIBSAPROC_G_DEBUGINFO = lib$(SAPROC_G).debuginfo
1178N/A
1178N/AAGENT_DIR = $(GAMMADIR)/agent
1178N/A
1178N/ASASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)/proc
1178N/A
1178N/ASASRCFILES = $(SASRCDIR)/saproc.cpp
1178N/A
1178N/ASAMAPFILE = $(SASRCDIR)/mapfile
1178N/A
1178N/ADEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
1178N/ADEST_SAPROC_DEBUGINFO = $(JDK_LIBDIR)/$(LIBSAPROC_DEBUGINFO)
0N/A
0N/A# if $(AGENT_DIR) does not exist, we don't build SA
1178N/A
0N/Aifneq ($(wildcard $(AGENT_DIR)),)
0N/A BUILDLIBSAPROC = $(LIBSAPROC)
0N/Aendif
0N/A
1178N/ASA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
1178N/A
0N/Aifdef USE_GCC
1178N/ASA_LFLAGS += -D_REENTRANT
1178N/Aelse
1178N/ASA_LFLAGS += -mt -xnolib -norunpath
1178N/Aendif
0N/A
1178N/A# The libproc Pstack_iter() interface changed in Nevada-B159.
1178N/A# Use 'uname -r -v' to determine the Solaris version as per
1178N/A# Solaris Nevada team request. This logic needs to match:
1178N/A# agent/src/os/solaris/proc/saproc.cpp: set_has_newer_Pstack_iter():
1178N/A# - skip SunOS 4 or older
1178N/A# - skip Solaris 10 or older
1178N/A# - skip two digit internal Nevada builds
1178N/A# - skip three digit internal Nevada builds thru 149
1178N/A# - skip internal Nevada builds 150-158
1178N/A# - if not skipped, print define for Nevada-B159 or later
1178N/ASOLARIS_11_B159_OR_LATER := \
1178N/A$(shell uname -r -v \
0N/A | sed -n \
1178N/A -e '/^[0-4]\. /b' \
1178N/A -e '/^5\.[0-9] /b' \
0N/A -e '/^5\.10 /b' \
0N/A -e '/ snv_[0-9][0-9]$$/b' \
0N/A -e '/ snv_[01][0-4][0-9]$$/b' \
1178N/A -e '/ snv_15[0-8]$$/b' \
1178N/A -e 's/.*/-DSOLARIS_11_B159_OR_LATER/' \
1178N/A -e 'p' \
1178N/A )
1178N/A
1178N/A# Uncomment the following to simulate building on Nevada-B159 or later
1178N/A# when actually building on Nevada-B158 or earlier:
1178N/A#SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER
1178N/A
1178N/A$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
1178N/A $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
1178N/A echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
1178N/A exit 1; \
1178N/A fi
1178N/A @echo Making SA debugger back-end...
1178N/A $(QUIETLY) $(CPP) \
1178N/A $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
1178N/A -I$(SASRCDIR) \
1178N/A -I$(GENERATED) \
1178N/A -I$(BOOT_JAVA_HOME)/include \
1178N/A -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \
1178N/A $(SOLARIS_11_B159_OR_LATER) \
1178N/A $(SASRCFILES) \
1178N/A $(SA_LFLAGS) \
0N/A -o $@ \
0N/A -ldl -ldemangle -lthread -lc
0N/A [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
0N/Aifneq ($(OBJCOPY),)
0N/A $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
0N/A $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
1178N/A ifeq ($(STRIP_POLICY),all_strip)
0N/A $(QUIETLY) $(STRIP) $@
0N/A else
0N/A ifeq ($(STRIP_POLICY),min_strip)
0N/A $(QUIETLY) $(STRIP) -x $@
0N/A # implied else here is no stripping at all
1178N/A endif
0N/A endif
0N/A [ -f $(LIBSAPROC_G_DEBUGINFO) ] || { ln -s $(LIBSAPROC_DEBUGINFO) $(LIBSAPROC_G_DEBUGINFO); }
0N/Aendif
0N/A
0N/Ainstall_saproc: $(BULDLIBSAPROC)
0N/A $(QUIETLY) if [ -f $(LIBSAPROC) ] ; then \
0N/A echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \
0N/A test -f $(LIBSAPROC_DEBUGINFO) && \
0N/A cp -f $(LIBSAPROC_DEBUGINFO) $(DEST_SAPROC_DEBUGINFO); \
0N/A cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \
0N/A fi
0N/A
0N/A.PHONY: install_saproc
1178N/A