# KillWOW makefile
#
# Copyright (c) 1991, Microsoft Corporation
#
# History:
#   26-Jan-1991 Matt Felton (mattfe)
#   21-Mar-1992 Matt Felton Code from win 3.1 progman
#   Created.
#

!INCLUDE ..\makefile.inc

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

!if !$(FREEBUILD)
COBJ    = -AS -G2s -Os -W2 -Zp -DDEBUG
!IF "$(OLD_WOW_BUILD)" != ""
CW16    = -AS -G2sw -Os -W2 -Zp -DDEBUG -DOLD_WOW_BUILD
!ELSE
CW16    = -AS -G2sw -Os -W2 -Zp -DDEBUG
!ENDIF
!else
COBJ    = -AS -G2s -Os -W2 -Zp
!IF "$(OLD_WOW_BUILD)" != ""
CW16    = -AS -G2sw -Os -W2 -Zp -DOLD_WOW_BUILD
!ELSE
CW16    = -AS -G2sw -Os -W2 -Zp
!ENDIF
!endif

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

LINKOPTS    = /map /stack:8192 /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) $*;

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


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

.c{$(DEST)}.lst:
    @set include=$(ENVINCS);$(INCLUDES)
    $(CL) -c -nologo $(CW16) -Fonul -Fc$*.lst $(*F).c


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


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

all: $(DEST)\KillWOW.exe $(DEST)\KillWOW.sym
    -binplace -o $(ALT_PROJECT_TARGET) $(DEST)\killwow.exe $(DEST)\killwow.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)\KillWOW.lrf: makefile.sub
    echo $(DEST)\killwow.obj >$@
    echo $(DEST)\KillWOW $(LINKOPTS)>>$@
    echo $(DEST)\KillWOW>>$@
    echo $(W16LIBS) /nod>>$@
    echo $(DEST)\KillWOW;>>$@

$(DEST)\KillWOW.def: makefile.sub
    echo name KillWOW>$@
    echo exetype windows>>$@
    echo stub '..\bin\winstub.exe'>>$@
    echo code preload moveable discardable>>$@
    echo data preload moveable multiple>>$@
    echo heapsize 4096>>$@
    echo imports>>$@
    echo WOWQUERYDEBUG = KERNEL.512>>$@

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

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