#
# Makefile for DeFT
#
TARGET = DeFT.exec
FFLAGS += -w -O3
CFLAGS += -w -O3
.if ${MACHINE_ARCH} == "i386"
FFLAGS += -malign-double
CFLAGS += -malign-double
.endif
F2C = f2c
F2CFLAGS += -w -Nn802
.if ${OSVERSION} >= 400005
FC = ftn77
#FC = fc
CFLAGS += -I${PREFIX}/include
.endif
LFLAGS = 
SRCS:sh = ls *.f
OBJS = $(SRCS:.f=.o)
.if defined(USEMPICH) && ${USEMPICH} == yes
FFLAGS+=	-I/usr/local/mpich/include
FC=		/usr/local/mpich/bin/mpif77
LFLAGS+=	-L/usr/local/mpich/lib -lmpich
.endif

all: ${TARGET}

${TARGET}: ${OBJS}
	${FC} ${LFLAGS} ${OBJS} -o $@

.if ${FC} == ftn77
cdgrxx.o: cdgrxx.f
	${F2C} ${F2CFLAGS} cdgrxx.f
	${CC} ${CFLAGS} -c cdgrxx.c
.endif

clean:
	rm -f ${OBJS} ${TARGET}

