ARCH           = OS
SHOBJ          = YES

#include ../include/makeinclude/Makefile.$(ARCH)
include ../include/makeinclude/Makefile.linux

APPNAME        = "CDEV Generic Client/Server Engine"
TEMPLINKS      = ClientAcceptor.cc\
                 ClientHandler.cc\
		 cdevServer.cc\
		 cdevServerTools.cc\
		 cdevSessionManager.cc\
		 ServerInterface.cc\
		 ServerHandler.cc\
		 cdevClientRequestObject.cc\
		 cdevClientService.cc\
		 cdevMessage.cc\
		 cdevMessageBinary.cc\
		 cdevPacket.cc\
		 cdevContextMap.cc\
		 cdevMonitorTable.cc\
		 cdevTagMap.cc\
		 SignalManager.cc\
		 cdevAddr.cc\
		 cdevEventHandler.cc\
		 cdevHandleSet.cc\
		 cdevReactor.cc\
		 cdevSocket.cc\
		 cdevSocketAcceptor.cc\
		 cdevSocketConnector.cc\
		 cdevSocketDatagram.cc\
		 cdevSocketStream.cc\
		 cdevStreamNode.cc\
		 cdevStreamQueue.cc\
		 cdevTime.cc\
		 fifo.cc\
		 IntHash.cc


LIBS           = $(CDEVLIBS) $(OSLIBS) 

SERVER_OBJS    = $(OBJDIR)/cdevServer.o\
                 $(OBJDIR)/cdevServerTools.o\
		 $(OBJDIR)/cdevSessionManager.o\
		 $(OBJDIR)/ClientHandler.o\
		 $(OBJDIR)/ClientAcceptor.o\
		 $(OBJDIR)/cdevTagMap.o\
		 $(OBJDIR)/cdevMonitorTable.o

CLIENT_OBJS    = $(OBJDIR)/cdevClientService.o\
                 $(OBJDIR)/cdevClientRequestObject.o\
		 $(OBJDIR)/ServerInterface.o\
                 $(OBJDIR)/ServerHandler.o

COMMON_OBJS    = $(OBJDIR)/cdevPacket.o\
                 $(OBJDIR)/cdevMessageBinary.o\
		 $(OBJDIR)/cdevMessage.o\
		 $(OBJDIR)/cdevContextMap.o\
		 $(OBJDIR)/SignalManager.o\
		 $(OBJDIR)/fifo.o\
		 $(OBJDIR)/IntHash.o

ACE_OBJS       = $(OBJDIR)/cdevAddr.o\
                 $(OBJDIR)/cdevEventHandler.o\
		 $(OBJDIR)/cdevHandleSet.o\
		 $(OBJDIR)/cdevReactor.o\
		 $(OBJDIR)/cdevSocket.o\
		 $(OBJDIR)/cdevSocketAcceptor.o\
		 $(OBJDIR)/cdevSocketConnector.o\
		 $(OBJDIR)/cdevSocketDatagram.o\
		 $(OBJDIR)/cdevSocketStream.o\
		 $(OBJDIR)/cdevStreamNode.o\
		 $(OBJDIR)/cdevStreamQueue.o\
		 $(OBJDIR)/cdevTime.o
		 
OBJS           = $(SERVER_OBJS) $(CLIENT_OBJS) $(COMMON_OBJS) $(ACE_OBJS)
		 		 
# ******************************************************************************
# * The BINARIES definition names all of the binary files that should be deleted
# * whenever "make clean" is executed.
# ******************************************************************************
BINARIES    = $(CDEVLIB)/libcdevGenericServer.$(SHARED_EXT) \
              $(CDEVLIB)/libcdevGenericServer.a

ifeq ($(SHOBJ),YES)
       TARGETS = $(TEMPLINKS) \
       		 $(CDEVLIB)/libcdevGenericServer.$(SHARED_EXT) 
else
       TARGETS = $(TEMPLINKS) \
       		 $(CDEVLIB)/libcdevGenericServer.a
