# Makefile.in for kaffevm - a Java(tm) compatible virtual machine.
#
# 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@@VPATHSEP@@srcdir@/@with_engine@@VPATHSEP@@srcdir@/../../config/@host_cpu@/@host_os@@VPATHSEP@@srcdir@/../../config/@host_cpu@
srcdir=		@srcdir@
prefix=		@prefix@
exec_prefix=	@exec_prefix@
libdir=		@libdir@
INSTALL=	@INSTALL@
INSTALL_DATA=	@INSTALL_DATA@
MKDIR=		@MKDIR@
LN=		@LN_S@
CC=		@CC@
LD=		@LD@
AR=		@AR@
RANLIB=		@RANLIB@
DLLTOOL=	@DLLTOOL@
PIC=		@PICVM@
LDFLAGS=	@LIBSHARE@
LIBS=		@LIBS@
LDTAIL=		@LDTAIL@ @NET_LIBRARIES@ @STD_LIBRARIES@ @VM_LIBRARIES@
KVER=		@KVER@
OBJEXT=		@OBJEXT@
LIBEXT=		@LIBVMEXT@

INCLUDES=	-I. -I$(srcdir) -I$(srcdir)/../../config -I../../config -I../../include -I$(srcdir)/../../include
CFLAGS=		@CFLAGS@
ALL_CFLAGS=	$(CFLAGS) @KAFFEVMFLAGS@ $(INCLUDES) $(ENGINE_CFLAGS) -DKVER=\"$(KVER)\"

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

COMMON=\
		code$(OBJEXT) \
		lookup$(OBJEXT) \
		external$(OBJEXT) \
		constants$(OBJEXT) \
		classMethod$(OBJEXT) \
		readClass$(OBJEXT) \
		findInJar$(OBJEXT) \
		baseClasses$(OBJEXT) \
		object$(OBJEXT) \
		itypes$(OBJEXT) \
		gc$(OBJEXT) \
		gc-mem$(OBJEXT) \
		thread$(OBJEXT) \
		locks$(OBJEXT) \
		threadCalls$(OBJEXT) \
		support$(OBJEXT) \
		zextract$(OBJEXT) \
		soft$(OBJEXT) \
		flags$(OBJEXT) \
		string$(OBJEXT) \
		verify$(OBJEXT) \
		code-analyse$(OBJEXT) \
		exception$(OBJEXT) \
		stackTrace$(OBJEXT) \
		md$(OBJEXT)

all:		mkkaffevm

@engine_frag@
@cpu_frag@
@cpu_os_frag@

OBJECT=		$(COMMON) $(ENGINE_OBJECTS) $(CPU_OBJECTS) $(CPUOS_OBJECTS)

mkkaffevm:	$(LLIB)

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

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

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

gc.o:		gc.h gc.c gc-incremental.c gc-incremental.h

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

distclean:	clean
		rm -f md.c jit.def icode.h trampolines.c
		rm -f thread-native.h locks-native.h
		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
