#################################################
#
# SEISAN 8.3
#
# May 2010     
#
# Makefile for SEISAN PRO directory to compile SEISAN libraries  
# and programs. The SEISARCH environmental variable, 
# which can be solaris or linux, is used to produce 
# platform dependant executables. You may need to modify
# some of the variables used in the Makefile to adjust
# the Makefile to your system. To compile a specific 
# program use for example 'make solaris/mulplt' to compile
# mulplt for solaris. The output file created will be
# solaris/mulplt.
#
##################################################
#
# changes:
#
#
# October 5,1999 jh : cleaned for distribution
# February 11, 200, jh: Add sissei
# February 15, 2000 jh: add kinsei
# April 16            : add get_wavd, get_wavc
# april 19            : change both above to to extract
# may   05     2000 lo: check if any changes in INC or LIB
# may 12            jh: add cripar
# sep 6               : add wad_plot
# sep 28              : add gursei
# oct 17              : add rsasei,rsanor
# oct 24              : add swarm
# nov 10              : add lensei
# feb 19, 2001     lo : add hypo71, hypo71exe
# may 27           jh : add sample_read_write_s
# jul 1               : add tsig.for, sample_read_wav,sample_graphics
# jul 3               : add tersei.for, norims
# sep 12              : add wgssei.for
# dec 17           lo : add install part
# mar 04 2002      lo : add focmec_exe
# apr 19 2002      bm : change extract to wavetool
# oct 02 2002      lo : add volcstat
# may 21 2003      lo : add isfnor
# may 27           jh : add ascsei
# Jun    2003      lo : clean up for version 8.0
# jun 13           jh : add sample_read_cont
# jun 17              : rem bgiasc
# aug 26              : added macosx entries (dstoll@lennartz-electronic.de)
# oct 13           jh : add hyp_isc
# apr 14 2004      jh : add seicut
# may 11              : add econt as a copy of sample_read_cont
# jan  17 2005     jh : add macromap
# may 31 2005      lo : add nor2dd and nor2jhd_pujol
# jun 1            jh : remove mseedsei
# sep 4               : remove timehist
# mar 30 2006      lo : add condet
# may 02 2006      lo : add sei2psxy
# aug 23 2006      jh : add silmseed
# nov 16 2006      jh : add stasei, add nrwsei
# june 2007        jh : add msfix
# dec 14 2007      pv : add gmap
# mar 18 2008      jh : add array
# apr 24 2008      jh,pv: add mscut
# apr 25 2008      jh  : add harnor
# may  7 2008      lo: add edrnor, ttplot, gseresp2seed, array to pfit 
# jun 20 2008      pv : add p_align
# oct 3  2008      lo : add congap
# jun 8  2009      lo : add connoi, evanoi, database2mseed, dimassei
# nov 2  2009      jh . add ahsei
# mar 12 2010      jh: change change-mag to change_mag so same as other progs
# apr 28 2010      jh: add pinv
# apr 30 2010      lo: changed to gfortran64, removed cplot, cfile

##################################################
# THE ARCHITECTURE IS EXPECTED TO BE GIVEN BY
# THE ENVIRONMENTAL VARIABLE SEISARCH, WHICH
# CAN BE: solaris or linux or macosx
##################################################

##################################################
# PATH TO WHICH OUTPUT FILES ARE WRIITEN,
# THIS CAN BE SET TO $(SEISARCH) IF
# SEVERAL OPERATING SYSTEMS COMPILE
# SOURCE ON SHARED DISKS,
# OBVIOUSLY OUTPATH CAN BE USED TO WRITE
# OBJECTS TO ANY OTHER PLACE
#OUTPATH = $(SEISARCH)
OUTPATH = .

##################################################
# PATH TO WHICH EXECUTABLES ARE INSTALLED
INSTALL_PRO_PATH = /uibsan/home/s2000/seismo/pro

##################################################
# LINK TO X11 LIBRARIEs
xlink_solaris = -lX11 -lcurses -ltermcap
xlink_linux = -lX11 -L/usr/X11R6/lib
xlink_gfortran64 = -lX11 -L/usr/X11R6/lib
xlink_linux64 = -lX11 -L/usr/X11R6/lib
xlink_macosx = -lX11 -L/usr/X11R6/lib
xlink_macosxppc = -lX11 -L/usr/X11R6/lib
xlink = $(xlink_$(SEISARCH))

##################################################
# SET PLATFORM SPECIFIC ROUTINES
COMP_solaris = comp_sun.o
COMP_linux = comp_linux.o
COMP_gfortran64 = comp_linux.o
COMP_linux64 = comp_linux.o
COMP_macosx = comp_linux.o
COMP_macosxppc = comp_sun.o
COMP_windows = comp_pc.o
COMP_TYPE = COMP_$(SEISARCH)

##################################################
# COMPILERS
fc_solaris = f77 -g  -I../INC -o $@
fc_linux = g77 -g -I../INC -fdollar-ok -fugly-complex \
              -fno-automatic -fugly-logint -o $@
fc_gfortran64 = gfortran -I../INC -fdollar-ok \
              -fno-automatic -o $@
fc_linux64 = g77 -g -I../INC -fdollar-ok -fugly-complex \
              -fno-automatic -fugly-logint -o $@
fc_macosx = gfortran -m64 -g -I../INC -fdollar-ok \
              -fno-automatic -o $@
fc_macosxppc = gfortran -g -I../INC -fdollar-ok \
              -fno-automatic -o $@
#-malign-double -finit-local-zero

cc_solaris = cc  -o $@
cc_linux = gcc -I../INC  -o $@
cc_gfortran64 = gcc -I../INC  -o $@
cc_linux64 = gcc -I../INC  -o $@
cc_macosx = gcc -m64 -I../INC  -o $@
cc_macosxppc = gcc -I../INC  -o $@
fc = $(fc_$(SEISARCH))
cc = $(cc_$(SEISARCH))
df_flags = /assume:byterec -c /fpscomp:general  /list -I..\inc

##################################################
# PATH TO INSTALL TOOL
INSTALL_solaris = /usr/ucb/install -c -m755
INSTALL_linux = /usr/bin/install -m755
INSTALL_gfortran64 = /usr/bin/install  -m755
INSTALL_linux64 = /usr/bin/install -m755
INSTALL_macosx = /usr/bin/install -m755
INSTALL_macosxppc = /usr/bin/install -m755
INSTALL = $(INSTALL_$(SEISARCH))

