include  $(COSMOSTOP)/site.config


EXTHDRS	      = $(COSMOSINC)/Zkcele.h

HDRS	      =


MAKEFILE      = Makefile

OBJS	      = k16pGaussLeg.o \
		k4ptdi.o \
		kbinChop.o \
		kbinom.o \
		kceles.o \
		kcombi.o \
		kcossn.o \
		kcsplCoef.o \
		kcsplDif.o \
		kcsplInteg.o \
		kcsplIntp.o \
		kdexpIntF.o \
		kdexpIntFb.o \
		kdir2deg.o \
		kdmachmnmx.o \
		kdwhereis.o \
		kerf.o \
		kerfc.o \
		kexpot.o \
		kfrge.o \
		kgamma.o \
		kgauss.o \
		kintp3.o \
		klena.o \
		knbino.o \
		kpmnx.o \
		kpoisn.o \
		kpolintp.o \
		kpolintp2.o \
		ksampLin.o \
		ksampPw.o \
		ksbwig.o \
		kseblk.o \
		ksgamd.o \
		ksupblank.o \
		ktrpzIntT2.o \
		ktrpzIntegT.o \
		kzeta2a.o \
		rnd.o

PRINT	      = pr

SHELL	      = /bin/sh

SRCS	      = k16pGaussLeg.f \
		k4ptdi.f \
		kbinChop.f \
		kbinom.f \
		kceles.f \
		kcombi.f \
		kcossn.f \
		kcsplCoef.f \
		kcsplDif.f \
		kcsplInteg.f \
		kcsplIntp.f \
		kdexpIntF.f \
		kdexpIntFb.f \
		kdir2deg.f \
		kdmachmnmx.f \
		kdwhereis.f \
		kerf.f \
		kerfc.f \
		kexpot.f \
		kfrge.f \
		kgamma.f \
		kgauss.f \
		kintp3.f \
		klena.f \
		knbino.f \
		kpmnx.f \
		kpoisn.f \
		kpolintp.f \
		kpolintp2.f \
		ksampLin.f \
		ksampPw.f \
		ksbwig.f \
		kseblk.f \
		ksgamd.f \
		ksupblank.f \
		ktrpzIntT2.f \
		ktrpzIntegT.f \
		kzeta2a.f \
		rnd.f

SYSHDRS	      =

all:
	make	Checkdir $(LIBRARY) SeeSubDir "TARGET=$@"

clean:
	@rm -f $(OBJS) core  *~ a.out temp*.o temp*.f
	make SeeSubDir "TARGET=$@"


clobber:
	@rm -f $(OBJS) $(LIBRARY) core tags
	make SeeSubDir "TARGET=$@"

depend:
	@mkmf -f $(MAKEFILE) ROOT=$(ROOT)
	make SeeSubDir "TARGET=$@"

echo:
	@echo $(HDRS) $(SRCS)
	make SeeSubDir "TARGET=$@"

extract:
	@ar x $(LIBRARY)


index:
	@ctags -wx $(HDRS) $(SRCS)
	make SeeSubDir "TARGET=$@"

install:	$(LIBRARY)
		@echo "****" Installing $(LIBRARY) into $(DEST)
		$(INSTALL) -f  $(DEST) $(LIBRARY)
		@echo "****" Installing Template files into $(TEMPLATE)
		cp -r  $(COSMOSTOP)/Data  $(COSMOSTOP)/Util *
		 $(COSMOSTOP)/UserHook  $(COSMOSTOP)/Scrpt *
		 $(COSMOSTOP)/Doc        $(TEMPLATE)/
		cp $(COSMOSTOP)/site.config $(TEMPLATE)/
		@echo "****" Installing header files into $(HEADER)
		cp -r $(COSMOSTOP)/cosmos  $(HEADER)/
		@echo "****" Installation ended.
		@echo "****" Owner and group should be changed by hand

print:
	@$(PRINT) $(HDRS) $(SRCS)
	make SeeSubDir "TARGET=$@"

tags:           $(HDRS) $(SRCS)
	@ctags $(HDRS) $(SRCS)
	make SeeSubDir "TARGET=$@"


Checkdir:
	@( cd $(COSMOSTOP)/lib; if [ ! -d  $(ARCH) ]; then  mkdir $(ARCH); fi)



SeeSubDir:
	@for i in  * \
	;do   \
		if [ -d  $$i ] ; then \
			(cd $$i; \
			if [ -f Makefile  -a  $$i != Test \
			-a $$i != Util -a $$i != UC  \
	                -a $$i != Ana  -a $$i != Ceren \
	                -a $$i != Data  -a $$i != cosmos \
	                -a $$i != Misc  -a $$i != MuUg \
	                -a $$i != Obso  -a $$i != TeX \
	                -a $$i != lib  -a $$i != UserHook \
	                -a $$i != Doc  -a $$i != Betterone \
	                -a $$i != Scrpt -a $$i != NotForExport ] ; then \
		            $(MAKE) $(TARGET) \
			;fi) \
		; fi \
	done
###
$(LIBRARY)(kceles.o): $(COSMOSINC)/Zkcele.h

$(LIBRARY):         \
               $(LIBRARY)(k16pGaussLeg.o) \
               $(LIBRARY)(k4ptdi.o) \
               $(LIBRARY)(kbinChop.o) \
               $(LIBRARY)(kbinom.o) \
               $(LIBRARY)(kceles.o) \
               $(LIBRARY)(kcombi.o) \
               $(LIBRARY)(kcossn.o) \
               $(LIBRARY)(kcsplCoef.o) \
               $(LIBRARY)(kcsplDif.o) \
               $(LIBRARY)(kcsplInteg.o) \
               $(LIBRARY)(kcsplIntp.o) \
               $(LIBRARY)(kdexpIntF.o) \
               $(LIBRARY)(kdexpIntFb.o) \
               $(LIBRARY)(kdir2deg.o) \
               $(LIBRARY)(kdmachmnmx.o) \
               $(LIBRARY)(kdwhereis.o) \
               $(LIBRARY)(kerf.o) \
               $(LIBRARY)(kerfc.o) \
               $(LIBRARY)(kexpot.o) \
               $(LIBRARY)(kfrge.o) \
               $(LIBRARY)(kgamma.o) \
               $(LIBRARY)(kgauss.o) \
               $(LIBRARY)(kintp3.o) \
               $(LIBRARY)(klena.o) \
               $(LIBRARY)(knbino.o) \
               $(LIBRARY)(kpmnx.o) \
               $(LIBRARY)(kpoisn.o) \
               $(LIBRARY)(kpolintp.o) \
               $(LIBRARY)(kpolintp2.o) \
               $(LIBRARY)(ksampLin.o) \
               $(LIBRARY)(ksampPw.o) \
               $(LIBRARY)(ksbwig.o) \
               $(LIBRARY)(kseblk.o) \
               $(LIBRARY)(ksgamd.o) \
               $(LIBRARY)(ksupblank.o) \
               $(LIBRARY)(ktrpzIntT2.o) \
               $(LIBRARY)(ktrpzIntegT.o) \
               $(LIBRARY)(kzeta2a.o) \
               $(LIBRARY)(rnd.o) 
