##################################################################
#
#   makefile
# 
#   for the MARS software
#
##################################################################
# @maintitle

# @code

#
#  please change all system depend values in the 
#  config.mk.${OSTYPE} file 
#
#
INCLUDEMK = ../Makefile.conf.${OSTYPE}
include ${INCLUDEMK}

# @endcode 

# @code 

LIB   = libmocttest.a

#
#  connect the include files defined in the config.mk file
#
INCLUDES = -I./ -I../ -I../mbase/ -I../mrootformat/

#
#  ----->>>   root libraries
#

ROOTLIBS   =  `root-config --libs`
ROOTGLIBS  =  `root-config --glibs`
ROOTCFLAGS =  `root-config --cflags`

#
#  compiler flags
#

CXXFLAGS  = $(ROOTCFLAGS) $(INCLUDES) $(OPTIM) $(DEBUG)
CFLAGS    = $(CXXFLAGS)
FFLAGS    = $(CXXFLAGS)

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

#.SILENT:

.SUFFIXES: .c .cc .cxx .h .hxx .o 


SRCFILES = MGOctMain.cc \
	   MOctTest.cc \
	   MHistosAdc.cc \
	   MHistosTdc.cc \
	   MAdcSpect.cc \
	   MTdcSpect.cc \
	   MShowSpect.cc \
	   MGDisplayAdc.cc \
	   MCalcPed1.cc

SRCS    = $(SRCFILES)
HEADERS = $(SRCFILES:.cc=.h)
OBJS    = $(SRCFILES:.cc=.o) 

############################################################

all: $(LIB)

depend:
	@makedepend $(SRCS) $(INCLUDES) $(ROOTCFLAGS) \
        -fMakefile.depend 2> kk.kk ; cat kk.kk

$(LIB): $(OBJS) OcttestCint.o
	@echo "Building Library $(LIB) ... "
	@ar -r $(LIB) *.o

OcttestCint.cc: $(HEADERS) 
	@echo 
	@echo "Generating dictionary OcttestCint.cc ..."

	@$(ROOTSYS)/bin/rootcint -f OcttestCint.cc \
	-c $(INCLUDES) $(HEADERS) BaseLinkDef.h

.cxx.o:	
	@echo "Compiling " $<
	$(CXX) $(CXXFLAGS) -c $< -o $@

.cc.o:	
	@echo "Compiling " $<
	$(CXX) $(CXXFLAGS) -c $< -o $@

.c.o:	
	@echo "Compiling " $<
	$(CC) $(CFLAGS) -c $< -o $@

#
# The cleaning facility
#

rmlib:	
	@echo "Removing libraries..."
	@rm -f lib*.a

rmcint:	
	@echo "Removing cint-stuff..."
	@rm -f OcttestCint.*

rmobjs:	
	@echo "Removing object files..."
	@rm -f *.o

rmbin:	
	@echo "Removing binary files..."
	@rm -f core


clean:	rmlib rmcint rmobjs rmbin

mrproper:	clean
	@echo "Removing *~ kk.kk html/..."
	@rm -f *~ kk.kk

cflags: 
	@echo $(INCLUDES) $(CXXFLAGS)

# @endcode




