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

GSLCFLAGS   := $(shell gsl-config --cflags)
GSLLIBS     := $(shell gsl-config --libs)
GSLGLIBS    := $(shell gsl-config --glibs)


LDFLAGS       = -O
LIBS         += $(ROOTLIBS) $(GSLLIBS)
CFLAGS       += $(ROOTCFLAGS) $(GSLCFLAGS) #-std=gnu++11 

#  Not sure why Minuit isn't being included -- put in by hand
#
LIBS         += -lMinuit


all: convert 


plot:  plot.o
	g++ -o plot plot.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<

plotdata_intensity_proton:  plotdata_intensity_proton.o
	g++ -o plotdata_intensity_proton plotdata_intensity_proton.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<

plotdata_intensity_carbon:  plotdata_intensity_carbon.o
	g++ -o plotdata_intensity_carbon plotdata_intensity_carbon.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<


analyse: analyse.o
	g++ -o analyse  analyse.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<


convert: convert.o
	g++ -o convert  convert.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<


convert_batch: convert_batch.o
	g++ -o convert_batch  convert_batch.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<


analyse_batch: analyse_batch.o
	g++ -o analyse_batch analyse_batch.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<

analyse2: analyse2.o
	g++ -o analyse2 analyse2.o $(LDFLAGS) $(LIBS)

%.o: %.c
	g++ ${CFLAGS} -c  -g $<


test:
	@echo $(ROOTCFLAGS) 
	@echo $(LDFLAGS) 
	@echo $(LIBS)

clean:	
	-rm -f  *.o

