ARCH           = OS
SHOBJ          = YES

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

APPNAME        = "CDEV Generic Client Engine"
TEMPLINKS      = cdevPacket.cc\
		 cdevMessageBinary.cc\
		 cdevMessage.cc\
		 cdevContextMap.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
		 
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

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           = $(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)/libcdevClient.$(SHARED_EXT) \
              $(CDEVLIB)/libcdevClient.a

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

targets : $(TARGETS)
	
$(TEMPLINKS) : 
	@cp $^ $@

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

$(CDEVLIB)/libcdevClient.$(SHARED_EXT) : $(CLIENT_OBJS) $(COMMON_OBJS) $(ACE_OBJS)
	$(LINK.so) -o $@ $^ $(NETLIBS)
	@cp $@ $(CDEVLIB)
	
cdevMessage.cc			: ../cdevPacket/cdevMessage.cc
cdevMessageBinary.cc		: ../cdevPacket/cdevMessageBinary.cc
cdevPacket.cc			: ../cdevPacket/cdevPacket.cc
cdevContextMap.cc		: ../cdevContextMap/cdevContextMap.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
