all: bin macro

INC=-I`root-config --incdir`

lib:
	rootcint -v4 -f Dict.cxx -c -p Classes.h LinkDef.h
	gcc $(INC) -c Dict.cxx
	gcc $(INC) -shared Dict.cxx -o libLib.so 

bin:	lib
	gcc $(INC) -o bin main.cxx Dict.cxx -lstdc++ `root-config --glibs`
	@echo ; echo "Running binary..."
	./bin

macro:	lib
	@echo "{\
	gSystem->Load(\"libLib.so\"); " > macro.C
	@cat code.cxx >> macro.C
	@echo " return 0;}" >> macro.C
	@echo ; echo "Running macro..."
	root -q -l macro.C

clean:
	rm -f *Dict* *.so *.o ._* bin

