ARCH          = OS
SHOBJ         = YES
APPNAME       = "Name Server Interface for CDEV"

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

TEMPLINKS = rsvcSlist.cc \
	    rsvcHSlist.cc \
	    rsvcHash.cc \
	    rsvcDataStreamer.cc \
	    rsvcDataEntry.cc \
	    rsvcData.cc \
	    rsvcNetData.cc \
	    rsvcCbk.cc \
	    rsvcHashable.cc \
	    rsvcStreamable.cc \
	    rsvcCallback.cc \
	    rsvcClient.cc \
	    rsvcUdpClient.cc 
OBJS      = $(OBJDIR)/rsvcSlist.o \
	    $(OBJDIR)/rsvcHSlist.o \
	    $(OBJDIR)/rsvcHash.o \
	    $(OBJDIR)/rsvcDataStreamer.o \
	    $(OBJDIR)/rsvcDataEntry.o \
	    $(OBJDIR)/rsvcData.o \
	    $(OBJDIR)/rsvcNetData.o \
	    $(OBJDIR)/rsvcCbk.o \
	    $(OBJDIR)/rsvcHashable.o \
	    $(OBJDIR)/rsvcStreamable.o \
	    $(OBJDIR)/rsvcCallback.o \
	    $(OBJDIR)/rsvcClient.o \
	    $(OBJDIR)/rsvcUdpClient.o \
	    $(OBJDIR)/rnsService.o \
	    $(OBJDIR)/rnsRequestObject.o

ifeq ($(SHOBJ),YES)
       TARGETS = $(CDEVSHOBJ)/$(CDEVVERSION)/rnsService.so $(BASEBIN)/cdev_test 
else
       TARGETS = $(BASELIB)/librnsService.a
endif

CXXINCLUDES = -I./
LIBS        = -L$(CDEVLIB) -lcdevReactor $(CDEVLIBS) $(OSLIBS)
BINARIES    = $(BASEBIN)/cdev_test $(BASELIB)/rnsService.so $(BASELIB)/librnsService.a $(TEMPLINKS)

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

$(BASEBIN)/cdev_test: $(OBJDIR)/cdev_test.o 
	$(LINK.cc) $^ $(LIBS) -o $@
	
$(BASELIB)/librnsService.a: $(OBJS)
	$(LINK.a) $@ $^
	@$(RANLIB) $@ > /dev/null
	@cp $@ $(CDEVLIB)	

$(BASELIB)/rnsService.so: $(OBJS)
	@mkdir -p $(CDEVSHOBJ)/$(CDEVVERSION)
	$(LINK.so) -o $@ $^ $(NETLIBS)
	@cp $@ $(CDEVSHOBJ)/$(CDEVVERSION)
	

$(CDEVSHOBJ)/$(CDEVVERSION)/rnsService.so : $(BASELIB)/rnsService.so
	@mkdir -p $(@D)
	@echo "      => Copying $(@^) to $@"
	@rm -f $@
	@cp $^ $@

rsvcSlist.cc		: ../src/rsvcSlist.cc 
rsvcHSlist.cc		: ../src/rsvcHSlist.cc 
rsvcHash.cc		: ../src/rsvcHash.cc 
rsvcDataStreamer.cc	: ../src/rsvcDataStreamer.cc 
rsvcDataEntry.cc	: ../src/rsvcDataEntry.cc 
rsvcData.cc		: ../src/rsvcData.cc 
rsvcNetData.cc		: ../src/rsvcNetData.cc 
rsvcCbk.cc		: ../src/rsvcCbk.cc 
rsvcHashable.cc		: ../src/rsvcHashable.cc 
rsvcStreamable.cc	: ../src/rsvcStreamable.cc 
rsvcCallback.cc		: ../src/rsvcCallback.cc 
rsvcClient.cc		: ../src/rsvcClient.cc 
rsvcUdpClient.cc	: ../src/rsvcUdpClient.cc
