# Agent support for standard Java libraries
#
# Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# Written by Tim Wilkinson <tim@tjwassoc.demon.co.uk>, 1996.

@VPATHOPT@=	@srcdir@/sun.tools.debug.stubs
srcdir=		@srcdir@
prefix=		@prefix@
exec_prefix=	@exec_prefix@
libdir=		@libdir@
CC=		@CC@
LD=		@LD@
AR=		@AR@
RANLIB=		@RANLIB@
INCLUDES=	-I$(srcdir) -I../../../../include -I$(srcdir)/../../../../include -I../../../../config -I$(srcdir)/../../../../config
CFLAGS=		@CFLAGS@
ALL_CFLAGS=	$(CFLAGS) $(INCLUDES)
INSTALL=	@INSTALL@
INSTALL_DATA=	@INSTALL_DATA@
MKDIR=		@MKDIR@
LN=		@LN_S@
DLLTOOL=	@DLLTOOL@
PIC=		@PIC@
LDFLAGS=	@LIBSHARE@
LIBS=		@LIBS@
LDTAIL=		@LDTAIL@
KVER=		@KVER@
OBJEXT=		@OBJEXT@
LIBEXT=		@LIBEXT@

LIBNAME=	libagent
LIB=		$(LIBNAME)$(LIBEXT).$(KVER)
LLIB=		$(LIBNAME)$(LIBEXT)

OBJECT.AGENT=	AgentStub$(OBJEXT)

OBJECT=		$(OBJECT.AGENT)

all:		$(LLIB)

$(LLIB):	$(LIB)
		rm -f $(LLIB)
		$(LN) $(LIB) $(LLIB)

$(LIB):         $(OBJECT) lib.exp
		@LINKLIB@

.c$(OBJEXT):
		$(CC) $(ALL_CFLAGS) -c $(PIC) $<

clean:
		rm -f $(LLIB) $(LIB) $(OBJECT) lib.exp

distclean:	clean
		rm -f Makefile

install:
		test -d $(libdir) || $(MKDIR) $(libdir)
		$(INSTALL_DATA) $(LIB) $(libdir)/$(LIB)
		rm -f $(libdir)/$(LLIB)
		$(LN) $(LIB) $(libdir)/$(LLIB)

lib.exp:
		$(DLLTOOL) --def $(srcdir)/$(LIBNAME).def --output-exp lib.exp --output-lib $(LIBNAME).a --dllname $(LLIB)
		touch lib.exp

# -------------------------------------------------------------------------
# Stuff to regenerate stubs.

SUNDEBUG=	sun.tools.debug.Agent

stubs:
	(cd $(srcdir)/sun.tools.debug.stubs &&\
		kaffeh -base $(SUNDEBUG);\
		kaffeh -postfix Stub -base -stubs $(SUNDEBUG))
