include  $(EPICSTOP)/site.config


EXTHDRS	      =

HDRS	      = 


MAKEFILE      = Makefile

OBJS	      = epLightMaxDef.o  \
	epLight.o \
	epLightPty.o \
	elLightCounter.o \
	epmodUI.o \
	epMinMaxQuenchComp.o \
	epLightEdepo.o \
	epidentify.o \
	epSrim.o  \
	epmodGUI.o \
	epmodIntInfo.o 
 
PRINT	      = pr

SHELL	      = /bin/sh

SRCS  = epLightMaxDef.f90  \
	epLight.f90 \
	epLightPty.f90 \
	elLightCounter.f90 \
	epmodUI.f90 \
	epMinMaxQuenchComp.f \
	epLightEepo.f90  \
	epidentify.f90 \
	epSrim.f90  \
	epmodGUI.f90  \
	epmodIntInfo.f90  


SYSHDRS	      =

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

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

veryclean:
	@rm -f $(OBJS) core  *~ a.out temp*.f temp*.f90
	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  $(EPICSTOP)/Data  $(EPICSTOP)/Util \
		 $(EPICSTOP)/UserHook  $(EPICSTOP)/Scrpt  \
		 $(EPICSTOP)/Doc        $(TEMPLATE)/
		cp $(EPICSTOP)/site.config $(TEMPLATE)/
		@echo "****" Installing header files into $(HEADER)
		cp -r $(EPICSTOP)/epics  $(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 $(EPICSTOP)/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 != Data  -a $$i != epics \
	                -a $$i != Obso  -a $$i != TeX \
	                -a $$i != lib  -a $$i != UserHook \
	                -a $$i != Scrpt -a $$i != DistJob ] ; then \
		            $(MAKE) $(TARGET) \
			;fi) \
		; fi \
	done


$(LIBRARY): \
	$(LIBRARY)(epLightMaxDef.o) \
	$(LIBRARY)(epLight.o) \
	$(LIBRARY)(epLightPty.o) \
	$(LIBRARY)(epLightCounter.o) \
	$(LIBRARY)(epmodUI.o) \
	$(LIBRARY)(epMinMaxQuenchComp.o) \
	$(LIBRARY)(epLightEdepo.o) \
	$(LIBRARY)(epidentify.o) \
	$(LIBRARY)(epSrim.o) \
	$(LIBRARY)(epmodGUI.o) \
	$(LIBRARY)(epmodIntInfo.o) 

