include  $(COSMOSTOP)/site.config


EXTHDRS	      = $(COSMOSINC)/Zcondc.h \
		$(COSMOSINC)/Zmanagerp.h \
		$(COSMOSINC)/Zmaxdef.h

HDRS	      =


MAKEFILE      = Makefile

OBJS	      = dpm_1.o \
		dpm_2.o \
		dpm_3.o \
		dpm_4.o \
		dpm_5.o \
		pho_1.o \
		pho_2.o \
		pho_3.o \
		pho_4.o \
		py_1.o \
		py_2.o \
		py_3.o \
		py_4.o

PRINT	      = pr

SHELL	      = /bin/sh

SRCS	      = dpm_1.f \
		dpm_2.f \
		dpm_3.f \
		dpm_4.f \
		dpm_5.f \
		pho_1.f \
		pho_2.f \
		pho_3.f \
		pho_4.f \
		py_1.f \
		py_2.f \
		py_3.f \
		py_4.f

SYSHDRS	      =

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

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

veryclean:
	@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
###
dpm_1.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
dpm_2.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
dpm_3.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
dpm_4.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
dpm_5.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
pho_1.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
pho_2.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
pho_3.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
pho_4.o: $(COSMOSINC)/Zcondc.h \
	$(COSMOSINC)/Zmanagerp.h \
	$(COSMOSINC)/Zmaxdef.h
py_1.o: $(COSMOSINC)/Zcondc.h
py_2.o: $(COSMOSINC)/Zcondc.h
py_3.o: $(COSMOSINC)/Zcondc.h
py_4.o: $(COSMOSINC)/Zcondc.h

$(LIBRARY):         \
               $(LIBRARY)(dpm_1.o) \
               $(LIBRARY)(dpm_2.o) \
               $(LIBRARY)(dpm_3.o) \
               $(LIBRARY)(dpm_4.o) \
               $(LIBRARY)(dpm_5.o) \
               $(LIBRARY)(pho_1.o) \
               $(LIBRARY)(pho_2.o) \
               $(LIBRARY)(pho_3.o) \
               $(LIBRARY)(pho_4.o) \
               $(LIBRARY)(py_1.o) \
               $(LIBRARY)(py_2.o) \
               $(LIBRARY)(py_3.o) \
               $(LIBRARY)(py_4.o) 
