# Win32 Makefile for dynamic library interface to sockets

# The runtime system must be compiled with support for dynamic libraries.
# The operating system must support Windows sockets 2.

!include ..\..\Makedefs.w32

CC=cl
OPTS= /nologo /LD /MT /W1 /GB /O2 /Oy- /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS"
#OPTS= /nologo /LD /MTd /W1 /GB /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS"

CFLAGS= -Dunix $(OPTS) /I ..\..\runtime
LIBS= ws2_32.lib ..\..\runtime\camlrt.lib

MOSMLHOME=$(HOME)\mosml
MOSMLTOOLS=camlrunm $(MOSMLHOME)\tools
MOSMLC=mosmlc -c
MOSMLL=mosmlc
MOSMLLEX=mosmllex
MOSMLYACC=mosmlyac

all: libmsocket.so
	@echo "Now execute 'nmake install'"

libmsocket.so: msocket.obj
    $(CC) $(CFLAGS) /Felibmsocket.so msocket.obj $(LIBS) /link /subsystem:console

install:
    copy /b libmsocket.so $(BINDIR)\libmsocket.so
    @echo
    @echo "Then execute  mosml testserver.sml"

test:
    mosml testsocket.sml

clean:
    -del *.so
    -del *.exp
    -del *.lib
    -del *.obj
    -del *.ui
    -del *.uo

.sig.ui:
    $(MOSMLC) $<

.sml.uo:
    $(MOSMLC) $<

depend: 
    del Makefile.bak
    mv Makefile Makefile.bak
    $(MOSMLTOOLS)\cutdeps < Makefile.bak > Makefile
    $(MOSMLTOOLS)\mosmldep >> Makefile

msocket.obj: msocket.c

### EVERYTHING THAT GOES BEYOND THIS COMMENT WILL BE ERASED WITHOUT WARNING
### DO NOT DELETE THIS LINE
testsocket.uo: Socket.ui 
Socket.uo: Socket.ui 
