all: liblib.so test

clean:
	rm -f *.o
	rm -f *Dict*
	rm -f *.so
	rm -f *~
	rm -f *.root

libDict.C: ClassA.h ClassB.h
	rootcint -f libDict.C -c $^ LinkDef.h

libDict.o: libDict.C
	g++ -I$(ROOTSYS)/include -c libDict.C

ClassB.o: ClassB.h ClassB.C
	g++ -I$(ROOTSYS)/include -c ClassB.C

ClassA.o: ClassA.h ClassA.C
	g++ -I$(ROOTSYS)/include -c ClassA.C

liblib.so: ClassA.o ClassB.o libDict.o
	g++ -shared $^ -o $@

test: liblib.so
	@echo
	@echo
	@echo
	@echo "**** Here's the problem.  I have a class 'ClassA' and"
	@echo "**** a class 'ClassB' that I want to write to disk.  ClassB"
	@echo "**** has a TRef to a ClassA.  I have two scripts.  In the first"
	@echo "**** I create ClassB and ClassA, set up the TRef in ClassB"
	@echo "**** to point to my ClassA then write both to disk"
	@echo "**** Running the make-b-then-write.C script gives: "
	@echo
	root -l scripts/make-b-then-write.C
	@echo "**** and then reading it in again with read-aandb.C"
	@echo
	root -l scripts/read-aandb.C
	@echo
	@echo "**** notice that I successfully get the 'ClassA' pointer out"
	@echo "**** of the ClassB that I read from file."
	@echo "**** but if I instead create a ClassA, write it to file, then"
	@echo "**** create my ClassB, have it point to ClassA then write"
	@echo "**** my ClassB to file, when I read them both back in, the"
	@echo "**** TRef points to 0"
	@echo "**** so 'write-a-then-make-b.C' gives:"
	@echo
	root -l scripts/write-a-then-make-b.C
	@echo
	root -l scripts/read-aandb.C
	@echo
	@echo "**** and now I can't get the 'ClassA' pointer out again"



