# mmsystem16 makefile
#
# Copyright (c) 1991, Microsoft Corporation
#
# History:
#   Created  02-Oct-1992 David Treadwell (davidtr)
#

!IFDEF USEBUILD

# If using BUILD.EXE, edit .\sources. if you want to add a new source
# file to this component.  This file merely indirects to the real make file
# that is shared by all the components of NT OS/2.

!INCLUDE $(NTMAKEENV)\makefile.def

!ELSE

.SUFFIXES:
.SUFFIXES: .c   .asm .h   .inc .obj .lst .sys .exe .com .map .sym .def .lib .dll .rc .res


!ifdef INCLUDE
INCS    =
!else
INCS    = -I..\inc -I..\..\inc
!endif

# DEFINES = -DWOW -DDEBUG $(MVDMFLAGS)
DEFINES = -DWOW $(MVDMFLAGS)

AOBJ    = -Ml -t $(DEFINES) $(INCS)

CW16    = -AS -G2sw -Os -W3 -Zp $(DEFINES) $(INCS)
CW16B   = $(CW16) -B1 c1l.exe -B2 c2l.exe -B3 c3l.exe

LPATH   = ..\..\tools.os2
LINK    = /map /align:16

# work around stupid bug in RC 3.1 that doesn't allow rcpp.err to be
# in a directory that is greater than 128 chars down the path, even if
# rc 3.1 is running as an OS/2 app.

PATH    = ..\..\tools16;$(PATH)

!if "$(NTDEBUG)"!="" && "$(NTDEBUG)"!="retail"
!if "$(NTDEBUGTYPE)"=="windbg"
AOBJ    = $(AOBJ) -Zi
CW16    = $(CW16) /Od /Oi /Zi
LINK    = $(LINK) /CO
!else
AOBJ    = $(AOBJ) -Zd
CW16    = $(CW16) /Od /Oi /Zd
LINK    = $(LINK) /LI
!endif
!endif

!ifdef LIB
W16LIBS = sdllcew
!else
W16LIBS = ..\lib\sdllcew.lib
!endif


.asm.obj:
    masm $(AOBJ) $*;

.asm.lst:
    masm $(AOBJ) -l $*,nul,$*.lst;


.c.obj:
    cl -c -nologo $(CW16) $*.c

.c.lst:
    cl -c -nologo $(CW16) -Fonul -Fc$*.lst $*.c


.def.lib:
    implib $*.lib $*.def

.map.sym:
    mapsym $*

.rc.res:
!IFDEF NTVDM_BASED_BUILD
    rc16 $(INCS) -r $*.rc
!ELSE
    $(LPATH)\rc $(INCS) -r $*.rc
!ENDIF

all: winsock.dll winsock.sym
####	copy winsock.exe winsock.dll
     -binplace winsock.dll
     -binplace winsock.sym

clean:
    if exist *.lrf del *.lrf
    if exist *.obj del *.obj
    if exist *.dll del *.dll
    if exist *.map del *.map
    if exist *.sym del *.sym
    if exist *.res del *.res

winsock.obj: $*.asm ..\..\inc\wow.inc ..\..\inc\wowwsock.inc
    masm $(AOBJ) $*;

winsock.lrf: makefile
    echo $*.obj >$@
    echo $*.dll>>$@
    echo $* $(LINK)>>$@
    echo ..\lib\libw.lib /nod>>$@
    echo $*;>>$@

# winsock.exe: winsock.obj winsock.lrf winsock.def

winsock.dll: $*.obj $*.lrf $*.def $*.res
!IFDEF NTVDM_BASED_BUILD
    link16 @$*.lrf;
    rc16 -t $*.res $@
!ELSE
    $(LPATH)\link @$*.lrf;
    $(LPATH)\rc -t $*.res $@
!ENDIF

winsock.res: $*.rc $*.rcv ..\inc\common.ver

!ENDIF
