# RCS $Id: makefile,v 1.6 2003/08/21 21:02:11 strain Exp $
# Bourne shell.
SHELL = /bin/sh

# Gnu f77 and flags.
F77 = g77
F77FLAGS = -O -Wall

### Suffixes and rules ###

# C and f77 suffixes
.SUFFIXES :
.SUFFIXES : .f .c .o .x .tex .dvi .ps

# Rule for C compiling.
.c.o:
	${CC} ${CCFLAGS} -c $<

# Rule for Fortran 77 compiling.
.f.o:
	${F77} ${F77FLAGS} -c $<

# Files to be placed under RCS: avoid RCS by [a-z]*
RCS = *.m *.c *.f makefile zlogd/*.eps zzlogd/*.eps

# Get read-only or writable source files from RCS to run or edit.
co:
	co ${RCS}
cl:
	co -l ${RCS}
# Check new version into RCS and check-out read-only or writable version.
ciu:
	ci -u ${RCS}
cil:
	ci -l ${RCS}


### Files for this project ###
SRC = zeta.f dps.f zgesv_dep_blas.f lsame.f

OBJ = ${SRC:.f=.o}

all: lint test
xall: lint.x test.x

#run:
	#make ${RUN}.x ; \
	#mkdir -p Runs/${RUN}/${DATE} ; \
	#cd Runs/${RUN}/${DATE} ; \
	#echo "run ${RUN} on machine ${HOST} at date ${DATE}" 1> run.log ; \
	#mkdir ./PS ; \
	#cp ../../../${RUN}.x . ; \
	#./${RUN}.x ; \
	#rm -rf ./${RUN}.x

# Zero computations
1000: lint.x 
	lint.x < 1000.in
lint: lint.x 
	lint.x < lint.in
lint.x: lint.o ${OBJ}
	 ${F77} ${F77FLAGS} -o lint.x lint.o ${OBJ}

# Testing against matlab code.
test: test.x
	${MAKE} run "RUN=test" "DATE=$${DATE}" "HOST=$${HOST}"
test.x: test.o ${OBJ}
	 ${F77} ${F77FLAGS} -o test.x test.o ${OBJ}

# Files and directories to be synced between machines.
FILES = *

rsync_backup:
	 rsync -e ssh -auvzC --exclude "*.x" ${FILES} ${TARGET}:projects/zeta/f77/

rsf1:
	${MAKE} rsync_backup "TARGET=fac-1099-1.math.berkeley.edu"

tar:
	tar cvf zeta.tar ./*f ./makefile ./*.m
