############################################################################
#
#   Common settings
#
ROOTCFLAGS  := $(shell root-config --cflags)
ROOTLIBS    := $(shell root-config --libs)
ROOTGLIBS   := $(shell root-config --glibs)

CPPFLAGS    :=   $(ROOTCFLAGS)

CXXFLAGS    := -g -fPIC -Wall -O0 -L/usr/X11R6/lib
LDFLAGS     := -z 
LIBS        :=  -lXpm -lX11 -lm $(ROOTGLIBS)

LD          := g++
AR          := ar

all:  libfoo test

%.o:	%.cc
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $<

test:	test.o
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LIBS) -L./ -lfoo   $<  -o  test   $(LDFLAGS)

libfoo:	foo.o foo_Cint.o
	$(CXX) -g -shared -Wl,-soname,libfoo.so -o libfoo.so  $?   -lc

foo_Cint.C:	foo.h
	rootcint -v4 -f foo_Cint.C -c -p foo.h  fooLinkDef.h


clean:
	rm -rf *.o lib*.so test *.root

distclean:
	rm -rf *.o lib*.so *_Cint.C *_Cint.h test *.root
