#
# the makefile for the runtime library
# win32 specific
#

SHELL =

INC_DIR =	..\..\include
MACH_DIR =      ..\..\mach-dep
CLIB_DIR =	..\

INCLUDES =	/I$(INC_DIR) /I$(CLIB_DIR) /I..\..\objs /I$(MACH_DIR)
GC_INCLUDES =	$(INCLUDES) /I..\..\gc

MAKEFILE = 	makefile.win32
MAKE =		nmake /F$(MAKEFILE)
AR =		lib
ARFLAGS =
RANLIB =	lib

LIBRARY =	libsmlnj-runt.lib

VERSION =	v-dummy

OBJS =		smlnj-runt-lib.obj \
		argv.obj \
		raw-argv.obj \
		cmd-name.obj \
		blast-in.obj \
		blast-out.obj \
		debug.obj \
		dummy.obj \
		export-heap.obj \
		export-fun.obj \
		gc-ctl.obj \
		mkcode.obj \
		sysinfo.obj \
		itick.obj \
		setitimer.obj

$(LIBRARY)	: $(VERSION) $(OBJS)
	del /Q /F $(LIBRARY)
	$(AR) $(ARFLAGS) /out:$(LIBRARY) $(OBJS)
	$(RANLIB) $(LIBRARY)

$(VERSION) :
	$(MAKE) MAKE="$(MAKE)" clean
	echo "$(VERSION)" > $(VERSION)

DEPENDENTS=$(INC_DIR)\ml-unixdep.h $(INC_DIR)\ml-base.h \
	   $(INC_DIR)\ml-values.h \
	   $(INC_DIR)\ml-objects.h \
	   $(CLIB_DIR)\ml-c.h cfun-proto-list.h cfun-list.h

smlnj-runt-lib.obj: smlnj-runt-lib.c $(DEPNEDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c smlnj-runt-lib.c

argv.obj: argv.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c argv.c

raw-argv.obj: raw-argv.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c raw-argv.c

cmd-name.obj: cmd-name.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c cmd-name.c

blast-in.obj: blast-in.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c blast-in.c

blast-out.obj: blast-out.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c blast-out.c

debug.obj: debug.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c debug.c

dummy.obj: dummy.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c dummy.c

export-heap.obj: export-heap.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c export-heap.c

export-fun.obj: export-fun.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c export-fun.c

gc-ctl.obj: gc-ctl.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c gc-ctl.c

mkcode.obj: mkcode.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c mkcode.c

sysinfo.obj: sysinfo.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c sysinfo.c

itick.obj: itick.c $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c itick.c

setitimer.obj: setitimer.c $(MACH_DIR)\win32-timers.h $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(GC_INCLUDES) /c setitimer.c

clean :
	del /Q /F v-* *.obj *.pdb $(LIBRARY)

