duke@435: # trims@1907: # Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. duke@435: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: # duke@435: # This code is free software; you can redistribute it and/or modify it duke@435: # under the terms of the GNU General Public License version 2 only, as duke@435: # published by the Free Software Foundation. duke@435: # duke@435: # This code is distributed in the hope that it will be useful, but WITHOUT duke@435: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: # version 2 for more details (a copy is included in the LICENSE file that duke@435: # accompanied this code). duke@435: # duke@435: # You should have received a copy of the GNU General Public License version duke@435: # 2 along with this work; if not, write to the Free Software Foundation, duke@435: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: # trims@1907: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA trims@1907: # or visit www.oracle.com if you need additional information or have any trims@1907: # questions. duke@435: # duke@435: # duke@435: duke@435: ARCH := $(shell if ([ `uname -m` = "ia64" ]) ; then echo ia64 ; elif ([ `uname -m` = "x86_64" ]) ; then echo amd64; elif ([ `uname -m` = "sparc64" ]) ; then echo sparc; else echo i386 ; fi ) duke@435: GCC = gcc duke@435: duke@435: JAVAH = ${JAVA_HOME}/bin/javah duke@435: duke@435: SOURCES = salibelf.c \ duke@435: symtab.c \ duke@435: libproc_impl.c \ duke@435: ps_proc.c \ duke@435: ps_core.c \ duke@435: LinuxDebuggerLocal.c duke@435: duke@435: INCLUDES = -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux duke@435: duke@435: OBJS = $(SOURCES:.c=.o) duke@435: duke@435: LIBS = -lthread_db duke@435: duke@435: CFLAGS = -c -fPIC -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) duke@435: duke@435: LIBSA = $(ARCH)/libsaproc.so duke@435: duke@435: all: $(LIBSA) duke@435: duke@435: LinuxDebuggerLocal.o: LinuxDebuggerLocal.c duke@435: $(JAVAH) -jni -classpath ../../../build/classes \ duke@435: sun.jvm.hotspot.debugger.x86.X86ThreadContext \ duke@435: sun.jvm.hotspot.debugger.sparc.SPARCThreadContext \ duke@435: sun.jvm.hotspot.debugger.amd64.AMD64ThreadContext duke@435: $(GCC) $(CFLAGS) $< duke@435: duke@435: .c.obj: duke@435: $(GCC) $(CFLAGS) duke@435: duke@435: ifndef LDNOMAP duke@435: LFLAGS_LIBSA = -Xlinker --version-script=mapfile duke@435: endif duke@435: never@1189: # If this is a --hash-style=gnu system, use --hash-style=both never@1189: # The gnu .hash section won't work on some Linux systems like SuSE 10. never@1189: _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu') never@1189: ifneq ($(_HAS_HASH_STYLE_GNU),) never@1189: LDFLAGS_HASH_STYLE = -Wl,--hash-style=both never@1189: endif never@1189: LFLAGS_LIBSA += $(LDFLAGS_HASH_STYLE) never@1189: duke@435: $(LIBSA): $(OBJS) mapfile duke@435: if [ ! -d $(ARCH) ] ; then mkdir $(ARCH) ; fi duke@435: $(GCC) -shared $(LFLAGS_LIBSA) -o $(LIBSA) $(OBJS) $(LIBS) duke@435: duke@435: test.o: test.c duke@435: $(GCC) -c -o test.o -g -D_GNU_SOURCE -D$(ARCH) $(INCLUDES) test.c duke@435: duke@435: test: test.o duke@435: $(GCC) -o test test.o -L$(ARCH) -lsaproc $(LIBS) duke@435: duke@435: clean: duke@435: rm -rf $(LIBSA) duke@435: rm -rf $(OBJS) duke@435: rmdir $(ARCH) duke@435: