!define TKLIBPATH e:\os2toolkit\lib
!define TKINCLUDE e:\os2toolkit\h
!define RCINC -i e:\watcom\h -i e:\watcom\h\os2

# Change TKLIBPATH to point to the library directory of the OS/2 Toolkit 4.5
# Change TKINCLUDE to point to the include directory of the OS/2 Toolkit 4.5
# Change RCINC to point to the include directory of your OpenWatcom installation

# Note that the WarpIn installation area must be in your path and libpath in
# order to create the WPI package, otherwise make will fail there.

# Major targets are "distribution", "mrmessage.wpi", "lxlite", and "all"

!define CPPFLAGS_DEBUG -w4 -e25 -sg -zp1 -d3 -hd -en -bm -fp5 -fpi87 -5r&
 -bt=os2 -mf -xd -i=$TKINCLUDE
!define CPPFLAGS -w4 -e25 -sg -zp1 -os -of -ob -ol -ol+ -oc -oi -oa&
 -or -om -oh -hd -en -bm -fp5 -fpi87 -zff -zgf -5r -bt=os2 -mf -xd&
 -i=$TKINCLUDE
# -i=$TKINCLUDE
# -w4 = lots of warnings
# -e25 = max errors = 25
# -sg = automatic stack growing
# -zp1 = 1-byte structure packing
# -hd = DWARF debug info
# -bm = multithreaded libraries
# -fp5 = inline math coprocessor instructions
# -fpi87 = inline coprocessor stuff
# -zff = use FS
# -zgf = use GS
# -mf = flat memory model
# -xd = disable exceptions


!define LDDEBUG d all

!ifdef DEBUG
!define CPPFLAGSUSE $CPPFLAGS_DEBUG
!define LDFLAGS $LDDEBUG
!else
!define CPPFLAGSUSE $CPPFLAGS
!define LDFLAGS
!endif

!define OBJECTS md5.obj buddy.obj compatibility.obj errors.obj mrmessage.obj&
 oscardata.obj oscarprotocol.obj oscarrx.obj oscarsession.obj oscartx.obj&
 sessionmanager.obj unterminatedString.obj mrmsggui.dll baseexe.res
!define INCLUDES ACLCtl10.h buddy.h compatibility.h errors.h md5.h oscardata.h&
 oscarprotocol.h oscarsession.h resource.h sessionmanager.h&
 unterminatedString.h
# Definitions above are used in the build itself


!define SOUNDS boing.wav coffee.wav drwclose.wav drwropen.wav firsttime.wav&
 goodisdum.wav lookinat.wav stopped.wav twip.wav vacusuck.wav
!define REXX awayfilter.cmd forwarder.cmd imfilter.cmd infilter.cmd&
 profilefilter.cmd statschecker.cmd ReadMe.REXX
!define BINARIES mrmessage.exe mrmsggui.dll aclctl10.dll ReadMe.OS2
!define RESOURCES aimlogo_crossout.ico aimlogo_greyed_crossout.ico&
 aimlogo_greyed.ico aimlogo_hot.ico aimlogo.ico folder.ico niceaim_away.ico&
 niceaim.ico Paper.ico target.ico unplugged_crossout.ico unplugged.ico&
 writing.ico mrmessage.bmp resource.h mrmessage.rc baseexe.rc
!define SOURCE ACLCtl10.h buddy.cpp buddy.h compatibility.cpp&
 compatibility.h errors.cpp errors.h getmodule.cpp md5.c md5.h &
 MrMessage.cpp makefile oscardata.cpp oscardata.h&
 oscarprotocol.cpp oscarprotocol.h oscarRx.cpp oscarsession.cpp&
 oscarsession.h oscarTx.cpp SessionManager.cpp SessionManager.h&
 unterminatedString.cpp unterminatedString.h install.wis ReadMe.build&
 $RESOURCES updateversion.cmd renamefiles.cmd
!define WISOURCE ACLCtl10.dll
# Definitions above are used for packaging the distribution.

all : mrmessage.exe mrmsggui.dll .SYMBOLIC

clean : installer\source installer\base installer\sounds installer\rexx&
  .SYMBOLIC
 @rm -f $OBJECTS getmodule.obj mrmessage.exe *.lk1 *.map *.err *.imp *.sym&
  MrMessage.wpi MrMessage_srcbin.zip MrMessage_bin.zip
 @cd installer\source
 @rm -f $SOURCE
 @rm -f $WISOURCE
 @cd ..\base
 @rm -f $BINARIES
 @cd ..\sounds
 @rm -f $SOUNDS
 @cd ..\rexx
 @rm -f $REXX
 @echo Cleaned out all generated files.

lxlite : all .ALWAYS .SYMBOLIC
 lxlite /F+ /B- /MF3 /YUR /YDD mrmessage.exe mrmsggui.dll

installer :
 @mkdir installer

installer\source : installer
 @mkdir installer\source

installer\base : installer
 @mkdir installer\base

installer\sounds : installer
 @mkdir installer\sounds

installer\rexx : installer
 @mkdir installer\rexx

