# Native 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@/java.io@VPATHSEP@@srcdir@/java.lang@VPATHSEP@@srcdir@/java.lang.reflect@VPATHSEP@@srcdir@/java.util@VPATHSEP@@srcdir@/java.io.stubs@VPATHSEP@@srcdir@/java.lang.stubs@VPATHSEP@@srcdir@/java.lang.reflect.stubs@VPATHSEP@@srcdir@/java.util.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@ @STD_LIBRARIES@
KVER=		@KVER@
OBJEXT=		@OBJEXT@
LIBEXT=		@LIBEXT@

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

OBJECT.IO=\
		FileDescriptorStub$(OBJEXT) \
		FileDescriptor$(OBJEXT) \
		FileInputStreamStub$(OBJEXT) \
		FileInputStream$(OBJEXT) \
		FileOutputStreamStub$(OBJEXT) \
		FileOutputStream$(OBJEXT) \
		FileStub$(OBJEXT) \
		File$(OBJEXT) \
		ObjectInputStream$(OBJEXT) \
		ObjectInputStreamStub$(OBJEXT) \
		ObjectOutputStream$(OBJEXT) \
		ObjectOutputStreamStub$(OBJEXT) \
		ObjectStreamClassStub$(OBJEXT) \
		ObjectStreamClass$(OBJEXT) \
		RandomAccessFileStub$(OBJEXT) \
		RandomAccessFile$(OBJEXT)

OBJECT.LANG=\
		ClassLoaderStub$(OBJEXT) \
		ClassLoader$(OBJEXT) \
		ClassStub$(OBJEXT) \
		Class$(OBJEXT) \
		CompilerStub$(OBJEXT) \
		Compiler$(OBJEXT) \
		DoubleStub$(OBJEXT) \
		Double$(OBJEXT) \
		FloatStub$(OBJEXT) \
		Float$(OBJEXT) \
		MathStub$(OBJEXT) \
		Math$(OBJEXT) \
		ObjectStub$(OBJEXT) \
		Object$(OBJEXT) \
		RuntimeStub$(OBJEXT) \
		Runtime$(OBJEXT) \
		SecurityManagerStub$(OBJEXT) \
		SecurityManager$(OBJEXT) \
		StringStub$(OBJEXT) \
		String$(OBJEXT) \
		SystemStub$(OBJEXT) \
		System$(OBJEXT) \
		ThreadStub$(OBJEXT) \
		Thread$(OBJEXT) \
		ThrowableStub$(OBJEXT) \
		Throwable$(OBJEXT) \
		UNIXProcessStub$(OBJEXT) \
		UNIXProcess$(OBJEXT)

OBJECT.LANG.REFLECT=\
		ArrayStub$(OBJEXT) \
		Array$(OBJEXT) \
		ConstructorStub$(OBJEXT) \
		Constructor$(OBJEXT) \
		FieldStub$(OBJEXT) \
		Field$(OBJEXT) \
		MethodStub$(OBJEXT) \
		Method$(OBJEXT)

OBJECT.UTIL=\
		ResourceBundleStub$(OBJEXT) \
		ResourceBundle$(OBJEXT) \

OBJECT=		$(OBJECT.LANG) $(OBJECT.LANG.REFLECT) $(OBJECT.IO) \
		$(OBJECT.UTIL)

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

JAVALANG=	java.lang.Class java.lang.ClassLoader java.lang.Compiler \
		java.lang.Double java.lang.Float java.lang.Math \
		java.lang.Object java.lang.Runtime java.lang.SecurityManager \
		java.lang.System java.lang.Thread java.lang.Throwable \
		java.lang.UNIXProcess java.lang.String
JAVALANGREFLECT=java.lang.reflect.Array java.lang.reflect.Constructor \
		java.lang.reflect.Field java.lang.reflect.Method
JAVAIO=		java.io.File java.io.FileDescriptor java.io.FileInputStream \
		java.io.FileOutputStream java.io.RandomAccessFile \
		java.io.ObjectInputStream java.io.ObjectOutputStream \
		java.io.ObjectStreamClass
stubs:
		(cd $(srcdir)/java.lang.stubs &&\
			kaffeh -base $(JAVALANG)\
			java.lang.Integer;\
			kaffeh -postfix Stub -base -stubs $(JAVALANG))
		(cd $(srcdir)/java.lang.reflect.stubs &&\
			kaffeh -base $(JAVALANGREFLECT);\
			kaffeh -postfix Stub -base -stubs $(JAVALANGREFLECT))
		(cd $(srcdir)/java.io.stubs &&\
			kaffeh -base $(JAVAIO)\
			java.io.PrintStream java.io.InputStream \
			java.io.ObjectStreamField;\
			kaffeh -postfix Stub -base -stubs $(JAVAIO))
