CXX = g++
LD = g++

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

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


OBJS          = ParticleArray.o ParticleArrayDict.o
SRCS          = ParticleArray.cxx ParticleArrayDict.cxx
LIBS          = libParticleArray.so


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

.SUFFIXES: .cxx .o .so

all:            $(LIBS)

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

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

distclean:      clean


.SUFFIXES: .cxx

###

ParticleArray.o: ParticleArray.h

ParticleArrayDict.cxx: ParticleArray.h ParticleArrayLinkDef.h
	@echo "Generating dictionary $@..."
	@rootcint -f $@ -c $^


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