#--------------------------------------------------#
#   Makefile for EE programs          tab Nov 97   #
#--------------------------------------------------#
#
include ../Options

UALIB=../UA/ua

all: prog1 prog2

prog1: autoid makee makeepipe arc2arc arc2obj spim0 spim1 spim2

prog2: align_match binim codesum combine combine1 combine1xy cutspec cutspim flatave wavecheck rotate flip window biw hdedit esifit esiwave esipipe imgplot mash linear logsum moverow nozero opim sss parsefits rmlamp smthresp star2resp starzero unbinim unparsefits testfit

clean:
	rm -f align_match arc2arc arc2obj autoid binim codesum combine combine1 combine1xy cutspec cutspim flatave makee makeepipe hdedit esifit esiwave esipipe imgplot linear logsum moverow nozero opim sss parsefits rmlamp smthresp spim0 spim1 spim2 star2resp starzero unbinim unparsefits testfit *.o harua wavecheck rotate flip window biw mash


#============ HARUA ==============

# First make the "harua" utilities archive.

harua: eeu0.o eeu1.o eeu2.o eeuc.o autoid-util.o arc-util.o spim-util.o
	$(AR) $(ARFLAGS) harua eeu0.o eeu1.o eeu2.o eeuc.o autoid-util.o arc-util.o spim-util.o

eeu0.o: eeu0.f eeu0.inc makeepipe.inc makee.inc maxpix.inc
	$(G77) $(G77FLAGS) -c eeu0.f

eeu1.o: eeu1.f makee.inc makeepipe.inc makee_big.inc maxpix.inc
	$(G77) $(G77FLAGS) -c eeu1.f

eeu2.o: eeu2.f makee.inc makeepipe.inc makee_big.inc maxpix.inc
	$(G77) $(G77FLAGS) -c eeu2.f

eeuc.o: eeuc.c
	$(GCC) $(GCCFLAGS) -c eeuc.c

autoid-util.o: autoid-util.f autoid.inc maxpix.inc
	$(G77) $(G77FLAGS) -c autoid-util.f

spim-util.o: spim-util.f spim1.inc spim2.inc maxpix.inc
	$(G77) $(G77FLAGS) -c spim-util.f

arc-util.o: arc-util.f maxpix.inc
	$(G77) $(G77FLAGS) -c arc-util.f

#==========================

#=========== PROGRAMS THAT REQUIRE HARUA ===============

autoid: autoid.f autoid.inc harua $(UALIB)
	$(G77) $(G77FLAGS) -o autoid autoid.f harua $(UALIB) $(PGLIB)

makee: makee.f makee.inc pse.inc harua $(UALIB)
	$(G77) $(G77FLAGS) -o makee makee.f harua $(UALIB) $(PGLIB)

makeepipe: makeepipe.f makeepipe.inc harua $(UALIB)
	$(G77) $(G77FLAGS) -o makeepipe makeepipe.f harua $(UALIB) $(PGLIB)

arc2arc: arc2arc.f harua $(UALIB)
	$(G77) $(G77FLAGS) -o arc2arc arc2arc.f harua $(UALIB) $(PGLIB)

arc2obj: arc2obj.f harua $(UALIB)
	$(G77) $(G77FLAGS) -o arc2obj arc2obj.f harua $(UALIB) $(PGLIB)

spim0: spim0.f harua $(UALIB)
	$(G77) $(G77FLAGS) -o spim0 spim0.f harua $(UALIB) $(PGLIB)

spim1: spim1.f spim1.inc harua $(UALIB)
	$(G77) $(G77FLAGS) -o spim1 spim1.f harua $(UALIB) $(PGLIB)

spim2: spim2.f spim2.inc harua $(UALIB)
	$(G77) $(G77FLAGS) -o spim2 spim2.f harua $(UALIB) $(PGLIB)

opim: opim.f harua $(UALIB)
	$(G77) $(G77FLAGS) -o opim opim.f harua $(UALIB)

sss: sss.f harua $(UALIB)
	$(G77) $(G77FLAGS) -o sss sss.f harua $(UALIB) $(PGLIB)

flatave: flatave.f makeepipe.inc harua $(UALIB)
	$(G77) $(G77FLAGS) -o flatave flatave.f harua $(UALIB) $(PGLIB)

