#
# makefile for the C library that provides ML-callable C functions
# win32 specific

SHELL =

INC_DIR =	..\..\include
CLIB_DIR =	..\

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

MAKEFILE = 	makefile.win32
MAKE =		nmake /F$(MAKEFILE)
AS =		ml /Cx /Zd /Zi /Fr
AR =		lib
ARFLAGS =	
RANLIB =	lib

LIBRARY =	libsmlnj-ccalls.lib

VERSION =	v-dummy



OBJS =		c-calls-lib.obj \
		c-calls.obj \
		c-calls-fns.obj \
		c-entry.obj \
		cutil.obj

C_CFUNS = cutil-cfuns.h

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

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

DEPENDENTS = $(CLIB_DIR)\ml-c.h	$(CLIB_DIR)\ml-c.h \
	     $(INC_DIR)\ml-osdep.h $(INC_DIR)\ml-base.h \
	     $(INC_DIR)\ml-values.h $(INC_DIR)\cache-flush.h \
	     c-calls.h \
  	     cfun-proto-list.h cfun-list.h

c-calls-lib.obj: $(INC_DIR)\ml-osdep.h $(DEPENDENTS) $(C_CFUNS)
	$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) $(LOCAL_INCLUDES) /c c-calls-lib.c
	
c-entry.obj: c-entry.asm c-calls.h
	$(CPP) /D_ASM_ $(DEFS) $(INCLUDES) c-entry.asm > c-entry.s
	$(AS) /c c-entry.s

c-calls.obj: $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) $(LOCAL_INCLUDES) /c c-calls.c

c-calls-fns.obj: $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) $(LOCAL_INCLUDES) /c c-calls-fns.c

cutil.obj: $(DEPENDENTS)
	$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) $(LOCAL_INCLUDES) /c cutil.c

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

