# Native support for zip Java library
#
# Copyright (c) 1996,97 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.co.uk>

@VPATHOPT@=	@srcdir@/java.util.zip.stubs@VPATHSEP@@srcdir@/java.util.zip
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@ @STD_LIBRARIES@
KVER=		@KVER@
OBJEXT=		@OBJEXT@
LIBEXT=		@LIBEXT@

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

OBJECT.UTIL.ZIP=\
		Adler32Stub$(OBJEXT) \
		CRC32Stub$(OBJEXT) \
		DeflaterStub$(OBJEXT) \
		InflaterStub$(OBJEXT)

OBJECT=		$(OBJECT.UTIL.ZIP)

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

JAVAUTILZIP=	java.util.zip.Adler32 java.util.zip.CRC32 \
		java.util.zip.Deflater java.util.zip.Inflater

stubs:
		(cd $(srcdir)/java.util.zip.stubs;\
			kaffeh -base $(JAVAUTILZIP);\
			kaffeh -postfix Stub -base -stubs $(JAVAUTILZIP))
