######################################################################
#         Makefile for TChat Demo Used in Dr. Dobbs Article          #
#                             29-Feb-96                              #
#                                                                    #
#          For Use with NMAKE that Comes with VisualAge C++          #
#                                                                    #
# Personally I don't use NMAKE but prefer OpusMAKE instead, even     #
# though OpusMAKE costs, therefore this makefile is derived from my  #
# OpusMAKE environment, by expanding all macros/rules in-place.  The #
# real makefile is makefile.omk and relies upon REXX and 4OS2 some.  #
#                                                                    #
######################################################################

###################
# Places and Things
###################

TOBJS = tchat.obj m_tchat.obj bkthread.obj chatview.obj

##################
# Macros and Flags
##################
_BASE		= /Q /W2 /I$(PROJINCLUDE)
		# /Q   = Omit IBM Copyright
		# /W2  = Show Warnings/Errors Only
		# /Fi  = Create Precompiled Headers
		# /Si  = Utilize Precompiled Headers

_GEN		= /G4 /Gm /Gd /Tdp
		# /G4  = Generate Code for 486 (Use 386 for Debugger)
		# /Gm  = Use Multithread Runtime
		# /Gd  = Dynamically Load Runtime
		# /Gs  = Remove Code for Stack Probes
		# /Gx  = Remove C++ Exception-Handling Info
		# /Tdp = Generate Code for C++ Templates
		# /Rn  = Generate Code without a Runtime
		# /B"/STACK:n" = Set Stack Size

#_OPT		= /O /Ol /Gl
		# /O   = Enable Speed-Optimizations
		# /Ol  = Pass Code Thru Intermediate Linker
		# /Gu  = Advise Linker All Ext Data is ID'd
		# /Gl  = Have Linker Remove Unused Fns

_DBG		= /Tx
		# /Ti  = Embed Debugger/Analyzer Recs
		# /Tm  = Enable Debug Memory Fns
		# /Tx  = Request Full Dump Upon Exception
		# /DDEBUG = Enable App-Internal Debugging Code

_OUT		= 
		# /Fb  = Embed Browser Recs
		# /Gh  = Generate Code for Profiler Hooks
		# /Fl. = Output C/C++ Listing Files
		# /Fm. = Output Linker Map File
		# /Ft. = Output C++ Template Resolution Files

_DLL		= /Ge-
_EXE		= /Ge
		# /Ge = Create an EXE, not DLL

CPPFLAGS	= $(_BASE) $(_GEN) $(_OPT) $(_DBG) $(_OUT) $(_DLL)

###################
# Primary Target(s)
###################
All:  Chatroom.lib Chatroom.dll TChat.res TChat.dll

#######################
# Chatroom Server Class
#######################
Chatroom.lib: Chatroom.def
	implib /NOLOGO /NOIGNORE Chatroom.lib Chatroom.def
	ilib /NOLOGO /CONVFORMAT /NOEXTDICTIONARY /NOBROWSE /NOBACKUP Chatroom.lib;

Chatroom.dll: Chatroom.obj Chatroom.def
	icc $(CPPFLAGS) $(_DLL) /FeChatroom.dll Chatroom.obj Chatroom.def

Chatroom.def: Chatroom.idl
	sc -S 100000 -sdef -d. Chatroom.idl

Chatroom.idl: Chatroom.hh
	icc $(CPPFLAGS) /c /FsChatroom.idl Chatroom.hh
	sc -S 100000 -sir -u Chatroom.idl

Chatroom.obj: Chatroom.cpp chatroom.hh
	icc -c $(CPPFLAGS) -FoChatroom.obj Chatroom.cpp

######################
# TChat DSOM/WPS Class
######################
TChat.res: TChat.rc TChat.h
	rc -r TChat.rc TChat.res

TChat.dll: tchat.obj m_tchat.obj bkthread.obj chatview.obj chatroom.lib tchat.def
	icc $(CPPFLAGS) $(_DLL) /FeTChat.dll $(TOBJS) chatroom.lib tchat.def
	rc -p -x TChat.res TChat.dll

TChat.def: TChat.idl
	sc -S 100000 -sdef -d. TChat.idl

TChat.idl: TChat.hh
	icc $(CPPFLAGS) /c /FsTChat.idl TChat.hh
	sc -S 100000 -sir -u TChat.idl

TChat.obj: TChat.cpp bkthread.hpp chatroom.hh chatview.hpp tchat.h tchat.hh useful.hpp
	icc -c $(CPPFLAGS) -FoTChat.obj TChat.cpp

M_TChat.obj: M_TChat.cpp bkthread.hpp chatroom.hh tchat.h tchat.hh useful.hpp
	icc -c $(CPPFLAGS) -FoM_TChat.obj M_TChat.cpp

BkThread.obj: BkThread.cpp BkThread.hpp chatroom.hh tchat.h tchat.hh useful.hpp
	icc -c $(CPPFLAGS) -FoBkThread.obj BkThread.cpp

ChatView.obj: ChatView.cpp chatview.hpp tchat.h tchat.hh
	icc -c $(CPPFLAGS) -FoChatView.obj ChatView.cpp

TChat.hh: Chatroom.idl

######################################################################
#         Makefile for TChat Demo Used in Dr. Dobbs Article          #
######################################################################