logsum: logsum.f harua $(UALIB)
	$(G77) $(G77FLAGS) -o logsum logsum.f harua $(UALIB) $(PGLIB)

biw: biw.f harua maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o biw biw.f harua $(UALIB) $(PGLIB)

esipipe: esipipe.f harua $(UALIB)
	$(G77) $(G77FLAGS) -o esipipe esipipe.f harua $(UALIB) $(PGLIB)

esiwave: esiwave.c harua $(UALIB)
	$(GCC) $(GCCFLAGS) -c esiwave.c
	$(G77) $(G77FLAGS) -o esiwave esiwave.o harua $(UALIB) $(PGLIB)


#==========================

#=========== PROGRAMS INDEPENDENT OF HARUA ===============

align_match: align_match.f $(UALIB)
	$(G77) $(G77FLAGS) -o align_match align_match.f $(UALIB)

binim: binim.f maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o binim binim.f $(UALIB)

codesum: codesum.f $(UALIB)
	$(G77) $(G77FLAGS) -o codesum codesum.f $(UALIB)

combine: combine.f $(UALIB)
	$(G77) $(G77FLAGS) -o combine combine.f $(UALIB)

combine1: combine1.f $(UALIB)
	$(G77) $(G77FLAGS) -o combine1 combine1.f $(UALIB)

combine1xy: combine1xy.f $(UALIB)
	$(G77) $(G77FLAGS) -o combine1xy combine1xy.f $(UALIB)

cutspec: cutspec.f $(UALIB)
	$(G77) $(G77FLAGS) -o cutspec cutspec.f $(UALIB)

cutspim: cutspim.f $(UALIB)
	$(G77) $(G77FLAGS) -o cutspim cutspim.f $(UALIB)

hdedit: hdedit.f $(UALIB)
	$(G77) $(G77FLAGS) -o hdedit hdedit.f $(UALIB)

esifit: esifit.c $(UALIB)
	$(GCC) $(GCCFLAGS) -c esifit.c
	$(G77) $(G77FLAGS) -o esifit esifit.o $(UALIB) $(PGLIB)

imgplot: imgplot.f maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o imgplot imgplot.f $(UALIB) $(PGLIB)

linear: linear.f $(UALIB)
	$(G77) $(G77FLAGS) -o linear linear.f $(UALIB)

mash: mash.f maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o mash mash.f $(UALIB) $(PGLIB)

moverow: moverow.f $(UALIB)
	$(G77) $(G77FLAGS) -o moverow moverow.f $(UALIB)

nozero: nozero.f $(UALIB)
	$(G77) $(G77FLAGS) -o nozero nozero.f $(UALIB)

parsefits: parsefits.f $(UALIB)
	$(G77) $(G77FLAGS) -o parsefits parsefits.f $(UALIB)

rmlamp: rmlamp.f $(UALIB)
	$(G77) $(G77FLAGS) -o rmlamp rmlamp.f $(UALIB)

rotate: rotate.f maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o rotate rotate.f $(UALIB)

flip: flip.f maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o flip flip.f $(UALIB)

smthresp: smthresp.f $(UALIB)
	$(G77) $(G77FLAGS) -o smthresp smthresp.f $(UALIB)

star2resp: star2resp.f $(UALIB)
	$(G77) $(G77FLAGS) -o star2resp star2resp.f $(UALIB)

starzero: starzero.f $(UALIB)
	$(G77) $(G77FLAGS) -o starzero starzero.f $(UALIB)

unbinim: unbinim.f maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o unbinim unbinim.f $(UALIB)

testfit: testfit.f $(UALIB)
	$(G77) $(G77FLAGS) -o testfit testfit.f $(UALIB)

unparsefits: unparsefits.f $(UALIB)
	$(G77) $(G77FLAGS) -o unparsefits unparsefits.f $(UALIB)

wavecheck: wavecheck.f $(UALIB)
	$(G77) $(G77FLAGS) -o wavecheck wavecheck.f $(UALIB) $(PGLIB)

window: window.f maxpix.inc $(UALIB)
	$(G77) $(G77FLAGS) -o window window.f $(UALIB)

#==========================

