# written by Zheng Gengbin

srcdir      = @srcdir@
top_srcdir  = @top_srcdir@

hpfc  = @top_srcdir@/scripts/hpfc
prun  = @top_srcdir@/@adlibdir@/src/script/prun

SUBDIR =  
EXECS = forall1 forall2 forall3 forall4 sub1 sub2 intr1 intr2

FFLAGS = --pcrcf --clear --silent

default: $(EXECS) 

testing: run compare

run: $(EXECS)
	@for file in $(EXECS) ;  do	\
	    echo ; echo "######### Running $$file ... #########";	\
	    num_proc=`../utils/getproc $$file.f` ;	\
	    echo "$(prun) $$num_proc $$file" ;	\
	    $(prun) $$num_proc $$file >  $$file.out;	\
	 done

forall1: forall1.f
	$(hpfc) $(FFLAGS) forall1.f
forall2: forall2.f
	$(hpfc) $(FFLAGS) forall2.f
forall3: forall3.f
	$(hpfc) $(FFLAGS) forall3.f
forall4: forall4.f
	$(hpfc) $(FFLAGS) forall4.f
sub1:sub1.f
	$(hpfc) $(FFLAGS) sub1.f
sub2:sub2.f
	$(hpfc) $(FFLAGS) sub2.f
intr1:intr1.f
	$(hpfc) $(FFLAGS) intr1.f
intr2:intr2.f
	$(hpfc) $(FFLAGS) intr2.f

compare:
	@echo
	@echo '######## Checking for differences from expected output ########'
	@for i in `ls *.out 2>/dev/null` ; \
	do ( echo "Compare: $$i = $$i.rec" ; diff $$i $$i.rec ) ; done

record:
	for i in `ls *.out` ; do ( cp $$i $$i.rec ) ; done

clean:
	rm -f $(EXECS) PI* core *_2.f *_1.f *_r.f *f.f *.dep *.out

distclean: clean

install:

uninstall:
