##################################################################
#
# 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.1.1.1 $
# $Author: magiccvs $ 
# $Date: 1999-11-25 20:34:58 $
#
##################################################################
# @maintitle

# @code

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

# @endcode

# @code 

# includes		

INCLUDE       = ../../Detector/include-GENERAL
INCLUDE_COR   = ../../Detector/include-CORSIKA
INCLUDE_CHECK = .


# common flags

INCLUDES = -I${INCLUDE}      \
	   -I${INCLUDE_COR}  \
	   -I${INCLUDE_CHECK} \
           -I${INCLUDE_CERN} \
           -I/usr/include 

CERNLIBDIR = ${CERNDIR}/pro/lib/
CERNLIB    = -L${CERNLIBDIR} -lgraflib -lgrafX11 -lpacklib \
             -lkernlib -lpawlib -lmathlib

RANLIBDIR = ../../Detector/lib
RANLIB  = -L${RANLIBDIR} -lranlib

# special flags

osf_FORLIBS = -lUfor -lfor -lutil -lots -lm 
linux_FORLIBS = -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57 \
-L/usr/local/i686-pc-linux-gnu/lib \
-L/usr/local/lib \
/usr/X11R6/lib/libXt.a \
/usr/X11R6/lib/libXext.a \
/usr/X11R6/lib/libXp.a \
/usr/X11R6/lib/libX11.a \
-lcrypt -ldl -lg2c -lm -lgcc -lc -lgcc /usr/lib/crtn.o
generic_FORLIBS = -lm 

FORLIBS = ${${SYSTEM}_FORLIBS}

# compilation and linking flags

CXXFLAGS  = -D__${SYSTEM}__ ${INCLUDES} ${OPTIM} ${DEBUG}
CFLAGS    = ${CXXFLAGS}
FFLAGS    = ${CXXFLAGS}
LIBS      = ${RANLIB} ${CERNLIB}  ${FORLIBS} ${LIBS_linux}
#LIBS      = ${CERNLIB} ${RANLIB} ${FORLIBS}

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

#.SILENT:

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

SRCS = \
	${INCLUDE_COR}/COREventHeader.cxx \
	${INCLUDE_COR}/CORParticle.cxx \
	${INCLUDE_COR}/CORStatfile.cxx \
        checkmc.cxx

HEADERS = \
	COREventHeader.hxx \
	CORParticle.hxx \
	CORStatfile.hxx \
        checkmc.h

OBJS = \
	${INCLUDE_COR}/COREventHeader.o \
	${INCLUDE_COR}/CORParticle.o \
	${INCLUDE_COR}/CORStatfile.o \
	checkmc.o


PROGRAM=checkmc_${OSTYPE} 

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

all: ${PROGRAM}

depend:
	@makedepend $(SRCS) -fMakefile 2> /dev/null

doc: reflector-doc

reflector-doc: 
	@echo "Generating documentation for camera . . . "
	$(DOCUM) -latex -o reflector.tex \
	reflector.cxx reflector.h \
	readparam.cxx readparam.h \
	atm.cxx atm.h
	latex "\nonstopmode\input{reflector.tex}" && \
	makeindex reflector && \
	latex "\nonstopmode\input{reflector.tex}" && \
	latex "\nonstopmode\input{reflector.tex}"
	@echo "Files reflector.tex and reflector.dvi generated."

rate: 
	@echo "Rating documentation inside code . . . "
	$(RATE) \
	reflector.cxx reflector.h \
	readparam.cxx readparam.h \
	atm.cxx atm.h

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

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

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

.f.o:	
	@echo "Compiling " $<
	$(F77) $(FFLAGS) -c $< -o $@

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

clean:
	@echo "Cleanning..."
	@rm -f $(OBJS) core 

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

ctags:
	@echo "Creating CTAGS file . . ."
	@ctags -txw $(SRCS) $(HEADERS) > CTAGS

etags:
	@echo "Creating TAGS file . . ."
	@etags -C $(SRCS) $(HEADERS)

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

redo: clean all

# @endcode

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

../../Detector/include-CORSIKA/COREventHeader.o: ../../Detector/include-CORSIKA/COREventHeader.hxx
../../Detector/include-CORSIKA/COREventHeader.o: /usr/include/stdlib.h
../../Detector/include-CORSIKA/COREventHeader.o: /usr/include/standards.h
../../Detector/include-CORSIKA/COREventHeader.o: /usr/include/getopt.h
../../Detector/include-CORSIKA/COREventHeader.o: /usr/include/sys/types.h
../../Detector/include-CORSIKA/COREventHeader.o: /usr/include/mach/machine/vm_types.h
../../Detector/include-CORSIKA/COREventHeader.o: /usr/include/sys/select.h
../../Detector/include-CORSIKA/COREventHeader.o: /usr/include/math.h
../../Detector/include-CORSIKA/CORParticle.o: ../../Detector/include-CORSIKA/CORParticle.hxx
../../Detector/include-CORSIKA/CORParticle.o: /usr/include/stdlib.h
../../Detector/include-CORSIKA/CORParticle.o: /usr/include/standards.h
../../Detector/include-CORSIKA/CORParticle.o: /usr/include/getopt.h
../../Detector/include-CORSIKA/CORParticle.o: /usr/include/sys/types.h
../../Detector/include-CORSIKA/CORParticle.o: /usr/include/mach/machine/vm_types.h
../../Detector/include-CORSIKA/CORParticle.o: /usr/include/sys/select.h
../../Detector/include-CORSIKA/CORParticle.o: /usr/include/math.h
../../Detector/include-CORSIKA/CORStatfile.o: ../../Detector/include-CORSIKA/CORStatfile.hxx
../../Detector/include-CORSIKA/CORStatfile.o: /usr/include/stdlib.h
../../Detector/include-CORSIKA/CORStatfile.o: /usr/include/standards.h
../../Detector/include-CORSIKA/CORStatfile.o: /usr/include/getopt.h
../../Detector/include-CORSIKA/CORStatfile.o: /usr/include/sys/types.h
../../Detector/include-CORSIKA/CORStatfile.o: /usr/include/mach/machine/vm_types.h
../../Detector/include-CORSIKA/CORStatfile.o: /usr/include/sys/select.h
../../Detector/include-CORSIKA/CORStatfile.o: /usr/include/math.h
checkmc.o: checkmc.h /usr/include/stdlib.h /usr/include/standards.h
checkmc.o: /usr/include/getopt.h /usr/include/sys/types.h
checkmc.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
checkmc.o: /usr/include/stdio.h /usr/include/sys/seek.h
checkmc.o: /usr/include/va_list.h /usr/include/sys/limits.h
checkmc.o: /usr/include/sys/machine/machlimits.h /usr/include/sys/syslimits.h
checkmc.o: /usr/include/sys/machine/machtime.h /usr/include/sys/rt_limits.h
checkmc.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdarg.h
checkmc.o: /usr/include/math.h /usr/include/float.h /usr/include/fp_class.h
checkmc.o: /usr/include/dirent.h
checkmc.o: ../../Detector/include-CORSIKA/COREventHeader.hxx
checkmc.o: ../../Detector/include-CORSIKA/CORParticle.hxx
checkmc.o: ../../Detector/include-CORSIKA/CORStatfile.hxx
