##################################################################
#
# makefile
#
# @file        makefile 
# @title       Simulation of the camera and trigger logic
# @author      J C Gonz\'alez
# @email       gonzalez@mppmu.mpg.de
# @date        Fri Mar 12 11:51:11 MET 1999
#
#_______________________________________________________________
#
# Created: Fri Mar 12 11:51:11 MET 1999
# Author:  Jose Carlos Gonzalez
# Purpose: Makefile for the compilation of the camera program
# Notes:   
#    
#---------------------------------------------------------------
#
# $RCSfile: Makefile,v $
# $Revision: 1.9 $
# $Author: moralejo $ 
# $Date: 2004-11-11 16:17:07 $
#
##################################################################
# @maintitle

# @code

INCLUDEMK = config.mk.${OSTYPE}
include ${INCLUDEMK}
PROGRAM = starrespo

# @endcode

# @code 

# common flags
INCLUDES = -I${INCLUDE}      \
	-I${INCLUDE_COR}  \
	-I${INCLUDE_MC}   \
	-I${INCLUDE_TRIGGER}   \
	-I${INCLUDE_FADC}   \
        -I${INCLUDE_ROOT} \
        -I${INCLUDE_CPLUS} \
        -I${INCLUDE_MARS_MBASE} \
        -I${INCLUDE_MARS_MGEOM} \
        -I${INCLUDE_MARS_MGUI} \
        -I${INCLUDE_MARS_MC} \
        -I${INCLUDE_MARS_MRAW}


RANLIB  = -L${RANLIBDIR} -lranlib

# what is needed for ROOT is inside the config.mk... file


# special flags

osf_FORLIBS = -lUfor -lfor -lutil -lots -lm 
linux_FORLIBS =  -lm -ldl 
generic_FORLIBS = -lm 

MARSLIBS = ../../../Mars/libmars.so

FORLIBS = ${${SYSTEM}_FORLIBS}

# compilation and linking flags

CXXFLAGS  = -D__${SYSTEM}__ ${INCLUDES} ${OPTIM} ${DEBUG}
CFLAGS    = ${CXXFLAGS}
FFLAGS    = ${CXXFLAGS}
LIBS      = ${RANLIB} ${ROOTLIBS} ${ROOTGLIBS} ${GLIBS} ${MARSLIBS}

#
#  ----->>>   Compile files related to MARS with Makefiles in their
#	      directories.
#

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

#.SILENT:

.SUFFIXES: .c .cc .cxx .C .c++ .h .hxx .H .h++ .o .so .f

SRCS = \
	${INCLUDE_TRIGGER}/MTrigger.cxx \
	${INCLUDE_TRIGGER}/MGTriggerSignal.cxx \
	${INCLUDE_FADC}/MFadc.cxx \
	${INCLUDE_FADC}/MGFadcSignal.cxx \
	MStarLight.cxx \
	srreadparam.cxx \
	starresponse.cxx   

HEADERS = \
	MTRigger.hxx \
	MGTRiggerSignal.hxx \
	MFadc.hxx \
	MGFadcSignal.hxx \
	MStarLight.hxx \
	srreadparam.h \
	starresponse.hxx

OBJS = \
	${INCLUDE_TRIGGER}/MTrigger.o \
	${INCLUDE_TRIGGER}/MGTriggerSignal.o \
	${INCLUDE_FADC}/MFadc.o \
	${INCLUDE_FADC}/MGFadcSignal.o \
	MStarLight.o \
	srreadparam.o \
	starresponse.o      

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

all: $(PROGRAM) 
	@echo " Done. "
	@echo " "

$(PROGRAM): $(OBJS)
	@echo " Linking $@ ..."
	$(CXX) $(CXXFLAGS) $(OBJS) $(LIBS) -o $@

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

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

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

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

lclean:
	@echo "Cleanning..."
	@rm -f *.o core 

clean:  rmcint rmobjs
	@echo "Cleanning...done"

mrproper: clean 
	@echo "Mr.Proper in action . . ."
	@rm -f $(PROGRAM)

listsrc:
	@ls -m $(SRCS) $(HEADERS) | sed 's/,//g'

redo: clean all

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

#
# The cleaning facility
#

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

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

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

rmcore:	
	@echo " Removing core files..."
	@rm -f core*

rmbin:	
	@echo " Removing binary files..."
	@rm -f $(PROGRAM) lib/$(SOLIB) so_locations

rmbak:
	@echo " Removing backup files..."
	@rm -f *~ kk.kk *.bak

# @endcode

# DO NOT DELETE THIS LINE -- make depend depends on it.
