1 # 2 # Copyright 2005-2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 # CA 95054 USA or visit www.sun.com if you need additional information or 21 # have any questions. 22 # 23 # 24 25 # Rules to build serviceability agent library, used by vm.make 26 27 # libsaproc[_g].so: serviceability agent 28 SAPROC = saproc$(G_SUFFIX) 29 LIBSAPROC = lib$(SAPROC).so 30 31 AGENT_DIR = $(GAMMADIR)/agent 32 33 SASRCDIR = $(AGENT_DIR)/src/os/$(Platform_os_family) 34 35 SASRCFILES = $(SASRCDIR)/salibelf.c \ 36 $(SASRCDIR)/symtab.c \ 37 $(SASRCDIR)/libproc_impl.c \ 38 $(SASRCDIR)/ps_proc.c \ 39 $(SASRCDIR)/ps_core.c \ 40 $(SASRCDIR)/LinuxDebuggerLocal.c \ 41 $(AGENT_DIR)/src/share/native/sadis.c 42 43 SAMAPFILE = $(SASRCDIR)/mapfile 44 45 DEST_SAPROC = $(JDK_LIBDIR)/$(LIBSAPROC) 46 47 # DEBUG_BINARIES overrides everything, use full -g debug information 48 ifeq ($(DEBUG_BINARIES), true) 49 SA_DEBUG_CFLAGS = -g 50 endif 51 52 # if $(AGENT_DIR) does not exist, we don't build SA 53 # also, we don't build SA on Itanium. 54 55 checkAndBuildSA: 56 $(QUIETLY) if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" ] ; then \ 57 $(MAKE) -f vm.make $(LIBSAPROC); \ 58 fi 59 60 SA_LFLAGS = $(MAPFLAG:FILENAME=$(SAMAPFILE)) $(LDFLAGS_HASH_STYLE) 61 62 $(LIBSAPROC): $(SASRCFILES) $(SAMAPFILE) 63 $(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \ 64 echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \ 65 exit 1; \ 66 fi 67 @echo Making SA debugger back-end... 68 $(QUIETLY) $(CC) -D$(BUILDARCH) -D_GNU_SOURCE \ 69 $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ 70 -I$(SASRCDIR) \ 71 -I$(GENERATED) \ 72 -I$(BOOT_JAVA_HOME)/include \ 73 -I$(BOOT_JAVA_HOME)/include/$(Platform_os_family) \ 74 $(SASRCFILES) \ 75 $(SA_LFLAGS) \ 76 $(SA_DEBUG_CFLAGS) \ 77 -o $@ \ 78 -lthread_db 79 80 install_saproc: checkAndBuildSA 81 $(QUIETLY) if [ -e $(LIBSAPROC) ] ; then \ 82 echo "Copying $(LIBSAPROC) to $(DEST_SAPROC)"; \ 83 cp -f $(LIBSAPROC) $(DEST_SAPROC) && echo "Done"; \ 84 fi 85 86 .PHONY: checkAndBuildSA install_saproc