# Makefile.in for kaffevm - a Java(tm) compatible virtual machine.
#
# 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@@VPATHSEP@@srcdir@/@TYPE@
srcdir=		@srcdir@
prefix=		@prefix@
exec_prefix=	@exec_prefix@
libdir=		@libdir@
INSTALL=	@INSTALL@
INSTALL_DATA=	@INSTALL_DATA@
LN=		@LN_S@
CC=		@CC@
AR=		@AR@
AR_FLAGS=	cr
RANLIB=		@RANLIB@
PIC=		@PIC@
LDFLAGS=	@LIBSHARE@
LDTAIL=		@LDTAIL@
KVER=		@KVER@
OBJEXT=		@OBJEXT@
LIBEXT=		@LIBEXT@

jit_CFLAGS=	-DTRANSLATOR -I$(srcdir)/jit
intrp_CFLAGS=	-DINTERPRETER -I$(srcdir)/intrp

CFLAGS=		@CFLAGS@ @KAFFEVMFLAGS@ -I. -I$(srcdir) -I$(srcdir)/../config -I../config \
		$(@TYPE@_CFLAGS)

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

COMMON=\
		code$(OBJEXT) \
		lookup$(OBJEXT) \
		external$(OBJEXT) \
		constants$(OBJEXT) \
		classMethod$(OBJEXT) \
		readClass$(OBJEXT) \
		findClass$(OBJEXT) \
		baseClasses$(OBJEXT) \
		object$(OBJEXT) \
		itypes$(OBJEXT) \
		gc$(OBJEXT) \
		thread$(OBJEXT) \
		locks$(OBJEXT) \
		threadCalls$(OBJEXT) \
		support$(OBJEXT) \
		zextract$(OBJEXT) \
		soft$(OBJEXT) \
		flags$(OBJEXT) \
		md$(OBJEXT)

intrp_OBJECTS=\
		exception$(OBJEXT) \
		machine$(OBJEXT)

jit_OBJECTS=\
		basecode$(OBJEXT) \
		funcs$(OBJEXT) \
		icode$(OBJEXT) \
		labels$(OBJEXT) \
		registers$(OBJEXT) \
		slots$(OBJEXT) \
		machine$(OBJEXT) \
		seq$(OBJEXT) \
		exception$(OBJEXT)

OBJECT=		$(COMMON) $(@TYPE@_OBJECTS)

all:		mkkaffevm

mkkaffevm:	$(LLIB)

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

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

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

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

distclean:	clean
		rm -f md.c jit.def icode.h
		rm -f Makefile config.log config.status

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