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

SRCS := $(wildcard *.cpp)
OBJS := $(SRCS:.cpp=.o)
BOOSTTESTLIBDIR := $(BOOSTDIR)/libs/test/build/bin/libboost_unit_test_framework.so/gcc/debug/runtime-link-dynamic/shared-linkable-true/threading-multi/
LDLIBS += -L$(BOOSTTESTLIBDIR) -lboost_unit_test_framework
LDLIBS += -lSct -lSctData -lSctApiIPC -lsctConfIPC -lrcl -lrccomms -lchsm -lconfdb -loks -ldal

LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(BOOSTTESTLIBDIR)

CPPFLAGS += $(ROOTINCLUDES)
LDLIBS += $(ROOTLIBS)

.PHONY: all c++ test java install clean distclean

all: c++ execute

c++: TestSuite

java:
install:
clean:
	-rm -f *.o TestSuite

distclean: clean
	-rm -f *.d execute

execute: TestSuite $(LibDir)/libSctData.so
	env SCT_PERSISTENT_DIR=/tmp ./TestSuite && touch $@

TestSuite: $(OBJS)
	$(BINCMD)

gdb	: TestSuite
	gdb ./TestSuite

valgrind : TestSuite
	valgrind ./TestSuite

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


#dependencies
%.d: %.cpp
	$(DEPENDCMD)

ifeq ($(INCLUDEDEPENDANCIES),)
include $(SRCS:.cpp=.d)
endif
