FC=f90

STAGGER=stagger.o
OS=os.o

.f90.o:
	$(FC) $(FFLAGS) -c $< -o $@
.f.o:
	$(FC) $(FFLAGS) -c $< -o $@

include $(MACHTYPE)/Makefile

#TIMEST=hyman
TIMEST=rk3_2n

hd= $(EXTRA) main.o aver.o io.o start.o hd.o $(STAGGER) courant.o $(TIMEST).o $(OS) boundary.o

hd.x: $(hd)
	$(FC) $(LFLAGS)  $(hd) -o hd.x $(LIBS)

test: hd.x
	cp test.in job.in
	./hd.x

testst = $(EXTRA) test_stagger.o $(STAGGER)
test_stagger.x: $(testst)
	$(FC) $(LFLAGS)  $(testst) -o test_stagger.x $(LIBS)

clean:
	rm -rf *.x *.o $(MACHTYPE)/*.o rii_files

cread.inc: cdata.inc cread.sed
	sed -f cread.sed cdata.inc > cread.inc
cprint.inc: cread.inc cprint.sed
	sed -e 's/read/print/' -e p cread.inc | sed -f cprint.sed > cprint.inc
cread_com.inc: cdata.inc cread_com.sed
	sed -f cread_com.sed cdata.inc | sed -e '1s/+ ,/ read(12,rec=nio) /' > cread_com.inc
cwrite_com.inc: cread_com.inc
	sed -e 's/read/write/' cread_com.inc > cwrite_com.inc

cdata.in: cprint.inc
	sed -f in.sed cprint.inc > cdata.in

aver.o: cparam.inc cwork.inc cdata.inc
boundary.o: cparam.inc cwork.inc cdata.inc
io.o:  cparam.inc cwork.inc cdata.inc cread_com.inc cwrite_com.inc
main.o: cparam.inc cwork.inc cdata.inc cread.inc cprint.inc
hd.o: cparam.inc cwork.inc cdata.inc
$(TIMEST).o: cparam.inc cwork.inc cdata.inc
courant.o: cparam.inc cwork.inc cdata.inc
test_stagger.o: cparam.inc stagger.ifc
stagger.o: cparam.inc cwork.inc cdata.inc
$(STAGGER): cparam.inc cwork.inc cdata.inc
stagger_do.o: cparam.inc cwork.inc cdata.inc
start.o: cparam.inc cwork.inc cdata.inc
