##################################################################
#
# 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.6 $
# $Author: moralejo $ 
# $Date: 2003-01-21 15:02:32 $
#
##################################################################
# @maintitle

# @code

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

# @endcode

# @code 

# common flags
INCLUDES = -I/usr/include  -I/usr/include/cxx

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

RANLIB  = -L${RANLIBDIR} -lranlib

# special flags

osf_FORLIBS = -L/usr/lib -lUfor -lFutil -lfor -lutil -lots -lm
linux_FORLIBS = -lm 
generic_FORLIBS = -lm 

FORLIBS = ${${SYSTEM}_FORLIBS}

# compilation and linking flags

#CXXFLAGS  = -D__${SYSTEM}__ ${INCLUDES} ${OPTIM} ${DEBUG}
CXXFLAGS  = -D__${SYSTEM}__ ${INCLUDES} ${OPTIM}
#CXXFLAGS  = -D__${SYSTEM}__ ${INCLUDES} ${DEBUG}

CFLAGS    = ${CXXFLAGS}
FFLAGS    = ${CXXFLAGS}
LIBS      = ${CERNLIB} ${RANLIB} ${FORLIBS} 

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

#.SILENT:

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

SRCS = \
	attenu.f \
	diag.c \
	init.c \
	parms.c \
	geometry.c \
	atm.c \
	ph2cph.c \
	header.c \
	attach.c \
	reflector.c

HEADERS = \
	atm.h \
	diag.h \
	geometry.h \
	header.h \
	init.h \
	lagrange.h \
	parms.h \
        version.h

OBJS = \
	attenu.o \
	diag.o \
	init.o \
	parms.o \
	geometry.o \
	atm.o \
	ph2cph.o \
	header.o \
	attach.o \
	reflector.o

PROGRAM=reflector

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

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 -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.

diag.o: /usr/include/stdio.h /usr/include/standards.h /usr/include/sys/seek.h
diag.o: /usr/include/va_list.h /usr/include/sys/types.h
diag.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
diag.o: /usr/include/getopt.h /usr/include/sys/limits.h
diag.o: /usr/include/sys/machine/machlimits.h /usr/include/sys/syslimits.h
diag.o: /usr/include/sys/machine/machtime.h /usr/include/sys/rt_limits.h
diag.o: /usr/include/stdlib.h /usr/include/stdarg.h version.h diag.h
init.o: /usr/include/stdio.h /usr/include/standards.h /usr/include/sys/seek.h
init.o: /usr/include/va_list.h /usr/include/sys/types.h
init.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
init.o: /usr/include/getopt.h /usr/include/sys/limits.h
init.o: /usr/include/sys/machine/machlimits.h /usr/include/sys/syslimits.h
init.o: /usr/include/sys/machine/machtime.h /usr/include/sys/rt_limits.h
init.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdlib.h
init.o: /usr/include/math.h version.h diag.h init.h
parms.o: /usr/include/stdio.h /usr/include/standards.h
parms.o: /usr/include/sys/seek.h /usr/include/va_list.h
parms.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
parms.o: /usr/include/sys/select.h /usr/include/getopt.h
parms.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
parms.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
parms.o: /usr/include/sys/rt_limits.h /usr/include/string.h
parms.o: /usr/include/strings.h /usr/include/stdlib.h /usr/include/math.h
parms.o: diag.h parms.h init.h
geometry.o: /usr/include/stdio.h /usr/include/standards.h
geometry.o: /usr/include/sys/seek.h /usr/include/va_list.h
geometry.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
geometry.o: /usr/include/sys/select.h /usr/include/getopt.h
geometry.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
geometry.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
geometry.o: /usr/include/sys/rt_limits.h /usr/include/string.h
geometry.o: /usr/include/strings.h /usr/include/stdlib.h /usr/include/math.h
geometry.o: diag.h geometry.h init.h
atm.o: /usr/include/stdio.h /usr/include/standards.h /usr/include/sys/seek.h
atm.o: /usr/include/va_list.h /usr/include/sys/types.h
atm.o: /usr/include/mach/machine/vm_types.h /usr/include/sys/select.h
atm.o: /usr/include/getopt.h /usr/include/sys/limits.h
atm.o: /usr/include/sys/machine/machlimits.h /usr/include/sys/syslimits.h
atm.o: /usr/include/sys/machine/machtime.h /usr/include/sys/rt_limits.h
atm.o: /usr/include/string.h /usr/include/strings.h /usr/include/math.h
atm.o: /usr/include/stdlib.h atm.h diag.h init.h
ph2cph.o: /usr/include/stdio.h /usr/include/standards.h
ph2cph.o: /usr/include/sys/seek.h /usr/include/va_list.h
ph2cph.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
ph2cph.o: /usr/include/sys/select.h /usr/include/getopt.h
ph2cph.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
ph2cph.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
ph2cph.o: /usr/include/sys/rt_limits.h /usr/include/math.h
ph2cph.o: /usr/include/stdlib.h diag.h init.h lagrange.h
header.o: /usr/include/string.h /usr/include/standards.h
header.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
header.o: /usr/include/sys/select.h /usr/include/strings.h header.h
attach.o: /usr/include/stdio.h /usr/include/standards.h
attach.o: /usr/include/sys/seek.h /usr/include/va_list.h
attach.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
attach.o: /usr/include/sys/select.h /usr/include/getopt.h
attach.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
attach.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
attach.o: /usr/include/sys/rt_limits.h
reflector.o: /usr/include/stdio.h /usr/include/standards.h
reflector.o: /usr/include/sys/seek.h /usr/include/va_list.h
reflector.o: /usr/include/sys/types.h /usr/include/mach/machine/vm_types.h
reflector.o: /usr/include/sys/select.h /usr/include/getopt.h
reflector.o: /usr/include/sys/limits.h /usr/include/sys/machine/machlimits.h
reflector.o: /usr/include/sys/syslimits.h /usr/include/sys/machine/machtime.h
reflector.o: /usr/include/sys/rt_limits.h /usr/include/stdlib.h
reflector.o: /usr/include/string.h /usr/include/strings.h /usr/include/math.h
reflector.o: version.h diag.h init.h header.h