endif

targets : $(TARGETS)
	
$(TEMPLINKS) : 
	@cp $^ $@
		
$(CDEVLIB)/libcdevGenericServer.a : $(OBJS)
	$(LINK.a) $@ $^
	@$(RANLIB) $@ > /dev/null

$(CDEVLIB)/libcdevGenericServer.$(SHARED_EXT) : $(OBJS)
	$(LINK.so) -o $@ $^ -L$(CDEVLIB) -lrsvc $(NETLIBS)
	
$(CDEVLIB)/libcdevServer.a : $(SERVER_OBJS) $(COMMON_OBJS) $(ACE_OBJS)
	$(LINK.a) $@ $^
	@$(RANLIB) $@ > /dev/null

$(CDEVLIB)/libcdevServer.$(SHARED_EXT) : $(SERVER_OBJS) $(COMMON_OBJS) $(ACE_OBJS)
	$(LINK.so) -o $@ $^ -L$(CDEVLIB) -lrsvc $(NETLIBS)

$(CDEVLIB)/libcdevClient.a : $(CLIENT_OBJS) $(COMMON_OBJS) $(ACE_OBJS)
	$(LINK.a) $@ $^ 
	@$(RANLIB) $@ > /dev/null

$(CDEVLIB)/libcdevClient.$(SHARED_EXT) : $(CLIENT_OBJS) $(COMMON_OBJS) $(ACE_OBJS)
	$(LINK.so) -o $@ $^ -L$(CDEVLIB) -lrsvc $(NETLIBS)

ClientAcceptor.cc		: ../cdevServer/ClientAcceptor.cc
ClientHandler.cc		: ../cdevServer/ClientHandler.cc
cdevServer.cc			: ../cdevServer/cdevServer.cc
cdevServerTools.cc		: ../cdevServer/cdevServerTools.cc
cdevSessionManager.cc		: ../cdevServer/cdevSessionManager.cc
ServerHandler.cc		: ../cdevClient/ServerHandler.cc
ServerInterface.cc		: ../cdevClient/ServerInterface.cc
cdevClientRequestObject.cc	: ../cdevClient/cdevClientRequestObject.cc
cdevClientService.cc		: ../cdevClient/cdevClientService.cc
cdevMessage.cc			: ../cdevPacket/cdevMessage.cc
cdevMessageBinary.cc		: ../cdevPacket/cdevMessageBinary.cc
cdevPacket.cc			: ../cdevPacket/cdevPacket.cc
cdevContextMap.cc		: ../cdevContextMap/cdevContextMap.cc
cdevMonitorTable.cc		: ../cdevMonitorTable/cdevMonitorTable.cc
cdevTagMap.cc			: ../cdevTagMap/cdevTagMap.cc
SignalManager.cc		: ../common/SignalManager.cc
cdevAddr.cc			: ../cdevReactor/cdevAddr.cc
cdevEventHandler.cc		: ../cdevReactor/cdevEventHandler.cc
cdevHandleSet.cc		: ../cdevReactor/cdevHandleSet.cc
cdevReactor.cc			: ../cdevReactor/cdevReactor.cc
cdevSocket.cc			: ../cdevReactor/cdevSocket.cc
cdevSocketAcceptor.cc		: ../cdevReactor/cdevSocketAcceptor.cc
cdevSocketConnector.cc		: ../cdevReactor/cdevSocketConnector.cc
cdevSocketDatagram.cc		: ../cdevReactor/cdevSocketDatagram.cc
cdevSocketStream.cc		: ../cdevReactor/cdevSocketStream.cc
cdevStreamNode.cc		: ../cdevReactor/cdevStreamNode.cc
cdevStreamQueue.cc		: ../cdevReactor/cdevStreamQueue.cc
cdevTime.cc			: ../cdevReactor/cdevTime.cc
fifo.cc				: ../common/fifo.cc
IntHash.cc			: ../common/IntHash.cc
