##################################################################
#
# 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.2 $
# $Author: blanch $ 
# $Date: 2001-04-26 07:57:41 $
#
##################################################################
# @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}
CFLAGS    = ${CXXFLAGS}
#CFLAGS    = -std1 -warnprotos -msg_enable level6 -msg_disable returnchecks
FFLAGS    = ${CXXFLAGS}
LIBS      = ${RANLIB} ${FORLIBS} 
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 \
	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 \
	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/features.h /usr/include/sys/cdefs.h
diag.o: /usr/include/gnu/stubs.h
diag.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
diag.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h
diag.o: /usr/include/bits/types.h /usr/include/libio.h
diag.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h
diag.o: /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h
diag.o: /usr/include/endian.h /usr/include/bits/endian.h
diag.o: /usr/include/sys/select.h /usr/include/bits/select.h
diag.o: /usr/include/bits/sigset.h /usr/include/sys/sysmacros.h
diag.o: /usr/include/alloca.h version.h diag.h
init.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
init.o: /usr/include/gnu/stubs.h
init.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
init.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h
init.o: /usr/include/bits/types.h /usr/include/libio.h
init.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h
init.o: /usr/include/string.h /usr/include/stdlib.h /usr/include/sys/types.h
init.o: /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h
init.o: /usr/include/sys/select.h /usr/include/bits/select.h
init.o: /usr/include/bits/sigset.h /usr/include/sys/sysmacros.h
init.o: /usr/include/alloca.h /usr/include/math.h
init.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h
init.o: /usr/include/bits/mathcalls.h
init.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/float.h
init.o: version.h diag.h init.h
parms.o: /usr/include/stdio.h /usr/include/features.h
parms.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
parms.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
parms.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h
parms.o: /usr/include/bits/types.h /usr/include/libio.h
parms.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h
parms.o: /usr/include/string.h /usr/include/math.h
parms.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h
parms.o: /usr/include/bits/mathcalls.h
parms.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/float.h
parms.o: diag.h parms.h init.h
geometry.o: /usr/include/stdio.h /usr/include/features.h
geometry.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
geometry.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
geometry.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h
geometry.o: /usr/include/bits/types.h /usr/include/libio.h
geometry.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h
geometry.o: /usr/include/string.h /usr/include/math.h
geometry.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h
geometry.o: /usr/include/bits/mathcalls.h
geometry.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/float.h
geometry.o: diag.h geometry.h init.h
atm.o: /usr/include/stdio.h /usr/include/features.h /usr/include/sys/cdefs.h
atm.o: /usr/include/gnu/stubs.h
atm.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
atm.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h
atm.o: /usr/include/bits/types.h /usr/include/libio.h
atm.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h
atm.o: /usr/include/string.h /usr/include/math.h /usr/include/bits/huge_val.h
atm.o: /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h
atm.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/float.h diag.h
atm.o: atm.h init.h
ph2cph.o: /usr/include/stdio.h /usr/include/features.h
ph2cph.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
ph2cph.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
ph2cph.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h
ph2cph.o: /usr/include/bits/types.h /usr/include/libio.h
ph2cph.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h
ph2cph.o: /usr/include/math.h /usr/include/bits/huge_val.h
ph2cph.o: /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h
ph2cph.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/float.h
ph2cph.o: diag.h init.h lagrange.h
header.o: /usr/include/string.h /usr/include/features.h
header.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
header.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
header.o: header.h
reflector.o: /usr/include/stdio.h /usr/include/features.h
reflector.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h
reflector.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h
reflector.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stdarg.h
reflector.o: /usr/include/bits/types.h /usr/include/libio.h
reflector.o: /usr/include/_G_config.h /usr/include/bits/stdio_lim.h
reflector.o: /usr/include/stdlib.h /usr/include/sys/types.h
reflector.o: /usr/include/time.h /usr/include/endian.h
reflector.o: /usr/include/bits/endian.h /usr/include/sys/select.h
reflector.o: /usr/include/bits/select.h /usr/include/bits/sigset.h
reflector.o: /usr/include/sys/sysmacros.h /usr/include/alloca.h
reflector.o: /usr/include/string.h /usr/include/math.h
reflector.o: /usr/include/bits/huge_val.h /usr/include/bits/mathdef.h
reflector.o: /usr/include/bits/mathcalls.h
reflector.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/float.h
reflector.o: version.h diag.h init.h header.h
