SHELL=/bin/sh
BENCHMARK=sp
BENCHMARKU=SP

include ../config/make.def
include ../sys/make.common

SOURCES = sp.for \
	set_constants.for \
	initialize.for \
	exact_rhs.for \
	compute_rhs.for \
	verify.for \
	compute_errors.for \
	timers.for \
	print_result.for

SOURCES_SINGLE = z_solve.for x_solve.for y_solve.for
SOURCES_MPI = x_solve_mpi.for y_solve_mpi.for z_solve_mpi.for

OBJS = ${SOURCES:.for=.o}
OBJS_SINGLE = ${SOURCES_SINGLE:.for=.o}
OBJS_MPI = ${SOURCES_MPI:.for=.o}

${PROGRAM}: config
	@if [ $(VERSION) = MPI ] ; then	\
		${MAKE} MPI_VER;		\
	else				   	\
		${MAKE} SINGLE_VER;		\
	fi

MPI_VER: $(OBJS) $(OBJS_MPI)
	${FLINK} -o ${PROGRAM} ${OBJS} $(OBJS_MPI)

SINGLE_VER: $(OBJS) $(OBJS_SINGLE)
	${FLINK} -o ${PROGRAM} ${OBJS} $(OBJS_SINGLE)

%.o: %.for npbparams.h header.h
	${F77} ${FFLAGS} -c -o $@ $<
	
clean:
	rm -f npbparams.h
	rm -f *.o *~
	rm -f *.cu *.cuf *.c *.f