##################################################
# SET SUFFIX FOR EXECUTABLES
esuf_solaris = 
esuf_linux = 
esuf_gfortran64 = 
esuf_linux64 = 
esuf_macosx = 
esuf_macosxppc = 
esuf_windows = .exe
esuf = $(esuf_$(SEISARCH))

##################################################
# NAME OF SEISAN ARCHIVE
asuf_solaris = a
asuf_linux = a
asuf_gfortran64 = a
asuf_linux64 = a
asuf_macosx = a
asuf_macosxppc = a
asuf_windows = lib
asuf = $(asuf_$(SEISARCH))
SEISAN_ARCHIVE = ../LIB/$(OUTPATH)/seisan.$(asuf)

##################################################
# PROGRAMS TO COMPILE ON SPECIFIC PLATFORM ONLY
ONLY_solaris = \
  $(OUTPATH)/crisis99$(esuf) \
  $(OUTPATH)/hypinv$(esuf) \
  $(OUTPATH)/norhyp$(esuf) \
  $(OUTPATH)/nansei$(esuf) \
  $(OUTPATH)/kinsei$(esuf) \
  $(OUTPATH)/hypo71$(esuf) \
  $(OUTPATH)/hypo71exe$(esuf) \
  $(OUTPATH)/rsasei$(esuf) \
  $(OUTPATH)/silmseed$(esuf)
ONLY_linux = $(OUTPATH)/bgisei
ONLY_gfortran64 = $(OUTPATH)/bgisei
ONLY_linux64 = $(OUTPATH)/bgisei
ONLY_windows = 
ONLY_macosx =
ONLY_macosxppc =
PLATFORM_DEP_EXE = $(ONLY_$(SEISARCH))

##################################################
# PROGRAMS THAT ARE EXECUTABLE ONLY
EXEC_ONLY_solaris = y5dump
EXEC_ONLY_linux = 
EXEC_ONLY_gfortran64 = 
EXEC_ONLY_linux64 = 
EXEC_ONLY_macosx = 
EXEC_ONLY_macosxppc = 
EXEC_ONLY_windows = 
EXEC_ONLY = $(EXEC_ONLY_$(SEISARCH))

##################################################
# LIBRARIES
SL_solaris = $(SEISAN_ARCHIVE) 
SL_linux = $(SEISAN_ARCHIVE) 
SL_gfortran64 = $(SEISAN_ARCHIVE) 
SL_linux64 = $(SEISAN_ARCHIVE) 
SL_macosx = $(SEISAN_ARCHIVE)
SL_macosxppc = $(SEISAN_ARCHIVE)
SL_windows = $(SEISAN_ARCHIVE)
SL = $(SL_$(SEISARCH))

##################################################
# LIBRARIES
del_solaris = 
del_linux = 
del_gfortran64 = 
del_linux64 = 
del_macosx = 
del_macosxppc = 
del_windows = del_out
del = $(del_$(SEISARCH))

