include  $(COSMOSTOP)/site.config


EXTHDRS	      = $(COSMOSINC)/Zcode.h \
		$(COSMOSINC)/Zcondc.h \
		$(COSMOSINC)/Zevhnp.h \
		$(COSMOSINC)/Zevhnv.h \
		$(COSMOSINC)/Zmass.h \
		$(COSMOSINC)/Zptcl.h \
		$(COSMOSINC)/Zunionmap.h

HDRS	      = cumProb.h \
		cumProb14.h \
		cumProb16.h \
		cumProb2.h \
		cumProb40.h


MAKEFILE      = Makefile

OBJS	      = caveNoOfSucC.o \
		cfxTgtChg.o \
		chAcol.o \
		chAcolAdhoc.o \
		csampCollInA.o \
		csampFermiM.o \
		csmpColInA2.o

PRINT	      = pr

SHELL	      = /bin/sh

SRCS	      = caveNoOfSucC.f \
		cfxTgtChg.f \
		chAcol.f \
		chAcolAdhoc.f \
		csampCollInA.f \
		csampFermiM.f \
		csmpColInA2.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)(chAcol.o): $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zcode.h \
	$(COSMOSINC)/Zptcl.h \
	$(COSMOSINC)/Zunionmap.h \
	$(COSMOSINC)/Zevhnp.h \
	$(COSMOSINC)/Zevhnv.h
$(LIBRARY)(chAcolAdhoc.o): $(COSMOSINC)/Zptcl.h \
	$(COSMOSINC)/Zunionmap.h \
	$(COSMOSINC)/Zcode.h \
	$(COSMOSINC)/Zevhnp.h
$(LIBRARY)(csampCollInA.o): $(COSMOSINC)/Zcode.h \
	$(COSMOSINC)/Zptcl.h \
	$(COSMOSINC)/Zunionmap.h cumProb.h
$(LIBRARY)(csampFermiM.o): $(COSMOSINC)/Zmass.h \
	$(COSMOSINC)/Zptcl.h \
	$(COSMOSINC)/Zunionmap.h
$(LIBRARY)(csmpColInA2.o): $(COSMOSINC)/Zptcl.h \
	$(COSMOSINC)/Zunionmap.h cumProb2.h cumProb14.h \
	cumProb16.h cumProb40.h

$(LIBRARY):         \
               $(LIBRARY)(caveNoOfSucC.o) \
               $(LIBRARY)(cfxTgtChg.o) \
               $(LIBRARY)(chAcol.o) \
               $(LIBRARY)(chAcolAdhoc.o) \
               $(LIBRARY)(csampCollInA.o) \
               $(LIBRARY)(csampFermiM.o) \
               $(LIBRARY)(csmpColInA2.o) 
