# This is a part of the Microsoft Foundation Classes C++ library.
# Copyright (C) 1994 WATCOM International Corporation
# All rights reserved.
#
# This source code is only intended as a supplement to the
# Microsoft Foundation Classes Reference and Microsoft
# QuickHelp and/or WinHelp documentation provided with the library.
# See these sources for detailed information regarding the
# Microsoft Foundation Classes product.

# Common include for building MFC Sample programs
#
#	exe = hello.exe
#	objs = hello.obj
#	res = hello.res
#	!include ..\master.mif
#
# Options to wmake:
#	afxdll=1  -> dll client app (default afxdll=0, static linkage to MFC)
#	debug=0	  -> retail, no debuging info. (debug=1 is default)
#	model=[l] -> only large model is supported
#	opt	  -> use to set custom compile options
#

!ifndef debug
debug=1
!endif

!ifndef model
model=l
!endif

#define flags for tools
cflags = -ox-w3-m$(model) -fhq $(opt)
rflags = -bt=windows -k
usrdllflags = -bd-zu -d_USRDLL -d_WINDLL

!ifeq debug 1
dbgflags = -d2 -d_DEBUG
lflags = debug all
dbgsuffix=d
!endif

!ifdef dos
sys=dos
cflags+= -bt=dos
!else
sys=windows
cflags+= -2-bt=windows
cbflags= -zws
!endif

!ifeq afxdll 1
cflags+= -d_AFXDLL
rflags+= -d_AFXDLL
!endif

!ifndef stacksize
stacksize=20k
!endif

.extensions:
.extensions: .exe .lib .dll .obj .res .rc .cpp

.before
    set include=$(%watcom)\h;$(%watcom)\h\win;
    
.cpp.obj:
    wpp.exe $[@ $(cflags) $(cbflags) $(dbgflags)

.rc.res:
    wrc.exe $(rflags) -r $^*.rc

master : $(exe) $(hlp) .symbolic
    @%null
    
$(exe) : $(objs) $(res) tmp.lnk
    wlink.exe $(lflags) name $^& @$]@ 
!ifdef res
    wrc.exe $(rflags) $(res) $^@
!endif

!ifdef hlp
$(hlp) : makehelp.bat resource.h
    !makehelp.bat
!endif

tmp.lnk : $(__MAKEFILES__)
    %create $^@
    @%append $^@ system $(sys) 
    @%append $^@ option map,eliminate
!ifndef dos
    @%append $^@ option heapsize=1k
!endif
    @%append $^@ option stack=$(stacksize)
    @for %i in ( $(objs) ) do @%append $^@ file %i
!ifdef extralib
    @%append $^@ library { $(extralib) }
!endif

clean global : .symbolic
    @if exist *.exe erase *.exe >nul
    @if exist *.map erase *.map >nul
    @if exist *.obj erase *.obj >nul
    @if exist *.err erase *.err >nul
    @if exist *.res erase *.res >nul
    @if exist *.lnk erase *.lnk >nul
    @if exist *.lbc erase *.lbc >nul
    @if exist *.hlp erase *.hlp >nul
    @if exist *.ph erase *.ph >nul
    @if exist *.pch erase *.pch >nul
