# Makefile.in for kaffevm - a Java(tm) compatible virtual machine.
# Borland
# 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>, May 1996.

srcdir=		@srcdir@
prefix=		@prefix@
exec_prefix=	@exec_prefix@
libdir=		@libdir@
INSTALL=	@INSTALL@
INSTALL_DATA=	@INSTALL_DATA@
CC=		@CC@
PIC=		@PIC@
LDFLAGS=	@LIBSHARE@
LDTAIL=		@LDTAIL@
KVER=		@KVER@
OBJEXT=@OBJEXT@
LIBEXT=@LIBEXT@

jit_CFLAGS=	-DTRANSLATOR 
intrp_CFLAGS=	-DINTERPRETER 

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

LIBNAME=	libkaffe_vm
LIBX=		$(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:		links $(LLIB)

.path.c=	.;..\..\kaffevm;..\..\kaffevm\@TYPE@


$(LLIB):		$(OBJECT) $(LIBNAME).def
		tlink32 -Tpd -v c0d32 @&&!
$(OBJECT)
!,$(LLIB),NUL,cw32 import32,$(LIBNAME).def,
		implib $(LIBNAME) $(LLIB)

.c.obj:
		$(CC) @&&!
$(CFLAGS)
! -c $(PIC) $<

#links:		md.h md.c $(LIBNAME).def icode.h jit.def ..\config\config.h
links:		md.h md.c $(LIBNAME).def ..\config\config.h

md.h:		$(srcdir)\..\config\i386\win32\bc\md.h
		copy $(srcdir)\..\config\i386\win32\bc\md.h md.h

md.c:		$(srcdir)\..\config\i386\win32\bc\md.c
		copy $(srcdir)\..\config\i386\win32\bc\md.c md.c

$(LIBNAME).def: ..\..\config\i386\win32\bc\$(LIBNAME).def
		copy ..\..\config\i386\win32\bc\$(LIBNAME).def $(LIBNAME).def

icode.h:	..\..\config\i386\jit-icode.h
		copy ..\..\config\i386\jit-icode.h icode.h

jit.def:	..\..\config\i386\jit-i386.def
		copy ..\..\config\i386\jit-i386.def jit.def

..\config\config.h:	..\..\config\i386\win32\bc\config.h
		copy ..\..\config\i386\win32\bc\config.h ..\config\config.h


clean:
		del *.obj
		del *.dll
		del *.lib

distclean:	clean
		del md.h
		del md.c
		del jit.def
		del icode.h
		del $(LIBNAME).def
		del ..\config\config.h
		del Makefile
		del config.log
		del config.status

install:
		$(INSTALL_DATA) $(LIB) $(libdir)\$(LIB)
