# winoldap makefile
#
# Copyright (c) 1993, Microsoft Corporation
#
# History:
#   30-Nov-1993 Dave Hart (davehart) Created from wowexec makefile
#

!INCLUDE ..\makefile.inc


AOBJ    = -W2 -DSEGNAME=COMMAND $(INCS)

!if !$(FREEBUILD)
CW16    = -AS -G2sw -Os -W2 -Zp -DDEBUG
!else
CW16    = -AS -G2sw -Os -W2 -Zp
!endif

CW16L   = $(CW16) -B1 c1l.exe -B2 c2l.exe -B3 c3l.exe

LINKOPTS = /map /stack:5120 /align:16

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

W16LIBS = ..\lib\snocrt.lib ..\lib\$(ALT_PROJECT)\libw.lib


.h.inc:
    h2inc -t $*.h -o $*.inc


.asm{$(DEST)}.obj:
    $(ASM) $(AOBJ) $*,$(*F);

.asm{$(DEST)}.lst:
    $(ASM) $(AOBJ) -l $*,nul,$*.lst;


.c{$(DEST)}.obj:
    @set include=$(ENVINCS);$(INCLUDE)
    $(CL) -c -nologo $(CW16) -Fo$* $(*F).c

.c{$(DEST)}.lst:
    $(CL) -c -nologo $(CW16) -Fonul -Fc$*.lst $(*F).c


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

{$(DEST)}.map{$(DEST)}.sym:
    mapsym -o $*.sym $*

.rc{$(DEST)}.res:
    @set include=$(ENVINCS);$(INCLUDE)
    $(RC) -r -fo $*.res $(*F).rc


all: $(DEST)\winoldap.mod $(DEST)\winoldap.sym
    binplace $(DEST)\winoldap.mod $(DEST)\winoldap.map $(DEST)\winoldap.sym

clean: cleanup all

cleanup:
    cd $(DEST)
    if exist *.lrf del *.lrf
    if exist *.def del *.def
    if exist *.obj del *.obj
    if exist *.exe del *.exe
    if exist *.map del *.map
    if exist *.sym del *.sym
    if exist *.res del *.res
    cd ..\..\..


$(DEST)\winoldap.lrf: makefile.sub
    echo $(DEST)\winoldap.obj          >$@
    echo $(DEST)\winoldap.mod $(LINKOPTS) >>$@
    echo $(DEST)\winoldap             >>$@
    echo $(W16LIBS) /nod              >>$@
    echo $(DEST)\winoldap.def;        >>$@

$(DEST)\winoldap.def: makefile.sub
    echo name winoldap                      >$@
    echo exetype windows                   >>$@
    echo stub '..\bin\winstub.exe'         >>$@
    echo code preload moveable discardable >>$@
    echo data preload moveable multiple    >>$@
    echo heapsize 512                      >>$@
    echo exports                           >>$@


$(DEST)\winoldap.mod: $(DEST)\winoldap.obj $(DEST)\winoldap.lrf $(DEST)\winoldap.def $(DEST)\winoldap.res
    $(LINK) @$(DEST)\winoldap.lrf;
    $(RC) -t $(DEST)\winoldap.res $(DEST)\winoldap.mod

$(DEST)\winoldap.res: $(*F).rc $(*F).rcv ..\inc\common.ver