mrmessage.wpi : lxlite installer\source installer\base installer\sounds&
  installer\rexx
 for %file in ($(SOURCE)) do copy %file installer\source\.
 for %file in ($(WISOURCE)) do copy %file installer\source\.
 for %file in ($(BINARIES)) do copy %file installer\base\.
 for %file in ($(SOUNDS)) do copy %file installer\sounds\.
 for %file in ($(REXX)) do copy %file installer\REXX\.
 updateversion
 move install.wis install.wis.old
 move install.wis.new install.wis
 wic MrMessage.wpi -a 1 -cinstaller\base *.* 2 -cinstaller\sounds&
 *.* 3 -cinstaller\rexx *.* 4 -cinstaller\source *.* -s install.wis
 del install.wis.old

mrmessage_bin.zip : lxlite
 zip -9 MrMessage_bin.zip $BINARIES $SOUNDS $REXX

mrmessage_srcbin.zip : lxlite
 zip -9 MrMessage_srcbin.zip $SOURCE $BINARIES $SOUNDS $REXX

distribution : mrmessage.wpi mrmessage_bin.zip mrmessage_srcbin.zip .SYMBOLIC
  renamefiles

md5.obj : md5.c .AUTODEPEND
 *wcc386 md5.c -w4 -e25 -bm -5r -bt=os2

buddy.obj : buddy.cpp .AUTODEPEND
 *wpp386 buddy.cpp $CPPFLAGSUSE

compatibility.obj : compatibility.cpp .AUTODEPEND
 *wpp386 compatibility.cpp $CPPFLAGSUSE

errors.obj : errors.cpp .AUTODEPEND
 *wpp386 errors.cpp $CPPFLAGSUSE

mrmessage.obj : mrmessage.cpp .AUTODEPEND
 *wpp386 mrmessage.cpp $CPPFLAGSUSE

oscardata.obj : oscardata.cpp .AUTODEPEND
 *wpp386 oscardata.cpp $CPPFLAGSUSE

oscarprotocol.obj : oscarprotocol.cpp .AUTODEPEND
 *wpp386 oscarprotocol.cpp $CPPFLAGSUSE

oscarrx.obj : oscarrx.cpp .AUTODEPEND
 *wpp386 oscarrx.cpp $CPPFLAGSUSE

oscarsession.obj : oscarsession.cpp .AUTODEPEND
 *wpp386 oscarsession.cpp $CPPFLAGSUSE

oscartx.obj : oscartx.cpp .AUTODEPEND
 *wpp386 oscartx.cpp $CPPFLAGSUSE

sessionmanager.obj : sessionmanager.cpp .AUTODEPEND
 *wpp386 sessionmanager.cpp $CPPFLAGSUSE

unterminatedString.obj : unterminatedString.cpp .AUTODEPEND
 *wpp386 unterminatedString.cpp $CPPFLAGSUSE

getmodule.obj : getmodule.cpp .AUTODEPEND
 *wpp386 getmodule.cpp $CPPFLAGSUSE -bd
# -bd needed because it is in a DLL

mrmessage.res : $RESOURCES .AUTODEPEND
 *rc $RCINC -r mrmessage.rc mrmessage.res

mrmsggui.dll : getmodule.obj mrmessage.res .AUTODEPEND
 @%write mrmsggui.lk1 FIL getmodule.obj
 *wlink name mrmsggui SYS os2v2 dll initi termi op m op maxe=25&
 @mrmsggui.lk1
 rc $RCINC mrmessage.res mrmsggui.dll
 wlib -n -b mrmsggui.lib +mrmsggui.dll
 @%erase mrmsggui.lk1

baseexe.res : baseexe.rc .AUTODEPEND
 *rc $RCINC -r baseexe.rc baseexe.res

mrmessage.exe : $OBJECTS $INCLUDES ACLCtl10.DLL .AUTODEPEND
 @%write mrmessage.lk1 FIL md5.obj,buddy.obj,compatibility.obj,errors.obj,&
mrmessage.obj,oscardata.obj,oscarprotocol.obj,oscarrx.obj,oscarsession.obj,&
oscartx.obj,sessionmanager.obj,unterminatedString.obj
 *wlib -n -b mrmessage.imp ACLCtl10.DLL mrmsggui.dll
 @%append mrmessage.lk1 LIBR mrmessage.imp
 *wlink name mrmessage $LDFLAGS SYS os2v2 pm op st=256K op m libp&
 $TKLIBPATH libr TCP32DLL.LIB,SO32DLL.LIB op v op maxe=25 op symf&
 op vers=2008.1.17 op el @mrmessage.lk1
 rc $RCINC baseexe.res mrmessage.exe
 @%erase mrmessage.lk1

acltest.obj : acltest.cpp ACLCtl10.h
 *wpp386 acltest.cpp $CPPFLAGSUSE

acltest.exe : acltest.obj ACLCtl10.DLL
 *wlib -n -b acltest.imp ACLCtl10.DLL
 *wlink name acltest $LDFLAGS SYS os2v2 pm op st=256K op m FIL acltest.obj &
  LIBR acltest.imp op v op maxe=25 op symf op el
