#Variables
include $(SCT_DAQ_ROOT)/build/Makefile.include
#Commands
include $(SCT_DAQ_ROOT)/build/Makefile.commands

#Lists of source files
# HDRS = $(wildcard *.h)
# ALLHDRS =  $(shell find -name "*.h")
SRCS = $(wildcard *.cxx)
ALLSRCS = $(shell find -name "*.cxx")
OBJS = $(SRCS:.cxx=.o)
ALLOBJS = $(ALLSRCS:.cxx=.o)

SOOBJS = SCTDCSCommand.o SCTDdcCommandSender.o SCTDdcRequest.o

CPPFLAGS += -I..

#Flags

CPPFLAGS += # $(ROOTINCLUDES)

LDLIBS += -lcmdline -lpthread
# Not necessary at the moment
# LDLIBS += -lddc

#Phony Targets
.PHONY: all c++ java install clean distclean 

all: c++

%.d: %.cxx
	$(DEPENDCMD)

c++: $(OBJS) install

#Do nothing
java:

install: $(LibDir)/libsctDDC.so $(BinDir)/ddc_sendcmd

distclean: clean
	-rm -f depend*

clean:
	-rm -f *.o libsctDDC.so

#Real targets
libsctDDC.so: $(SOOBJS)
	$(LIBCMD)

ddc_sendcmd: LDLIBS += -lsctDDC
ddc_sendcmd: ddc_sendcmd.o 
	$(BINCMD)

#Patterns
%.o: %.cxx
	$(CPPCMD)

$(BinDir)/%: %
	$(CPCMD)

$(LibDir)/lib%: lib%
	$(CPCMD)

#Pre-requisites

#Include dependancies
include $(SRCS:.cxx=.d)
