# TAPI.DLL thunk makefile
#
# Copyright (c) 1995, Microsoft Corporation
#
# History:
#   Created.
#


!INCLUDE $(NTMAKEENV)\makefile.plt


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

# The files currently live in mvdm\wow16\inc and need to be published
#  SDK_INC16_PATH=..\..\..\Base\mvdm\wow16\inc

INCS    = -I..\inc -I$(SDK_INC16_PATH) -I$(SDK_INC_PATH)
PATH=$(PATH_TOOLS16);$(PATH)


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

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

LINK    = /map /align:16 /batch

!if !$(FREEBUILD)
AOBJ    = $(AOBJ) -Zd
CW16    = $(CW16) /Od /Oi
LINK    = $(LINK) /LI
!endif


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

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


.c.obj:
    cl16 -c $(CW16) $*.c

.c.pp:
    cl16 -c $(CW16) -E $*.c > $@

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


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

.map.sym:
    mapsym $*

.rc.res:
    rc16 -DWINNT=1 -r $(INCS) -fo $@ $*.rc


all: tapi.dll tapi.sym
    binplace tapi.dll tapi.sym

clean: cleanup all

cleanup:
    if exist *.lrf del *.lrf
    if exist *.obj del *.obj
    if exist *.exe del *.exe
    if exist *.map del *.map
    if exist *.sym del *.sym
    if exist *.drv del *.drv
    if exist *.res del *.res


thunk.obj thunk.lst: thunk.c thunk.h

tapi.res: $*.rc

tapi.lrf: makefil0
    echo $(SDK_LIB16_PATH)\libentry.obj thunk >$@
    echo $*.dll/align:16>>$@
    echo $* $(LINK)>>$@
    echo $(SDK_LIB16_PATH)\ldllcew.lib libw.lib /map /nod>>$@
    echo $*;>>$@

tapi.dll tapi.map: thunk.obj \
      $*.def $*.res $*.lrf
    link16 @$*.lrf;
    rc16 -t $*.res $*.dll

tapi.sym: $*.map
    mapsym $*