CXX = g++
LD = g++

ROOTCFLAGS   := $(shell root-config --cflags) -fPIC
ROOTLDFLAGS  := $(shell root-config --ldflags)
ROOTLIBS     := $(shell root-config --libs)

CXXFLAGS      = $(ROOTCFLAGS)
LDFLAGS       = -shared $(ROOTLDFLAGS)


OBJS          = TTest.o TTestDict.o
SRCS          = TTest.cxx TTestDict.cxx
LIBS          = libTTest.so


#------------------------------------------------------------------------------

.SUFFIXES: .cxx .o .so

all:            $(LIBS)

$(LIBS):      $(OBJS)
	$(LD) $(LDFLAGS) $^ -o $@ $(ROOTLIBS)

clean:
		@rm -f $(OBJS) $(LIBS) *Dict* core

distclean:      clean


.SUFFIXES: .cxx

###

TTest.o: TTest.h

TTestDict.cxx: TTest.h TTestLinkDef.hh
	@echo "Generating dictionary $@..."
	@rootcint -f $@ -c $^


.cxx.o:
	$(CXX)  $(CXXFLAGS) -c $<
