

INCS=ctbMain.h ctbDacs.h   ctbPattern.h  ctbSignals.h  ctbAdcs.h ctbAcquisition.h ctbPowers.h   ctbSlowAdcs.h 
SRC= $(INCS:.h=.cpp) ctbDict.cpp 
LINKDEF=ctbLinkDef.h 
ZMQLIB=../slsReceiverSoftware/include
LIBRARYCBF=$(CBFLIBDIR)/lib/*.o

INCDIR=-I../slsReceiverSoftware/include/ -I../slsDetectorSoftware/include/ -I../slsSupportLib/include/  -I../slsDetectorCalibration -I../slsDetectorCalibration/dataStructures  -I$(CBFLIBDIR)/include  -I../slsDetectorCalibration/interpolations
LDFLAG=-L../build/bin -lSlsDetector -lSlsSupport  -L/usr/lib64/ -lpthread -lm  -lstdc++  -lzmq -pthread -lrt  -ltiff -L$(ZMQLIB) -L$(CBFLIBDIR)/lib/ -std=c++11
#
MAIN=ctbGui.cpp

DESTDIR?=../build/bin


OBJS = $(SRC:.cpp=.o) $(MAIN:.cpp=.o)

all: $(DESTDIR)/ctbGui


doc:
	cd manual && make DESTDIR=$(DESTDIR)

htmldoc:
	cd manual && make html DESTDIR=$(DESTDIR)

ctbDict.cpp: $(INCS)  $(LINKDEF)
	rootcint -f ctbDict.cpp -c $(INCS) $(LINKDEF)	

%.o : %.cpp 
	echo $@
	g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG)  -o $@ -c $< $(INCDIR)
#$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC  $(EPICSFLAGS) -lpthread #$(FLAGS)



$(DESTDIR)/ctbGui: $(OBJS) $(LINKDEF) 
	g++ -DMYROOT `root-config --cflags --glibs` -lMinuit -DCTB $(LDFLAG) -o ctbGui $(INCDIR) $(OBJS)  ../slsDetectorCalibration/tiffIO.cpp
	mv ctbGui $(DESTDIR)	

clean:
	rm -f $(DESTDIR)/ctbGui *.o ctbDict.* $(OBJS)

