# Net support for standard Java libraries
#
# Copyright (c) 1996 Systems Architecture Research Centre,
#		   City University, 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@sarc.city.ac.uk>, February 1996.

@VPATHOPT@=	@srcdir@/java.net@VPATHSEP@@srcdir@/java.net.stubs
srcdir=		@srcdir@
prefix=		@prefix@
exec_prefix=	@exec_prefix@
libdir=		@libdir@
CC=		@CC@
AR=		@AR@
AR_FLAGS=	cr
RANLIB=		@RANLIB@
CFLAGS=		@CFLAGS@ -I$(srcdir) -I../support -I$(srcdir)/../support -I../../config -I$(srcdir)/../../config
INSTALL=	@INSTALL@
INSTALL_DATA=	@INSTALL_DATA@
LN=		@LN_S@
PIC=		@PIC@
LDFLAGS=	@LIBSHARE@
LDTAIL=		@LDTAIL@
KVER=		@KVER@
OBJEXT=		@OBJEXT@
LIBEXT=		@LIBEXT@

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

OBJECT.NET=	DatagramSocketStub$(OBJEXT) \
		DatagramSocket$(OBJEXT) \
		InetAddressStub$(OBJEXT) \
		InetAddress$(OBJEXT) \
		PlainSocketImplStub$(OBJEXT) \
		PlainSocketImpl$(OBJEXT) \
		SocketInputStreamStub$(OBJEXT) \
		SocketInputStream$(OBJEXT) \
		SocketOutputStreamStub$(OBJEXT) \
		SocketOutputStream$(OBJEXT)

OBJECTS=	$(OBJECT.NET)

all:		$(LLIB)

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

$(LIB):         $(OBJECTS)
		if test "$(LIBEXT)" = ".a" ; then \
			$(AR) $(AR_FLAGS) $(LIB) $(OBJECTS); \
			$(RANLIB) $(LIB); \
		else \
			$(LD) $(LDFLAGS) -o $(LIB) $(OBJECTS) $(LDTAIL); \
		fi

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

clean:
		rm -f $(LLIB) $(LIB) $(OBJECTS)

distclean:	clean
		rm -f Makefile

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