##################################################
# SOME MORE DEFINITIONS
LIB = ../LIB
LIB_TO_PRO = ../PRO
INCS = ../INC/*.inc ../INC/*.f ../INC/*INC
CHECK_WITH = $(INCS) $(SL)

PROGS = \
  $(OUTPATH)/ahsei$(esuf) $(OUTPATH)/append$(esuf) $(OUTPATH)/associ$(esuf) \
  $(OUTPATH)/ascsei$(esuf) $(OUTPATH)/associ$(esuf) \
  $(OUTPATH)/auto$(esuf) $(OUTPATH)/autopic$(esuf) \
  $(OUTPATH)/autoreg$(esuf) $(OUTPATH)/autosig$(esuf) \
  $(OUTPATH)/base$(esuf) $(OUTPATH)/bouch$(esuf) \
  $(OUTPATH)/bousei$(esuf)$(esuf) \
  $(OUTPATH)/bul$(esuf) $(OUTPATH)/bvalue\
  $(OUTPATH)/check_base$(esuf) $(OUTPATH)/cat_aga$(esuf) \
  $(OUTPATH)/catstat$(esuf) $(OUTPATH)/cripar$(esuf) $(OUTPATH)/change_mag$(esuf)\
  $(OUTPATH)/check$(esuf) $(OUTPATH)/checkre$(esuf) \
  $(OUTPATH)/cluster$(esuf) $(OUTPATH)/codaq$(esuf) $(OUTPATH)/collect$(esuf) \
  $(OUTPATH)/condet$(esuf) $(OUTPATH)/congap$(esuf) $(OUTPATH)/connoi$(esuf)\
  $(OUTPATH)/citsei$(esuf) $(OUTPATH)/criatt$(esuf) $(OUTPATH)/corr$(esuf) \
  $(OUTPATH)/database2mseed$(esuf) $(OUTPATH)/dimassei$(esuf) \
  $(OUTPATH)/delf$(esuf) $(OUTPATH)/dirf$(esuf) \
  $(OUTPATH)/drsei$(esuf) $(OUTPATH)/eev$(esuf) $(OUTPATH)/edrnor$(esuf) \
  $(OUTPATH)/epimap$(esuf) $(OUTPATH)/eqrisk$(esuf) $(OUTPATH)/eqrsei$(esuf) \
  $(OUTPATH)/exfilter$(esuf) \
  $(OUTPATH)/fk$(esuf) $(OUTPATH)/focmec$(esuf) \
  $(OUTPATH)/focmec_exe$(esuf) $(OUTPATH)/get_wav$(esuf) $(OUTPATH)/gmap$(esuf) \
  $(OUTPATH)/giinor$(esuf) $(OUTPATH)/giisei$(esuf) $(OUTPATH)/gursei$(esuf) \
  $(OUTPATH)/gseresp$(esuf) $(OUTPATH)/gsrsei$(esuf) $(OUTPATH)/harnor$(esuf) \
  $(OUTPATH)/gseresp2seed$(esuf) \
  $(OUTPATH)/herrman$(esuf) $(OUTPATH)/hersei$(esuf) $(OUTPATH)/hinnor$(esuf) \
  $(OUTPATH)/hspec8$(esuf) \
  $(OUTPATH)/hsumnor$(esuf) $(OUTPATH)/hyp$(esuf) $(OUTPATH)/hypnor$(esuf) \
  $(OUTPATH)/hyp_isc$(esuf)  \
  $(OUTPATH)/iasp$(esuf) $(OUTPATH)/invrad$(esuf) $(OUTPATH)/irisei$(esuf) \
  $(OUTPATH)/isfnor$(esuf) \
  $(OUTPATH)/iscnor$(esuf) $(OUTPATH)/iscsta$(esuf) $(OUTPATH)/kinnor$(esuf) \
  $(OUTPATH)/leesei$(esuf) $(OUTPATH)/lensei$(esuf) \
  $(OUTPATH)/kacsei$(esuf) \
  $(OUTPATH)/lsq$(esuf) $(OUTPATH)/m88sei$(esuf) $(OUTPATH)/macromap$(esuf) \
  $(OUTPATH)/macroin$(esuf) $(OUTPATH)/mag$(esuf) $(OUTPATH)/makehin$(esuf) \
  $(OUTPATH)/makerea$(esuf) $(OUTPATH)/make_tt$(esuf) \
  $(OUTPATH)/mech$(esuf) $(OUTPATH)/mulplt$(esuf) $(OUTPATH)/neisei$(esuf) \
  $(OUTPATH)/mech$(esuf) $(OUTPATH)/msfix$(esuf) \
  $(OUTPATH)/neweve$(esuf) $(OUTPATH)/norgse$(esuf) $(OUTPATH)/norims$(esuf) \
  $(OUTPATH)/norhin$(esuf) $(OUTPATH)/os9sei$(esuf) $(OUTPATH)/pdasei$(esuf) \
  $(OUTPATH)/norhead$(esuf) \
  $(OUTPATH)/nor2dd $(OUTPATH)/nor2jhd_pujol $(OUTPATH)/nrwsei$(esuf) \
  $(OUTPATH)/p_align$(esuf) $(OUTPATH)/pinv$(esuf) \
  $(OUTPATH)/pdenor$(esuf) $(OUTPATH)/presp$(esuf) $(OUTPATH)/pr_resp$(esuf) \
  $(OUTPATH)/pfit$(esuf) $(OUTPATH)/psnsei$(esuf) $(OUTPATH)/qlg$(esuf) \
  $(OUTPATH)/qnxsei$(esuf) $(OUTPATH)/remodl$(esuf) \
  $(OUTPATH)/rdseed_many$(esuf) \
  $(OUTPATH)/report$(esuf) $(OUTPATH)/resamp$(esuf) \
  $(OUTPATH)/resp$(esuf) $(OUTPATH)/rhfoc10$(esuf) $(OUTPATH)/rhwvinta$(esuf) \
  $(OUTPATH)/rmsdep$(esuf) $(OUTPATH)/rsanor$(esuf) \
  $(OUTPATH)/s89sei$(esuf)$(esuf) $(OUTPATH)/seedresp2gse$(esuf) \
  $(OUTPATH)/seiasc$(esuf) $(OUTPATH)/seidel$(esuf) \
  $(OUTPATH)/seisei$(esuf) $(OUTPATH)/select$(esuf) $(OUTPATH)/sample_read_cont$(esuf) \
  $(OUTPATH)/sacsei$(esuf) $(OUTPATH)/sample_graphics$(esuf) \
  $(OUTPATH)/sample_read_wav$(esuf) $(OUTPATH)/sample_read_write_s$(esuf) \
  $(OUTPATH)/sei2psxy$(esuf) \
  $(OUTPATH)/seigmt$(esuf) $(OUTPATH)/seim88a$(esuf) \
  $(OUTPATH)/seicut$(esuf) \
  $(OUTPATH)/seisaf$(esuf) \
  $(OUTPATH)/seipitsa$(esuf) $(OUTPATH)/selmap$(esuf) $(OUTPATH)/selsei$(esuf) \
  $(OUTPATH)/setbrn$(esuf) $(OUTPATH)/sissei$(esuf) $(OUTPATH)/spec$(esuf) \
  $(OUTPATH)/silsei$(esuf) \
  $(OUTPATH)/split$(esuf) $(OUTPATH)/stalog$(esuf) $(OUTPATH)/statis$(esuf) \
  $(OUTPATH)/statstat$(esuf) $(OUTPATH)/stasei$(esuf) \
  $(OUTPATH)/swarm$(esuf) $(OUTPATH)/tersei$(esuf) $(OUTPATH)/tsig$(esuf) \
  $(OUTPATH)/trace_plot$(esuf) \
  $(OUTPATH)/ttlayer$(esuf) $(OUTPATH)/ttplot$(esuf) $(OUTPATH)/ttim$(esuf) \
  $(OUTPATH)/upd$(esuf) $(OUTPATH)/update$(esuf) $(OUTPATH)/usgsnor$(esuf) \
  $(OUTPATH)/velest$(esuf) $(OUTPATH)/velmenu$(esuf) \
  $(OUTPATH)/volcstat$(esuf) \
  $(OUTPATH)/wadati$(esuf) $(OUTPATH)/wad_plot$(esuf) $(OUTPATH)/wavfix$(esuf) \
  $(OUTPATH)/wavetool$(esuf) $(OUTPATH)/wavfullname$(esuf) \
  $(OUTPATH)/wgssei$(esuf) $(OUTPATH)/wkbj$(esuf) $(OUTPATH)/wkbj_or \
  $(OUTPATH)/xclust$(esuf)
#  $(OUTPATH)/evanoi$(esuf)\

# $(OUTPATH)/mscut$(esuf) 

info:
	@echo --------------------------------------------------
	@echo "SEISAN Makefile FOR PRO DIRETORY, OPTIONS ARE:"
	@echo " "
	@echo "Compiler is defined through environmental variable"
	@echo "SEISACH (solaris, linux, linux64, gfortran64,macosx,macosppc)"
	@echo " "
	@echo "   all - compiles all"
	@echo "   $(OUTPATH)/<program> - compile specfic program "
	echo "   install - install executables"
	@echo "   clean - remove executables"
	@echo " "
	@echo "OUTPUT PATH IS SET TO $(OUTPATH) "
	@echo --------------------------------------------------

all: $(del) lib output $(OUTPATH) $(PLATFORM_DEP_EXE) $(PROGS)

lib:
	cd $(LIB); $(MAKE) all; cd $(LIB_TO_PRO)

output:
	@echo --------------------------------------------------
	@echo ---- COMPILING SEISAN 8 PROGRAMS -----------------
	@echo --------------------------------------------------

solaris:
	mkdir solaris
linux:
	mkdir linux
gfortran64:
	mkdir gfortran64
linux64:
	mkdir linux64
macosx:
	mkdir macosx
macosx:
	mkdir macosxppc
#
# compile programs, NOTE below in front of @echo and $ ther MUST be a TAB
#


$(OUTPATH)/ahsei: ahsei.for $(CHECK_WITH)
	@echo ----- ahsei -----
	$(fc) ahsei.for $(SL)

$(OUTPATH)/append: append.for $(CHECK_WITH)
	@echo ----- append -----
	$(fc) append.for $(SL)

$(OUTPATH)/ascsei: ascsei.for $(CHECK_WITH)
	@echo ----- ascsei -----
	$(fc) ascsei.for $(SL)

$(OUTPATH)/associ: associ.for $(CHECK_WITH)
	@echo ----- associ -----
	$(fc) associ.for $(SL)

auto: $(OUTPATH)/auto
$(OUTPATH)/auto: auto.for $(CHECK_WITH)
	@echo ----- auto -----
	$(fc) auto.for $(SL)

$(OUTPATH)/autopic: autopic.for $(CHECK_WITH)
	@echo ----- autopic -----
	$(fc) autopic.for $(SL)

$(OUTPATH)/autoreg: autoreg.for $(CHECK_WITH)
	@echo ----- autoreg -----
	$(fc) autoreg.for $(SL)

$(OUTPATH)/autosig: autosig.for $(CHECK_WITH)
	@echo ----- autosig -----
	$(fc) autosig.for $(SL) -lm

$(OUTPATH)/base:   base.for $(CHECK_WITH)
	@echo ----- base -----
	$(fc) base.for $(SL)

$(OUTPATH)/bgisei: bgisei.for $(CHECK_WITH)
	@echo ----- bgisei -----
	$(fc) bgisei.for $(SL)

$(OUTPATH)/bouch: bouch.for $(CHECK_WITH)
	@echo ----- bouch -----
	$(fc) bouch.for $(SL)

$(OUTPATH)/bousei: bousei.for $(CHECK_WITH)
	@echo ----- bousei -----
	$(fc) bousei.for $(SL)

$(OUTPATH)/bul: bul.for $(CHECK_WITH)
	@echo ----- bul -----
	$(fc) bul.for $(SL)

$(OUTPATH)/bvalue: bvalue.for $(CHECK_WITH)
	@echo ----- bvalue -----
	$(fc) bvalue.for $(SL) $(xlink)

$(OUTPATH)/cat_aga: cat_aga.for $(CHECK_WITH)
	@echo ----- cat_aga -----
	$(fc) cat_aga.for $(SL) 

$(OUTPATH)/catstat: catstat.for $(catstat_obj) $(CHECK_WITH)
	@echo ----- catstat -----
	$(fc) catstat.for $(SL) $(xlink)

$(OUTPATH)/cripar: cripar.for $(cripar_obj) $(CHECK_WITH)
	@echo ----- cripart -----
	$(fc) cripar.for $(SL) $(xlink)

$(OUTPATH)/change_mag: change_mag.for $(CHECK_WITH)
	@echo ----- change_mag -----
	$(fc) change_mag.for $(SL)

$(OUTPATH)/check:   check.for $(CHECK_WITH)
	@echo ----- check -----
	$(fc) check.for $(SL)

$(OUTPATH)/check_base: check_base.for $(CHECK_WITH)
	@echo ----- check_base -----
	$(fc) check_base.for $(SL)

$(OUTPATH)/checkre: checkre.for $(CHECK_WITH)
	@echo ----- checkre -----
	$(fc) checkre.for $(SL)

$(OUTPATH)/citsei: citsei.for $(CHECK_WITH)
	@echo ----- citsei -----
	$(fc) citsei.for $(SL)

$(OUTPATH)/cluster: cluster.for $(CHECK_WITH)
	@echo ----- cluster -----
	$(fc) cluster.for $(SL)

$(OUTPATH)/codaq: codaq.for $(CHECK_WITH)
	@echo ----- codaq -----
	$(fc) codaq.for $(SL) $(xlink)

$(OUTPATH)/corr: corr.for $(CHECK_WITH)
	@echo ----- corr -----
	$(fc) corr.for $(SL)  $(xlink)

$(OUTPATH)/collect: collect.for $(CHECK_WITH)
	@echo ----- collect -----
	$(fc) collect.for $(SL)

$(OUTPATH)/condet: condet.for $(CHECK_WITH)
	@echo ----- condet -----
	$(fc) condet.for $(SL)

$(OUTPATH)/congap: congap.for $(CHECK_WITH)
	@echo ----- congap -----
	$(fc) congap.for $(SL)

$(OUTPATH)/connoi: connoi.for $(CHECK_WITH)
	@echo ----- connoi -----
	$(fc) connoi.for $(SL)

$(OUTPATH)/criatt: criatt.for $(CHECK_WITH)
	@echo ----- criatt -----
	$(fc) criatt.for $(SL)

$(OUTPATH)/crisei: crisei.for $(CHECK_WITH)
	@echo ----- crisei -----
	$(fc) crisei.for $(SL)

$(OUTPATH)/crisis99: crisis99.for $(CHECK_WITH)
	@echo ----- crisis99 -----
	$(fc) crisis99.for $(SL)

$(OUTPATH)/decon: decon.for $(CHECK_WITH)
	@echo ----- decon -----
	$(fc) decon.for $(SL) $(xlink)

$(OUTPATH)/det: det.for $(CHECK_WITH)
	@echo ----- det -----
	$(fc) det.for $(SL)

$(OUTPATH)/dirf: dirf.c $(CHECK_WITH)
	@echo ----- dirf -----
	$(cc) dirf.c

$(OUTPATH)/database2mseed: database2mseed.for $(CHECK_WITH)
	@echo ----- database2mseed -----
	$(fc) database2mseed.for $(SL)

$(OUTPATH)/dimassei: dimassei.for $(CHECK_WITH)
	@echo ----- dimassei -----
	$(fc) dimassei.for $(SL)

$(OUTPATH)/delf: delf.for $(CHECK_WITH)
	@echo ----- delf -----
	$(fc) delf.for $(SL)

$(OUTPATH)/drsei: drsei.for $(CHECK_WITH)
	@echo ----- drsei -----
	$(fc) drsei.for $(SL)

$(OUTPATH)/edrnor: edrnor.for $(CHECK_WITH)
	@echo ----- edrnor -----
	$(fc) edrnor.for $(SL)

$(OUTPATH)/eev: eev.for $(CHECK_WITH)
	@echo ----- eev -----
	$(fc) eev.for $(SL)

$(OUTPATH)/epimap: epimap.for $(CHECK_WITH)
	@echo ----- epimap -----
	$(fc) epimap.for $(SL) $(xlink)

$(OUTPATH)/eqrisk: eqrisk.for $(CHECK_WITH)
	@echo ----- eqrisk -----
	$(fc) eqrisk.for $(SL) 

$(OUTPATH)/eqrsei: eqrsei.for $(CHECK_WITH)
	@echo ----- eqrsei -----
	$(fc) eqrsei.for $(SL) 

$(OUTPATH)/evanoi: evanoi.for $(CHECK_WITH)
	@echo ----- evanoi -----
	$(fc) evanoi.for $(SL)

$(OUTPATH)/exfilter: exfilter.for $(CHECK_WITH)
	@echo ----- exfilter -----
	$(fc) exfilter.for $(SL)

$(OUTPATH)/wavetool: wavetool.for $(CHECK_WITH)
	@echo ----- wavetool -----
	$(fc) wavetool.for $(SL) 

$(OUTPATH)/wavfullname: wavfullname.for $(CHECK_WITH)
	@echo ----- wavfullname -----
	$(fc) wavfullname.for $(SL) 

$(OUTPATH)/findp: findp.for $(CHECK_WITH)
	@echo ----- findp -----
	$(fc) findp.for $(SL) $(xlink)

$(OUTPATH)/fk: fk.for $(CHECK_WITH)
	@echo ----- fk -----
	$(fc) fk.for $(SL) $(xlink)

$(OUTPATH)/focmec: focmec.for $(CHECK_WITH)
	@echo ----- focmec -----
	$(fc) focmec.for $(SL) $(xlink)

$(OUTPATH)/focmec_exe: focmec_exe.for $(CHECK_WITH)
	@echo ----- focmec_exe -----
	$(fc) focmec_exe.for \
           ../LIB/$(OUTPATH)/focmec_exe_sub.o

$(OUTPATH)/galoc: galoc.for $(CHECK_WITH)
	@echo ----- galoc -----
	$(fc) galoc.for $(SL)

$(OUTPATH)/get_wav: get_wav.for $(CHECK_WITH)
	@echo ----- get_wav -----
	$(fc) get_wav.for $(SL)

$(OUTPATH)/gmap: gmap.for $(CHECK_WITH)
	@echo ----- gmap -----
	$(fc) gmap.for $(SL)

$(OUTPATH)/giinor: giinor.for $(CHECK_WITH)
	@echo ----- giinor -----
	$(fc) giinor.for $(SL)

$(OUTPATH)/giisei: giisei.for $(CHECK_WITH)
	@echo ----- giisei -----
	$(fc) giisei.for $(SL)

$(OUTPATH)/gseresp: gseresp.for $(CHECK_WITH)
	@echo ----- gseresp -----
	$(fc) gseresp.for $(SL)

$(OUTPATH)/gseresp2seed: gseresp2seed.for $(CHECK_WITH)
	@echo ----- gseresp2seed -----
	$(fc) gseresp2seed.for $(SL)

$(OUTPATH)/gsrsei: gsrsei.for $(CHECK_WITH)
	@echo ----- gsrsei -----
	$(fc) gsrsei.for $(SL)

$(OUTPATH)/gursei: gursei.for $(CHECK_WITH)
	@echo ----- gursei -----
	$(fc) gursei.for $(SL)

$(OUTPATH)/harnor: harnor.for $(CHECK_WITH)
	@echo ----- harnor -----
	$(fc) harnor.for $(SL)

$(OUTPATH)/herrman: herrman.for $(CHECK_WITH)
	@echo ----- herrman -----
	$(fc) herrman.for $(SL)
   
$(OUTPATH)/hersei: hersei.for $(CHECK_WITH)
	@echo ----- hersei -----
	$(fc) hersei.for $(SL)

$(OUTPATH)/hinnor: hinnor.for $(CHECK_WITH)
	@echo ----- hinnor -----
	$(fc) hinnor.for $(SL)
   
$(OUTPATH)/hspec8: hspec8.for $(CHECK_WITH)
	@echo ----- hspec8 -----
	$(fc) hspec8.for $(SL) 

$(OUTPATH)/hsumnor: hsumnor.for $(CHECK_WITH)
	@echo ----- hsumnor -----
	$(fc) hsumnor.for $(SL)

$(OUTPATH)/hyp: hyp.for $(CHECK_WITH)
	@echo ----- hyp -----
	$(fc) hyp.for $(SL)

$(OUTPATH)/hyp_isc: hyp_isc.for $(CHECK_WITH)
	@echo ----- hyp_isc -----
	$(fc) hyp_isc.for $(SL)

$(OUTPATH)/hypinv: hypinv.for $(CHECK_WITH)
	@echo ----- hypinv -----
	$(fc) hypinv.for  $(SL)

$(OUTPATH)/hypnor: hypnor.for $(CHECK_WITH)
	@echo ----- hypnor -----
	$(fc) hypnor.for $(SL)
   
$(OUTPATH)/hypo71: hypo71.for $(CHECK_WITH)
	@echo ----- hypo71 -----
	$(fc) hypo71.for $(SL)

$(OUTPATH)/hypo71exe: hypo71exe.for
	@echo ----- hypo71exe -----
	$(fc) hypo71exe.for

$(OUTPATH)/iasp: iasp.for $(CHECK_WITH)
	@echo ----- iasp -----
	$(fc) iasp.for $(SL)

$(OUTPATH)/invrad:invrad.for  $(CHECK_WITH)
	@echo ----- invrad -----
	$(fc) invrad.for $(SL)

$(OUTPATH)/iscnor: iscnor.for $(CHECK_WITH)
	@echo ----- iscnor -----
	$(fc) iscnor.for $(SL)

$(OUTPATH)/isfnor: isfnor.for $(CHECK_WITH)
	@echo ----- isfnor -----
	$(fc) isfnor.for $(SL)

$(OUTPATH)/iscsta: iscsta.for $(CHECK_WITH)
	@echo ----- iscsta -----
	$(fc) iscsta.for $(SL)

$(OUTPATH)/irisei: irisei.for $(CHECK_WITH)
	@echo ----- irisei -----
	$(fc) irisei.for $(SL)

$(OUTPATH)/kacsei: kacsei.for $(CHECK_WITH)
	@echo ----- kacsei -----
	$(fc) kacsei.for $(SL)

$(OUTPATH)/kinnor: kinnor.for $(CHECK_WITH)
	@echo ----- kinnor -----
	$(fc) kinnor.for $(SL)

$(OUTPATH)/kinsei: kinsei.for $(CHECK_WITH)
	@echo ----- kinsei -----
	$(fc) kinsei.for $(SL)

$(OUTPATH)/leesei: leesei.for $(CHECK_WITH)
	@echo ----- leesei -----
	$(fc) leesei.for $(SL)

$(OUTPATH)/lensei: lensei.for $(CHECK_WITH)
	@echo ----- lensei -----
	$(fc) lensei.for $(SL)

$(OUTPATH)/lsq: lsq.for $(CHECK_WITH)
	@echo ----- lsq -----
	$(fc) lsq.for $(SL) $(xlink)

$(OUTPATH)/m88sei: m88sei.for $(CHECK_WITH)
	@echo ----- m88sei -----
	$(fc) m88sei.for $(SL)

$(OUTPATH)/macroin: macroin.for $(CHECK_WITH)
	@echo ----- macroin -----
	$(fc) macroin.for $(SL)

$(OUTPATH)/macromap: macromap.for $(CHECK_WITH)
	@echo ----- macromap -----
	$(fc) macromap.for $(SL)

$(OUTPATH)/mag: mag.for $(CHECK_WITH)
	@echo ----- mag -----
	$(fc) mag.for $(SL) $(xlink)

$(OUTPATH)/mag2: mag2.for $(CHECK_WITH)
	@echo ----- mag2 -----
	$(fc) mag2.for $(SL)

$(OUTPATH)/magstat: magstat.for $(CHECK_WITH)
	@echo ----- magstat -----
	$(fc) magstat.for $(SL)

$(OUTPATH)/makehin: makehin.for $(CHECK_WITH)
	@echo ----- makehin -----
	$(fc) makehin.for $(SL)

$(OUTPATH)/makerea: makerea.for $(CHECK_WITH)
	@echo ----- makerea -----
	$(fc) makerea.for $(SL)

$(OUTPATH)/make_tt: make_tt.for $(CHECK_WITH)
	@echo ----- make_tt -----
	$(fc) make_tt.for $(SL)

$(OUTPATH)/mech:   mech.for $(CHECK_WITH)
	@echo ----- mech -----
	$(fc) mech.for $(SL)

$(OUTPATH)/mscut: mscut.c $(CHECK_WITH)
	@echo ----- mscut-----
#	$(cc) mscut.c

$(OUTPATH)/msfix:   msfix.for $(CHECK_WITH)
	@echo ----- msfix -----
	$(fc) msfix.for $(SL)

$(OUTPATH)/mulplt: mulplt.for $(CHECK_WITH)
	@echo ----- mulplt -----
	$(fc) mulplt.for $(SL) $(flags) $(xlink)

$(OUTPATH)/nansei: nansei.for $(CHECK_WITH)
	@echo ----- nansei -----
	$(fc) nansei.for $(SL)

$(OUTPATH)/neisei: neisei.for $(CHECK_WITH)
	@echo ----- neisei -----
	$(fc) neisei.for $(SL)

$(OUTPATH)/neweve: neweve.for $(CHECK_WITH)
	@echo ----- neweve -----
	$(fc) neweve.for $(SL)

$(OUTPATH)/new_version: new_version.for $(CHECK_WITH)
	@echo ----- new_version -----
	$(fc) new_version.for $(SL)

$(OUTPATH)/norgse: norgse.for $(CHECK_WITH)
	@echo ----- norgse -----
	$(fc) norgse.for $(SL)

$(OUTPATH)/norhin: norhin.for $(CHECK_WITH)
	@echo ----- norhin -----
	$(fc) norhin.for $(SL)

$(OUTPATH)/norhead: norhead.for $(CHECK_WITH)
	@echo ----- norhead -----
	$(fc) norhead.for $(SL)

$(OUTPATH)/nor2dd: nor2dd.for $(CHECK_WITH)
	@echo ----- nor2dd -----
	$(fc) nor2dd.for $(SL)

$(OUTPATH)/nor2jhd_pujol: nor2jhd_pujol.for $(CHECK_WITH)
	@echo ----- nor2jhd_pujol -----
	$(fc) nor2jhd_pujol.for $(SL)

$(OUTPATH)/norhyp: norhyp.for $(CHECK_WITH)
	@echo ----- norhyp -----
	$(fc) norhyp.for $(SL)

$(OUTPATH)/norims: norims.for $(CHECK_WITH)
	@echo ----- norims -----
	$(fc) norims.for $(SL)

$(OUTPATH)/norrayinvr: norrayinvr.for $(CHECK_WITH)
	@echo ----- norrayinvr -----
	$(fc) norrayinvr.for $(SL)

$(OUTPATH)/nornoise: nornoise.for $(CHECK_WITH)
	@echo ----- nornoise -----
	$(fc) nornoise.for $(SL)

$(OUTPATH)/nrwsei: nrwsei.for $(CHECK_WITH)
	@echo ----- nrwsei -----
	$(fc) nrwsei.for $(SL)

$(OUTPATH)/os9sei: os9sei.for $(CHECK_WITH)
	@echo ----- os9sei -----
	$(fc) os9sei.for $(SL)

$(OUTPATH)/p_align: p_align.for $(CHECK_WITH)
	@echo ----- p_align -----
	$(fc) p_align.for $(SL)

$(OUTPATH)/pinv: pinv.for $(CHECK_WITH)
	@echo ----- pinv -----
	$(fc) pinv.for $(SL)

$(OUTPATH)/pdasei: pdasei.for $(CHECK_WITH)
	@echo ----- pdasei-----
	$(fc) pdasei.for $(SL)

$(OUTPATH)/pdenor: pdenor.for $(CHECK_WITH)
	@echo ----- pdenor -----
	$(fc) pdenor.for $(SL)

$(OUTPATH)/pfit: pfit.for $(CHECK_WITH)
	@echo ----- pfit -----
	$(fc) pfit.for $(SL) $(flags) $(xlink)

$(OUTPATH)/pr_resp: pr_resp.for $(CHECK_WITH)
	@echo ----- pr_resp -----
	$(fc) pr_resp.for $(SL) $(xlink)

$(OUTPATH)/presp:  presp.for $(CHECK_WITH)
	@echo ----- presp -----
	$(fc) presp.for $(SL) $(xlink)

$(OUTPATH)/psnsei: psnsei.for $(CHECK_WITH)
	@echo ----- psnsei -----
	$(fc) psnsei.for $(SL)

$(OUTPATH)/qnxsei: qnxsei.for $(CHECK_WITH)
	@echo ----- qnxsei -----
	$(fc) qnxsei.for $(SL)

$(OUTPATH)/qlg:    qlg.for $(CHECK_WITH)
	@echo ----- qlg -----
	$(fc) qlg.for $(SL)

$(OUTPATH)/qsei:   qsei.for $(CHECK_WITH)
	@echo ----- qsei -----
	$(fc) qsei.for $(SL)

$(OUTPATH)/remodl: remodl.for $(CHECK_WITH)
	@echo ----- remodl -----
	$(fc) remodl.for $(SL)

$(OUTPATH)/report: report.for $(CHECK_WITH)
	@echo ----- report -----
	$(fc) report.for $(SL)

$(OUTPATH)/resamp: resamp.for $(CHECK_WITH)
	@echo ----- resamp -----
	$(fc) resamp.for $(SL)

$(OUTPATH)/rdseed_many: rdseed_many.for $(CHECK_WITH)
	@echo ----- rdseed_many -----
	$(fc) rdseed_many.for $(SL)

$(OUTPATH)/resp: resp.for $(CHECK_WITH)
	@echo ----- resp -----
	$(fc) resp.for $(SL)

$(OUTPATH)/rhfoc10: rhfoc10.for $(CHECK_WITH)
	@echo ----- rhfoc10 -----
	$(fc) rhfoc10.for $(SL)

$(OUTPATH)/rhwvinta: rhwvinta.for $(CHECK_WITH)
	@echo ----- rhwvinta -----
	$(fc) rhwvinta.for $(SL)

$(OUTPATH)/rmsdep: rmsdep.for $(CHECK_WITH)
	@echo ----- rmsdep -----
	$(fc) rmsdep.for $(SL) $(xlink)

$(OUTPATH)/rsanor: rsanor.for $(CHECK_WITH)
	@echo ----- rsanor -----
	$(fc) rsanor.for $(SL) 

$(OUTPATH)/rsasei: rsasei.for $(CHECK_WITH)
	@echo ----- rsasei -----
	$(fc) rsasei.for $(SL) 

$(OUTPATH)/s89sei: s89sei.for $(CHECK_WITH)
	@echo ----- s89sei -----
	$(fc) s89sei.for $(SL) 

$(OUTPATH)/sample_graphics: sample_graphics.for $(CHECK_WITH)
	@echo ----- sample_graphics -----
	$(fc) sample_graphics.for $(SL) $(xlink) 

$(OUTPATH)/sample_read_cont: sample_read_cont.for $(CHECK_WITH)   
	@echo ----- sample_read_cont -----
	$(fc) sample_read_cont.for $(SL)  

$(OUTPATH)/sample_read_write_s: sample_read_write_s.for $(CHECK_WITH)
	@echo ----- sample_read_write_s -----
	$(fc) sample_read_write_s.for $(SL) 

$(OUTPATH)/sample_read_wav: sample_read_wav.for $(CHECK_WITH)
	@echo ----- sample_read_wav -----
	$(fc) sample_read_wav.for $(SL)

$(OUTPATH)/sample_write_wav: sample_write_wav.for $(CHECK_WITH)
	@echo ----- sample_write_wav -----
	$(fc) sample_write_wav.for $(SL)

$(OUTPATH)/sacsei: sacsei.for $(CHECK_WITH)
	@echo ----- sacsei -----
	$(fc) sacsei.for $(SL)

$(OUTPATH)/seedresp2gse: seedresp2gse.for $(CHECK_WITH)
	@echo ----- seedresp2gse -----
	$(fc) seedresp2gse.for $(SL)

$(OUTPATH)/seiasc: seiasc.for $(CHECK_WITH)
	@echo ----- seiasc -----
	$(fc) seiasc.for $(SL)

$(OUTPATH)/seicut: seicut.for $(CHECK_WITH)
	@echo ----- seicut -----
	$(fc) seicut.for $(SL)

$(OUTPATH)/seidel: seidel.for $(CHECK_WITH)
	@echo ----- seidel -----
	$(fc) seidel.for $(SL)

$(OUTPATH)/sei2psxy: sei2psxy.for $(CHECK_WITH)
	@echo ----- sei2psxy -----
	$(fc) sei2psxy.for $(SL)

$(OUTPATH)/seigmt: seigmt.for $(CHECK_WITH)
	@echo ----- seigmt -----
	$(fc) seigmt.for $(SL)

$(OUTPATH)/seisaf: seisaf.for $(CHECK_WITH)
	@echo ----- seisaf -----
	$(fc) seisaf.for $(SL)

$(OUTPATH)/seim88a: seim88a.for $(CHECK_WITH)
	@echo ----- seim88a -----
	$(fc) seim88a.for $(SL)

$(OUTPATH)/seipitsa: seipitsa.for $(CHECK_WITH)
	@echo ----- seipitsa -----
	$(fc) seipitsa.for $(SL)

$(OUTPATH)/seisei: seisei.for $(CHECK_WITH)
	@echo ----- seisei -----
	$(fc) seisei.for  $(SL)

$(OUTPATH)/select: select.for $(CHECK_WITH)
	@echo ----- select -----
	$(fc) select.for $(SL)

$(OUTPATH)/selmap: selmap.for $(CHECK_WITH)
	@echo ----- selmap -----
	$(fc) selmap.for $(SL)

$(OUTPATH)/selsei: selsei.for $(CHECK_WITH)
	@echo ----- selsei -----
	$(fc) selsei.for $(SL)

$(OUTPATH)/silmseed: silmseed.for $(CHECK_WITH)
	@echo ----- silmseed -----
	$(fc) silmseed.for $(SL)

$(OUTPATH)/silsei: silsei.for $(CHECK_WITH)
	@echo ----- silsei -----
	$(fc) silsei.for $(SL)

$(OUTPATH)/sissei: sissei.for $(CHECK_WITH)
	@echo ----- sissei -----
	$(fc) sissei.for $(SL)

$(OUTPATH)/setbrn: setbrn.for $(CHECK_WITH)
	@echo ----- setbrn -----
	$(fc) setbrn.for $(SL)

$(OUTPATH)/spec: spec.for $(CHECK_WITH)
	@echo ----- spec -----
	$(fc) spec.for $(SL) $(xlink)

$(OUTPATH)/split: split.for $(CHECK_WITH)
	@echo ----- split -----
	$(fc) split.for $(SL)

$(OUTPATH)/stalog: stalog.for $(CHECK_WITH)
	@echo ----- stalog -----
	$(fc) stalog.for $(SL)

$(OUTPATH)/statis: statis.for $(CHECK_WITH)
	@echo ----- statis -----
	$(fc) statis.for $(SL)

$(OUTPATH)/statstat:  statstat.for $(CHECK_WITH)
	@echo ----- statstat  -----
	$(fc) statstat.for $(SL)

$(OUTPATH)/stasei:  stasei.for $(CHECK_WITH)
	@echo ----- stasei  -----
	$(fc) stasei.for $(SL)

$(OUTPATH)/swarm:  swarm.for $(CHECK_WITH)
	@echo ----- swarm  -----
	$(fc) swarm.for $(SL)

$(OUTPATH)/tersei: tersei.for $(CHECK_WITH)
	@echo ----- tersei -----
	$(fc) tersei.for $(SL)

$(OUTPATH)/trace_plot: trace_plot.for $(CHECK_WITH)
	@echo ----- trace_plot -----
	$(fc) trace_plot.for $(SL)

$(OUTPATH)/tsig:   tsig.for $(CHECK_WITH)
	@echo ----- tsig -----
	$(fc) tsig.for $(SL)

$(OUTPATH)/ttlayer: ttlayer.for $(CHECK_WITH)
	@echo ----- ttlayer -----
	$(fc) ttlayer.for $(SL)

$(OUTPATH)/ttim:   ttim.for $(CHECK_WITH)
	@echo ----- ttim -----
	$(fc) ttim.for $(SL)

$(OUTPATH)/ttplot:  ttplot.for $(CHECK_WITH)
	@echo ----- ttplot -----
	$(fc) ttplot.for $(SL) $(xlink)

$(OUTPATH)/upd:    upd.for $(CHECK_WITH)
	@echo ----- upd -----
	$(fc) upd.for $(SL)

$(OUTPATH)/update: update.for $(CHECK_WITH)
	@echo ----- update -----
	$(fc) update.for $(SL)

$(OUTPATH)/usgsnor: usgsnor.for $(CHECK_WITH)
	@echo ----- usgsnor -----
	$(fc) usgsnor.for $(SL)

$(OUTPATH)/velmenu: velmenu.for $(CHECK_WITH)
	$(fc) velmenu.for $(SL)

$(OUTPATH)/velest: velest.for $(CHECK_WITH)
	$(fc) velest.for $(SL)

$(OUTPATH)/volcstat: volcstat.for $(CHECK_WITH)
	@echo ----- volcstat -----
	$(fc) volcstat.for $(SL)
   
$(OUTPATH)/wadati: wadati.for $(CHECK_WITH)
	@echo ----- wadati -----
	$(fc) wadati.for $(SL)
	
$(OUTPATH)/wad_plot: wad_plot.for $(CHECK_WITH)
	@echo ----- wad_plot-----
	$(fc) wad_plot.for $(SL) $(xlink)

$(OUTPATH)/wavfix: wavfix.for $(CHECK_WITH)
	@echo ----- wavfix -----
	$(fc) wavfix.for $(SL)

$(OUTPATH)/wgssei: wgssei.for $(CHECK_WITH)
	@echo ----- wgssei -----
	$(fc) wgssei.for $(SL)

$(OUTPATH)/wkbj:   wkbj.for $(CHECK_WITH)
	@echo ----- wkbj -----
	$(fc) wkbj.for $(SL)

$(OUTPATH)/wkbj_or:   wkbj_or.for $(CHECK_WITH)
	@echo ----- wkbj_or -----
	$(fc) wkbj_or.for $(SL)

$(OUTPATH)/xclust:   xclust.for $(CHECK_WITH)
	@echo ----- xclust -----
	$(fc) xclust.for $(SL)

#
# Windows programs
#
del_out:
	del out > out

append.exe: append.for
	@echo ----- compiling append ----- >> out
	@echo ----- compiling append -----
	df $(df_flags) append.for >> out
	df append.obj $(SL)  >>out

#
# remove all programs
#
clean:
	rm -f $(PROGS) $(EXEC_ONLY) $(ONLY)
	cd $(LIB); $(MAKE); cd $(LIB_TO_PRO)

# 
# install all files defined by $(PROG) and $(ONLY), 
# if newer than files in $(INSTALL_PRO_PATH)
#
install: install-progs install-only install-exec

install-progs: 
	@for i in $(PROGS) ; do \
	  echo "Install: $(INSTALL) $$i $(INSTALL_PRO_PATH)"; \
	  $(INSTALL) $$i $(INSTALL_PRO_PATH); \
	done

install-only:
	@for i in $(PLATFORM_DEP_EXE) ; do \
	  echo "Install: $(INSTALL) $$i $(INSTALL_PRO_PATH)"; \
	  $(INSTALL) $$i $(INSTALL_PRO_PATH); \
	done

install-exec:
	@for i in $(EXEC_ONLY) ; do \
	  echo "Install: $(INSTALL) $$i $(INSTALL_PRO_PATH)"; \
	  $(INSTALL) $$i $(INSTALL_PRO_PATH); \
	done



