2796N/A#
2796N/A# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
2796N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2796N/A#
2796N/A# This code is free software; you can redistribute it and/or modify it
2796N/A# under the terms of the GNU General Public License version 2 only, as
2796N/A# published by the Free Software Foundation.
2796N/A#
2796N/A# This code is distributed in the hope that it will be useful, but WITHOUT
2796N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2796N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2796N/A# version 2 for more details (a copy is included in the LICENSE file that
2796N/A# accompanied this code).
2796N/A#
2796N/A# You should have received a copy of the GNU General Public License version
2796N/A# 2 along with this work; if not, write to the Free Software Foundation,
2796N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2796N/A#
2796N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2796N/A# or visit www.oracle.com if you need additional information or have any
2796N/A# questions.
2796N/A#
2796N/A#
2796N/A
2796N/A# Rules to build serviceability agent library, used by vm.make
2796N/A
2796N/A# libsaproc[_g].so: serviceability agent
2796N/ASAPROC = saproc
2796N/ASAPROC_G = $(SAPROC)$(G_SUFFIX)
2796N/A
2796N/Aifeq ($(OS_VENDOR), Darwin)
2796N/A LIBSAPROC = lib$(SAPROC).dylib
2796N/A LIBSAPROC_G = lib$(SAPROC_G).dylib
2796N/Aelse
2796N/A LIBSAPROC = lib$(SAPROC).so
2796N/A LIBSAPROC_G = lib$(SAPROC_G).so
2796N/Aendif
2796N/A
2796N/AAGENT_DIR = $(GAMMADIR)/agent
2796N/A
2796N/ASASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family)
2796N/A
2842N/ANON_STUB_SASRCFILES = $(SASRCDIR)/salibelf.c \
2842N/A $(SASRCDIR)/symtab.c \
2842N/A $(SASRCDIR)/libproc_impl.c \
2842N/A $(SASRCDIR)/ps_proc.c \
2842N/A $(SASRCDIR)/ps_core.c \
2842N/A $(SASRCDIR)/BsdDebuggerLocal.c
2842N/A
2842N/Aifeq ($(OS_VENDOR), FreeBSD)
2842N/A SASRCFILES = $(NON_STUB_SASRCFILES)
2842N/A SALIBS = -lutil -lthread_db
2842N/A SAARCH = $(ARCHFLAG)
2842N/Aelse
2842N/A ifeq ($(OS_VENDOR), Darwin)
2842N/A SASRCFILES = $(SASRCDIR)/MacosxDebuggerLocal.m
2842N/A SALIBS = -g -framework Foundation -F/System/Library/Frameworks/JavaVM.framework/Frameworks -framework JavaNativeFoundation -framework Security -framework CoreFoundation
2842N/A #objc compiler blows up on -march=i586, perhaps it should not be included in the macosx intel 32-bit C++ compiles?
2842N/A SAARCH = $(subst -march=i586,,$(ARCHFLAG))
2842N/A else
2842N/A SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c
2842N/A SALIBS =
2842N/A SAARCH = $(ARCHFLAG)
2842N/A endif
2842N/Aendif
2796N/A
2796N/ASAMAPFILE = $(SASRCDIR)/mapfile
2796N/A
2796N/ADEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC)
2796N/A
2796N/A# DEBUG_BINARIES overrides everything, use full -g debug information
2796N/Aifeq ($(DEBUG_BINARIES), true)
2796N/A SA_DEBUG_CFLAGS = -g
2796N/Aendif
2796N/A
2796N/A# if $(AGENT_DIR) does not exist, we don't build SA
2796N/A# also, we don't build SA on Itanium, PPC, ARM or zero.
2796N/A
2796N/Aifneq ($(wildcard $(AGENT_DIR)),)
2796N/Aifneq ($(filter-out ia64 arm ppc zero,$(SRCARCH)),)
2796N/A BUILDLIBSAPROC = $(LIBSAPROC)
2796N/Aendif
2796N/Aendif
2796N/A
2796N/A
2796N/Aifneq ($(OS_VENDOR), Darwin)
2796N/ASA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE))
2796N/Aendif
2796N/ASA_LFLAGS += $(LDFLAGS_HASH_STYLE)
2796N/A
2842N/Aifeq ($(OS_VENDOR), Darwin)
2842N/A BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
2842N/A -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]") \
2842N/A -I/System/Library/Frameworks/JavaVM.framework/Headers
2842N/Aelse
2842N/A BOOT_JAVA_INCLUDES = -I$(BOOT_JAVA_HOME)/include \
2842N/A -I$(BOOT_JAVA_HOME)/include/$(shell uname -s | tr "[:upper:]" "[:lower:]")
2842N/Aendif
2842N/A
2796N/A$(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE)
2796N/A $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
2796N/A echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
2796N/A exit 1; \
2796N/A fi
2796N/A @echo Making SA debugger back-end...
2796N/A $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \
2842N/A $(SYMFLAG) $(SAARCH) $(SHARED_FLAG) $(PICFLAG) \
2796N/A -I$(SASRCDIR) \
2796N/A -I$(GENERATED) \
2842N/A $(BOOT_JAVA_INCLUDES) \
2796N/A $(SASRCFILES) \
2796N/A $(SA_LFLAGS) \
2796N/A $(SA_DEBUG_CFLAGS) \
2796N/A -o $@ \
2796N/A $(SALIBS)
2796N/A $(QUIETLY) [ -f $(LIBSAPROC_G) ] || { ln -s $@ $(LIBSAPROC_G); }
2796N/A
2796N/Ainstall_saproc: $(BUILDLIBSAPROC)
2796N/A $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \
2796N/A echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \
2796N/A cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \
2796N/A fi
2796N/A
2796N/A.PHONY: install_saproc