#  Makefile for run-time helpers
#

include ../configs/basic.mk
include ../configs/current.mk

CFLAGS = -I../packages/API/include -I../packages/TOBA/include -DARCH_$(ARCH)=1 $(CBUILD)

DONE = runtime.done
UPDATED = runtime.updated

HELP = alloc.c binary_loader.c file.c finalizer.c helpers.c \
       loader.c monitor.c runtime.c sthreads.c structs.c throw.c \
       intern.c classfile_ClassData.c

JITSRC = jit_JITCodeGen.c jit_CodeBlock.c \
       runtime_ClassRT.c \
       runtime_SystemClassLoader.c runtime_CodeGen.c

API = awt_image_ColorModel.c io_File.c io_FileDescriptor.c \
  io_FileInputStream.c io_FileOutputStream.c io_RandomAccessFile.c \
  lang_Class.c lang_ClassLoader.c lang_Compiler.c lang_Double.c \
  lang_Float.c lang_Math.c lang_Object.c lang_Runtime.c \
  lang_SecurityManager.c lang_System.c lang_Thread.c \
  lang_Throwable.c net_DatagramSocket.c net_InetAddress.c \
  net_PlainSocketImpl.c net_SocketInputStream.c \
  net_SocketOutputStream.c util_Date.c $(PROC)

# NB: JIT becomes either empty or $(JITSRC) depending on whether JIT
# support is available on this platform.
SRC = $(HELP) $(API) $(JIT)

# Definitions of the machine dependent sources for each target
COMMON_MD_OBJS = 
COMMON_MD_SRCS = 

OBJ = $(SRC:.c=.o) $(ARCH)_md.o

# The targets that can be made from this file.
default:  $(DONE)

$(DONE): $(OBJ) 
	touch $(UPDATED) $(DONE)
	sleep 1

$(OBJ): toba.h runtime.h md.h

withjit:
	$(MAKE) JIT="$(JITSRC)"

nojit: $(DONE)

alloc.o finalizer.o lang_Thread.o:		sthreads.h
monitor.o runtime.o sthreads.o: 		sthreads.h
alloc.o lang_Runtime.o runtime.o sthreads.o:	../gc/gc.h
$(ARCH)_md.o: $(ARCH)_md.c $(ARCH)_md.h
md.h: $(ARCH)_md.h

lint:
	lint -I../packages/API/include $(SRC)

sthreads.c sthreads.h : sthreads_$(THREADS).c sthreads_$(THREADS).h
	rm -f sthreads.c sthreads.h
	cp sthreads_$(THREADS).c sthreads.c
	cp sthreads_$(THREADS).h sthreads.h


clean:
	rm -f *.o sthreads.c sthreads.h $(DONE)
