# wowexec 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.
#

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


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

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

# 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"
COBJ    = -AS -G2s -Os -W2 -Zp -DDEBUG $(INCS)
!IF "$(OLD_WOW_BUILD)" != ""
CW16    = -AS -G2sw -Os -W2 -Zp -DDEBUG -DOLD_WOW_BUILD $(INCS)
!ELSE
CW16    = -AS -G2sw -Os -W2 -Zp -DDEBUG $(INCS)
!ENDIF
!else
COBJ    = -AS -G2s -Os -W2 -Zp $(INCS)
!IF "$(OLD_WOW_BUILD)" != ""
CW16    = -AS -G2sw -Os -W2 -Zp -DOLD_WOW_BUILD $(INCS)
!ELSE
CW16    = -AS -G2sw -Os -W2 -Zp $(INCS)
!ENDIF
!endif

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

LINK    = /map /stack:8192 /align:16

!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 = snocrt libw
!else
W16LIBS = ..\..\lib\snocrt.lib ..\..\lib\libw.lib
!endif


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


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

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


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

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


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

.map.sym:
    mapsym $*


all: wowexec.exe wowexec.sym
    -binplace wowexec.exe
    -binplace wowexec.sym

clean:
    if exist *.lrf del *.lrf
    if exist *.def del *.def
    if exist *.res del *.res
    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

wowexec.obj: wowexec.c ..\..\..\inc\wowinfo.h
    cl16 -c -nologo $(CW16) $*.c


wowexec.lrf: makefile
    echo wowexec.obj pmdos.obj>wowexec.lrf
    echo wowexec $(LINK)>>wowexec.lrf
    echo wowexec>>wowexec.lrf
    echo $(W16LIBS) /nod>>wowexec.lrf
    echo wowexec;>>wowexec.lrf

wowexec.def: makefile
    echo name wowexec>wowexec.def
    echo exetype windows>>wowexec.def
    echo stub '..\..\bin\winstub.exe'>>wowexec.def
    echo code preload moveable discardable>>wowexec.def
    echo data preload moveable multiple>>wowexec.def
    echo heapsize 512>>wowexec.def
    echo exports WndProc>>wowexec.def
    echo imports>>wowexec.def
    echo WOWQUERYDEBUG = KERNEL.512>>wowexec.def
    echo WOWWAITFORMSGANDEVENT = KERNEL.262>>wowexec.def
    echo WOWMSGBOX             = KERNEL.263>>wowexec.def

wowexec.res: wowexec.rc wowexec.h wowexec.rcv
    rc16 -r -fo wowexec.res $(INCS) wowexec.rc

wowexec.exe: wowexec.obj wowexec.lrf wowexec.def wowexec.res pmdos.obj
    link16 @wowexec.lrf;
    rc16 -t wowexec.res wowexec.exe
